/* Falcon Eye Dashboard — Universiti Malaya Institutional Identity */

/* ── Brand ───────────────────────────────────────────────────────────────────
   Primary Blue : #00467F  (UM Deep Corporate Blue)
   Crest Gold   : #E0B02F  (UM Premium Gold)
   Alert Red    : #C0202A
   Body         : #FFFFFF / #F8F9FA
   ──────────────────────────────────────────────────────────────────────────── */

/* ── CSS custom properties (light = default) ─────────────────────────────── */
:root {
  --bg:        #F4F6F9;
  --surface:   #FFFFFF;
  --surface2:  #EDF1F7;
  --border:    #E2E8F0;
  --text:      #1E293B;
  --text-mute: #334155;

  --um-blue:   #00467F;
  --um-gold:   #E0B02F;
  --um-red:    #C0202A;

  --blue:      #00467F;
  --green:     #1A7A3C;
  --red:       #C0202A;
  --amber:     #E0B02F;

  --radius:    12px;
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.05), 0 1px 3px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 20px -4px rgba(0,70,127,0.12);
}

[data-theme="dark"] {
  --bg:        #0b0f1a;
  --surface:   #131828;
  --surface2:  #1c2238;
  --border:    #2a3155;
  --text:      #e8ecf8;
  --text-mute: #6e7aa0;
  --shadow:    0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 6px 28px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  transition: background 0.2s, color 0.2s;
  font-size: 15px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  background: var(--um-blue);
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 200;
  min-height: 62px;
  /* Gold accent integrated as border — eliminates the scroll gap the standalone
     .gold-bar div caused between the sticky header and the sticky tabs-nav */
  border-bottom: 3px solid var(--um-gold);
}

.header-left  {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-right: 1px solid rgba(255,255,255,0.15);
  padding-right: 20px;
  margin-right: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
}

/* Native logo image */
.um-portal-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* Fallback text badge (shown only when image 404s) */
.um-logo-fallback {
  flex-direction: column;
  line-height: 1.05;
}
.um-logo-main {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.18em;
  color: var(--um-gold); text-transform: uppercase;
}
.um-logo-sub {
  font-size: 0.58rem; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.6); text-transform: uppercase;
}

/* Vertical divider between logo and system title */
.header-logo-divider {
  width: 1px;
  height: 34px;
  background: rgba(255,255,255,0.22);
  flex-shrink: 0;
  margin: 0 4px;
}

.header-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.header-sub   { font-size: 0.68rem; color: rgba(255,255,255,0.55); margin-top: 1px; letter-spacing: 0.01em; }

.last-updated { font-size: 0.7rem; color: rgba(255,255,255,0.5); display: flex; gap: 4px; }

