/* ============================================================
   WM CSAT portal - design system
   Matches WM ConfigHub / CMDB: lavender sidebar, teal accent,
   dark navy header. Login is its own dark navy split-screen.
   ============================================================ */

:root {
  --brand: #0d9488;
  --brand-600: #0f766e;
  --brand-700: #115e56;
  --brand-soft: #d8f2ee;
  --brand-ring: rgba(13, 148, 136, 0.24);

  --violet: #5b3df5;
  --violet-soft: #ede9ff;
  --gold: #ffc72c;

  --ok: #0f9d58;
  --ok-soft: #e4f6ec;
  --warn: #c07f00;
  --warn-soft: #fbf1d9;
  --bad: #d92d20;
  --bad-soft: #fdecea;
  --info: #1570ef;

  --bg: #f3f0fb;
  --surface: #ffffff;
  --surface-2: #f7f7fc;
  --surface-3: #eeecf7;
  --border: #e6e2f2;
  --border-strong: #d4cde8;

  --ink: #0f1729;
  --ink-2: #3a4256;
  --ink-3: #6b7186;
  --ink-inv: #ffffff;

  --sidebar-bg-1: #ece6fb;
  --sidebar-bg-2: #e2d9f7;
  --header-bg: #0f1e3d;
  --header-ink: #eef2fb;
  --header-ink-soft: #9fb0cf;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.16);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --sidebar-w: 248px;
}

[data-theme="dark"] {
  --brand: #8f7aff;
  --brand-600: #7a63f5;
  --brand-700: #6b53e8;
  --brand-soft: #241f3f;
  --brand-ring: rgba(143, 122, 255, 0.32);

  --ok: #45c98a; --ok-soft: #17301f;
  --warn: #e8b64c; --warn-soft: #312813;
  --bad: #ff6b5e; --bad-soft: #331a17;
  --info: #6aa8ff;

  --bg: #0b0a17;
  --surface: #14131f;
  --surface-2: #191826;
  --surface-3: #201f30;
  --border: #2a2940;
  --border-strong: #3a3956;

  --ink: #f0f0f8;
  --ink-2: #b9b9cf;
  --ink-3: #8988a3;
  --ink-inv: #14131f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8f7aff; --brand-600: #7a63f5; --brand-700: #6b53e8;
    --brand-soft: #241f3f; --brand-ring: rgba(143, 122, 255, 0.32);
    --ok: #45c98a; --ok-soft: #17301f; --warn: #e8b64c; --warn-soft: #312813;
    --bad: #ff6b5e; --bad-soft: #331a17; --info: #6aa8ff;
    --bg: #0b0a17; --surface: #14131f; --surface-2: #191826; --surface-3: #201f30;
    --border: #2a2940; --border-strong: #3a3956;
    --ink: #f0f0f8; --ink-2: #b9b9cf; --ink-3: #8988a3; --ink-inv: #14131f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 6px 22px rgba(0,0,0,.45); --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- App shell ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--sidebar-bg-1), var(--sidebar-bg-2));
  border-right: 1px solid var(--border);
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.55);
}
.brand-mark {
  background: #fff; border-radius: 9px; padding: 6px 9px;
  display: inline-flex; box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.brand-mark img { height: 18px; display: block; width: auto; }
.brand-name { font-weight: 750; font-size: 13.5px; letter-spacing: -0.01em; color: var(--ink); }
.brand-sub { font-size: 9px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-3); font-weight: 600; }

.sidebar-nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 4px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 6px; }
.nav-group-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--ink-3); padding: 0 12px; margin-bottom: 4px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: 9px;
  color: var(--ink-2); font-weight: 550; font-size: 13px;
  margin-bottom: 1px; position: relative;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: rgba(255,255,255,0.55); text-decoration: none; color: var(--ink); }
.nav-link.active { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); font-weight: 650; }
.nav-link.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-link .ic { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.62; }
.nav-link:hover .ic, .nav-link.active .ic { opacity: 1; }
.nav-link .badge { margin-left: auto; }

.sidebar-foot { margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.55); }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; flex-shrink: 0; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--border); background: rgba(255,255,255,0.6); color: var(--ink-3);
  cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: #fff; color: var(--bad); border-color: var(--border-strong); }
