/* Southmark dashboard
   Layout: one centred column (max 1240px) under a floating glass top bar;
   pages are stacks of glass panels on a warm, softly lit dark ground. */
:root {
  --bg: #0d0a0b;
  --bg-2: #15100f;
  --glass: rgba(30, 24, 25, 0.66);
  --glass-strong: rgba(38, 30, 31, 0.86);
  --glass-hover: rgba(46, 37, 38, 0.8);
  --line: rgba(244, 239, 230, 0.085);
  --line-strong: rgba(244, 239, 230, 0.16);
  --fg: #f4efe6;
  --muted: #b0a59c;
  --faint: #837871;
  --gold: #c9a86a;
  --gold-ink: #c9a86a;
  --gold-soft: rgba(201, 168, 106, 0.14);
  --gold-line: rgba(201, 168, 106, 0.42);
  --on-gold: #1a1416;
  --bordeaux: #9b2f42;
  --bordeaux-soft: rgba(155, 47, 66, 0.2);
  --bordeaux-ink: #e3929f;
  --good: #8ccb97;
  --good-soft: rgba(140, 203, 151, 0.13);
  --warn: #e3b35c;
  --warn-soft: rgba(227, 179, 92, 0.13);
  --bad: #ec8b8b;
  --bad-soft: rgba(236, 139, 139, 0.14);
  --info: #a8b4ee;
  --info-soft: rgba(168, 180, 238, 0.13);
  --cream: #f1ebe0;
  --chart-a: #c9a86a;
  --chart-b: #e9e1d3;
  --chart-c: #9b2f42;
  --chart-d: #8f7fd6;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 50px rgba(0, 0, 0, 0.35);
  --font-display: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --font-accent: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body: "Wix Madefor Text", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 20px;
  --radius-sm: 13px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ece5da; --bg-2: #e3dacd;
    --glass: rgba(255, 252, 247, 0.72); --glass-strong: rgba(255, 252, 247, 0.92); --glass-hover: rgba(255, 255, 255, 0.9);
    --line: rgba(26, 20, 22, 0.09); --line-strong: rgba(26, 20, 22, 0.16);
    --fg: #1a1416; --muted: #5f5450; --faint: #81766f;
    --gold: #a7843f; --gold-ink: #7f6128; --gold-soft: rgba(167, 132, 63, 0.14); --gold-line: rgba(127, 97, 40, 0.42); --on-gold: #ffffff;
    --bordeaux: #7b1e2e; --bordeaux-soft: rgba(123, 30, 46, 0.1); --bordeaux-ink: #7b1e2e;
    --good: #2f7a43; --good-soft: rgba(47, 122, 67, 0.1); --warn: #8a5a00; --warn-soft: rgba(176, 120, 20, 0.12);
    --bad: #b03a3a; --bad-soft: rgba(176, 58, 58, 0.1); --info: #3d4ea8; --info-soft: rgba(61, 78, 168, 0.1);
    --cream: #1a1416; --chart-a: #a7843f; --chart-b: #cfc4b3; --chart-c: #7b1e2e; --chart-d: #6a5ac8;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 14px 40px rgba(60, 40, 30, 0.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ece5da; --bg-2: #e3dacd;
  --glass: rgba(255, 252, 247, 0.72); --glass-strong: rgba(255, 252, 247, 0.92); --glass-hover: rgba(255, 255, 255, 0.9);
  --line: rgba(26, 20, 22, 0.09); --line-strong: rgba(26, 20, 22, 0.16);
  --fg: #1a1416; --muted: #5f5450; --faint: #81766f;
  --gold: #a7843f; --gold-ink: #7f6128; --gold-soft: rgba(167, 132, 63, 0.14); --gold-line: rgba(127, 97, 40, 0.42); --on-gold: #ffffff;
  --bordeaux: #7b1e2e; --bordeaux-soft: rgba(123, 30, 46, 0.1); --bordeaux-ink: #7b1e2e;
  --good: #2f7a43; --good-soft: rgba(47, 122, 67, 0.1); --warn: #8a5a00; --warn-soft: rgba(176, 120, 20, 0.12);
  --bad: #b03a3a; --bad-soft: rgba(176, 58, 58, 0.1); --info: #3d4ea8; --info-soft: rgba(61, 78, 168, 0.1);
  --cream: #1a1416; --chart-a: #a7843f; --chart-b: #cfc4b3; --chart-c: #7b1e2e; --chart-d: #6a5ac8;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 14px 40px rgba(60, 40, 30, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  background: var(--bg); z-index: 30;
}

