@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── TOKENS ──────────────────────────────────────── */
:root {
  --bg:           #f4f6f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --border-2:     #cbd5e1;

  --sidebar-bg:   #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active:#ffffff;
  --sidebar-hover:#334155;

  --text-1:       #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;

  --red:          #ef4444;
  --red-bg:       #fef2f2;
  --red-border:   #fecaca;

  --amber:        #f59e0b;
  --amber-bg:     #fffbeb;
  --amber-border: #fde68a;

  --green:        #10b981;
  --green-bg:     #f0fdf4;
  --green-border: #bbf7d0;

  --blue:         #3b82f6;
  --blue-bg:      #eff6ff;
  --blue-border:  #bfdbfe;

  --accent:       #6366f1;
  --accent-bg:    #eef2ff;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.12);

  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
  --sidebar-w:    230px;
  --topbar-h:     60px;

  --font:         'DM Sans', sans-serif;
  --mono:         'DM Mono', monospace;
}

/* ─── RESET ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text-1); line-height: 1.5; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ─── LAYOUT ──────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-size: 15px; flex-shrink: 0;
}
.brand-name { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.brand-name span { color: #a5b4fc; }

.nav-section { padding: 12px 10px 4px; }
.nav-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: #475569;
  padding: 0 8px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: .875rem; font-weight: 500;
  transition: background .15s, color .15s; cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: rgba(99,102,241,.25); color: #c7d2fe; }
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700; padding: 1px 6px;
  border-radius: 99px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: .82rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .68rem; color: #64748b; }
.btn-logout {
  background: none; border: 1px solid #334155;
  border-radius: 5px; padding: 3px 8px;
  color: #64748b; font-size: .7rem;
  transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ─── MAIN ────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ─── TOPBAR ──────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-bg); border: 1px solid var(--green-border);
  border-radius: 99px; padding: 4px 12px;
  font-size: .75rem; font-weight: 500; color: var(--green);
}
.topbar-pill.alert-mode { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
.topbar-time {
  font-family: var(--mono); font-size: .78rem; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px;
}

/* ─── PAGE ────────────────────────────────────────── */
.page { padding: 22px 24px; flex: 1; }
.page-header { margin-bottom: 18px; }
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--text-1); }
.page-sub { font-size: .85rem; color: var(--text-2); margin-top: 2px; }

/* ─── SECTION VIEWS ───────────────────────────────── */
.view { display: none; animation: fadeIn .2s ease; }
.view.active { display: block; }

/* ─── STAT CARDS ──────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--card-color, var(--accent)); border-radius: 99px;
}
.stat-card.red   { --card-color: var(--red); }
.stat-card.amber { --card-color: var(--amber); }
.stat-card.green { --card-color: var(--green); }
.stat-card.blue  { --card-color: var(--blue); }

.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: .78rem; font-weight: 500; color: var(--text-2); }
.stat-icon-wrap {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--card-bg, var(--accent-bg));
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.stat-card.red   .stat-icon-wrap { background: var(--red-bg); }
.stat-card.amber .stat-icon-wrap { background: var(--amber-bg); }
.stat-card.green .stat-icon-wrap { background: var(--green-bg); }
.stat-card.blue  .stat-icon-wrap { background: var(--blue-bg); }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; color: var(--text-1); }
.stat-footer { font-size: .73rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.stat-footer .up   { color: var(--red); }
.stat-footer .down { color: var(--green); }

/* ─── CARDS ───────────────────────────────────────── */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-6-4 { display: grid; grid-template-columns: 6fr 4fr; gap: 16px; margin-bottom: 16px; }
.grid-4-6 { display: grid; grid-template-columns: 4fr 6fr; gap: 16px; margin-bottom: 16px; }
.mb-4 { margin-bottom: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: .88rem; font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 7px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: blink 2s infinite; }
.card-title .dot.red { background: var(--red); animation-duration: .9s; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 18px; }
.card-body.no-pad { padding: 0; }

/* ─── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm); font-size: .82rem;
  font-weight: 500; transition: all .15s; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4f46e5; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--border-2); color: var(--text-1); background: var(--surface-2); }
.btn-danger  { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.btn-danger:hover  { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .75rem; }
.btn-xs { padding: 3px 8px; font-size: .7rem; }

/* ─── BADGE / CHIP ────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px; font-size: .7rem; font-weight: 600;
}
.badge-red    { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }
.badge-amber  { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-green  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-blue   { background: var(--blue-bg);  color: var(--blue);  border: 1px solid var(--blue-border); }
.badge-gray   { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ─── ALERT FEED ──────────────────────────────────── */
.alert-feed { max-height: 400px; overflow-y: auto; }
.alert-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  transition: background .1s; animation: slideIn .25s ease;
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--bg); }
.alert-row.acked { opacity: .45; }