.icon-btn svg { width: 15px; height: 15px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px; height: 58px;
  background: var(--header-bg);
  color: var(--header-ink);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; color: var(--header-ink); font-weight: 650; }
.topbar .spacer { flex: 1; }

.content { padding: 24px 32px 72px; max-width: 1760px; width: 100%; margin: 0 auto; }

/* ---------- User menu ---------- */

.usermenu { position: relative; }
.usermenu-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08);
  cursor: pointer; color: var(--header-ink); font: inherit;
}
.usermenu-btn:hover { background: rgba(255,255,255,0.14); }
.topbar .menu-toggle { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.18); color: var(--header-ink); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.usermenu-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 8px; display: none;
}
.usermenu-pop.open { display: block; }
.usermenu-pop .who { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.usermenu-pop a, .usermenu-pop button {
  display: flex; width: 100%; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--ink-2);
  background: none; border: none; font: inherit; cursor: pointer; text-align: left;
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* Filter bars: keep selects/inputs inline, not full-width */
form.row select, form.row input[type=text], form.row input[type=email], form.row input[type=date],
form.row input[type=number], form.row input[type=search] {
  width: auto; min-width: 150px; max-width: 260px;
}
form.row select { padding-right: 30px; }

/* ---------- KPI tiles ---------- */

.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; line-height: 1; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--ink-3); }
.kpi-foot { font-size: 12px; color: var(--ink-3); }
.kpi.accent { border-color: var(--brand-ring); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 80%); }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--bad); }

/* ---------- Badges / pills ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.02em;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--border);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--ink-3); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { min-height: 84px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-2); }
.checkbox input { width: auto; margin-top: 2px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 11px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
table.data td.strong { color: var(--ink); font-weight: 600; }

/* ---------- Score visuals ---------- */

.gauge { display: flex; align-items: center; gap: 14px; }
.gauge svg { flex-shrink: 0; }
.score-big { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }

.bar-row { display: grid; grid-template-columns: 160px 1fr 46px; align-items: center; gap: 12px; padding: 7px 0; }
.bar-row .bar-label { font-size: 12px; color: var(--ink-2); }
.bar-row .bar-val { font-size: 12px; font-weight: 700; text-align: right; }

/* Dual-metric trend (CSAT + NPS) */
.trend2 {
  display: flex; align-items: flex-end; gap: 18px; height: 200px;
  padding: 8px 4px 0; border-bottom: 1px solid var(--border);
  background:
    linear-gradient(to top, transparent 0, transparent calc(15% - 1px), var(--border) 15%, transparent calc(15% + 1px)) no-repeat;
}
.trend2-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend2-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 6px; width: 100%; }
.trend2-bars .tb {
  width: 38%; max-width: 42px; border-radius: 5px 5px 0 0; position: relative; min-height: 3px;
  display: flex; justify-content: center;
}
.trend2-bars .tb span {
  position: absolute; top: -18px; font-size: 10px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
}
.tb-csat { background: linear-gradient(180deg, var(--brand-soft), var(--brand)); }
.tb-nps { background: linear-gradient(180deg, #ffe6a8, var(--gold)); }
.trend2-x { font-size: 11px; font-weight: 600; text-align: center; margin-top: 8px; color: var(--ink-2); line-height: 1.3; }
.trend2-x .muted { font-weight: 400; font-size: 10px; }
.trend2-baseline { margin-top: 8px; font-size: 11px; color: var(--ink-3); }

.trend { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .col .bar { width: 100%; max-width: 46px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--brand), var(--brand-600)); min-height: 3px; }
.trend .col .t { font-size: 10px; color: var(--ink-3); }
.trend .col .v { font-size: 11px; font-weight: 700; }

.pill-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--ink-3); }
.pill-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.pill-legend .prom::before { background: var(--ok); }
.pill-legend .pass::before { background: var(--warn); }
.pill-legend .det::before { background: var(--bad); }

.nps-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; }
.nps-bar .prom { background: var(--ok); }
.nps-bar .pass { background: var(--warn); }
.nps-bar .det { background: var(--bad); }