/* Ambient ground: warm light falling through tall windows. */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.ambient::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(60% 50% at 50% 8%, rgba(201, 168, 106, 0.22), transparent 70%),
    radial-gradient(40% 45% at 12% 40%, rgba(155, 47, 66, 0.16), transparent 70%),
    radial-gradient(45% 50% at 92% 55%, rgba(201, 168, 106, 0.12), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 7%, rgba(201, 168, 106, 0.06) 7% 9%, transparent 9% 14%);
  filter: blur(28px);
}
.ambient::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 92%);
}
:root[data-theme="light"] .ambient::before { opacity: 0.7; }

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
::selection { background: var(--gold-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Type */
.mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.eyebrow { color: var(--muted); display: flex; gap: 10px; align-items: center; }
.eyebrow b { color: var(--gold-ink); font-weight: 500; }
.title { font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 4.4vw, 52px); line-height: 1.02; letter-spacing: -0.012em; margin: 10px 0 10px; text-wrap: balance; }
.title em, .it { font-family: var(--font-accent); font-style: italic; color: var(--gold-ink); letter-spacing: -0.02em; font-weight: 400; }
.lede { color: var(--muted); max-width: 70ch; margin: 0; text-wrap: pretty; }
h2, h3 { margin: 0; font-weight: 600; }
.panel-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel-title small { font-weight: 400; color: var(--faint); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* Shell */
.shell { min-height: 100vh; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; padding-block: 14px 10px; background: linear-gradient(180deg, var(--bg) 55%, transparent); }
.topbar.tight .wrap { flex-wrap: wrap; }
.topbar.no-org .brand-org { display: none; }
.topbar.tight .nav { order: 3; flex-basis: 100%; margin: 0; }
.topbar.tight .tools { margin-left: auto; }
.hours-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.hours-row .input { min-width: 0; padding-inline: 10px; }
.topbar .wrap { display: flex; align-items: center; gap: 10px; }
.pill {
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 8px; min-width: 0; text-decoration: none; }
.brand-orb { width: 30px; height: 30px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #f3dfae, #c9a86a 45%, #6f5426 100%); box-shadow: 0 0 18px rgba(201, 168, 106, 0.35); }
.brand-word { font-family: var(--font-display); font-size: 20px; white-space: nowrap; }
.brand-word em { font-family: var(--font-accent); font-style: italic; color: var(--gold-ink); }
.brand-org { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; }

.nav { display: flex; gap: 2px; padding: 5px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 0 1 auto; margin-inline: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 500; color: var(--fg); white-space: nowrap; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--glass-hover); }
.nav a[aria-current="page"] { background: var(--gold); color: var(--on-gold); }
.badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--bordeaux); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.nav a[aria-current="page"] .badge { background: rgba(26, 20, 22, 0.85); }

.tools { display: flex; align-items: center; gap: 8px; flex: none; }
.seg { display: inline-flex; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--fg); }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; position: relative; border: 1px solid var(--line); background: var(--glass-strong); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.icon-btn:hover { background: var(--glass-hover); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: -2px; right: -2px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--glass-strong); }

.banner { margin-top: 2px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 9px 9px 9px 16px; border-radius: 14px; border: 1px solid var(--gold-line); background: var(--gold-soft); font-size: 13.5px; }
.banner.demo { border-color: var(--line-strong); background: var(--glass); }

/* Page header */
.page { padding-top: 26px; display: grid; gap: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head > div { min-width: 0; }

/* Panels */
.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(26px) saturate(1.15); -webkit-backdrop-filter: blur(26px) saturate(1.15);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.flush .panel-head { padding: 18px 20px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }

/* KPI tiles */
.kpi { display: grid; gap: 4px; align-content: start; min-height: 150px; }
.kpi .label { font-size: 13.5px; color: var(--muted); }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.kpi .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.kpi .spark { margin-top: auto; padding-top: 10px; }
.delta { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--good-soft); color: var(--good); letter-spacing: 0.02em; }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--glass-hover); color: var(--muted); }