.sev-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
}
.sev-dot.high   { background: var(--red);   box-shadow: 0 0 0 3px var(--red-bg); }
.sev-dot.medium { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.sev-dot.low    { background: var(--blue);  box-shadow: 0 0 0 3px var(--blue-bg); }

.alert-body { flex: 1; min-width: 0; }
.alert-msg { font-size: .85rem; font-weight: 500; color: var(--text-1); margin-bottom: 3px; }
.alert-meta { font-size: .73rem; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.alert-meta span { display: flex; align-items: center; gap: 3px; }

/* ─── LOG ROWS ────────────────────────────────────── */
.log-feed { max-height: 500px; overflow-y: auto; font-family: var(--mono); font-size: .75rem; }
.log-row {
  display: flex; gap: 10px; align-items: baseline;
  padding: 6px 18px; border-bottom: 1px solid var(--border);
  animation: slideIn .2s ease;
}
.log-row:last-child { border-bottom: none; }
.log-row:hover { background: var(--bg); }
.log-time  { color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.log-tag   { width: 60px; font-weight: 500; flex-shrink: 0; }
.log-tag.info    { color: var(--blue); }
.log-tag.warn    { color: var(--amber); }
.log-tag.error   { color: var(--red); }
.log-tag.success { color: var(--green); }
.log-msg { color: var(--text-2); flex: 1; }

/* ─── CAMERA GRID ─────────────────────────────────── */
.cam-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cam-cell {
  border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid var(--border); position: relative; background: #0d1117;
  transition: border-color .2s; cursor: pointer;
  aspect-ratio: 16/10;
}
.cam-cell:hover { border-color: var(--accent); }
.cam-cell.alert-cam { border-color: var(--red); animation: borderFlash .9s infinite; }
.cam-cell.offline   { opacity: .5; }

.cam-canvas { width: 100%; height: 100%; display: block; }
.cam-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  border-radius: 4px; padding: 2px 7px;
  font-family: var(--mono); font-size: .62rem; color: #fff;
  display: flex; align-items: center; gap: 5px;
}
.rec-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); animation: blink .8s infinite; }
.cam-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  padding: 12px 8px 5px;
  display: flex; justify-content: space-between; align-items: flex-end;
  font-family: var(--mono); font-size: .62rem; color: rgba(255,255,255,.8);
}
.cam-id { color: #7dd3fc; }
.cam-alert-label {
  position: absolute; top: 6px; right: 6px;
  background: var(--red); color: #fff;
  font-family: var(--mono); font-size: .6rem; font-weight: 600;
  padding: 2px 7px; border-radius: 4px; display: none;
}
.cam-cell.alert-cam .cam-alert-label { display: block; }

/* ─── CHART WRAP ──────────────────────────────────── */
.chart-wrap { padding: 16px 18px; }
.chart-wrap canvas { max-height: 220px; }

/* ─── RISK BARS ───────────────────────────────────── */
.risk-list { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.risk-row  { display: flex; align-items: center; gap: 12px; }
.risk-name { font-size: .82rem; width: 130px; flex-shrink: 0; color: var(--text-2); }
.risk-track { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.risk-fill  { height: 100%; border-radius: 99px; transition: width 1.2s cubic-bezier(.4,0,.2,1); }
.risk-fill.high   { background: var(--red); }
.risk-fill.medium { background: var(--amber); }
.risk-fill.low    { background: var(--green); }
.risk-pct { font-family: var(--mono); font-size: .72rem; width: 36px; text-align: right; }
.risk-pct.high   { color: var(--red); }
.risk-pct.medium { color: var(--amber); }
.risk-pct.low    { color: var(--green); }

/* ─── DATA TABLE ──────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); color: var(--text-1); }

/* ─── STORE MAP ───────────────────────────────────── */
.store-map-wrap { padding: 10px; }
.store-map-canvas-el { width: 100%; border-radius: var(--radius-sm); display: block; }

/* ─── FILTER BAR ──────────────────────────────────── */
.filter-bar {
  display: flex; gap: 6px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px;
  font-size: .75rem; font-weight: 500; color: var(--text-2);
  transition: all .15s;
}
.filter-btn:hover  { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.search-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 12px;
  font-size: .8rem; color: var(--text-1); outline: none;
  transition: border-color .15s; min-width: 190px;
}
.search-box:focus { border-color: var(--accent); }
.search-box::placeholder { color: var(--text-3); }

/* ─── STAFF ALERT ─────────────────────────────────── */
.staff-alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  animation: slideIn .3s ease; transition: background .1s;
}
.staff-alert:last-child { border-bottom: none; }
.staff-alert:hover { background: var(--bg); }
.staff-alert.acked { opacity: .4; }

.sa-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.sa-icon.high   { background: var(--red-bg); }
.sa-icon.medium { background: var(--amber-bg); }
.sa-icon.low    { background: var(--blue-bg); }

.sa-body { flex: 1; }
.sa-title { font-size: .87rem; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.sa-location { font-size: .77rem; color: var(--amber); font-weight: 500; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.sa-time { font-size: .72rem; color: var(--text-3); }

/* ─── TOAST ───────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: flex-start;
  animation: toastIn .3s cubic-bezier(.175,.885,.32,1.275);
  border-left: 3px solid var(--toast-color, var(--accent));
  cursor: pointer;
}
.toast.t-error   { --toast-color: var(--red); }
.toast.t-warn    { --toast-color: var(--amber); }
.toast.t-success { --toast-color: var(--green); }
.toast-icon { font-size: 1.1rem; }
.toast-body { flex: 1; }
.toast-title { font-size: .83rem; font-weight: 600; color: var(--text-1); margin-bottom: 2px; }
.toast-text  { font-size: .75rem; color: var(--text-2); }

/* ─── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  backdrop-filter: blur(3px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: scaleIn .2s cubic-bezier(.175,.885,.32,1.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── FORM ELEMENTS ───────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-input, .form-select {
  width: 100%; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .85rem; color: var(--text-1);
  outline: none; transition: border-color .15s;
  appearance: none; -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-switch { position: relative; display: inline-block; width: 48px; height: 24px; }
.form-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 24px; }
.switch-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .switch-slider { background-color: var(--green); }
input:checked + .switch-slider:before { transform: translateX(24px); }
.form-hint { font-size: .72rem; color: var(--text-3); margin-top: 4px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }

/* ─── CAMERA MGMT CARD ────────────────────────────── */
.cam-mgmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px 18px; }
.cam-mgmt-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; background: var(--surface-2); position: relative;
  transition: box-shadow .15s;
}
.cam-mgmt-card:hover { box-shadow: var(--shadow-md); }
.cam-mgmt-card.offline { opacity: .6; }
.cam-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.cam-id-tag { font-family: var(--mono); font-size: .75rem; font-weight: 500; color: var(--accent); }
.cam-status-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 3px; }
.cam-status-dot.online  { background: var(--green); }
.cam-status-dot.offline { background: var(--red); }
.cam-status-dot.pending { background: var(--amber); animation: blink 1s infinite; }
.cam-zone { font-size: .78rem; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.cam-ip   { font-family: var(--mono); font-size: .7rem; color: var(--text-3); margin-bottom: 10px; }
.cam-actions { display: flex; gap: 6px; }

/* ─── EMPTY STATE ─────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state .e-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state .e-text { font-size: .85rem; }

/* ─── INFO ROWS ───────────────────────────────────── */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: .83rem;
}
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--text-2); }
.info-val { font-weight: 500; color: var(--text-1); font-family: var(--mono); font-size: .78rem; }

