:root {
  --primary: #1b2352;
  --accent: #7b3fe4;
  --accent-dark: #622cd1;
  --accent-soft: #efe7ff;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e6e8ec;
  --muted: #6d7282;
  --danger: #d93030;
  --success: #1fa855;
}

/* RESET */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Segoe UI", sans-serif; }

/* ================================
   TOP BAR
================================ */
.topbar {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { font-size: 20px; font-weight: 600; }

.top-actions { display: flex; gap: 10px; }

.btn-top {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  color: white;
}
.btn-top.ia { background: var(--accent); }
.btn-top.zbx { background: #3b82f6; }
.btn-top:hover { opacity: 0.85; }

/* ================================
   GRID LAYOUT
================================ */
.layout {
  display: grid;
  grid-template-columns: 300px 400px 1fr;
  height: calc(100vh - 56px);
}

/* ================================
   PANELS
================================ */
.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 14px;
  overflow-y: auto;
}
.panel h2 {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 18px;
}

/* ================================
   ENTITIES
================================ */
.entity {
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.entity:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.entity .muted { font-size: 12px; }

/* ================================
   TICKETS LIST
================================ */
.ticket {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #f9f9f9;
  cursor: pointer;
  border: 1px solid #ececec;
  transition: background .2s ease;
}
.ticket:hover { background: var(--accent-soft); }

.ticket.sla-late {
  border-left: 4px solid var(--danger);
  background: #ffecec;
}

.ticket-top { font-weight: bold; margin-bottom: 4px; }

.ticket-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.ticket-extra {
  font-size: 12px;
  margin-top: 6px;
}

.small { font-size: 11px; }

/* ================================
   BADGES
================================ */
.badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: white;
  display: inline-block;
}

.badge-prio-1 { background: #6b7280; }
.badge-prio-2 { background: #3b82f6; }
.badge-prio-3 { background: #f59e0b; }
.badge-prio-4 { background: #ef4444; }
.badge-prio-5 { background: #7e22ce; }

.badge-status {
  background: #1b2352;
}
.badge-type {
  background: #6a3ee2;
}

.badge-private {
  background: #d93030;
  padding: 2px 6px;
}

/* ================================
   TICKET DETAIL (PREMIUM)
================================ */
#ticketDetail {
  padding: 20px;
}

#ticketDetail h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--primary);
}

.ticket-info {
  background: #fafafa;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.descbox {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  max-height: 250px;
  overflow-y: auto;
}

/* ================================
   TIMELINE PREMIUM
================================ */
.timeline-item {
  padding: 10px;
  background: #ffffff;
  border-radius: 6px;
  border-left: 4px solid var(--accent);
  margin-bottom: 12px;
}

.tl-header {
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--primary);
}

.tl-text {
  font-size: 13px;
  color: #444;
  white-space: pre-wrap;
}

/* ================================
   IA PANEL / ZABBIX PANEL (SLIDE)
================================ */
.sidepanel,
#panelZabbixDetail {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  height: 100%;
  background: var(--panel);
  box-shadow: -4px 0 14px rgba(0,0,0,0.25);
  padding: 20px;
  transition: right .35s ease;
  overflow-y: auto;
  z-index: 9999;
}
.sidepanel.open,
#panelZabbixDetail.open {
  right: 0;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 26px;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--muted);
}
.close-btn:hover { color: var(--danger); }

.ia-response {
  background: #fafafa;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  min-height: 150px;
  white-space: pre-wrap;
}

/* ================================
   ZABBIX LIST
================================ */
.zitem {
  padding: 12px;
  background: #eef4ff;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #3b82f6;
  cursor: pointer;
}
.zitem:hover { background: #dae7ff; }

.z-critical { border-left-color: #dc2626; }
.z-warning { border-left-color: #f59e0b; }

/* ZABBIX DETAIL */
#panelZabbixDetail { border-left: 5px solid #2563eb; }
#zbx-detail-content h2 { color: #2563eb; margin-bottom: 10px; }

/* =========================================================
   IA PANEL – STYLE PREMIUM
========================================================= */

.ia-panel {
  width: 480px !important;
  background: #f8f9fb;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.ia-form label {
  font-weight: bold;
  margin-top: 12px;
  display: block;
}

.ia-form select,
.ia-form input,
.ia-form textarea {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-top: 4px;
  font-size: 14px;
}

.btn-ia-run {
  margin-top: 15px;
  width: 100%;
  padding: 12px;
  background: #4a6cf7;
  color: white;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: 0.2s;
}

.btn-ia-run:hover {
  background: #2e4ed8;
}

.ia-title {
  margin-top: 20px;
  font-size: 18px;
}

.ia-response-block {
  margin-top: 10px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
  height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 14px;
}