/* Lists */
.rows { display: grid; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 4px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--bordeaux-soft); color: var(--bordeaux-ink); }
.row .ic.gold { background: var(--gold-soft); color: var(--gold-ink); }
.row .ic svg { width: 16px; height: 16px; }
.row .t { font-weight: 600; min-width: 0; }
.row .s { color: var(--muted); font-size: 13px; }
.row-btn { all: unset; cursor: pointer; display: contents; }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-ink); font-weight: 600; font-size: 13.5px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 6px 4px; white-space: nowrap; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--muted); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chip.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.chip.gold { color: var(--gold-ink); background: var(--gold-soft); border-color: transparent; }
.chip.plain::before { display: none; }
.tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--gold-line); color: var(--gold-ink); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 13.5px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--glass-strong); text-decoration: none; white-space: nowrap; min-height: 40px; transition: background .2s, border-color .2s, transform .1s; }
.btn:hover { background: var(--glass-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--cream); color: var(--bg); border-color: transparent; padding-left: 6px; }
.btn.primary .orb { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; }
.btn.primary:hover { filter: brightness(1.04); }
.btn.gold { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.btn.danger { background: var(--bordeaux); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; color: var(--faint); padding: 12px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 20px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--glass-hover); }
td .sub { display: block; color: var(--faint); font-size: 12.5px; }
td.right, th.right { text-align: right; }

/* Forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--glass-strong); color: var(--fg); font: inherit; font-size: 14.5px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--gold-line); outline-offset: 0; border-color: var(--gold-line); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 38px; min-width: 220px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); transition: transform .2s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--on-gold); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Activity */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: 52px 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 20px; border-top: 1px solid var(--line); font-size: 14px; }
.feed-row:first-child { border-top: 0; }
.feed-row time { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.feed-row .who { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--faint); text-transform: uppercase; }
.feed-row .what b { font-weight: 600; }
.feed-row .what span { color: var(--muted); }
.feed-row.new { animation: arrive .9s ease; }
@keyframes arrive { from { background: var(--gold-soft); } to { background: transparent; } }
.agent-orb { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--on-gold); background: var(--gold); }
.agent-orb.arthur { background: var(--cream); color: var(--bg); }
.agent-orb.max { background: var(--faint); color: var(--bg); }
.agent-orb.sys { background: var(--line-strong); color: var(--fg); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--good); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--good-soft); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Calls */
.handoffs { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.handoff { border: 1px solid var(--line-strong); border-radius: 16px; padding: 16px; display: grid; gap: 10px; background: var(--glass-strong); }
.handoff.urgent { border-color: color-mix(in srgb, var(--bordeaux) 60%, var(--line-strong)); }
.handoff header { display: flex; gap: 12px; align-items: flex-start; }
.handoff p { margin: 0; color: var(--muted); font-size: 14px; }
.handoff footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.handoff footer .phone { margin-left: auto; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.transcript { display: grid; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.bubble.agent { background: var(--gold-soft); border: 1px solid var(--gold-line); border-bottom-left-radius: 4px; }
.bubble.caller { background: var(--glass-strong); border: 1px solid var(--line); justify-self: end; border-bottom-right-radius: 4px; }
.bubble .who { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
audio { width: 100%; height: 40px; }

/* Bookings */
.week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 10px; overflow-x: auto; }
.day { border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 180px; display: grid; gap: 8px; align-content: start; background: var(--glass-strong); }
.day.today { border-color: var(--gold-line); }
.day h4 { margin: 0 0 4px; display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.day h4 span { color: var(--faint); }
.appt { border-left: 2px solid var(--line-strong); padding: 6px 8px; border-radius: 8px; background: var(--glass); font-size: 12.5px; }
.appt.agent { border-left-color: var(--gold); background: var(--gold-soft); }
.appt b { display: block; font-variant-numeric: tabular-nums; }
.appt.cancelled { opacity: .55; text-decoration: line-through; }

/* Bars */
.hbar { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 46px; gap: 12px; align-items: center; font-size: 13.5px; padding: 6px 0; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--bordeaux), var(--gold)); }
.hbar .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar .k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--glass-strong); border: 1px solid var(--line-strong); font-size: 12.5px; box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* Approvals */
.appr-list .row { cursor: pointer; border-radius: 12px; padding-inline: 10px; }
.appr-list .row[aria-selected="true"] { background: var(--gold-soft); }
.appr-list .row .idx { font-family: var(--font-mono); font-size: 12px; color: var(--gold-ink); }
.decide { border: 1px solid var(--line-strong); border-radius: 16px; padding: 18px; display: grid; gap: 12px; background: var(--glass-strong); }

/* Agent cards */
.agent-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.agent-card:first-child { border-top: 0; }
.agent-card .t { font-weight: 600; }

/* Empty, loading, errors */
.empty { padding: 28px 12px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 28px; height: 28px; color: var(--gold-ink); }
.empty b { color: var(--fg); }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { padding: 12px 14px; border-radius: 12px; font-size: 13.5px; border: 1px solid var(--line-strong); background: var(--glass-strong); }
.notice.bad { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.notice.good { border-color: transparent; background: var(--good-soft); color: var(--good); }
.notice.gold { border-color: var(--gold-line); background: var(--gold-soft); }
.notice.warn { border-color: transparent; background: var(--warn-soft); color: var(--warn); }

/* Overlays */
.scrim { position: fixed; inset: 0; background: rgba(8, 6, 7, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 40; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--glass-strong); border-left: 1px solid var(--line-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); overflow-y: auto; padding: calc(22px + env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) 22px; display: grid; gap: 18px; align-content: start; animation: slide .25s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 22px; padding: 24px; display: grid; gap: 16px; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: fade .2s ease; }
.overlay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.overlay-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.1; }
.menu { position: fixed; z-index: 42; min-width: 240px; padding: 8px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line-strong); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); box-shadow: 0 20px 60px rgba(0, 0, 0, .4); display: grid; gap: 2px; }
.menu button, .menu a { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--glass-hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .head { padding: 8px 12px 6px; display: grid; gap: 2px; }
.menu .head small { color: var(--faint); }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.code { font-family: var(--font-mono); font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); overflow-wrap: anywhere; user-select: all; }