/* ─── TABS ────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 18px; gap: 0; }
.tab-btn {
  padding: 10px 14px; font-size: .82rem; font-weight: 500;
  color: var(--text-3); border-bottom: 2px solid transparent;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
  margin-bottom: -1px; transition: all .15s;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── ANIMATIONS ──────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideIn  { from { opacity: 0; transform: translateX(10px) } to { opacity: 1; transform: none } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(.94) } to { opacity: 1; transform: none } }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: none } }
@keyframes blink    { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
@keyframes borderFlash { 0%,100% { border-color: var(--red) } 50% { border-color: var(--red-border) } }
@keyframes scanLine { 0% { top: -2px } 100% { top: 102% } }

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1100px) { .grid-2, .grid-6-4, .grid-4-6 { grid-template-columns: 1fr; } }
@media (max-width: 860px)  { .stats-row { grid-template-columns: 1fr 1fr; } .cam-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px)  {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ─── LOGIN SPECIFIC ──────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(circle at 20% 20%, rgba(99,102,241,.07) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(59,130,246,.05) 0%, transparent 50%);
  padding: 24px;
}
.login-box {
  width: 100%; max-width: 400px;
  animation: scaleIn .4s cubic-bezier(.175,.885,.32,1.2);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-size: 22px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; box-shadow: 0 8px 24px rgba(99,102,241,.35);
}
.login-brand-name { font-size: 1.5rem; font-weight: 800; color: var(--text-1); letter-spacing: -.02em; }
.login-brand-name span { color: var(--accent); }
.login-brand-sub { font-size: .8rem; color: var(--text-3); margin-top: 3px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 { font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .06em; }
.role-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 18px; }
.role-btn {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: all .15s;
}
.role-btn:hover { border-color: var(--accent); background: var(--accent-bg); }
.role-btn.active { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.role-emoji { font-size: 1.4rem; margin-bottom: 5px; }
.role-name { font-size: .75rem; font-weight: 600; color: var(--text-2); }
.role-btn.active .role-name { color: var(--accent); }
.login-sep { font-size: .75rem; color: var(--text-3); text-align: center; margin: 14px 0; }
.login-footer { text-align: center; margin-top: 14px; font-size: .72rem; color: var(--text-3); }
.login-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: .9rem; font-weight: 600;
  border: none; transition: all .15s; margin-top: 4px;
}
.login-btn:hover { background: #4f46e5; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,.35); }
