/* ============================================================
   PROVANCE AI — SECLUB Security Operations Center
   app.css — Tek CSS dosyası: tema, layout, tüm bileşenler
   ============================================================ */

/* ── 1. RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Arka planlar */
  --bg-app:        #F1F5F9;
  --bg-card:       #FFFFFF;
  --bg-sidebar:    #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-topbar:     #FFFFFF;
  --bg-input:      #F8FAFC;

  /* Vurgu renkleri — steel blue (SOC temaı) */
  --accent:        #0EA5E9;
  --accent-hover:  #0284C7;
  --accent-light:  #E0F2FE;
  --accent-green:  #22C55E;
  --accent-green-light: #DCFCE7;
  --accent-amber:  #F59E0B;
  --accent-amber-light: #FEF3C7;
  --accent-red:    #EF4444;
  --accent-red-light: #FEE2E2;
  --accent-blue:   #3B82F6;
  --accent-blue-light: #DBEAFE;

  /* Metinler */
  --text-primary:   #0F172A;
  --text-secondary: #64748B;
  --text-muted:     #94A3B8;
  --text-sidebar:   #94A3B8;
  --text-sidebar-active: #FFFFFF;

  /* Sınırlar */
  --border:        #E2E8F0;
  --border-focus:  #0EA5E9;

  /* Gölgeler */
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl:     0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);

  /* Layout */
  --sidebar-w:     240px;
  --topbar-h:      64px;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  /* Geçişler */
  --tr:            .18s ease;
}

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .85em;
}

/* ── 2. APP LAYOUT ───────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ── 3. SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -.3px;
}

.sidebar-brand-sub {
  font-size: .72rem;
  color: var(--text-sidebar);
  margin-top: 2px;
}

.sidebar-section {
  padding: 20px 12px 6px;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #E2E8F0;
}

.nav-item.active {
  background: var(--accent);
  color: var(--text-sidebar-active);
}

.nav-item svg, .nav-item .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item.active svg, .nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-version {
  font-size: .65rem;
  color: #475569;
  padding: 4px 8px;
  margin-bottom: 4px;
}

/* ── 4. TOPBAR ───────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-breadcrumb {
  font-size: .8rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.topbar-badge.live {
  background: var(--accent-green-light);
  color: #166534;
}

.topbar-badge.live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-dot 2s infinite;
}

.topbar-badge.offline {
  background: var(--accent-red-light);
  color: #B91C1C;
}

.topbar-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  color: var(--text-secondary);
}

.topbar-user {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── 5. MAIN CONTENT ─────────────────────────────────────── */
.main-content {
  grid-area: main;
  padding: 24px;
  overflow-y: auto;
}

