/* ScreenWise dashboard styles. No inline styles (strict CSP). */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --sidebar: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --accent: #3d63dd;
  --accent-hover: #3354c4;
  --accent-soft: #eef2ff;
  --accent-ink: #ffffff;
  --grid: #eef0f3;
  --ok: #12a150;
  --ok-soft: #e7f6ee;
  --warn: #d48806;
  --warn-soft: #fdf3e1;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --violet: #7c5cdb;
  --violet-soft: #f1edfc;
  --teal: #0e9f9a;
  --teal-soft: #e3f5f4;
  --seq-0: #eef0f4;
  --seq-1: #d4defb;
  --seq-2: #a5b9f4;
  --seq-3: #6f8eea;
  --seq-4: #3d63dd;
  --seq-5: #2440a0;
  --series-use: #3d63dd;
  --series-other: #f08a4b;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.22);
  --ring: 0 0 0 4px rgba(61, 99, 221, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #15181e;
    --surface-2: #1b1f26;
    --sidebar: #111419;
    --border: #262a33;
    --border-strong: #343a46;
    --text: #f2f4f7;
    --text-2: #c0c5d0;
    --muted: #8a92a3;
    --accent: #6b8cff;
    --accent-hover: #86a0ff;
    --accent-soft: rgba(107, 140, 255, 0.14);
    --accent-ink: #0c0e12;
    --grid: #22262e;
    --ok: #3ccb7f;
    --ok-soft: rgba(60, 203, 127, 0.13);
    --warn: #f0b440;
    --warn-soft: rgba(240, 180, 64, 0.13);
    --bad: #ff6b70;
    --bad-soft: rgba(255, 107, 112, 0.13);
    --violet: #a68bff;
    --violet-soft: rgba(166, 139, 255, 0.14);
    --teal: #3fd0c9;
    --teal-soft: rgba(63, 208, 201, 0.13);
    --seq-0: #1d2129;
    --seq-1: #1e2f66;
    --seq-2: #2a4396;
    --seq-3: #3d63dd;
    --seq-4: #6b8cff;
    --seq-5: #b3c4ff;
    --series-use: #6b8cff;
    --series-other: #e9783a;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
    --ring: 0 0 0 4px rgba(107, 140, 255, 0.22);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --surface: #15181e;
  --surface-2: #1b1f26;
  --sidebar: #111419;
  --border: #262a33;
  --border-strong: #343a46;
  --text: #f2f4f7;
  --text-2: #c0c5d0;
  --muted: #8a92a3;
  --accent: #6b8cff;
  --accent-hover: #86a0ff;
  --accent-soft: rgba(107, 140, 255, 0.14);
  --accent-ink: #0c0e12;
  --grid: #22262e;
  --ok: #3ccb7f;
  --ok-soft: rgba(60, 203, 127, 0.13);
  --warn: #f0b440;
  --warn-soft: rgba(240, 180, 64, 0.13);
  --bad: #ff6b70;
  --bad-soft: rgba(255, 107, 112, 0.13);
  --violet: #a68bff;
  --violet-soft: rgba(166, 139, 255, 0.14);
  --teal: #3fd0c9;
  --teal-soft: rgba(63, 208, 201, 0.13);
  --seq-0: #1d2129;
  --seq-1: #1e2f66;
  --seq-2: #2a4396;
  --seq-3: #3d63dd;
  --seq-4: #6b8cff;
  --seq-5: #b3c4ff;
  --series-use: #6b8cff;
  --series-other: #e9783a;
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 4px rgba(107, 140, 255, 0.22);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
.sprite { display: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.em { color: var(--text); font-weight: 500; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 13px; }
h1, h2, h3 { letter-spacing: -0.01em; }
h1 { margin: 0; font-size: 24px; font-weight: 650; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 600; }
h3 .muted { font-weight: 400; margin-left: 4px; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }

/* ---------- form controls ---------- */
input, select, button { font: inherit; color: inherit; }
input, select {
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"] { height: 16px; width: 16px; padding: 0; accent-color: var(--accent); box-shadow: none; }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px;
}
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); } }

button { cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 550; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .nav-item:focus-visible, .icon-btn:focus-visible, .segmented button:focus-visible, a.csv:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(1.06); }
.btn.lg { height: 42px; font-size: 15px; }
.btn:disabled { opacity: .6; cursor: default; }
button.link {
  border: 0; background: none; color: var(--accent); padding: 4px 8px; border-radius: 6px; font-size: 13px; font-weight: 500;
}
button.link:hover { background: var(--accent-soft); }
button.link.danger-link { color: var(--bad); }
button.link.danger-link:hover { background: var(--bad-soft); }

a.csv {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-2); font-size: 12px; font-weight: 550; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); padding: 5px 10px; border-radius: 8px;
  transition: color .15s, border-color .15s, background .15s;
}
a.csv::before {
  content: ""; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 19h16'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 19h16'/%3E%3C/svg%3E") center / contain no-repeat;
}
a.csv:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.segmented button {
  border: 0; background: none; height: 28px; padding: 0 11px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px var(--border); }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; width: 240px; }

/* ---------- progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 50;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity .2s;
}
.progress.on { opacity: 1; animation: slide 1s linear infinite; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b7cfa 0%, #3d63dd 50%, #7c5cdb 100%);
  box-shadow: 0 4px 10px -2px rgba(61, 99, 221, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.logo svg { width: 18px; height: 18px; stroke-width: 2; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-hero {
  position: relative; overflow: hidden; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 40px 48px;
  background:
    radial-gradient(1000px 600px at 110% -10%, rgba(124, 92, 219, .75), transparent 60%),
    radial-gradient(800px 500px at -20% 120%, rgba(14, 159, 154, .55), transparent 60%),
    linear-gradient(160deg, #1a2a6c 0%, #2440a0 55%, #3d63dd 100%);
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.login-hero > * { position: relative; z-index: 1; }
.brand-light .logo { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.login-pitch h1 { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; max-width: 16ch; margin-bottom: 28px; }
.login-pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 420px; }
.login-pitch li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .88); font-size: 15px; }
.login-pitch li svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.login-foot { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .6); }
.login-pane { display: grid; place-items: center; padding: 32px 16px; background: var(--surface); }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 18px; }
.login-card h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.login-card p.muted { margin: 4px 0 0; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.field input { height: 42px; font-size: 15px; }
.only-mobile { display: none; }
.sso-buttons, .password-login { display: grid; gap: 12px; }
.forgot-link { justify-self: center; font-size: 13.5px; color: var(--accent); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.password-login { gap: 18px; }
.sso-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 550; }
.sso-btn svg { width: 18px; height: 18px; flex: none; }
.sso-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.sso-divider::before, .sso-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px 14px;
  background: var(--sidebar); border-right: 1px solid var(--border);
}
.sidebar > .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  border: 0; background: none; text-align: left;
  height: 38px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item svg { color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.nav-sub { padding-left: 22px; height: 34px; font-size: 13.5px; }
.nav-sub svg { width: 16px; height: 16px; }
.portal-switch {
  display: flex; align-items: center; gap: 9px; margin: 0 0 10px; height: 36px; padding: 0 10px;
  border: 1px dashed var(--border-strong); border-radius: 9px; background: none; color: var(--text-2); font-size: 13px; font-weight: 550;
  transition: background .15s, color .15s, border-color .15s;
}
.portal-switch svg { width: 16px; height: 16px; color: var(--muted); }
.portal-switch:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.portal-switch.active { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); color: var(--accent); }
.portal-switch.active svg { color: var(--accent); }
.portal-switch:focus-visible { outline: none; box-shadow: var(--ring); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 650; font-size: 13px; text-transform: uppercase;
  color: var(--violet); background: var(--violet-soft);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; color: var(--accent); background: var(--accent-soft); }
.user-meta { display: grid; min-width: 0; line-height: 1.3; }
.user-email { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.foot-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.main { min-width: 0; padding: 0 32px 48px; }
.page-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 26px 0 18px; margin-bottom: 4px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
          backdrop-filter: saturate(1.4) blur(12px);
}
.page-head p { margin: 4px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.daterange {
  display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.daterange:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.daterange input { border: 0; box-shadow: none; height: 32px; padding: 0 6px; background: none; }
.daterange input:focus { box-shadow: none; }

.tab { display: grid; gap: 20px; animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; min-width: 0; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head > div:first-child { min-width: 0; }
.card-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); max-width: 70ch; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.row { margin-bottom: 4px; }
form.row input:not([type="checkbox"]) { flex: 1 1 140px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.student-id { display: flex; align-items: center; gap: 12px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.tile-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px;
  color: var(--accent); background: var(--accent-soft);
}
.tile-icon.c2 { color: var(--violet); background: var(--violet-soft); }
.tile-icon.c3 { color: var(--teal); background: var(--teal-soft); }
.tile-icon.c4 { color: var(--warn); background: var(--warn-soft); }
.tile-icon.ok { color: var(--ok); background: var(--ok-soft); }
.tile-icon.warn { color: var(--warn); background: var(--warn-soft); }
.tile-icon.bad { color: var(--bad); background: var(--bad-soft); }
.tile-label { color: var(--text-2); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.ico-sm { width: 15px; height: 15px; color: var(--muted); }
.tile-value { font-size: 30px; font-weight: 680; letter-spacing: -0.025em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.dot.live { box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.tile-value.loading, .tile-value:empty { color: transparent; }

/* ---------- charts ---------- */
.chart { position: relative; height: 270px; }
.chart.tall { height: 430px; }