.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; display: grid; gap: 10px; justify-items: end; }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: var(--shadow); font-size: 13.5px; max-width: 360px; animation: rise .3s ease; }
.toast b { display: block; }
.toast span { color: var(--muted); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* Sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px var(--gutter-r) 32px var(--gutter-l); }
.auth-card { width: min(440px, 100%); display: grid; gap: 18px; padding: 30px; }
.auth-card .title { font-size: 40px; }
.demo-users { display: grid; gap: 8px; }
.demo-user { all: unset; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--glass-strong); }
.demo-user:hover, .demo-user:focus-visible { border-color: var(--gold-line); background: var(--glass-hover); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--gold); }

.stack { display: grid; gap: 12px; align-content: start; }
.hstack { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.health { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--good); }
.health.warn { background: var(--warn); }
.health.bad { background: var(--bad); }
.health.off { background: var(--faint); }

/* Responsive */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .topbar .wrap { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; margin: 0; }
  .tools { margin-left: auto; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .g2, .g3, .g4, .handoffs, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .brand-org { display: none; }
  .brand-word { font-size: 18px; }
  .seg button { padding: 6px 9px; }
  .icon-btn, .avatar { width: 38px; height: 38px; }
  .panel { padding: 16px; border-radius: 18px; }
  .flush .panel-head { padding: 16px 16px 0; }
  th, td { padding: 11px 14px; }
  .feed-row { grid-template-columns: 44px 26px minmax(0, 1fr); padding: 11px 14px; }
  .feed-row .who { display: none; }
  .hbar { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 40px; }
  .search .input { min-width: 0; }
  .kpi { min-height: 0; }
  .title { font-size: 34px; }
  .hide-sm { display: none; }
  .topbar { position: relative; background: none; }
  .nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .hours-row { grid-template-columns: 112px minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
}
@media (max-width: 440px) {
  .brand-word { display: none; }
  .brand { padding-right: 8px; }
  .seg button { padding: 6px 8px; font-size: 12.5px; }
}
/* Glass HQ: the hall (hq-dark.svg / hq-light.svg) shows through every panel,
   out of focus, the way a photo sits behind frosted glass. Same colours as above. */
:root {
  --glass: rgba(26, 20, 21, 0.46);
  --glass-strong: rgba(30, 24, 25, 0.7);
  --glass-hover: rgba(52, 42, 43, 0.6);
  --glass-edge: rgba(255, 246, 230, 0.1);
  --glass-sheen: rgba(255, 246, 230, 0.05);
  --hq: url("hq-dark.svg");
  --hq-veil: rgba(13, 10, 11, 0.38);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --glass: rgba(255, 252, 247, 0.5); --glass-strong: rgba(255, 252, 247, 0.78); --glass-hover: rgba(255, 255, 255, 0.75);
    --glass-edge: rgba(255, 255, 255, 0.85); --glass-sheen: rgba(255, 255, 255, 0.35);
    --hq: url("hq-light.svg"); --hq-veil: rgba(236, 229, 218, 0.3);
  }
}
:root[data-theme="light"] {
  --glass: rgba(255, 252, 247, 0.5); --glass-strong: rgba(255, 252, 247, 0.78); --glass-hover: rgba(255, 255, 255, 0.75);
  --glass-edge: rgba(255, 255, 255, 0.85); --glass-sheen: rgba(255, 255, 255, 0.35);
  --hq: url("hq-light.svg"); --hq-veil: rgba(236, 229, 218, 0.3);
}