/* ── 6. SAYFA BAŞLIĞI ────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── 7. KARTLAR ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ── 8. KPI KARTLARI ─────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.kpi-card.critical {
  border-color: #FECACA;
  background: #FFFBFB;
}

.kpi-card-info {}

.kpi-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-value.red   { color: var(--accent-red); }
.kpi-value.green { color: #16A34A; }
.kpi-value.amber { color: #D97706; }
.kpi-value.blue  { color: #0284C7; }

.kpi-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.green  { background: var(--accent-green-light);  color: #16A34A; }
.kpi-icon.red    { background: var(--accent-red-light);    color: #DC2626; }
.kpi-icon.blue   { background: var(--accent-blue-light);   color: #2563EB; }
.kpi-icon.amber  { background: var(--accent-amber-light);  color: #D97706; }
.kpi-icon.sky    { background: var(--accent-light);        color: var(--accent); }
.kpi-icon.gray   { background: #F1F5F9;                    color: #64748B; }

/* ── 9. BADGE'LER ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-green  { background: var(--accent-green-light);  color: #15803D; }
.badge-green::before  { background: var(--accent-green); }
.badge-red    { background: var(--accent-red-light);    color: #B91C1C; }
.badge-red::before    { background: var(--accent-red); }
.badge-amber  { background: var(--accent-amber-light);  color: #92400E; }
.badge-amber::before  { background: var(--accent-amber); }
.badge-blue   { background: var(--accent-blue-light);   color: #1D4ED8; }
.badge-blue::before   { background: var(--accent-blue); }
.badge-gray   { background: #F1F5F9; color: var(--text-secondary); }
.badge-gray::before   { background: var(--text-muted); }
.badge-sky    { background: var(--accent-light); color: #0284C7; }
.badge-sky::before    { background: var(--accent); }

/* Senaryo badge'leri */
.scenario-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.scenario-overcrowding { background: #FEF3C7; color: #92400E; }
.scenario-blocked_exit  { background: #FEE2E2; color: #B91C1C; }
.scenario-intrusion     { background: #FEE2E2; color: #991B1B; }
.scenario-loitering     { background: #DBEAFE; color: #1D4ED8; }
.scenario-fire          { background: #FEE2E2; color: #B91C1C; }
.scenario-smoke         { background: #E2E8F0; color: #475569; }
.scenario-spark         { background: #FEF3C7; color: #B45309; }
.scenario-unknown       { background: #F1F5F9; color: #64748B; }

/* Severity badge */
.severity-critical { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.severity-high     { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.severity-normal   { background: var(--accent-blue-light); color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ── 10. BUTONLAR ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  border: none;
  transition: all var(--tr);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(14,165,233,.35); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-app); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.btn-ghost:hover { background: var(--bg-app); color: var(--text-primary); }

.btn-danger {
  background: var(--accent-red-light);
  color: #B91C1C;
  border: 1px solid #FECACA;
}
.btn-danger:hover { background: var(--accent-red); color: #fff; }

.btn-amber {
  background: var(--accent-amber-light);
  color: #92400E;
  border: 1px solid #FDE68A;
}
.btn-amber:hover { background: var(--accent-amber); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: .75rem; }
.btn-lg { padding: 12px 22px; font-size: .9rem; }

.btn svg { width: 15px; height: 15px; }
.btn.is-active { box-shadow: inset 0 0 0 2px rgba(15,23,42,.08); }

/* ── 11. TABLOLAR ────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-app);
  padding: 10px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th.sortable-th {
  cursor: pointer;
  user-select: none;
}

thead th.sortable-th:hover {
  color: var(--text-primary);
  background: var(--border);
}

.sort-icon {
  font-size: .8rem;
  color: var(--accent);
  font-style: normal;
}

tbody td {
  padding: 12px 14px;
  font-size: .8rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; cursor: pointer; }
tbody tr.row-muted td { opacity: .7; }
tbody tr.row-escalated td:first-child,
tbody tr.row-review td:first-child {
  border-left: 3px solid transparent;
}
tbody tr.row-escalated td:first-child { border-left-color: var(--accent-amber); }
tbody tr.row-review td:first-child { border-left-color: var(--accent); }

.td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: .75rem;
  color: var(--text-secondary);
}

/* ── 12. FORM ELEMANLARI ─────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-primary);
  transition: border-color var(--tr), box-shadow var(--tr);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

/* ── 13. FİLTRE ÇUBUĞU ──────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-card);
}

.filter-btn {
  padding: 8px 14px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all var(--tr);
  cursor: pointer;
}

.filter-btn:hover { background: var(--bg-app); color: var(--text-primary); }
.filter-btn.active { background: var(--accent); color: #fff; }

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--tr);
}

.search-input:focus { border-color: var(--accent); }

.alert-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.alert-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.alert-summary-label {
  font-size: .72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.alert-summary-value {
  font-size: 1.8rem;
  line-height: 1.1;
  margin-top: 8px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.alert-summary-sub {
  margin-top: 6px;
  font-size: .74rem;
  color: var(--text-muted);
}

.scenario-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.scenario-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr), border-color var(--tr), box-shadow var(--tr);
  flex: 0 0 auto;
  min-height: 34px;
}

.scenario-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(14,165,233,.35);
  box-shadow: var(--shadow-md);
}

.scenario-chip.active {
  border-color: rgba(14,165,233,.45);
  box-shadow: 0 0 0 3px rgba(14,165,233,.08);
}

.scenario-chip-count {
  min-width: 16px;
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.scenario-chip .scenario-badge {
  padding: 2px 7px;
  font-size: .68rem;
}

/* ── 14. CİHAZ / KAMERA KART GRİDİ ──────────────────────── */
.device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow var(--tr), transform var(--tr);
  cursor: pointer;
}

.device-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.device-card.alert-card {
  border-color: #FECACA;
  box-shadow: 0 0 0 2px rgba(239,68,68,.1), var(--shadow-sm);
}

.device-card-header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.device-card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.device-card-name {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.device-card-body {
  padding: 0 16px 14px;
  flex: 1;
}

.device-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--text-secondary);
}

.device-meta-row svg {
  width: 12px; height: 12px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.device-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Thumbnail */
.snapshot-thumb {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-app);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.snapshot-thumb-lg {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-app);
  border: 1px solid var(--border);
}

.snapshot-placeholder {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Confidence bar */
.confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s ease, background-color .3s ease;
}

.confidence-label {
  font-size: .72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: right;
  font-weight: 600;
}

/* ── 15. SAĞDAN KAYAR PANEL ──────────────────────────────── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr);
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.slide-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 520px;
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.slide-panel.open { transform: translateX(0); }

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-close {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--tr);
}

.panel-close:hover { background: var(--bg-app); color: var(--text-primary); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.panel-section { margin-bottom: 24px; }

.panel-section-title {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.panel-kv {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  gap: 16px;
}
.panel-kv:last-child { border-bottom: none; }
.panel-k { color: var(--text-secondary); flex-shrink: 0; }
.panel-v { font-weight: 500; color: var(--text-primary); text-align: right; word-break: break-word; }

/* JSON raw viewer */
.json-viewer {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
}

.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflow-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #F8FAFC;
  padding: 10px 12px;
}

.workflow-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.workflow-item-meta {
  font-size: .74rem;
  color: var(--text-secondary);
}

.workflow-item-sub {
  font-size: .72rem;
  color: var(--text-muted);
}

.workflow-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .78rem;
  color: var(--text-muted);
  background: #FAFBFC;
}

/* ── 16. KAMERA MİNİ HARİTASI ───────────────────────────── */
#camMapCard { display: none !important; }

.cam-map {
  display: grid;
  gap: 12px;
}

.cam-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg-app);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}

.cam-pin:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.cam-pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cam-pin.online  .cam-pin-dot { background: var(--accent-green); }
.cam-pin.stale   .cam-pin-dot { background: var(--accent-amber); }
.cam-pin.offline .cam-pin-dot { background: var(--text-muted); }

.cam-pin.alert .cam-pin-dot {
  background: var(--accent-red);
  animation: cam-pulse 1.2s ease-in-out infinite;
}

@keyframes cam-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.cam-pin-label {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-all;
}

/* ── 17. AVATAR ──────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.avatar-sm { width: 28px; height: 28px; font-size: .65rem; }

/* ── 17. ALERT FEED (canlı alarm akışı) ──────────────────── */
.alert-feed { display: flex; flex-direction: column; gap: 0; }

.alert-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--tr);
}

.alert-feed-item:last-child { border-bottom: none; }
.alert-feed-item:hover { background: var(--bg-app); }

.alert-feed-item.critical { border-left: 3px solid var(--accent-red); }
.alert-feed-item.high     { border-left: 3px solid var(--accent-amber); }
.alert-feed-item.normal   { border-left: 3px solid var(--accent-blue); }

.alert-feed-info { flex: 1; min-width: 0; }
.alert-feed-top  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.alert-feed-cam  { font-family: 'JetBrains Mono', monospace; font-size: .78rem; font-weight: 700; }
.alert-feed-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.alert-feed-time { font-size: .7rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── 18. DURUM SATIRI / KAMERA DURUM PANELİ ──────────────── */
.status-list { display: flex; flex-direction: column; gap: 0; }

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child { border-bottom: none; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green  { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.status-dot.red    { background: var(--accent-red);   box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.status-dot.amber  { background: var(--accent-amber); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.status-dot.gray   { background: var(--text-muted); }

.status-name { font-size: .8rem; font-weight: 500; flex: 1; font-family: 'JetBrains Mono', monospace; }
.status-meta { font-size: .72rem; color: var(--text-muted); text-align: right; }

/* ── 19. DASHBOARD LAYOUT GRİDİ ──────────────────────────── */
.dash-mid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-three {
  display: grid;
  grid-template-columns: 1fr 1fr 280px;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── 20. RAPOR GRAFİK GRİDİ ──────────────────────────────── */
.report-charts-row {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.report-charts-row.two-col { grid-template-columns: 3fr 2fr; }
.report-charts-row.two-eq  { grid-template-columns: 1fr 1fr; }
.report-charts-row.three   { grid-template-columns: 1fr 1fr 1fr; }

/* ── 21. GİRİŞ SAYFASI ───────────────────────────────────── */
.login-root {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 4fr;
}

.login-visual {
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-visual::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.2) 0%, transparent 70%);
  top: -60px; right: -60px;
}

.login-visual::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,197,94,.12) 0%, transparent 70%);
  bottom: -40px; left: -40px;
}

.login-brand { position: relative; z-index: 1; text-align: center; }

.login-brand-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -1px;
}

.login-brand-accent { color: #0EA5E9; }

.login-brand-sub {
  font-size: .9rem;
  color: var(--text-sidebar);
  margin-top: 6px;
}

.login-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 10px 20px;
  background: rgba(255,255,255,.06);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
}

.login-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  animation: pulse 2s infinite;
}

.login-status-text { font-size: .78rem; color: #94A3B8; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
  50%       { box-shadow: 0 0 0 6px rgba(34,197,94,.1); }
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--bg-app);
}

.login-form-box {
  width: 100%;
  max-width: 380px;
}

.login-form-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-form-sub {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.login-input-group { position: relative; }

.login-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

.login-pw-toggle {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr), box-shadow var(--tr);
  margin-top: 6px;
}

.login-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(14,165,233,.4);
}

.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  margin-bottom: 14px;
  display: none;
}