/* ---------- heatmap ---------- */
.heatmap { display: grid; grid-template-columns: 34px repeat(var(--cols, 14), 1fr); gap: 3px; font-size: 11px; color: var(--muted); }
.heatmap .cell { height: 26px; border-radius: 5px; background: var(--seq-0); transition: transform .1s, box-shadow .1s; }
.heatmap .cell:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); position: relative; z-index: 1; }
.heatmap .lbl { display: flex; align-items: center; font-weight: 500; }
.heatmap .hlbl { text-align: center; padding-bottom: 2px; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 14px; font-size: 11px; color: var(--muted); }
.heat-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.heat-legend span:first-child { margin-right: 4px; } .heat-legend span:last-child { margin-left: 4px; }
.heat-legend .s1 { background: var(--seq-1); } .heat-legend .s2 { background: var(--seq-2); } .heat-legend .s3 { background: var(--seq-3); }
.heat-legend .s4 { background: var(--seq-4); } .heat-legend .s5 { background: var(--seq-5); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.scroll { max-height: 540px; overflow: auto; margin: 0 -20px -20px; border-top: 1px solid var(--border); }
.scroll.short { max-height: 300px; margin: 0; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 9px 12px; white-space: nowrap;
}
.table-wrap .table th { background: var(--surface); }
.table-wrap .table th:first-child { border-top-left-radius: 0; }
.table td { border-bottom: 1px solid var(--grid); padding: 10px 12px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.scroll .table th:first-child, .scroll .table td:first-child { padding-left: 20px; }
.scroll .table th:last-child, .scroll .table td:last-child { padding-right: 20px; }
.scroll.short .table th:first-child, .scroll.short .table td:first-child { padding-left: 12px; }
.scroll.short .table th:last-child, .scroll.short .table td:last-child { padding-right: 12px; }
.table td.num, .table th.num { text-align: right; }
.table td.num { font-weight: 500; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table.clickable tbody tr[data-i] { cursor: pointer; }
.table.clickable tbody tr[data-i]:hover { background: var(--accent-soft); }
.table td.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550;
  padding: 3px 9px 3px 8px; border-radius: 999px; text-transform: capitalize;
}
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.bad { color: var(--bad); background: var(--bad-soft); }
.badge.ok .dot { background: var(--ok); } .badge.warn .dot { background: var(--warn); } .badge.bad .dot { background: var(--bad); }
.tag {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.table td:has(> .bar-inline) { width: 22%; min-width: 90px; }
.bar-inline { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--seq-3), var(--accent)); min-width: 3px; }
.token {
  background: var(--surface-2); border: 1px dashed var(--accent); color: var(--text);
  padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; word-break: break-all;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- analytics ---------- */
.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px 28px; background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.def { display: flex; gap: 12px; align-items: flex-start; }
.def > div { display: grid; gap: 3px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; margin-top: 5px; display: inline-block; }
.swatch.sm { width: 10px; height: 10px; margin-top: 0; border-radius: 3px; }
.swatch.use { background: var(--series-use); }
.swatch.other { background: var(--series-other); }
.swatch.total { background: linear-gradient(to top, var(--series-use) 0 50%, var(--series-other) 50% 100%); }
.meter { height: 8px; border-radius: 4px; background: var(--series-other); margin-top: 12px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--series-use); border-right: 2px solid var(--surface); transition: width .5s ease; }
.split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; min-width: 90px; background: var(--series-other); }
.split > span { background: var(--series-use); border-right: 2px solid var(--surface); }
.table td:has(> .split) { width: 22%; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.checks label:hover { border-color: var(--border-strong); }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.checks .muted { font-size: 11.5px; font-weight: 400; }

/* ---------- dialog ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(10, 14, 22, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog[open] { animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.dialog form { display: grid; gap: 8px; }
.dialog p { margin: 0 0 12px; }
.dialog-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--bad); background: var(--bad-soft); margin-bottom: 8px; }
.dialog-icon svg { width: 22px; height: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- assets ---------- */
.toolbar { margin-bottom: 14px; }
.toolbar .csv { margin-left: auto; }
.toolbar .csv + .csv { margin-left: 0; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: var(--warn-soft); padding-top: 14px; padding-bottom: 14px; }
.badge.info { color: var(--accent); background: var(--accent-soft); }
.badge.info .dot { background: var(--accent); }
.badge.neutral { color: var(--muted); background: var(--surface-2); }
.badge.neutral .dot { background: var(--muted); }
.warn-text { color: var(--warn); font-weight: 550; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.dialog.wide { width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.dialog-head p { margin: 4px 0 0; }
.dialog h3:first-child { margin-top: 8px; }
.dialog .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid .field input, .form-grid .field select { height: 38px; font-size: 14px; width: 100%; }
textarea {
  font: inherit; font-size: 14px; color: inherit; width: 100%; resize: vertical;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; box-shadow: var(--shadow-sm);
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.panel { border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 14px; margin: 8px 0 4px; background: var(--surface-2); }
.assignment { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.assignment .who { display: grid; gap: 2px; min-width: 0; }
.assignment .who strong { overflow-wrap: anywhere; }
.btn.danger-outline { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger-outline:hover { background: var(--bad-soft); }
.btn svg { width: 16px; height: 16px; }
.bad-text { color: var(--bad); font-weight: 550; }

/* ---------- combo (dropdown with an "add new" input) ---------- */
.combo { position: relative; }
.combo-menu, .combo-add input { font-weight: 400; }
.combo-btn {
  width: 100%; height: 38px; display: flex; align-items: center; text-align: left; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 32px 0 11px; box-shadow: var(--shadow-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 16px;
}
.combo-btn:hover { border-color: var(--muted); }
.combo-btn:focus-visible, .combo-btn[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.combo-btn:disabled { opacity: .6; cursor: default; }
.combo-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-menu {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); overflow: hidden;
}
.combo-list { max-height: 200px; overflow: auto; padding: 4px; display: grid; }
.combo-opt { border: 0; background: none; text-align: left; padding: 7px 9px; border-radius: 6px; font-size: 14px; color: var(--text); }
.combo-opt.muted { color: var(--muted); }
.combo-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 9px 3px; }
.combo-opt:hover, .combo-opt:focus-visible { background: var(--surface-2); outline: none; }
.combo-opt.sel { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.combo-add { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.form-grid .combo-add input { flex: 1; height: 34px; }
.combo-add .btn { height: 34px; }

/* ---------- support resources ---------- */
.res-list { display: grid; gap: 8px; }
.res-list:empty { display: none; }
.res-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 8px; align-items: center; }
.res-link {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 6px; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft); text-decoration: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.res-link:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .res-row { grid-template-columns: minmax(0, 1fr) auto; }
  .res-row input { grid-column: 1; }
  .res-row button { grid-column: 2; grid-row: 1; }
}
.field input[type="file"] { height: auto; padding: 8px; font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt, .kv .k { color: var(--muted); }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .csv { margin-left: 0; }
}

/* ---------- requests ---------- */
.tab-inner { display: grid; gap: inherit; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; }
.quote { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
.check-field { align-content: end; }
.check-field > span { display: flex; align-items: center; gap: 8px; height: 38px; font-weight: 500; }
.form-grid .check-field input[type="checkbox"] { width: 16px; height: 16px; flex: none; }
.hint.ok { color: var(--ok); } .hint.warn { color: var(--warn); } .hint.bad { color: var(--bad); }

/* ---------- settings ---------- */
.role-select { height: 30px; font-size: 13px; padding-left: 9px; padding-right: 28px; background-position: right 7px center; }

/* ---------- software ---------- */
.mini-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.mini-tiles > div { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.mini-tiles .k { display: block; font-size: 12px; color: var(--muted); }
.mini-tiles .v { display: block; font-size: 18px; font-weight: 650; margin-top: 2px; }
.chart.short { height: 200px; }
#sw-dialog { width: min(940px, calc(100vw - 32px)); }
.grid2.tight { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.trend { font-size: 12px; font-weight: 550; margin-left: 6px; }
.trend.up { color: var(--ok); } .trend.down { color: var(--bad); }
.util { display: grid; gap: 4px; min-width: 110px; }
.util .meter { margin-top: 0; height: 6px; background: var(--surface-2); }
.util .meter-fill { background: var(--accent); border-right: 0; }
.util.low .meter-fill { background: var(--warn); }
.util.over .meter-fill { background: var(--bad); }
.util.over .lbl { color: var(--bad); font-weight: 550; }
.util.low .lbl { color: var(--warn); font-weight: 550; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; justify-items: end; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 380px;
  padding: 11px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
}
.toast.error { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar > .brand { padding: 0; font-size: 16px; }
  .sidebar > .brand .logo { width: 28px; height: 28px; }
  .nav { order: 3; flex: 1 0 100%; min-width: 0; max-width: calc(100% + 32px); flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .nav-item { flex: none; height: 34px; white-space: nowrap; }
  .sidebar-foot { margin-left: auto; border: 0; padding: 0; }
  .portal-switch { order: 1; margin: 0 0 0 auto; height: 32px; }
  .portal-switch:not(.hidden) + .sidebar-foot { order: 2; margin-left: 0; }
  .user-meta { display: none; }
  .avatar { width: 30px; height: 30px; font-size: 12px; }
  .main { padding: 0 16px 32px; }
  .page-head { position: static; padding: 20px 0 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: none; }
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .only-mobile { display: flex; }
}
@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .filters { width: 100%; }
  .filters > * { flex: 1 1 auto; }
  .daterange { width: 100%; }
  .daterange input { flex: 1; min-width: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .grid2 { gap: 16px; }
  .tab { gap: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .tile-icon { width: 30px; height: 30px; margin-bottom: 10px; }
  .tile-icon svg { width: 16px; height: 16px; }
  .tile-value { font-size: 22px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .scroll { margin: 0 -16px -16px; }
  .table th, .table td { white-space: nowrap; }
  .defs { grid-template-columns: 1fr; }
  .search, .search input { width: 100%; }
  .card-head .row { width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: 16px; justify-items: stretch; }
  .heatmap { grid-template-columns: 30px repeat(var(--cols, 14), 1fr); gap: 2px; }
  .heatmap .cell { height: 20px; border-radius: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Dense, scrolling tables keep one line per row */
.scroll .table td { white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.cell-line { display: block; line-height: 1.5; }
.cell-line a { font-size: 12px; text-decoration: none; }
.cell-line a:hover { text-decoration: underline; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 12px; }
#ext-days { margin-bottom: 14px; }
#ext-form .form-grid { margin-bottom: 6px; }

.stack-sections { display: grid; gap: 4px; }
.stack-sections h3 { margin-top: 6px; }

/* ---------- two-factor ---------- */
button.user { all: unset; flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; border-radius: 10px; padding: 4px; margin: -4px; }
button.user:hover { background: var(--surface-2); }
button.user:focus-visible { box-shadow: var(--ring); }
.code-input { font: 600 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; text-align: center; }
.enroll-box { display: grid; gap: 12px; }
.enroll-qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.enroll-qr img { width: 168px; height: 168px; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--border); }
.enroll-secret { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

/* ---------- email provider templates ---------- */
.provider-guide { font-weight: 400; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; gap: 8px; }
.provider-guide ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; }
.provider-guide .row { gap: 6px; }
.provider-guide .btn { height: 30px; font-size: 13px; }
.provider-guide .btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.provider-guide a { color: var(--accent); }

/* ---------- log forwarding ---------- */
.form-grid .field .inline-select { width: auto; height: 30px; font-size: 13px; padding-top: 0; padding-bottom: 0; }
#sl-test-line { white-space: pre-wrap; word-break: break-all; font-size: 12px; }

/* ---------- users & access ---------- */
.subtabs { align-self: start; justify-self: start; flex-wrap: wrap; }
.ac-pane { display: grid; gap: inherit; }
.ac-tiles .tile-value { font-size: 26px; }
.form-grid .field input[type="checkbox"], .form-grid .field input[type="radio"],
.check-line input[type="checkbox"], .check-line input[type="radio"] { width: 16px; height: 16px; flex: none; margin: 0; }
.field .check-line { font-weight: 450; color: var(--text); margin: 2px 0; }
.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); border-radius: 10px;
}
.bulk-bar > span { font-weight: 600; color: var(--accent); margin-right: 4px; }
.bulk-bar select { height: 34px; }
.table td.sel, .table th.sel { width: 32px; padding-right: 0; }
.table input[type="checkbox"] { width: 16px; height: 16px; vertical-align: middle; }
tr.is-disabled td { color: var(--muted); }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell .avatar { width: 30px; height: 30px; font-size: 12px; flex: none; }
.user-cell .cell-sub { overflow: hidden; text-overflow: ellipsis; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.perm-chips:empty::before { content: "No permissions: this user can sign in but will see nothing."; color: var(--warn); font-size: 13px; }
.perm-groups { display: grid; gap: 14px; font-weight: 400; }
.perm-group h4 { margin: 0 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.perm-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.perm-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.perm-opt input { margin-top: 2px; }
.perm-opt strong { font-size: 13.5px; color: var(--text); font-weight: 600; }
.perm-opt .hint { grid-column: 2; }
.perm-opt:has(input:disabled) { cursor: default; opacity: .85; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; }
.matrix td:first-child { white-space: normal; min-width: 220px; }
.matrix .yes { color: var(--ok); font-weight: 700; }
.matrix .no { color: var(--border-strong); }
.sso-title { display: flex; gap: 12px; align-items: flex-start; }
.sso-title > svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.copy-box { display: block; padding: 8px 10px; word-break: break-all; font-weight: 400; cursor: copy; }
.copy-box:empty::before { content: "Set the dashboard public URL first"; color: var(--muted); font-family: inherit; }
.member-list { max-height: 240px; overflow: auto; padding: 2px; margin-top: 8px; font-weight: 400; }
.member-list label.hidden { display: none; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 35%); z-index: 2; }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 640px) {
  .bulk-bar { flex-direction: column; align-items: stretch; }
  .subtabs { justify-self: stretch; }
  .subtabs button { flex: 1 1 auto; }
}