.ambient::before {
  inset: -4%;
  background: var(--hq) center 30% / cover no-repeat;
  filter: blur(9px) saturate(1.1);
  transform: scale(1.04);
  animation: hq-drift 40s ease-in-out infinite alternate;
}
.ambient::after { background: radial-gradient(120% 90% at 50% 0%, transparent 40%, var(--hq-veil) 100%), var(--hq-veil); }
:root[data-theme="light"] .ambient::before { opacity: 1; }
@keyframes hq-drift { to { transform: scale(1.08) translate3d(-1.2%, -0.8%, 0); } }

.topbar { background: none; }
/* Frosted band behind the floating menu, so content scrolling underneath blurs away instead of showing between the pills. */
.topbar::before {
  content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--hq-veil), transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.pill, .icon-btn, .avatar {
  background: linear-gradient(180deg, var(--glass-sheen), transparent 70%), var(--glass-strong);
  border-color: var(--glass-edge);
  backdrop-filter: blur(26px) saturate(1.5); -webkit-backdrop-filter: blur(26px) saturate(1.5);
}
.panel {
  background: linear-gradient(180deg, var(--glass-sheen), transparent 38%), var(--glass);
  border-color: var(--glass-edge);
  backdrop-filter: blur(30px) saturate(1.5); -webkit-backdrop-filter: blur(30px) saturate(1.5);
  box-shadow: 0 1px 0 var(--glass-edge) inset, 0 24px 60px rgba(0, 0, 0, 0.32);
}
:root[data-theme="light"] .panel { box-shadow: 0 1px 0 var(--glass-edge) inset, 0 18px 44px rgba(60, 40, 30, 0.12); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .panel { box-shadow: 0 1px 0 var(--glass-edge) inset, 0 18px 44px rgba(60, 40, 30, 0.12); }
}

/* Pages blur in, like glass coming into focus. The animation ends on no filter,
   so the panels' backdrop blur works again once the page has arrived. */
.page { animation: glass-in .42s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes glass-in { from { opacity: 0; filter: blur(10px); transform: translateY(8px); } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(26, 20, 21, 0.88); --glass-strong: rgba(30, 24, 25, 0.94); }
  :root[data-theme="light"] { --glass: rgba(255, 252, 247, 0.92); --glass-strong: rgba(255, 252, 247, 0.96); }
}

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

/* Print: the report as a clean page */
@media print {
  :root, :root[data-theme] { --bg: #fff; --glass: #fff; --glass-strong: #fff; --fg: #1a1416; --muted: #5f5450; --faint: #81766f; --line: #e6dfd5; --line-strong: #d6cdc0; --gold-ink: #7f6128; color-scheme: light; }
  body { background: #fff; color: #1a1416; font-size: 12pt; }
  .ambient, .topbar, [data-banner], .toasts, .btn, .seg, .chart-tip { display: none !important; }
  .panel { box-shadow: none; backdrop-filter: none; border-color: #e6dfd5; break-inside: avoid; }
  .page { padding-top: 0; }
  .title { font-size: 30pt; }
  a { text-decoration: none; }
}