.login-alert.error {
  background: var(--accent-red-light);
  color: #B91C1C;
  border: 1px solid #FECACA;
  display: block;
}

/* ── 22. SPINNER ─────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 23. BOŞ DURUM ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state-title { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.empty-state-sub { font-size: .8rem; }

/* ── 24. GRAFİK CONTAINER ────────────────────────────────── */
.chart-container {
  position: relative;
  padding: 4px 0;
}

/* ── 25. ISI HARİTASI ────────────────────────────────────── */
.heatmap-grid {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  font-size: .62rem;
  color: var(--text-muted);
}

.heatmap-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: .65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.heatmap-header {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}

.heatmap-hour {
  text-align: center;
  font-size: .6rem;
  color: var(--text-muted);
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: #F1F5F9;
  cursor: default;
  transition: transform var(--tr);
}

.heatmap-cell:hover { transform: scale(1.3); }
.heatmap-cell.h0  { background: #F1F5F9; }
.heatmap-cell.h1  { background: #BFDBFE; }
.heatmap-cell.h2  { background: #93C5FD; }
.heatmap-cell.h3  { background: #FDE68A; }
.heatmap-cell.h4  { background: #FCA5A5; }
.heatmap-cell.h5  { background: #EF4444; }

/* ── 26. RİSK LİSTESİ ────────────────────────────────────── */
.risk-list { display: flex; flex-direction: column; gap: 0; }

.risk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.risk-row:last-child { border-bottom: none; }

.risk-rank {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-app);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.risk-rank.top { background: var(--accent-red-light); color: #B91C1C; border-color: #FECACA; }

.risk-cam { font-family: 'JetBrains Mono', monospace; font-size: .78rem; font-weight: 700; flex: 1; }
.risk-count { font-size: .72rem; color: var(--text-secondary); white-space: nowrap; }

/* ── 27. ATTENTION PANEL ─────────────────────────────────── */
.attention-list { display: flex; flex-direction: column; gap: 8px; }

.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border);
  font-size: .78rem;
}

.attention-item.warn {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.attention-item.crit {
  background: #FFF8F8;
  border-color: #FECACA;
}

.attention-icon { flex-shrink: 0; width: 16px; height: 16px; }
.attention-text { flex: 1; color: var(--text-primary); }
.attention-sub  { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }

/* ── 28. RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1200px) {
  .device-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-mid { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
  .dash-three { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .report-charts-row.two-col,
  .report-charts-row.two-eq,
  .report-charts-row.three { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar { display: none; }
  .device-grid { grid-template-columns: 1fr; }
  .login-root { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .slide-panel { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── 29. YARDIMCI SINIFLAR ───────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: .78rem; }
.text-xs { font-size: .72rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── 30. PERIOD SELECTOR ─────────────────────────────────── */
.period-selector {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
}

.period-btn {
  padding: 7px 14px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--tr);
}

.period-btn:hover { background: var(--bg-app); }
.period-btn.active { background: var(--accent); color: #fff; }

/* ── 31. PANEL LOADING / ERROR ───────────────────────────── */
.panel-loading {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

.loading-row {
  display: flex;
  justify-content: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: .8rem;
  gap: 8px;
  align-items: center;
}

.error-row {
  display: flex;
  justify-content: center;
  padding: 32px;
  color: #B91C1C;
  font-size: .8rem;
  background: var(--accent-red-light);
  border-radius: var(--radius-sm);
  margin: 16px;
}