/* Agent badge */
.agent-badge {
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; transition: background 0.3s;
  letter-spacing: 0.03em;
}
.agent-ok      { background: rgba(26,122,60,0.25);  color: #5dd68a; border: 1px solid rgba(26,122,60,0.4); }
.agent-stale   { background: rgba(192,32,42,0.25);  color: #f07070; border: 1px solid rgba(192,32,42,0.4); }
.agent-unknown { background: rgba(80,90,120,0.25);  color: #8896b4; border: 1px solid rgba(80,90,120,0.3); }

/* Role badge */
.role-badge {
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
}
.role-viewer   { background: rgba(80,90,120,0.22);  color: #8896b4; border: 1px solid rgba(80,90,120,0.3); }
.role-engineer { background: rgba(224,176,47,0.22); color: #f0c84a; border: 1px solid rgba(224,176,47,0.3); }
.role-admin    { background: rgba(0,70,127,0.35);   color: #80b8f8; border: 1px solid rgba(0,70,127,0.5); }

/* Login / Logout header buttons */
.btn-login {
  padding: 5px 14px; border-radius: 4px; font-size: 0.75rem; font-weight: 700;
  background: var(--um-gold); color: #0D1C2E;
  border: none; cursor: pointer; font-family: inherit;
  transition: opacity 0.15s; letter-spacing: 0.02em;
}
.btn-login:hover { opacity: 0.88; }

.btn-logout {
  padding: 5px 14px; border-radius: 4px; font-size: 0.75rem; font-weight: 700;
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.28); cursor: pointer; font-family: inherit;
  transition: background 0.15s; letter-spacing: 0.02em;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); }

.theme-toggle {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px; padding: 5px 9px; cursor: pointer;
  font-size: 0.95rem; color: white; transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.2); }

/* Gold accent is now border-bottom on .header — retire standalone element */
.gold-bar { display: none; }

/* ── Stale banner ────────────────────────────────────────────────────────── */
.stale-banner {
  background: #5c0a0d;
  color: #ffc8ca; text-align: center; padding: 8px 16px;
  font-size: 0.82rem; font-weight: 500;
}
.hidden { display: none !important; }

/* ── Tab navigation ──────────────────────────────────────────────────────── */
.tabs-nav {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  display: flex; align-items: stretch; gap: 0;
  padding: 0 28px; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 65px; z-index: 100;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none; border: none; color: var(--text-mute);
  padding: 13px 16px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
  white-space: nowrap; font-family: inherit; letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover  { color: var(--um-blue); }
.tab-btn.active { color: var(--um-blue); border-bottom-color: var(--um-gold); font-weight: 700; }

[data-theme="dark"] .tab-btn:hover  { color: #80b8f8; }
[data-theme="dark"] .tab-btn.active { color: #80b8f8; border-bottom-color: var(--um-gold); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 1440px; margin: 0 auto;
  padding: 0 28px 24px;
  display: flex; flex-direction: column; gap: 20px;
}

/* Each tab pane is a flex column — sections inside get the gap automatically */
.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding-top: 1.25rem;
}

/* ── KPI Grid — fluid flex so all 4 cards stay on one row and never clip ─── */
.kpi-grid {
  display: flex;
  gap: 1rem;
  width: 100%;
  flex-wrap: wrap;
}
.kpi-card {
  flex: 1 1 200px;
  min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kpi-icon  { font-size: 1.7rem; }
.kpi-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-mute); font-weight: 700; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 3px; }

.kpi-total { border-left: 4px solid var(--um-blue); } .kpi-total .kpi-value { color: var(--um-blue); }
.kpi-up    { border-left: 4px solid var(--green);   } .kpi-up    .kpi-value { color: var(--green); }
.kpi-down  { border-left: 4px solid var(--um-red);  } .kpi-down  .kpi-value { color: var(--um-red); }
.kpi-maint { border-left: 4px solid var(--um-gold); } .kpi-maint .kpi-value { color: #a07800; }
[data-theme="dark"] .kpi-maint .kpi-value { color: var(--um-gold); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 0.9rem; font-weight: 700; color: var(--um-blue);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 16px;
}
[data-theme="dark"] .card-title { color: #80b8f8; }

.card-header-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.card-header-row .card-title { margin-bottom: 0; }
.row-2col { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }

/* Overview 3-column: breakdown | donut | uptime bar ── all equal-ish widths */
.row-overview {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr;
  gap: 18px;
  align-items: stretch;   /* cards grow to the tallest column's height */
}

/* Chart cards must be flex-column so their inner wrappers can grow */
.chart-card {
  display: flex;
  flex-direction: column;
}
.chart-card .card-title { flex-shrink: 0; }
.chart-card .muted-note { flex-shrink: 0; }

/* Donut fills its flex space */
.chart-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 180px;
}

/* Timeline fills its flex space; canvas is absolutely positioned inside */
.chart-wrap-full {
  flex: 1;
  position: relative;
  min-height: 180px;
}
.chart-wrap-full canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger {
  padding: 7px 18px; border-radius: 4px; font-size: 0.78rem;
  font-weight: 700; cursor: pointer; border: 1px solid; font-family: inherit;
  letter-spacing: 0.03em; transition: opacity 0.15s;
}
.btn-primary   { background: var(--um-blue); color: #fff; border-color: var(--um-blue); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-danger    { background: rgba(192,32,42,0.08); color: var(--um-red); border-color: rgba(192,32,42,0.25); }
.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { opacity: 0.82; }
.btn-sm { padding: 4px 11px; font-size: 0.72rem; }

/* ── Controller breakdown ────────────────────────────────────────────────── */
.ctrl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.ctrl-row:last-child { border-bottom: none; }
.ctrl-name     { font-weight: 700; width: 84px; flex-shrink: 0; font-size: 0.82rem; }
.ctrl-bar-wrap { flex: 1; background: var(--surface2); border-radius: 2px; height: 6px; overflow: hidden; }
.ctrl-bar      { height: 100%; border-radius: 2px; background: var(--um-blue); transition: width 0.6s ease; }
.ctrl-counts   { font-size: 0.74rem; color: var(--text-mute); white-space: nowrap; }
.ctrl-counts .c-up    { color: var(--green); font-weight: 600; }
.ctrl-counts .c-down  { color: var(--um-red); font-weight: 600; }
.ctrl-counts .c-maint { color: #a07800; font-weight: 600; }
[data-theme="dark"] .ctrl-counts .c-maint { color: var(--um-gold); }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.chart-card { display: flex; flex-direction: column; }
.chart-wrap { flex: 1; display: flex; align-items: center; justify-content: center; max-height: 240px; }
.chart-wrap-wide { position: relative; height: 260px; margin-top: 16px; }

/* ── Filters ─────────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 4px; padding: 6px 11px;
  font-size: 0.78rem; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.filters select:focus, .filters input:focus { border-color: var(--um-blue); }
.filters input { width: 190px; }

/* ── Device summary pills ────────────────────────────────────────────────── */
.device-summary-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ctrl-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 4px; font-size: 0.72rem; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border);
}
.ctrl-pill .pill-down { color: var(--um-red); }
.ctrl-pill .pill-name { color: var(--text-mute); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead th {
  padding: 10px 13px; text-align: left; font-size: 0.67rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--um-blue); background: var(--surface2);
  border-bottom: 2px solid var(--um-blue); white-space: nowrap; font-weight: 700;
}
[data-theme="dark"] thead th { color: #80b8f8; border-bottom-color: var(--border); }
thead th:first-child { border-radius: 4px 0 0 0; }
thead th:last-child  { border-radius: 0 4px 0 0; }
tbody td { padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
.loading-cell { text-align: center; color: var(--text-mute); padding: 36px; }

/* Responsive: collapse the device table into stacked cards on phones.
   Each <td> carries a data-label="" that becomes the field name on mobile. */
@media (max-width: 640px) {
  .cards-mobile thead { display: none; }
  .cards-mobile,
  .cards-mobile tbody,
  .cards-mobile tr,
  .cards-mobile td { display: block; width: 100%; box-sizing: border-box; }

  .cards-mobile tr {
    margin-bottom: 12px; padding: 4px 2px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface);
  }
  .cards-mobile tbody tr:last-child td { border-bottom: 1px solid var(--border); }
  .cards-mobile tbody tr:hover td { background: none; }

  .cards-mobile td {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 9px 14px; text-align: right;
    border-bottom: 1px solid var(--border);
  }
  .cards-mobile tr td:last-child { border-bottom: none; }
  .cards-mobile td::before {
    content: attr(data-label);
    flex: 0 0 auto; text-align: left;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--um-blue);
  }
  [data-theme="dark"] .cards-mobile td::before { color: #80b8f8; }

  /* Make the device name read as the card's title */
  .cards-mobile td[data-label="Name"] {
    background: var(--surface2); border-radius: 9px 9px 0 0;
    font-size: 0.92rem;
  }

  /* Full-width loading / empty / error rows keep their original centering */
  .cards-mobile td.loading-cell { display: block; text-align: center; }
  .cards-mobile td.loading-cell::before { content: none; }
}

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 3px;
  font-size: 0.67rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.badge-up    { background: rgba(26,122,60,0.1);   color: #1A7A3C; border: 1px solid rgba(26,122,60,0.25); }
.badge-down  { background: rgba(192,32,42,0.1);   color: var(--um-red); border: 1px solid rgba(192,32,42,0.25); }
.badge-maint { background: rgba(224,176,47,0.12); color: #7a5c00; border: 1px solid rgba(224,176,47,0.3); }
[data-theme="dark"] .badge-up    { color: #5dd68a; }
[data-theme="dark"] .badge-down  { color: #f07070; }
[data-theme="dark"] .badge-maint { color: var(--um-gold); }

/* ── Table footer / misc ─────────────────────────────────────────────────── */
.table-footer   { margin-top: 10px; font-size: 0.72rem; color: var(--text-mute);
                  display: flex; justify-content: space-between; align-items: center;
                  flex-wrap: wrap; gap: 6px; }
/* ── Pagination ──────────────────────────────────────────────────────────── */
.page-info      { white-space: nowrap; }
.page-right     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-nav       { display: flex; align-items: center; gap: 8px; }
.page-btn       { padding: 4px 12px; font-size: 0.72rem; font-weight: 600;
                  border: 1px solid var(--border); border-radius: 4px;
                  background: var(--surface2); color: var(--text); cursor: pointer;
                  font-family: inherit; transition: opacity 0.15s; }
.page-btn:hover:not([disabled]) { opacity: 0.78; }
.page-btn[disabled] { opacity: 0.35; cursor: default; }
.page-curr      { font-size: 0.72rem; color: var(--text-mute); white-space: nowrap; }
/* ── Page size selector ──────────────────────────────────────────────────── */
.page-size-sel  { background: var(--surface); border: 1px solid var(--border);
                  color: var(--text); border-radius: 4px; padding: 4px 8px;
                  font-size: 0.72rem; font-family: inherit; cursor: pointer; }
.page-size-sel:focus { border-color: var(--um-blue); outline: none; }
/* ── Go-to page ──────────────────────────────────────────────────────────── */
.page-goto      { display: flex; align-items: center; gap: 5px; }
.page-goto-label { font-size: 0.72rem; color: var(--text-mute); white-space: nowrap; }
.page-goto-input { width: 52px; padding: 4px 6px; font-size: 0.72rem;
                   font-family: inherit; text-align: center;
                   background: var(--surface); border: 1px solid var(--border);
                   border-radius: 4px; color: var(--text); }
.page-goto-input:focus { border-color: var(--um-blue); outline: none; }
/* hide number-input spinners for a cleaner look */
.page-goto-input::-webkit-inner-spin-button,
.page-goto-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.page-goto-input[type=number] { -moz-appearance: textfield; }
.page-goto-btn  { padding: 4px 10px; font-size: 0.72rem; }
.no-data        { color: var(--text-mute); font-size: 0.85rem; padding: 14px 0; }
.loading-text   { color: var(--text-mute); font-size: 0.85rem; }
/* Ensure descriptive text stays readable when light theme is active */
[data-theme="light"] .muted-note,
[data-theme="light"] .loading-text,
[data-theme="light"] .no-data,
[data-theme="light"] .ctrl-counts,
[data-theme="light"] .zone-area,
[data-theme="light"] .zone-pct,
[data-theme="light"] .zone-click-hint,
[data-theme="light"] .sla-meta,
[data-theme="light"] .sla-target-line,
[data-theme="light"] .table-footer,
[data-theme="light"] .hb-label,
[data-theme="light"] .top-ap-ctrl { color: #334155; }
.section-subtitle { font-size: 0.85rem; font-weight: 700; margin: 22px 0 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--um-blue); }
[data-theme="dark"] .section-subtitle { color: #80b8f8; }
.muted-note     { font-size: 0.77rem; color: var(--text-mute); margin-bottom: 14px; }

/* ── Maintenance items ───────────────────────────────────────────────────── */
.maint-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 13px 0; border-bottom: 1px solid var(--border); gap: 14px;
}
.maint-item:last-child { border-bottom: none; }
.maint-name   { font-weight: 700; }
.maint-meta   { font-size: 0.72rem; color: var(--text-mute); margin-top: 3px; }
.maint-reason { font-size: 0.77rem; color: #7a5c00; margin-top: 2px; }
[data-theme="dark"] .maint-reason { color: var(--um-gold); }

/* ── Maintenance form ────────────────────────────────────────────────────── */
.maint-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.device-search-results {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1px solid var(--um-blue);
  border-radius: 4px; z-index: 50; max-height: 220px; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.search-result-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 13px; cursor: pointer; font-size: 0.8rem; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface2); }
.search-result-ctrl { font-size: 0.7rem; color: var(--text-mute); flex-shrink: 0; }
.search-result-none { padding: 10px 13px; color: var(--text-mute); font-size: 0.8rem; }
.device-search-wrap { position: relative; }

/* ── Heartbeat section ───────────────────────────────────────────────────── */
.heartbeat-detail { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 4px 0; }
.hb-stat   { display: flex; flex-direction: column; gap: 2px; }
.hb-label  { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 700; }
.hb-value  { font-size: 0.95rem; font-weight: 700; }

/* ── SLA ─────────────────────────────────────────────────────────────────── */
.sla-target-note { font-size: 0.75rem; color: var(--text-mute); margin-bottom: 18px; }
.sla-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.sla-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.sla-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sla-controller  { font-weight: 700; font-size: 0.85rem; }
.sla-type        { font-size: 0.67rem; color: var(--text-mute); background: var(--surface);
  padding: 2px 7px; border-radius: 3px; border: 1px solid var(--border); font-weight: 600; }
.sla-pct         { font-size: 1.7rem; font-weight: 700; }
.sla-pct.good    { color: var(--green); }
.sla-pct.warn    { color: #a07800; }
.sla-pct.bad     { color: var(--um-red); }
[data-theme="dark"] .sla-pct.warn { color: var(--um-gold); }
.sla-bar-wrap    { background: var(--border); border-radius: 2px; height: 5px; margin: 9px 0 5px; overflow: hidden; }
.sla-bar         { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.sla-bar.good    { background: var(--green); }
.sla-bar.warn    { background: var(--um-gold); }
.sla-bar.bad     { background: var(--um-red); }
.sla-meta        { font-size: 0.69rem; color: var(--text-mute); display: flex; justify-content: space-between; }
.sla-target-line { font-size: 0.69rem; color: var(--text-mute); margin-top: 3px; }
.sla-target-line span { color: #7a5c00; font-weight: 700; }
[data-theme="dark"] .sla-target-line span { color: var(--um-gold); }

/* ── Analytics ───────────────────────────────────────────────────────────── */
.top-aps-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin-top: 10px;
}
.top-ap-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.top-ap-name    { font-size: 0.8rem; font-weight: 700; }
.top-ap-ctrl    { font-size: 0.68rem; color: var(--text-mute); }
.top-ap-clients { font-size: 1.1rem; font-weight: 700; color: var(--um-blue); }
[data-theme="dark"] .top-ap-clients { color: #80b8f8; }

/* ── Campus Map ──────────────────────────────────────────────────────────── */
.map-subtitle { font-size: 0.77rem; color: var(--text-mute); margin-bottom: 16px; }
.campus-map {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.zone-card {
  background: var(--surface2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.2s;
  text-align: center;
}
.zone-card:hover   { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.zone-up           { border-color: rgba(0,70,127,0.35); }
.zone-down         { border-color: rgba(192,32,42,0.4); background: rgba(192,32,42,0.03); }
.zone-maint        { border-color: rgba(224,176,47,0.4); }
.zone-empty        { border-color: var(--border); opacity: 0.7; }
.zone-icon         { font-size: 1.6rem; margin-bottom: 6px; }
.zone-name         { font-weight: 700; font-size: 0.92rem; margin-bottom: 2px; }
.zone-area         { font-size: 0.68rem; color: var(--text-mute); margin-bottom: 8px; }
.zone-stats        { font-size: 0.82rem; }
.zone-pct          { font-size: 0.72rem; color: var(--text-mute); margin-top: 4px; }
.zone-click-hint   { font-size: 0.65rem; color: var(--text-mute); margin-top: 6px; font-style: italic; }

/* Building cluster */
.building-group   { margin-bottom: 8px; }
.building-header  {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; background: var(--surface2); border-radius: 4px;
  cursor: pointer; border: 1px solid var(--border); font-size: 0.82rem;
  transition: background 0.15s;
}
.building-header:hover { background: var(--border); }
.building-header b { font-weight: 700; }
.building-aps     { padding: 6px 0 2px 16px; }
.ap-cluster-item  {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; font-size: 0.77rem; border-radius: 4px;
  border-left: 3px solid var(--border); margin-bottom: 4px;
}
.ap-cluster-item.status-up   { border-left-color: var(--green); }
.ap-cluster-item.status-down { border-left-color: var(--um-red); }
.ap-cluster-item.status-maint{ border-left-color: var(--um-gold); }

/* ── Inventory ───────────────────────────────────────────────────────────── */
.inv-input {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 4px 8px; font-size: 0.78rem; font-family: inherit;
  width: 100%; outline: none;
}
.inv-input:focus { border-color: var(--um-blue); }

/* ── User access role selector ───────────────────────────────────────────── */
.ua-role-select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 5px 8px; font-size: 0.78rem; font-family: inherit;
  outline: none; cursor: pointer; transition: border-color 0.2s;
}
.ua-role-select:focus { border-color: var(--um-blue); }

/* ── Audit log ───────────────────────────────────────────────────────────── */
.audit-action {
  font-family: 'Courier New', monospace; font-size: 0.72rem;
  background: var(--surface2); padding: 2px 6px; border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
dialog {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; color: var(--text);
  max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
[data-theme="dark"] dialog { box-shadow: 0 20px 60px rgba(0,0,0,0.65); }
dialog::backdrop { background: rgba(0,20,50,0.4); }
.modal-title  { font-size: 1rem; font-weight: 700; color: var(--um-blue); margin-bottom: 4px; }
[data-theme="dark"] .modal-title { color: #80b8f8; }
.modal-sub    { font-size: 0.76rem; color: var(--text-mute); margin-bottom: 20px; }
.modal-field  { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-mute); margin-bottom: 5px; }
.modal-field input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 4px; padding: 9px 12px;
  font-size: 0.875rem; font-family: inherit; outline: none;
}
.modal-field input:focus { border-color: var(--um-blue); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }

/* Login modal branding */
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo .um-badge {
  display: inline-block;
  padding: 6px 18px; background: var(--um-blue); border-radius: 4px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em;
  color: var(--um-gold); text-transform: uppercase;
}

/* ── Footer — centred SMART-portal layout ────────────────────────────────── */
.footer { background: var(--um-blue); margin-top: 8px; }

.footer-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 32px 28px 28px;
  text-align: center;
}

.footer-logo {
  height: 48px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1); opacity: 0.85;
}

.footer-links {
  display: flex; align-items: center;
  gap: 0.5rem; flex-wrap: wrap; justify-content: center;
}
.footer-links a {
  color: rgba(255,255,255,0.72); text-decoration: none;
  font-size: 0.75rem; transition: color 0.15s;
}
.footer-links a:hover { color: var(--um-gold); }
.footer-sep { color: rgba(255,255,255,0.28); font-size: 0.75rem; }

.footer-copy {
  font-size: 0.72rem; color: rgba(255,255,255,0.42);
  line-height: 1.75; letter-spacing: 0.01em;
}

/* ── View-layer architecture ─────────────────────────────────────────────── */
#public-portal-view          { display: block; padding-top: 70px; }
#authenticated-dashboard-view { display: none;  }

/* ── Public landing portal ───────────────────────────────────────────────── */

/* ─ Portal nav bar — fixed sticky header */
.lp-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--um-blue);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 70px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.lp-header-brand {
  display: flex; align-items: center; gap: 12px;
}
.lp-header-logo {
  height: 36px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1);
}
.lp-header-logo-fallback {
  font-size: 1rem; font-weight: 900; color: var(--um-gold);
  letter-spacing: -0.02em;
}
.lp-header-divider {
  width: 1px; height: 26px; background: rgba(255,255,255,0.22);
}
.lp-header-name {
  font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.88);
  letter-spacing: 0.01em;
}
.lp-nav {
  display: flex; align-items: center; gap: 4px;
}
.lp-nav-link {
  padding: 6px 16px; border-radius: 4px;
  font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.78);
  text-decoration: none; font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.lp-nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.lp-header-signin {
  padding: 8px 22px; border-radius: 5px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em;
  background: #fff; color: var(--um-blue);
  border: none; cursor: pointer; font-family: inherit;
  transition: opacity 0.15s, transform 0.1s;
}
.lp-header-signin:hover { opacity: 0.9; transform: translateY(-1px); }

/* Google sign-in button (hero) */
.lp-google-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 8px;
  background: #fff; color: #1E293B;
  border: 1.5px solid #E2E8F0;
  font-size: 0.88rem; font-weight: 600; font-family: inherit; letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s;
}
.lp-google-btn:hover  { box-shadow: 0 6px 20px rgba(0,0,0,0.12); transform: translateY(-1px); border-color: #CBD5E1; }
.lp-google-btn:active { transform: translateY(0); }
.lp-google-btn { max-width: 240px; margin: 0; }

/* ─ Hero split panel */
.lp-hero {
  flex: 1; display: flex; align-items: stretch; min-height: 0;
}

/* Hero slider showcase */
.hero-slider-showcase {
  width: 100%; max-width: 520px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,70,127,0.11);
  overflow: hidden;
}
.hero-slider-track {
  position: relative; width: 100%;
  aspect-ratio: 16 / 10; overflow: hidden; background: #F8FAFC;
}
.hero-slide {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity 0.65s ease;
}
.hero-slide.active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-slide-card {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: #fff; text-align: center; padding: 24px;
}
.hero-slide-icon { font-size: 3rem; line-height: 1; }
.hero-slide-label { font-size: 1.2rem; font-weight: 700; }
.hero-slide-sub { font-size: 0.8rem; opacity: 0.8; }
.hero-slide-dots {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  padding: 10px 0 12px; background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
}
.hero-dot {
  width: 7px; height: 7px; border-radius: 50%; border: none;
  background: #CBD5E1; cursor: pointer; padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.hero-dot.active { background: var(--um-blue); transform: scale(1.3); }

/* Left copy panel — subtle grid mesh background */
.lp-hero-left {
  flex: 0 0 50%; max-width: 560px;
  display: flex; flex-direction: column; justify-content: center;
  padding: 64px 72px; gap: 20px;
  background-color: #F8FBFF;
  background-image:
    linear-gradient(rgba(0,70,127,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,70,127,0.045) 1px, transparent 1px);
  background-size: 36px 36px;
}
.lp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(0,70,127,0.08); color: var(--um-blue);
  border: 1px solid rgba(0,70,127,0.2); width: fit-content;
}
.lp-badge::before { content: '●'; font-size: 0.5rem; color: var(--um-gold); }
.lp-title {
  font-size: 3.6rem; font-weight: 900; color: var(--um-blue);
  letter-spacing: -0.03em; line-height: 1;
}
.lp-subtitle {
  font-size: 1rem; font-weight: 500; color: #334155; line-height: 1.65;
  max-width: 400px;
}
/* Right panel — soft gray canvas */
.lp-hero-right {
  flex: 1; background: #EEF2F7;
  padding: 40px 40px 40px 32px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}

/* ─ Portal header — unified right cluster */
.lp-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.lp-header-vsep  { width: 1px; height: 18px; background: rgba(255,255,255,0.2); flex-shrink: 0; margin: 0 6px; }

/* Language dropdown */
.lp-lang-dropdown { position: relative; }
.lp-lang-trigger {
  display: flex; align-items: center; gap: 5px;
  background: none; border: 1px solid rgba(255,255,255,0.22);
  border-radius: 5px; padding: 5px 11px;
  font-size: 0.74rem; font-weight: 600; color: rgba(255,255,255,0.88);
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.lp-lang-trigger:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }
.lp-lang-trigger svg { transition: transform 0.2s ease; flex-shrink: 0; }
.lp-lang-dropdown:has(.lp-lang-menu.open) .lp-lang-trigger svg { transform: rotate(180deg); }
.lp-lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden; min-width: 160px;
  opacity: 0; transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 400;
}
.lp-lang-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }
.lp-lang-option {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 11px 15px;
  background: none; border: none; cursor: pointer;
  font-size: 0.82rem; color: #1E293B;
  font-family: inherit; text-align: left; gap: 12px;
  transition: background 0.12s;
}
.lp-lang-option:hover { background: #F1F5F9; }
.lp-lang-option.active { font-weight: 700; color: var(--um-blue); }
.lp-lang-check { color: var(--um-blue); font-size: 0.82rem; font-weight: 700; flex-shrink: 0; }

/* ── Scroll reveal — Apple-style cubic spring ────────────────────────────── */
.reveal-card {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-card.active { opacity: 1; transform: translateY(0); }

/* ─ Core Services section */
.lp-services {
  background: #F8FBFF; padding: 64px 72px;
  border-top: 1px solid #E2E8F0;
}
.lp-services-header  { margin-bottom: 40px; }
.core-services-header-group { text-align: center; width: 100%; margin-bottom: 2rem; }
.core-services-header-group .lp-services-sub { margin: 0 auto; }
.lp-services-title   { font-size: 1.4rem; font-weight: 800; color: var(--um-blue); margin-bottom: 8px; }
.lp-services-sub     { font-size: 0.86rem; color: #64748B; max-width: 560px; line-height: 1.6; }
.lp-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* Capability cards */
.lp-cap-card {
  background: #fff; border: 1px solid #E2E8F0;
  border-radius: 14px; padding: 28px 26px;
  position: relative; overflow: hidden;
  transition: box-shadow 0.22s ease, transform 0.18s ease;
}
.lp-cap-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--cap-color, var(--um-blue));
}
.lp-cap-card:hover { box-shadow: 0 14px 36px rgba(0,70,127,0.1); transform: translateY(-3px); }
.lp-cap-icon-wrap {
  width: 50px; height: 50px; border-radius: 12px;
  background: var(--cap-bg, rgba(0,70,127,0.07));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  color: var(--cap-color, var(--um-blue));
}
.lp-cap-title { font-size: 1.02rem; font-weight: 800; color: #1E293B; margin-bottom: 8px; line-height: 1.25; }
.lp-cap-desc  { font-size: 0.82rem; color: #64748B; line-height: 1.68; }
.lp-cap-stat  {
  display: inline-flex; align-items: center;
  margin-top: 18px; padding: 4px 11px; border-radius: 999px;
  background: var(--cap-bg, rgba(0,70,127,0.07));
  font-size: 0.68rem; font-weight: 700;
  color: var(--cap-color, var(--um-blue));
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* ── Header utility micro-buttons ────────────────────────────────────────── */
.util-btn {
  padding: 4px 10px; border-radius: 4px; font-size: 0.72rem; font-weight: 600;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.86);
  border: 1px solid rgba(255,255,255,0.2); cursor: pointer;
  font-family: inherit; transition: background 0.15s; white-space: nowrap;
}
.util-btn:hover { background: rgba(255,255,255,0.22); }
.version-tag {
  font-size: 0.66rem; font-weight: 700; color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em; white-space: nowrap; align-self: center;
}

/* ── FAQ accordion ───────────────────────────────────────────────────────── */
.lp-faq {
  background: #fff; padding: 60px 72px;
  border-top: 1px solid #E2E8F0;
}
.lp-faq-header { text-align: center; margin-bottom: 36px; }
.lp-faq-title  { font-size: 1.4rem; font-weight: 800; color: var(--um-blue); }
.lp-faq-list   { max-width: 720px; margin: 0 auto; }
.faq-item:first-child { border-top: 1px solid #E2E8F0; }
.faq-item             { border-bottom: 1px solid #E2E8F0; }
.faq-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px; background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 600; color: #1E293B;
  text-align: left; gap: 16px; transition: color 0.15s;
}
.faq-trigger:hover,
.faq-trigger[aria-expanded="true"] { color: var(--um-blue); }
.faq-chevron { flex-shrink: 0; color: #64748B; transition: transform 0.3s ease; }
.faq-trigger[aria-expanded="true"] .faq-chevron { transform: rotate(180deg); }
.faq-body {
  overflow: hidden; max-height: 0;
  transition: max-height 0.35s ease;
}
.faq-body.open { max-height: 200px; }
.faq-body p { padding: 0 4px 18px; font-size: 0.86rem; color: #475569; line-height: 1.7; }

/* ── Feature guide wizard ────────────────────────────────────────────────── */
.guide-overlay {
  position: fixed; inset: 0; z-index: 1070;
  display: flex;
  align-items: center; justify-content: center;
  padding-top: 120px;
  pointer-events: none;
}
.guide-overlay.hidden { display: none !important; }
.guide-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 1050;
  pointer-events: all;
  transition: all 0.3s ease;
}
/* Spotlight: element lifts above backdrop via box-shadow curtain */
.guide-highlight-target {
  position: relative !important;
  z-index: 1060 !important;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.75),
              0 10px 25px -5px rgba(0,0,0,0.3) !important;
  border-radius: 12px;
  pointer-events: auto;
}
.guide-card {
  position: relative; z-index: 1070;
  pointer-events: all;
  background: #fff; border-radius: 16px; padding: 28px 32px;
  width: 480px; max-width: 92vw;
  max-height: calc(100vh - 160px); overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.guide-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.guide-step-pill {
  font-size: 0.67rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--um-blue); color: #fff; padding: 3px 11px; border-radius: 999px;
}
.guide-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.05rem; color: #64748B; padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.guide-close-btn:hover { color: var(--um-red); background: #fef2f2; }
#guide-content h3 {
  font-size: 1.1rem; font-weight: 700; color: var(--um-blue); margin-bottom: 10px;
}
#guide-content p  { font-size: 0.875rem; color: #334155; line-height: 1.7; }
.guide-progress   { height: 4px; background: #E2E8F0; border-radius: 2px; margin: 20px 0 16px; }
.guide-progress-bar { height: 100%; background: var(--um-gold); border-radius: 2px; transition: width 0.3s ease; }
.guide-actions    { display: flex; justify-content: space-between; gap: 8px; }
/* Glowing ring on highlighted target element */
.guide-highlight  {
  position: relative; z-index: 1802;
  outline: 3px solid var(--um-gold); outline-offset: 5px;
  border-radius: var(--radius);
  box-shadow: 0 0 0 8px rgba(224,176,47,0.18);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .row-2col     { grid-template-columns: 1fr; }
  .row-overview { grid-template-columns: 1fr 1fr; }
  .row-overview .card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px)  { .campus-map { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px)  { .lp-services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .lp-nav, .lp-header-vsep { display: none; }
  .lp-hero           { flex-direction: column; }
  .lp-hero-left      { flex: none; max-width: 100%; padding: 40px 28px; }
  .lp-hero-right     { display: none; }
  .lp-title          { font-size: 2.6rem; }
  .lp-services       { padding: 40px 20px; }
  .lp-services-grid  { grid-template-columns: repeat(2, 1fr); }
  .guide-overlay     { padding-top: 0; align-items: flex-end; }
  .guide-card        { border-radius: 16px 16px 0 0; max-height: 80vh; width: 100%; max-width: 100%; }
}
@media (max-width: 480px) { .lp-services-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .kpi-grid    { gap: 0.75rem; }
  .kpi-card    { flex: 1 1 calc(50% - 0.75rem); }
  .row-overview { grid-template-columns: 1fr; }
  .header      { padding: 0 16px; flex-direction: column; align-items: flex-start;
                 gap: 0; min-height: auto; }
  .header-left { padding: 12px 0; border-right: none; }
  .header-right{ padding: 0 0 12px; }
  .tabs-nav    { padding: 0 12px; top: 0; }
  .container   { padding: 14px 14px; }
  .tab-btn     { padding: 11px 12px; }
  .maint-form-grid { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1fr; gap: 20px; padding: 24px 16px; }
}
@media (max-width: 480px) {
  .campus-map { grid-template-columns: 1fr; }
  .sla-grid   { grid-template-columns: 1fr; }
}

/* ═══ Sidebar navigation (replaces the horizontal tabs-nav) ═══════════════════ */
.dash-layout { display: flex; align-items: flex-start; }

.sidebar {
  flex: 0 0 220px; width: 220px; box-sizing: border-box;
  background: var(--surface);
  border-right: 2px solid var(--border);
  position: sticky; top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 10px; z-index: 100;
  transition: width .18s ease, flex-basis .18s ease, transform .2s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nav-group-title {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-mute); opacity: .8; padding: 10px 12px 4px;
}
/* Hide a whole group when all its links are role-hidden (e.g. Admin for viewers) */
.nav-group:not(:has(.nav-link:not(.hidden))) { display: none; }

.tab-btn.nav-link {
  display: flex; align-items: center; gap: 11px;
  width: 100%; box-sizing: border-box; margin: 0;
  padding: 9px 12px; border: none; border-radius: 8px;
  border-left: 3px solid transparent;
  background: none; color: var(--text-mute);
  font-size: .82rem; font-weight: 600; letter-spacing: .01em;
  text-align: left; white-space: nowrap; cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.tab-btn.nav-link .nav-ico { width: 18px; height: 18px; flex: 0 0 18px; }
.tab-btn.nav-link:hover  { color: var(--um-blue); background: rgba(0,70,127,.06); }
.tab-btn.nav-link.active {
  color: var(--um-blue); background: rgba(0,70,127,.09);
  border-left-color: var(--um-gold); font-weight: 700;
}
[data-theme="dark"] .tab-btn.nav-link:hover  { color: #80b8f8; background: rgba(128,184,248,.08); }
[data-theme="dark"] .tab-btn.nav-link.active { color: #80b8f8; background: rgba(128,184,248,.12); border-left-color: var(--um-gold); }
/* Role-gating must win over the flex display above */
.sidebar .nav-link.hidden { display: none !important; }

.sidebar-collapse {
  margin-top: auto; display: flex; align-items: center; gap: 11px;
  width: 100%; box-sizing: border-box; padding: 9px 12px;
  border: none; border-radius: 8px; background: none; cursor: pointer;
  color: var(--text-mute); font-size: .78rem; font-weight: 600; font-family: inherit;
}
.sidebar-collapse:hover { color: var(--um-blue); background: rgba(0,70,127,.06); }
.sidebar-collapse .collapse-ico { width: 18px; text-align: center; flex: 0 0 18px; transition: transform .18s; }

/* Collapsed icon-rail (desktop) */
.sidebar.collapsed { flex-basis: 64px; width: 64px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-title { display: none; }
.sidebar.collapsed .tab-btn.nav-link,
.sidebar.collapsed .sidebar-collapse { justify-content: center; gap: 0; padding: 10px 0; }
.sidebar.collapsed .collapse-ico { transform: rotate(180deg); }

/* Main column fills the remaining width */
.dash-layout > .container { flex: 1 1 auto; min-width: 0; margin: 0; }

/* Mobile hamburger (lives in the blue header) + off-canvas drawer */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 1.45rem; line-height: 1; color: #fff; padding: 4px 12px 4px 0;
}
.nav-overlay { display: none; }

@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .dash-layout { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
    width: 250px; flex-basis: 250px; transform: translateX(-100%);
    z-index: 250;          /* sit ABOVE the header (z 200) — the mobile header
                              stacks into a tall column, so a top:65px drawer
                              got overlapped, hiding the first nav item (Overview) */
    padding-top: max(16px, env(safe-area-inset-top));
    box-shadow: 2px 0 16px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: translateX(0); }
  /* never icon-rail on mobile, even if collapsed flag is set */
  .sidebar.collapsed { width: 250px; flex-basis: 250px; }
  .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-group-title { display: revert; }
  .sidebar.collapsed .tab-btn.nav-link,
  .sidebar.collapsed .sidebar-collapse { justify-content: flex-start; gap: 11px; padding: 9px 12px; }
  .sidebar-collapse { display: none; }   /* desktop-only control */
  .nav-overlay.show {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 240;   /* below the drawer (250), above the header (200) */
  }
  .dash-layout > .container { padding-top: 14px; }
}