/* ---------- Flash ---------- */

.flash {
  padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 13px; font-weight: 550; border: 1px solid transparent;
}
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.info { background: var(--brand-soft); color: var(--brand); }

/* ---------- Misc ---------- */

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }

.breadcrumb { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.breadcrumb a { color: var(--ink-3); }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { color: var(--ink); }

details.inline-form { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0; }
details.inline-form > summary {
  padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; list-style: none;
}
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] > summary { border-bottom: 1px solid var(--border); }
details.inline-form .body { padding: 16px; }

.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 8px 0; }
.timeline li::before { content: ""; position: absolute; left: -19px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.timeline .meta { font-size: 11px; color: var(--ink-3); }

/* ---------- Public survey ---------- */

.survey-page {
  min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 18px 80px;
}
.survey-card {
  width: 100%; max-width: 620px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.survey-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  color: #fff; padding: 26px 30px;
}
.survey-hero .eyebrow { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; }
.survey-hero h1 { color: #fff; font-size: 21px; margin-top: 6px; }
.survey-hero p { color: rgba(255,255,255,0.9); font-size: 13px; margin-top: 8px; }
.survey-body { padding: 26px 30px 30px; }
.q { padding: 20px 0; border-bottom: 1px solid var(--border); }
.q:last-of-type { border-bottom: none; }
.q .q-label { font-weight: 600; font-size: 14px; color: var(--ink); }
.q .q-help { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.q .q-req { color: var(--bad); margin-left: 3px; }

.scale { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.scale.wide { gap: 6px; }
.scale label {
  flex: 1; min-width: 42px; text-align: center; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 12px 4px; font-weight: 650; font-size: 14px; color: var(--ink-2);
  background: var(--surface); transition: all .12s; position: relative;
}
.scale label:hover { border-color: var(--brand); color: var(--brand); }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale input:checked + span,
.scale label.checked { }
.scale label.checked { background: var(--brand); border-color: var(--brand); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; }

.faces { display: flex; gap: 8px; margin-top: 14px; }
.faces label {
  flex: 1; text-align: center; cursor: pointer; padding: 12px 4px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: all .12s;
}
.faces label .face { font-size: 26px; display: block; filter: grayscale(0.4); }
.faces label .fl { font-size: 10px; color: var(--ink-3); margin-top: 4px; display: block; }
.faces label:hover { border-color: var(--brand); }
.faces label.checked { border-color: var(--brand); background: var(--brand-soft); }
.faces label.checked .face { filter: none; }
.faces input { position: absolute; opacity: 0; pointer-events: none; }

.survey-foot { padding: 20px 30px 26px; background: var(--surface-2); border-top: 1px solid var(--border); }
.autosave-note { font-size: 11px; color: var(--ink-3); margin-top: 10px; text-align: center; }

/* ---------- Login (navy -> teal brand panel, light form panel) ---------- */

.login-page {
  position: relative; min-height: 100vh; overflow: hidden;
  background: var(--bg); color: var(--ink);
  --ease-slow: cubic-bezier(0.22, 1, 0.36, 1);
}

.login-ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.login-orb { position: absolute; border-radius: 50%; filter: blur(52px); opacity: 0.5;
  animation: loginOrbFloat 15s var(--ease-slow) infinite alternate; }
.login-orb-a { width: 360px; height: 360px; left: -90px; top: 14%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.55), transparent 68%); }
.login-orb-b { width: 440px; height: 440px; left: 22%; top: -60px; animation-delay: -4s;
  background: radial-gradient(circle, rgba(255, 199, 44, 0.28), transparent 70%); }
.login-orb-c { width: 320px; height: 320px; left: 8%; bottom: -90px; animation-delay: -7s;
  background: radial-gradient(circle, rgba(91, 61, 245, 0.3), transparent 70%); }
@keyframes loginOrbFloat { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(24px,-28px,0) scale(1.08); } }

.login-shell {
  position: relative; z-index: 1; min-height: 100vh;
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(400px, 0.8fr);
}

.login-brand {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  padding: 3rem 3.6rem; color: #eef7f5;
  background: linear-gradient(158deg, #0f1e3d 0%, #124f57 52%, #0d9488 100%);
  overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(ellipse 78% 68% at 26% 16%, #000 0%, transparent 78%);
  animation: loginGridDrift 24s linear infinite;
}
@keyframes loginGridDrift { from { background-position: 0 0, 0 0; } to { background-position: 38px 38px, 38px 38px; } }
.login-brand > * { position: relative; z-index: 1; }

.login-brand-top { display: flex; align-items: center; gap: 0.9rem; }
.login-brand-logo {
  height: 30px; width: auto; display: block; padding: 7px 11px;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}
.login-brand-divider { width: 1px; height: 26px; background: rgba(255,255,255,0.24); }
.brand-wordmark {
  font-weight: 800; font-size: 1.3rem; letter-spacing: 0.05em;
  background: linear-gradient(90deg, #ffffff 0%, #d7f5f0 45%, #ffc72c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.login-brand-body { max-width: 640px; margin: auto 0; padding: 2.6rem 0; }
.login-brand-body h1 {
  margin: 0 0 1rem; font-size: clamp(1.9rem, 2.5vw, 2.5rem); line-height: 1.2;
  color: #ffffff; font-weight: 760; letter-spacing: -0.015em; max-width: 20ch;
}
.login-brand-body > p { margin: 0 0 2rem; color: rgba(255, 255, 255, 0.78); line-height: 1.7; font-size: 1rem; max-width: 52ch; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffd97a; flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(255,217,122,0.7); animation: livePing 2s ease-out infinite; }
@keyframes livePing { 0% { box-shadow: 0 0 0 0 rgba(255,217,122,0.55); } 70%,100% { box-shadow: 0 0 0 8px rgba(255,217,122,0); } }

/* Live programme snapshot panel */
.brand-metrics {
  margin: 0.2rem 0 1.7rem; max-width: 380px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px; padding: 1rem 1.15rem 1.1rem; backdrop-filter: blur(8px);
  box-shadow: 0 20px 46px rgba(6, 20, 28, 0.34);
  animation: bmIn 0.7s var(--ease-slow) both;
}
@keyframes bmIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.bm-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; }
.bm-head-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.7); }
.bm-period { margin-left: auto; font-size: 0.64rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 999px; background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.85); }
.bm-grid { display: flex; align-items: center; gap: 1.1rem; }
.bm-gauge { position: relative; flex-shrink: 0; }
.bm-gauge svg { display: block; }
.bm-arc { animation: bmArc 2s var(--ease-slow) 0.3s both; }
@keyframes bmArc { from { stroke-dashoffset: 289; } to { stroke-dashoffset: 43; } }
.bm-gauge-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 12px; }
.bm-gauge-c strong { font-size: 1.35rem; font-weight: 800; line-height: 1; color: #fff; }
.bm-gauge-c span { font-size: 0.56rem; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255,255,255,0.68); margin-top: 0.3rem; line-height: 1.25; }
.bm-side { flex: 1; display: flex; flex-direction: column; gap: 0.55rem; }
.bm-stat { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }
.bm-side .bm-stat:last-child { border-bottom: none; padding-bottom: 0; }
.bm-k { font-size: 0.72rem; color: rgba(255,255,255,0.62); }
.bm-v { font-size: 1rem; font-weight: 750; color: #fff; }
.bm-v i { font-size: 0.68rem; font-weight: 600; font-style: normal; color: rgba(255,255,255,0.55); }
.bm-nps { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin: 0.95rem 0 0.5rem; background: rgba(255,255,255,0.1); }
.bm-nps-seg { display: block; height: 100%; animation: bmSeg 1.1s var(--ease-slow) 0.5s both; transform-origin: left; }
@keyframes bmSeg { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bm-prom { background: #39d8a6; } .bm-pass { background: #ffc72c; } .bm-det { background: #ff7a70; }
.bm-legend { display: flex; gap: 0.9rem; font-size: 0.62rem; color: rgba(255,255,255,0.6); }
.bm-legend .bm-l::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 0.32rem; vertical-align: middle; }
.bm-legend .bm-prom::before { background: #39d8a6; } .bm-legend .bm-pass::before { background: #ffc72c; } .bm-legend .bm-det::before { background: #ff7a70; }
.bm-foot { display: flex; align-items: center; gap: 0.5rem; font-size: 0.7rem; color: rgba(255,255,255,0.62); margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.1); }
.bm-foot-dot { width: 6px; height: 6px; border-radius: 50%; background: #39d8a6; box-shadow: 0 0 8px rgba(57,216,166,0.8); }

.login-feature-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.85rem; }
.login-feature-list li {
  position: relative; padding-left: 1.5rem; color: rgba(255,255,255,0.85);
  font-size: 0.92rem; line-height: 1.5;
}
.login-feature-list li::before {
  content: ''; position: absolute; left: 0; top: 0.42rem; width: 8px; height: 8px; border-radius: 2px;
  background: #ffc72c; box-shadow: 0 0 10px rgba(255,199,44,0.6);
}

.login-brand-footer { color: rgba(255,255,255,0.55); font-size: 0.8rem; }

.login-form-panel {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2.5rem; overflow: hidden; background: var(--surface);
}
.login-form-panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(15,23,41,0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 65% 55% at 72% 82%, #000 0%, transparent 75%);
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 424px;
  padding: 2rem 1.9rem 1.7rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.login-card-head { margin-bottom: 1.6rem; }
.login-card-head h2 { margin: 0 0 0.35rem; color: var(--ink); font-size: 1.4rem; font-weight: 750; }
.login-card-head p { margin: 0; color: var(--ink-3); font-size: 0.9rem; }

.role-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; padding: 0.3rem;
  border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border);
  margin-bottom: 1.4rem;
}
.role-option {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: none; border-radius: 7px; padding: 0.62rem 0.7rem; background: transparent;
  color: var(--ink-3); font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.role-option svg { width: 15px; height: 15px; flex-shrink: 0; }
.role-option:hover { color: var(--ink); }
.role-option.active {
  background: var(--surface); color: var(--brand-700);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--brand-ring);
}

.login-form label {
  display: flex; flex-direction: column; gap: 0.42rem; margin-bottom: 1rem;
  color: var(--ink-2); font-size: 0.82rem; font-weight: 600;
}
.login-form input {
  width: 100%; padding: 0.72rem 0.8rem; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 0.9rem;
}
.login-form input::placeholder { color: var(--ink-3); opacity: 0.7; }
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }

