/*
  Advantage Log Portal 4.1 — Aurora / cyan observability UI.
  Additive frontend-only layer. All operational data comes from existing routes.
  Accent charts display only database-backed aggregation values.
*/
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --navy: #031427;
  --navy-light: #0b3656;
  --blue: #087faf;
  --blue-bright: #15cafa;
  --background: #061322;
  --surface: #0c2033;
  --surface-alt: #112c42;
  --border: rgba(51, 145, 192, .29);
  --text: #eef8ff;
  --muted: #93b2c7;
  --sidebar-text: #c7e0f1;
  --sidebar-hover: rgba(15, 187, 242, .11);
  --shadow: 0 12px 34px rgba(0, 4, 15, .22);
  --success: #25d5a3;
  --warning: #ffcb55;
  --danger: #ff647e;
  --purple: #a590ff;
  --v41-glow: 0 0 0 1px rgba(18, 199, 246, .14), 0 15px 42px rgba(0, 6, 17, .25);
  --v41-grid: rgba(72, 162, 208, .09);
}
html[data-theme="light"] {
  color-scheme: light;
  --navy: #08253c;
  --navy-light: #114e76;
  --blue: #087faf;
  --blue-bright: #00699b;
  --background: #edf5fa;
  --surface: #fff;
  --surface-alt: #eff6fb;
  --border: rgba(29, 98, 147, .18);
  --text: #152e40;
  --muted: #52748b;
  --sidebar-text: #deefff;
  --sidebar-hover: rgba(15, 187, 242, .11);
  --shadow: 0 12px 32px rgba(12, 49, 76, .07);
  --success: #087d63;
  --warning: #a15e04;
  --danger: #c83252;
  --purple: #714fcd;
  --v41-glow: 0 0 0 1px rgba(25, 126, 177, .07), 0 16px 34px rgba(8, 48, 83, .07);
  --v41-grid: rgba(15, 107, 164, .07);
}
* { scrollbar-width: thin; scrollbar-color: rgba(53, 150, 200, .5) transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
body[data-page]:not([data-page="login"]) {
  background-image:
    radial-gradient(circle at 85% 5%, rgba(2, 142, 211, .12), transparent 34rem),
    radial-gradient(circle at 36% 110%, rgba(0, 122, 196, .07), transparent 38rem),
    linear-gradient(180deg, var(--background), var(--background));
  background-attachment: fixed;
}
svg.v41-symbols { position:absolute; width:0; height:0; overflow:hidden; }
a { color: var(--blue-bright); text-underline-offset: 3px; }
a:hover { color:#5cdaff; }
html[data-theme="light"] a:hover { color:#004c77; }
button, input, select, textarea { font:inherit; }
:focus-visible { outline: 2px solid #1bd4fb; outline-offset: 3px; }
::selection { background:rgba(19,203,251,.3); color:var(--text); }

/* Brand, navigation, shell */
.app-shell { grid-template-columns: 232px minmax(0,1fr); min-height:100vh; }
.sidebar {
  z-index: 15;
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  padding:18px 12px 15px;
  overflow-x:hidden;
  overflow-y:auto;
  border-right:1px solid rgba(27,159,210,.29);
  background:
    radial-gradient(circle at -60px 105%, rgba(15,189,252,.20), transparent 56%),
    linear-gradient(166deg, #041527 0%, #07243b 63%, #09314e 100%);
  box-shadow: 5px 0 34px rgba(0,6,18,.22);
  color:#fff;
}
.sidebar::after {
  content:"";
  position:absolute;
  left:0; right:0; bottom:0;
  height:170px;
  background:url('v41-wave.svg') bottom left / 375px 175px no-repeat;
  opacity:.43;pointer-events:none;
}
.sidebar > * { position:relative; z-index:1; }
.brand { padding:4px 13px 24px; border-bottom:1px solid rgba(121,203,248,.13); }
.brand-main { color:#47e0fc; font-weight:850; font-size:11px; letter-spacing:.22em; }
.brand-product { position:relative; width:fit-content; font-size:25px; letter-spacing:-.055em; margin-top:3px; font-weight:820; line-height:1.18; }
.brand-swoosh { position:absolute; left:100%; top:4px; width:38px; height:16px; border-top:4px solid #06b9fb; border-radius:72% 80% 0 0; transform:rotate(-19deg); }
.version-badge { margin-top:11px; border-radius:18px; padding:4px 9px; background:rgba(17,155,226,.14);border:1px solid rgba(22,189,245,.24);color:#bfeeff;font-size:10px;font-weight:700; }
.nav-section-title { margin:22px 12px 7px; font-size:9px; letter-spacing:.19em; color:#86afc9; font-weight:850; }
.sidebar nav { display:block; }
.nav-link {
  position:relative;
  display:flex;
  align-items:center;
  min-height:39px;
  gap:11px;
  margin:2px 0;
  padding:8px 11px;
  border:1px solid transparent;
  border-radius:10px;
  background:transparent;
  text-decoration:none;
  color:var(--sidebar-text);
  font-size:12px;
  font-weight:720;
  transition:background .18s, border-color .18s, box-shadow .18s, color .18s;
}
.nav-link:hover { border-color:rgba(20,196,255,.16); background:rgba(22,140,215,.12);color:#fff; }
.nav-link.active {
  color:#fff;
  background:linear-gradient(100deg, rgba(0,136,225,.54),rgba(4,154,224,.23));
  border-color:rgba(19,204,249,.82);
  box-shadow:inset 3px 0 #20e0ff, 0 0 19px rgba(0,188,244,.19), inset 0 0 17px rgba(0,181,244,.10);
}
.nav-icon, .v41-mini-icon { width:20px; height:20px; flex:0 0 auto; display:inline-block; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; fill:none; }
.nav-link.active .nav-icon { color:#54eaff; filter:drop-shadow(0 0 6px rgba(18,211,249,.38)); }
.sidebar-bottom {
  display:flex;
  align-items:flex-start;
  gap:11px;
  margin-top:auto;
  padding:13px 10px;
  border:1px solid rgba(24,186,249,.22);
  border-radius:12px;
  background:rgba(8,49,82,.71);
  box-shadow: inset 0 0 20px rgba(13,168,239,.035);
}
.v41-user-mark { flex:0 0 31px; display:grid;place-items:center;width:31px;height:31px;color:#1be1ff;background:rgba(10,155,230,.16);border:1px solid rgba(13,194,253,.45);border-radius:10px; }
.v41-user-mark .nav-icon { width:20px;height:20px; }
.v41-user-info { min-width:0; }
.signed-in { font-size:10px;color:#9cbcd0; }
.signed-user { font-size:12px;overflow-wrap:anywhere;line-height:1.3; }
.signout-link { display:inline-flex;align-items:center;gap:5px;color:#3de1fe;font-size:11px;font-weight:700;margin-top:8px; }
.signout-link .v41-mini-icon { width:14px;height:14px; }

/* Top command bar */
.main-area { position:relative;min-width:0; }
.topbar {
  position:relative;
  min-height:84px;
  padding:15px clamp(18px,1.9vw,32px);
  display:flex;
  align-items:center;
  gap:14px;
  background:
    linear-gradient(100deg, rgba(3,20,38,.97) 0%,rgba(4,31,53,.93) 59%,rgba(4,22,44,.97) 100%);
  border-bottom:1px solid rgba(21,144,204,.22);
  overflow:visible;
}
.topbar::after { content:"";position:absolute;inset:0;pointer-events:none;opacity:.65;background:url('v41-wave.svg') right 35% / 700px 280px no-repeat;mask-image:linear-gradient(90deg,transparent 24%,#000 100%); }
.topbar > * { position:relative;z-index:1; }
.v41-heading-group { min-width:0;padding-left:15px;border-left:3px solid #19d3fc; }
.page-heading { font-size:clamp(20px,1.55vw,28px);line-height:1.1;font-weight:830;letter-spacing:-.035em;color:#f7fcff; }
.page-subtitle { font-size:11px;margin-top:5px;color:#b0c9dd;line-height:1.5; }
.top-actions { margin-left:auto;display:flex;align-items:center;justify-content:flex-end;gap:11px;min-width:0; }
.v41-global-search { width:clamp(220px,24vw,440px);height:39px;display:flex;align-items:center;gap:8px;padding:0 12px;border:1px solid rgba(76,165,223,.53);border-radius:10px;background:rgba(1,16,32,.62);box-shadow:inset 0 1px 4px rgba(0,0,0,.24); }
.v41-global-search:focus-within { border-color:#1cd9fc;box-shadow:0 0 0 3px rgba(19,195,243,.11); }
.v41-global-search .v41-mini-icon { color:#9cc9e6;width:17px;height:17px; }
.v41-global-search input { flex:1;min-width:0;min-height:0;height:100%;border:0;background:transparent!important;color:#e9f7ff!important;padding:0;font-size:12px;box-shadow:none!important; }
.v41-global-search input::placeholder { color:#8eacc3;opacity:1; }
.v41-global-search kbd { color:#a8c8dc;white-space:nowrap;background:rgba(123,173,205,.14);border:1px solid rgba(103,173,222,.18);border-radius:5px;padding:2px 5px;font-size:10px; }
.v41-icon-button,.theme-button,.v41-avatar,.v41-mobile-toggle { display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:#c8eaff;text-decoration:none;border:1px solid rgba(60,155,213,.32);background:rgba(1,20,37,.59);border-radius:10px;min-width:38px;height:38px; }
.v41-icon-button:hover,.theme-button:hover,.v41-avatar:hover { border-color:#26cffa;color:#fff;background:rgba(14,119,177,.2); }
.theme-button { width:auto; min-width:39px;padding:0 11px;font-size:11px;font-weight:700;cursor:pointer; }
.v41-avatar { width:37px;height:37px;border-radius:50%;background:linear-gradient(145deg,#126997,#083f6d);font-weight:820;letter-spacing:.05em;font-size:12px; }
.v41-mobile-toggle { display:none; }

/* System-wide panel foundation */
.container { width:calc(100% - clamp(30px,3.6vw,60px)); max-width:1870px;margin:22px auto 45px; }
.card, .log-insight, .explorer-context {
  background:linear-gradient(155deg, rgba(21,55,80,.95), rgba(10,30,49,.97) 80%);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:13px;
  box-shadow:var(--v41-glow);
}
html[data-theme="light"] .card,html[data-theme="light"] .log-insight, html[data-theme="light"] .explorer-context { background:linear-gradient(160deg,#fff,#f4f9fd); }
.card-header, .explorer-head { min-height:58px; padding:15px 19px; border-bottom:1px solid rgba(89,175,225,.13);background:rgba(24,59,86,.19);border-radius:13px 13px 0 0; }
.card-title { color:var(--text);font-size:14px;font-weight:820;letter-spacing:-.01em; }
.card-body { padding:20px; }
.v41-card-heading { display:flex;align-items:center;gap:11px;min-width:0; }
.v41-card-glyph { display:grid;place-items:center;width:24px;min-width:24px;height:24px;font-size:18px;line-height:1;color:#11cfff;text-shadow:0 0 13px rgba(13,210,251,.4); }
.v41-card-subtitle { margin-top:3px;color:var(--muted);font-size:10px;line-height:1.35; }
.v41-header-action { flex:0 0 auto;text-decoration:none;font-size:11px;font-weight:750; }
.muted { color:var(--muted); }
.button { min-height:38px;padding:9px 14px;border-radius:9px;background:linear-gradient(130deg,#0780bd,#0aa9da);border:1px solid rgba(29,210,247,.40);color:#fff;font-size:12px;letter-spacing:.01em;box-shadow:0 4px 15px rgba(0,153,218,.13);transition:background .18s, border .18s, transform .18s; }
.button:hover { opacity:1;background:linear-gradient(130deg,#0b9bce,#12bce1);color:#fff;transform:translateY(-1px); }
.button.secondary { border:1px solid rgba(68,157,207,.45);background:rgba(5,35,57,.61);color:#cdeeff;box-shadow:none; }
.button.secondary:hover { border-color:#22cef4;background:rgba(12,106,149,.17); }
.button.success { background:linear-gradient(130deg,#068e79,#13b894);border-color:rgba(19,206,152,.5); }
html[data-theme="light"] .button.secondary { background:#f3f9fc;color:#165278; }
input:not([type="checkbox"]):not([type="radio"]),select,textarea {
  min-height:39px;
  padding:9px 11px;
  border:1px solid rgba(81,155,198,.38);
  border-radius:8px;
  background:rgba(2,22,38,.5);
  color:var(--text);
  box-shadow:inset 0 1px 3px rgba(0,0,0,.08);
  font-size:12px;
}
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]),html[data-theme="light"] select,html[data-theme="light"] textarea { background:#fff; }
input::placeholder,textarea::placeholder { color:var(--muted);opacity:.77; }
input:focus,select:focus,textarea:focus { border-color:#17cdf7;box-shadow:0 0 0 3px rgba(21,195,239,.13);outline:none; }
label { color:#9abbd3;font-size:10px;font-weight:830;letter-spacing:.07em; }
html[data-theme="light"] label { color:var(--muted); }
input[type="checkbox"] { accent-color:#07bbe8; }
hr { border:0;border-top:1px solid var(--border); }
/* All existing tables keep their current data, sorting, forms and links. */
table { width:100%;border-collapse:collapse; }
th { background:rgba(31,72,104,.37);color:#9fc4de;font-size:10px;font-weight:760;letter-spacing:.07em;text-transform:uppercase; }
th,td { border-bottom:1px solid rgba(79,153,193,.18);padding:12px 13px;text-align:left;vertical-align:top; }
tbody tr:nth-child(even) td { background:rgba(7,32,53,.21); }
tbody tr:hover td { background:rgba(18,143,202,.095);color:var(--text); }
html[data-theme="light"] tbody tr:nth-child(even) td { background:rgba(10,104,152,.035); }
html[data-theme="light"] tbody tr:hover td { background:rgba(12,145,201,.1); }
.table-wrapper,.events-table-wrapper,.explorer-table-wrap { overflow-x:auto; }
.severity-badge, .health-badge, .device-status, .status { border-radius:999px;font-weight:850;border:1px solid transparent;text-transform:uppercase;font-size:10px;white-space:nowrap;letter-spacing:.025em; }
.severity-critical,.severity-crit,.severity-emerg,.severity-emergency,.severity-alert { background:rgba(255,69,105,.18);color:#ff9fb3;border-color:rgba(255,77,109,.63); }
.severity-error,.severity-err { background:rgba(255,137,77,.17);color:#ffac83;border-color:rgba(254,144,77,.54); }
.severity-warning,.severity-warn { background:rgba(255,208,70,.13);color:#ffe17f;border-color:rgba(249,201,77,.63); }
.severity-notice { background:rgba(40,154,245,.17);color:#a2d7ff;border-color:rgba(42,170,242,.49); }
.severity-information,.severity-info { background:rgba(4,175,232,.13);color:#9beaff;border-color:rgba(37,197,255,.54); }
.severity-debug { background:rgba(112,145,165,.22);color:#b4cadb;border-color:rgba(148,181,194,.35); }
.severity-unknown { background:rgba(173,151,242,.18);color:#ceb8fc;border-color:rgba(163,137,233,.42); }
.status-online,.status-active,.badge-good { background:rgba(17,204,159,.17);color:#83f3ce;border-color:rgba(20,198,158,.45); }
.status-stale,.badge-warning { background:rgba(255,194,67,.15);color:#ffdd86;border-color:rgba(255,192,63,.4); }
.status-offline,.status-inactive,.status-never_seen,.status-disabled,.status-blocked,.badge-bad { background:rgba(255,93,118,.13);color:#ff9eae;border-color:rgba(255,92,113,.44); }
html[data-theme="light"] .severity-badge,html[data-theme="light"] .status,html[data-theme="light"] .health-badge,html[data-theme="light"] .device-status { filter:brightness(.85); }
/* Old footer is retained and fitted to the new shell. */
.portal-clean-footer { margin-top:0;border-top:1px solid rgba(30,162,220,.28); }
.portal-clean-footer-inner { max-width:1900px;min-height:90px;padding:17px 30px; }
.portal-footer-logo { width:45px;height:45px;flex-basis:45px; }
.portal-footer-title { font-size:15px; }
.portal-footer-release-item { font-size:11px; }
/* Existing asynchronous loader, no global heavy animation. */
.portal-loading-card { border-color:rgba(20,194,253,.39);background:linear-gradient(155deg,#092e4a,#06182d);box-shadow:0 18px 55px rgba(0,0,0,.49),0 0 26px rgba(10,181,248,.09); }
.portal-loading-spinner { border-top-color:#11cef8;border-right-color:#13cda4; }
.portal-loading-progress-bar { background:linear-gradient(90deg,#066db6,#20e3f7); }
/* Flash messages/errors */
.flash,.alert,.flash-error,.explorer-banner { border-radius:10px; }

/* Dashboard: six KPI cards, live hourly rollup bars, actual severity donut. */
.v41-page-toolbar { display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:15px;font-size:11px; }
.v41-page-toolbar>div { display:flex;align-items:center;gap:9px;min-width:0;flex-wrap:wrap; }
.v41-eyebrow { font-size:10px;color:#73edcb;font-weight:780;letter-spacing:.04em; }
.v41-pulse-dot {display:inline-block;width:7px;height:7px;border-radius:50%;background:#11d5a1;margin-right:5px;box-shadow:0 0 0 3px rgba(17,213,161,.15); }
.v41-toolbar-sep { width:1px;height:12px;background:var(--border); }
.v41-toolbar-button {white-space:nowrap; }
.v41-dashboard .stats-grid { display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:18px; }
.v41-dashboard .stat-card { position:relative;min-width:0;min-height:130px;padding:19px 16px 15px;overflow:hidden;border-top-width:1px; }
.v41-dashboard .stat-card::after { content:"";position:absolute;right:-23px;bottom:-42px;width:115px;height:115px;border:1px solid currentColor;border-radius:50%;opacity:.08;box-shadow:0 0 38px currentColor;pointer-events:none; }
.v41-dashboard .stat-accent-blue {color:#1bd7ff;border-color:rgba(15,183,245,.42);}
.v41-dashboard .stat-accent-green {color:#2de8bb;border-color:rgba(27,204,162,.35);}
.v41-dashboard .stat-accent-purple {color:#ad9dff;border-color:rgba(140,141,241,.34);}
.v41-dashboard .stat-accent-red {color:#ff8198;border-color:rgba(239,95,123,.38);}
.v41-dashboard .stat-accent-yellow {color:#ffd36a;border-color:rgba(253,205,88,.34);}
.v41-dashboard .stat-label {color:#b9d2e5;font-size:9px;letter-spacing:.09em; }
.v41-dashboard .stat-value { margin-top:11px;color:var(--text);font-size:clamp(20px,1.55vw,30px);font-weight:870;line-height:1.15;letter-spacing:-.035em;overflow-wrap:anywhere; }
.v41-kpi-icon { display:block;float:right;color:inherit;font-size:27px;line-height:1;opacity:.9;text-shadow:0 0 12px currentColor; }
.v41-kpi-desc { margin-top:12px;color:#8fafc6;font-size:10px; }
.v41-dash-analytics { display:grid;grid-template-columns:minmax(0,1.5fr) minmax(310px,1fr);gap:17px;margin-bottom:17px; }
.v41-dash-bottom { display:grid;grid-template-columns:minmax(320px,.8fr) minmax(0,1.45fr);gap:17px; }
.v41-chart-body { padding:18px 23px 16px; }
.v41-chart-summary {display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin:0 0 15px; }
.v41-chart-summary strong { font-size:28px;letter-spacing:-.035em;font-weight:880; }
.v41-chart-summary span {font-size:11px;color:var(--muted);}
.v41-volume-chart { position:relative;display:flex;align-items:end;gap:3px;min-height:190px;height:206px;padding:9px 0 0;overflow:hidden;border-bottom:1px solid rgba(48,141,186,.25); }
.v41-chart-grid-lines {position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;padding:4px 0;pointer-events:none; }
.v41-chart-grid-lines i { width:100%;height:1px;background:rgba(51,135,179,.2); }
.v41-volume-column { z-index:1;flex:1;min-width:4px;height:var(--v41-column-height);display:flex;align-items:stretch;justify-content:center; }
.v41-volume-bar { display:block;width:min(100%,24px);height:100%;min-height:2px;background:linear-gradient(180deg,#43edff,#02a4f0 55%,rgba(1,103,184,.36));box-shadow:0 0 12px rgba(14,185,241,.15);border:1px solid rgba(65,225,250,.28);border-bottom:0;border-radius:3px 3px 0 0;transition:filter .15s; }
.v41-volume-column:hover .v41-volume-bar { filter:brightness(1.45); }
.v41-volume-axis { display:flex;justify-content:space-between;padding-top:10px;color:var(--muted);font-size:10px; }
.v41-chart-empty {min-height:195px;display:flex;align-items:center;justify-content:center;flex-direction:column;color:var(--muted);text-align:center;}
.v41-chart-empty>span { font-size:34px;opacity:.5;color:var(--blue-bright); }
.v41-chart-empty p {margin:8px 0 0;color:var(--text);font-weight:780;}
.v41-chart-empty small {margin-top:5px; }
.v41-severity-body {padding:24px 16px;display:flex;align-items:center;justify-content:center;gap:20px;min-height:294px;}
.v41-donut {position:relative;width:clamp(130px,11vw,190px);height:clamp(130px,11vw,190px);flex:0 0 auto;display:grid;place-items:center;border-radius:50%;box-shadow:0 0 18px rgba(18,172,226,.11);}
.v41-donut::before { content:"";position:absolute;inset:21%;background:var(--surface);border-radius:50%;box-shadow:inset 0 0 15px rgba(4,13,30,.5); }
.v41-donut-center { z-index:1;text-align:center;display:grid;gap:2px; }
.v41-donut-center strong {font-size:clamp(13px,1.1vw,20px);letter-spacing:-.035em;}
.v41-donut-center span {font-size:10px;color:var(--muted);}
.v41-severity-legend { flex:1;min-width:0;max-height:250px;overflow-y:auto; }
.v41-legend-row {display:grid;grid-template-columns:minmax(0,1fr) 47px minmax(57px,auto);align-items:center;gap:7px;padding:7px 0;border-bottom:1px solid rgba(60,138,182,.13);font-size:10px; }
.v41-legend-name {display:flex;align-items:center;gap:7px;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.v41-legend-name i {flex:0 0 8px;height:8px;border-radius:50%;box-shadow:0 0 7px currentColor;}
.v41-legend-row>span:nth-child(2) {text-align:right;color:var(--muted);}
.v41-legend-row strong {text-align:right;font-weight:770;}
.v41-top-sources,.v41-recent-events {min-width:0;}
.v41-top-sources .source-list {padding:6px 18px 15px; }
.v41-top-sources .source-row {display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1fr);gap:12px;padding:11px 0;border-bottom:1px solid rgba(60,138,182,.17);align-items:center; }
.v41-source-info {min-width:0; }
.v41-source-info .source-title { display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;font-size:11px;font-weight:760;color:var(--text); }
.v41-source-info .source-title:hover {color:#36d3fa;}
.v41-source-info .source-ip {display:block;margin:4px 0 0;font-size:10px;font-weight:500; }
.v41-source-info .source-ip-link {color:#62badf;text-decoration:none;font-size:10px;}
.v41-source-progress {min-width:0; }
.v41-progress-track { height:10px;width:100%;background:rgba(6,83,126,.4);border-radius:30px;overflow:hidden; }
.v41-progress-bar { display:block;height:100%;min-width:2px;max-width:100%;border-radius:30px;background:linear-gradient(90deg,#00a4dd,#1bedf0);box-shadow:0 0 9px rgba(20,226,242,.32); }
.v41-source-progress-info {display:flex;justify-content:space-between;gap:5px;margin-top:6px;font-size:9px;color:var(--muted);}
.v41-recent-events {overflow:hidden; }
.v41-recent-events .events-table-wrapper {max-height:420px;overflow:auto;}
.v41-recent-events table { width:100%;min-width:680px;table-layout:fixed;font-size:11px; }
.v41-recent-events th:nth-child(1) {width:146px;}
.v41-recent-events th:nth-child(2) {width:104px;}
.v41-recent-events th:nth-child(3) {width:156px;}
.v41-recent-events .v41-time-cell {white-space:nowrap;color:#b5cbdc;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:10px;}
.v41-recent-events .v41-event-source {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:760;}
.v41-recent-events .v41-ip {font-size:10px;text-decoration:none;}
.v41-event-msg {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.v41-empty {padding:30px;text-align:center;}

/* Log explorer: compact filter grid, quick chips, full-screen details drawer. */
.log-insight-row {grid-template-columns:repeat(3,minmax(0,1fr));gap:13px;margin-bottom:17px;}
.log-insight {position:relative;overflow:hidden;min-height:101px;padding:18px 19px;border-radius:12px;}
.log-insight::after { content:"";position:absolute;right:-45px;bottom:-45px;width:110px;height:110px;border:1px solid rgba(30,204,251,.12);border-radius:50%; }
.log-insight small {font-size:10px;color:#accfe0;}
.log-insight strong {color:var(--text);font-size:25px;margin-top:8px;}
.log-insight>span {font-size:10px;}
.explorer-card {overflow:hidden;margin-bottom:17px;}
.explorer-head h2 {font-size:15px;}
.explorer-form {padding:18px 20px;}
.explorer-grid {grid-template-columns:minmax(0,1.35fr) repeat(3,minmax(0,1fr));gap:13px;}
.explorer-grid .wide {grid-column:span 2;}
.explorer-actions {margin-top:16px;}
.explorer-actions .live-label {padding:7px 10px;border:1px solid var(--border);border-radius:9px;background:rgba(13,80,116,.13);}
.explorer-caption {max-width:920px;margin-top:12px;font-size:10px;}
.v41-quick-filters {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 17px;}
.v41-quick-label {color:var(--muted);font-size:11px;font-weight:800;white-space:nowrap;margin-right:6px;}
.v41-filter-chip {display:inline-flex;align-items:center;gap:7px;min-height:33px;padding:6px 12px;color:#b9d4e6;background:rgba(13,53,83,.6);border:1px solid rgba(51,148,196,.38);border-radius:22px;cursor:pointer;font-size:11px;font-weight:750;}
.v41-filter-chip:hover,.v41-filter-chip.selected {border-color:#15c9f3;color:#f3fdff;background:rgba(12,142,201,.24);box-shadow:0 0 15px rgba(0,168,225,.13);}
.v41-filter-dot {width:8px;height:8px;border-radius:50%;background:#13c6f1;}
.v41-red {background:#ff476e;}.v41-orange {background:#ff934f;}.v41-yellow {background:#ffd252;}.v41-blue {background:#56aaff;}
.explorer-results {overflow:hidden;}
.explorer-results .topline {padding:15px 20px;}
.explorer-results h2 {font-size:15px;}
.explorer-table-wrap {max-height:64vh;}
.explorer-table {font-size:11px;}
.explorer-table thead th {background:#12314a;border-bottom:1px solid rgba(48,185,223,.26);padding:12px;}
.explorer-table td {padding:11px 12px;}
.explorer-table .log-event-row:hover,.explorer-table .log-event-row:focus {background:rgba(0,152,218,.17);outline:1px solid rgba(12,209,243,.42);}
.explorer-table .preview {max-width:670px;-webkit-line-clamp:1;}
.explorer-table .mono {font-size:11px;}
.explorer-pager {padding:15px 20px;}
.explorer-context {background:var(--surface);}
.explorer-banner {border-color:var(--border);border-left-color:#18caff;background:var(--surface);}
.explorer-banner.error {border-left-color:#ff6378;}
/* Device record: details drawer from the right, supports keyboard Escape and existing copy button. */
.detail-backdrop.open {display:block;background:rgba(0,9,19,.71);backdrop-filter:blur(3px);}
.detail-panel {position:absolute;right:0;top:0;height:100%;max-height:none;width:min(630px,100%);overflow:auto;border-radius:14px 0 0 14px;border-color:rgba(24,190,247,.52);background:linear-gradient(155deg,#0e2940,#091b2e);box-shadow:-20px 0 65px rgba(0,0,0,.45),0 0 30px rgba(9,171,244,.13);}
.detail-head {position:sticky;top:0;z-index:1;padding:20px 22px;background:#0e2c45;border-bottom:1px solid var(--border);}
.detail-head h2 {font-size:19px;}
.detail-meta>div {min-width:0;padding:11px;border:1px solid rgba(51,142,191,.17);border-radius:9px;background:rgba(12,68,99,.17);}
.detail-meta small {color:#8bbbd3;}
.detail-meta div div {font-size:12px;}
.detail-message {background:#071b2d;border-color:rgba(51,153,200,.35);color:#d6f4ff;}
html[data-theme="light"] .detail-panel {background:#f8fdff;color:#152e40;}
html[data-theme="light"] .detail-head {background:#e8f4fa;}
html[data-theme="light"] .detail-message {background:#fff;color:#152e40;}

/* Devices listings, profiles, phones. */
.sources-grid {gap:16px;}
.source-card {position:relative;overflow:hidden;}
.source-card::before {content:"";position:absolute;top:0;left:0;width:48%;height:1px;background:linear-gradient(90deg,#14cefa,transparent);}
.source-card-top {gap:12px;}
.source-card .source-name {font-size:17px;font-weight:820;letter-spacing:-.02em;}
.source-card .source-ip {color:#54dbfa;font-size:13px;font-weight:700;text-shadow:none;}
.source-card .source-ip-icon {color:#25c5f7;filter:none;}
.source-card .source-metrics {gap:8px;}
.source-card .metric {background:rgba(9,61,95,.17);border-color:rgba(49,144,188,.19);border-radius:8px;}
.source-card .metric-label {font-size:9px;color:var(--muted);}
.source-card .metric-value {font-size:19px;letter-spacing:-.03em;}
.source-card .source-seen {border-top-color:rgba(64,141,181,.2);}
.source-actions {display:flex;flex-wrap:wrap;gap:7px;}
.source-actions>.button,.source-actions form .button {min-height:34px;padding:8px 11px;font-size:11px;}
.profile-header {position:relative;overflow:hidden;padding:21px 24px;margin-bottom:18px;border-color:rgba(26,198,240,.39);background:linear-gradient(110deg,rgba(9,60,81,.96),rgba(8,29,47,.96));}
.profile-header::before {content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,#0fe7dd,transparent);}
.profile-name {font-size:clamp(21px,1.9vw,29px);letter-spacing:-.04em;}
.profile-ip {color:#50cfe7;font-size:14px;}
.meta-pill {border-radius:22px;background:rgba(4,126,169,.14);border-color:rgba(22,192,238,.31);color:#b2e6f8;}
.profile-actions {gap:8px;}
.statistics-grid {gap:12px;}
.statistics-grid .stat-card {min-width:0;position:relative;overflow:hidden;padding:17px;min-height:106px;border-color:rgba(21,186,228,.34);background:linear-gradient(140deg,rgba(10,65,91,.37),rgba(11,32,52,.96));}
.statistics-grid .stat-card::after {content:"";position:absolute;top:0;right:0;width:55px;height:1px;background:#16dafa;box-shadow:0 0 12px #16dafa;}
.statistics-grid .stat-value {font-size:clamp(20px,1.6vw,29px);letter-spacing:-.03em;}
.statistics-grid .stat-label {font-size:9px;color:#a8c5d8;}
.detail-list {padding:8px 18px;}
.detail-row {border-bottom:1px solid rgba(71,143,184,.16);}
.phone-item {border-color:rgba(46,137,182,.23);background:rgba(7,52,82,.23);}
/* Already-collected per-device hourly events as cyan volume bars. */
.activity-bars {position:relative;min-height:176px;height:176px;padding:22px 17px 15px;gap:4px;background:repeating-linear-gradient(to top,transparent 0,transparent 37px,rgba(48,127,171,.11) 38px);}
.activity-column {min-width:17px;flex:1;max-width:54px;}
.activity-bar {border:1px solid rgba(50,226,248,.43);border-radius:3px 3px 0 0;background:linear-gradient(180deg,#41ebf8,#0099d6 50%,rgba(2,102,174,.34));box-shadow:0 0 9px rgba(12,200,246,.20);}
.activity-label {font-size:9px;color:#94b9cf;}
.profile-grid>.card {min-width:0;}
.profile-grid .card-header {background:rgba(23,69,103,.25);}
.detail-value {overflow-wrap:anywhere;}
.v41-ip,.phone-ip,.source-ip-link {text-underline-offset:3px;}
.table-card {overflow:hidden;}

/* Health dashboard real current readings; never invent timeseries. */
.overall-banner {padding:18px 21px;border-radius:12px;background:var(--surface);box-shadow:var(--v41-glow);}
.overall-healthy {border:1px solid rgba(13,224,154,.53)!important;background:linear-gradient(110deg,rgba(7,81,71,.5),rgba(8,49,57,.3))!important;color:#8cf2ce!important;}
.overall-warning {border:1px solid rgba(255,195,73,.53)!important;background:rgba(114,76,20,.15)!important;color:#ffdd93!important;}
.overall-critical {border:1px solid rgba(255,95,119,.55)!important;background:rgba(121,33,55,.16)!important;color:#ffb5c6!important;}
html[data-theme="light"] .overall-healthy {color:#087b55!important;background:#e7faf1!important;}
html[data-theme="light"] .overall-warning {color:#9a580d!important;background:#fff7e8!important;}
html[data-theme="light"] .overall-critical {color:#b52b4b!important;background:#fff1f4!important;}
.health-summary {gap:12px;margin-bottom:18px;}
.summary-card {min-width:0;min-height:105px;position:relative;overflow:hidden;padding:17px;border-color:rgba(21,175,231,.38);}
.summary-card::after {content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,rgba(8,222,247,.65),transparent);}
.summary-label {color:#afd0e3;font-size:9px;}
.summary-value {font-size:clamp(17px,1.55vw,26px);letter-spacing:-.035em;overflow-wrap:anywhere;}
.health-grid {gap:17px;}
.health-card {overflow:hidden;}
.resource-bar,.severity-track {height:9px;background:rgba(3,57,90,.49);}
.resource-fill,.severity-fill {background:linear-gradient(90deg,#0286cc,#22e6f7);box-shadow:0 0 12px rgba(18,218,241,.27);}
.health-badge {padding:5px 9px;}
/* Retention & administrative tables/forms */
.retention-stat {background:rgba(9,58,88,.20);border-color:rgba(64,154,199,.23);}
.retention-stat-value {font-weight:840;color:var(--text);}
.retention-confirm {border-color:rgba(252,194,67,.45);background:rgba(176,120,31,.08);}
.retention-info {border-color:rgba(72,147,193,.31);background:rgba(11,69,102,.17);}
.retention-info.warning {background:rgba(173,116,27,.10);}
.retention-info.failure {background:rgba(188,51,76,.1);}
.retention-field label {color:var(--text);}
/* Sign-in experience */
.login-page {min-height:100vh;background:radial-gradient(circle at 20% 10%,rgba(6,158,222,.19),transparent 45%),linear-gradient(145deg,#06172a,#061322)!important;}
.login-card {border-color:rgba(18,192,247,.52);box-shadow:0 25px 90px rgba(0,0,0,.45),0 0 36px rgba(12,178,232,.12);}
.login-header {background:linear-gradient(140deg,#082a45,#041b31);border-bottom:1px solid rgba(20,192,243,.25);}
.login-brand {color:#49dffc;}
.login-header h1 {letter-spacing:-.05em;font-size:33px;}
.login-header p {color:#b0d3e7;}
.login-body {background:var(--surface);}
.login-button {min-height:45px;}
/* Helper nav/search visual affordances */
.v41-mobile-toggle {cursor:pointer;}
/* Make 'unavailable' states visually honest, not fake success. */
.v41-offline-text {color:var(--warning);}

@media(max-width:1470px) {
  .v41-dashboard .stats-grid {grid-template-columns:repeat(3,minmax(0,1fr));}
  .v41-severity-body {flex-direction:column;min-height:290px;}
  .v41-donut {width:155px;height:155px;}
  .v41-severity-legend {width:100%;}
}
@media(max-width:1180px) {
  .v41-dash-analytics,.v41-dash-bottom {grid-template-columns:1fr;}
  .v41-severity-body {flex-direction:row;}
  .v41-global-search {width:250px;}
  .profile-grid {grid-template-columns:1fr;}
}
@media(max-width:980px) {
  .app-shell {display:block;}
  .sidebar {position:fixed;transform:translateX(-105%);left:0;top:0;width:242px;height:100dvh;transition:transform .19s ease;}
  body.v41-menu-open .sidebar {transform:translateX(0);}
  body.v41-menu-open::before {content:"";position:fixed;inset:0;z-index:14;background:rgba(0,7,17,.62);}
  .v41-mobile-toggle {display:inline-flex;}
  .topbar {min-height:78px;}
  .v41-global-search {width:clamp(180px,32vw,340px);}
  .health-grid {grid-template-columns:1fr;}
  .health-summary {grid-template-columns:repeat(3,minmax(0,1fr));}
}
@media(max-width:700px) {
  .container {width:calc(100% - 24px);margin-top:15px;}
  .topbar {flex-wrap:wrap;align-items:center;min-height:70px;padding:13px 14px;gap:10px;}
  .v41-heading-group {flex:1;}
  .page-heading {font-size:22px;}
  .top-actions {width:100%;margin-left:0;}
  .v41-global-search {flex:1;width:auto;}
  .top-actions .theme-button {font-size:10px;padding:0 6px;}
  .v41-global-search kbd {display:none;}
  .v41-dashboard .stats-grid {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;}
  .v41-dashboard .stat-card {padding:14px 12px;min-height:112px;}
  .v41-dashboard .stat-value {font-size:22px;}
  .v41-dashboard .stat-label {font-size:9px;}
  .v41-kpi-icon {font-size:21px;}
  .v41-dash-analytics,.v41-dash-bottom {gap:12px;}
  .v41-severity-body {flex-direction:column;}
  .v41-volume-chart {height:165px;min-height:165px;}
  .v41-donut {width:166px;height:166px;}
  .v41-top-sources .source-row {grid-template-columns:1fr;}
  .v41-source-progress-info {justify-content:flex-start;gap:18px;}
  .v41-page-toolbar {align-items:flex-start;flex-direction:column;}
  .log-insight-row {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;}
  .log-insight:last-child {grid-column:1 / -1;}
  .explorer-grid {grid-template-columns:1fr;}
  .explorer-grid .wide {grid-column:1;}
  .explorer-form {padding:14px;}
  .detail-meta {grid-template-columns:1fr 1fr;}
  .health-summary {grid-template-columns:repeat(2,minmax(0,1fr));}
  .statistics-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
  .retention-grid {grid-template-columns:1fr;}
  .portal-clean-footer-inner {grid-template-columns:1fr;}
}
@media(max-width:410px){.detail-meta {grid-template-columns:1fr;}.v41-global-search {min-width:0;}.v41-icon-button {display:none;}}
@media(prefers-reduced-motion:reduce) {html{scroll-behavior:auto;}.button,.nav-link,.sidebar,.v41-volume-bar {transition:none!important;}.portal-loading-spinner,.portal-loading-progress-bar{animation:none!important;}}
@media print { .sidebar,.topbar,.portal-clean-footer,.v41-page-toolbar,.explorer-actions,.explorer-pager {display:none!important;}body{background:#fff!important;color:#000!important;}.app-shell {display:block}.container{width:100%;margin:0;} }