.login-form .primary {
  width: 100%; margin-top: 0.6rem; padding: 0.82rem 1.1rem; font-size: 0.95rem; font-weight: 650;
  border: none; border-radius: 9px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  transition: transform .1s, box-shadow .3s, background .2s;
}
.login-form .primary:hover { background: var(--brand-600); box-shadow: 0 10px 26px rgba(13, 148, 136, 0.35); }
.login-form .primary:active { transform: translateY(1px); }

.login-legal { margin: 1.3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.72rem; color: var(--ink-3); }

.alert {
  background: var(--bad-soft); color: var(--bad); border: 1px solid transparent;
  border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 1rem; font-size: 0.86rem; font-weight: 550;
}

@media (prefers-reduced-motion: reduce) {
  .login-orb, .login-brand::before, .live-dot, .flow-runner { animation: none; }
}
@media (max-width: 1060px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 2.2rem; }
  .login-brand-body { padding: 1.6rem 0; margin: 1.2rem 0; }
  .flow-viz:nth-of-type(2) { display: none; }
  .login-form-panel { padding: 2rem 1.4rem 3rem; }
}
@media (max-width: 560px) {
  .flow-viz { display: none; }
  .brand-wordmark { font-size: 1.05rem; }
}

.status-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg);
}
.status-box {
  max-width: 460px; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 44px 36px; box-shadow: var(--shadow);
}
.status-box .icon { font-size: 40px; }
.status-box h1 { margin: 14px 0 8px; }
.status-box p { color: var(--ink-3); font-size: 14px; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -100%; z-index: 100; transition: left .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex !important; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 12px 16px; }
}
.menu-toggle { display: none; }
