/* AdmitFlow dashboard design system.
   8px spacing grid (4px half-steps), Inter, jade brand colour, borders over heavy shadows. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #f0f3f2;
  --border: #e2e7e5;
  --border-2: #d0d8d4;
  --text: #121b18;
  --text-2: #36423e;
  --muted: #64716c;
  --faint: #8e9994;

  --primary: #0f6b50;
  --primary-600: #0c5b44;
  --primary-700: #0a4a38;
  --primary-50: #edf6f2;
  --primary-100: #d6ebe2;
  --ring: 0 0 0 3px rgba(15, 107, 80, .2);

  --gold: #8a6526;
  --gold-50: #faf3e6;
  --gold-200: #ecd7ad;

  --ok: #13703f;
  --ok-50: #ebf7f0;
  --ok-200: #bfe3cd;
  --warn: #965a0a;
  --warn-50: #fdf6e7;
  --warn-200: #f1d7a3;
  --bad: #b42318;
  --bad-50: #fdefed;
  --bad-200: #f4c4be;
  --info: #1f5d9e;
  --info-50: #edf4fc;
  --info-200: #c6dbf3;
  --plum: #6b3fa0;
  --plum-50: #f4effa;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(18, 27, 24, .05);
  --shadow-sm: 0 1px 3px rgba(18, 27, 24, .08), 0 1px 2px rgba(18, 27, 24, .04);
  --shadow-md: 0 12px 32px -8px rgba(18, 27, 24, .18), 0 2px 6px rgba(18, 27, 24, .06);

  --sidebar-w: 252px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;

  --sb-bg: #0c1613;
  --sb-bg-2: #111e1a;
  --sb-border: #1b2a25;
  --sb-text: #b9c6c0;
  --sb-muted: #71847c;
  --sb-hover: rgba(255, 255, 255, .055);
  --sb-active: rgba(95, 207, 169, .13);
  --sb-accent: #5fcfa9;

  --wa: #25d366;
  --wa-dark: #075e54;
  --wa-bubble: #d9fdd3;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5;
  font-feature-settings: "cv11", "ss03"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.3; color: var(--text); font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: 20px; letter-spacing: -.018em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li { margin-bottom: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
small, .small { font-size: 12.5px; }
strong, b { font-weight: 600; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); border-radius: 4px; padding: 1px 5px; }
kbd { font-family: var(--font); font-size: 11px; color: var(--faint); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; line-height: 16px; }
::selection { background: var(--primary-100); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- icons */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- app shell */
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow-md); }
.skip-link:focus { left: 8px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-border); transition: width .18s ease;
}
.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .18s ease; }

.sb-head { height: var(--topbar-h); flex: none; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--sb-border); }
.sb-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 15px; letter-spacing: -.01em; min-width: 0; }
.sb-brand:hover { text-decoration: none; }
.sb-logo { width: 28px; height: 28px; flex: none; }
.sb-org { margin: 14px 12px 2px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border-radius: 10px; background: var(--sb-bg-2); border: 1px solid var(--sb-border); min-width: 0; }
.sb-org-mark { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: #19392f; color: #9fe2c8; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.sb-org-text { min-width: 0; display: block; }
.sb-org-text b { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-org-text small { display: block; color: var(--sb-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.sb-org { color: inherit; }
a.sb-org:hover { text-decoration: none; border-color: #2b4038; background: #142420; }
.sb-nav .sb-org { margin: 0 0 6px; }

/* the admin is looking at a client's dashboard */
.acting-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 9px 10px 9px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--sb-bg); color: #c9d6d0; font-size: 13px; line-height: 1.45; }
.acting-bar > .i { color: var(--sb-accent); }
.acting-text { flex: 1 1 320px; min-width: 0; }
.acting-text b { color: #fff; }
.acting-bar .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; }
.acting-bar .btn:hover { background: rgba(255, 255, 255, .15); }
.acting-bar .btn-ghost { background: transparent; border-color: transparent; color: #c9d6d0; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 14px; scrollbar-width: thin; scrollbar-color: #24352f transparent; }
.sb-section { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--sb-muted); padding: 16px 10px 6px; white-space: nowrap; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; height: 34px; padding: 0 10px; margin: 1px 0;
  border: 0; border-radius: 8px; background: none; color: var(--sb-text); font: inherit; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; cursor: pointer; text-align: left;
}
.sb-item .i { color: var(--sb-muted); }
.sb-item:hover { background: var(--sb-hover); color: #fff; text-decoration: none; }
.sb-item:hover .i { color: #d3e1db; }
.sb-item.is-active { background: var(--sb-active); color: #fff; }
.sb-item.is-active .i { color: var(--sb-accent); }
.sb-item.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sb-accent); }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
.sb-item .plan-tag { margin-left: auto; }
.sb-foot { flex: none; padding: 10px; border-top: 1px solid var(--sb-border); }
.sb-foot .i-expand { display: none; }
.sb-scrim { display: none; }

body.nav-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.nav-collapsed .shell { margin-left: var(--sidebar-w-collapsed); }
body.nav-collapsed .sb-label, body.nav-collapsed .sb-org-text, body.nav-collapsed .sb-item .plan-tag { display: none; }
body.nav-collapsed .sb-head { justify-content: center; padding: 0; }
body.nav-collapsed .sb-org { justify-content: center; padding: 6px; margin: 14px 10px 2px; background: none; border-color: transparent; }
body.nav-collapsed .sb-section { font-size: 0; height: 1px; padding: 0; margin: 12px 8px; background: var(--sb-border); }
body.nav-collapsed .sb-item { justify-content: center; padding: 0; }
body.nav-collapsed .sb-nav { overflow: visible; }
body.nav-collapsed .sb-foot .i-collapse { display: none; }
body.nav-collapsed .sb-foot .i-expand { display: block; }
body.nav-collapsed .sb-item:hover::after {
  content: attr(data-label); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  background: #18231f; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; box-shadow: var(--shadow-md); z-index: 100; pointer-events: none;
}

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 24px; background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
}
.top-spacer { flex: 1; }
.top-search { position: relative; flex: 0 1 460px; min-width: 0; }
.top-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; width: 16px; height: 16px; }
.top-search input[type=search] { height: 36px; padding: 0 40px 0 35px; background: var(--surface-2); box-shadow: none; }
.top-search input[type=search]:focus { background: #fff; }
.top-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.top-context { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.top-context b { color: var(--text); font-weight: 600; }

.icon-btn {
  position: relative; width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.only-mobile { display: none; }
.count-badge {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; border: 2px solid #fff;
  background: #d92d20; color: #fff; font-size: 10.5px; font-weight: 600; line-height: 14px; text-align: center; font-variant-numeric: tabular-nums;
}
.user-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border: 0; border-radius: 8px; background: transparent; font: inherit; color: var(--text); cursor: pointer; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-3); }
.user-btn .i { width: 15px; height: 15px; color: var(--faint); }
.user-name { font-size: 13.5px; font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-100); color: var(--primary-700); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 28px 64px; flex: 1; }
.content.narrow { max-width: 560px; }
.content.medium { max-width: 880px; }

/* dropdowns & menus */
.dropdown { position: relative; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); }
.dropdown-panel[hidden] { display: none; }
.menu-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.menu-head b { display: block; font-size: 13.5px; }
.menu-head small { color: var(--muted); }
.menu-list { padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.menu-item .i { color: var(--muted); width: 16px; height: 16px; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger .i { color: var(--bad); }

/* notifications */
.notif-panel { width: 392px; max-width: calc(100vw - 24px); }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.np-head b { font-size: 14px; }
.np-list { max-height: min(460px, 70vh); overflow-y: auto; }
.np-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.np-empty .i { display: block; margin: 0 auto 8px; width: 26px; height: 26px; color: var(--faint); }
.np-item { position: relative; display: flex; gap: 10px; padding: 11px 38px 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text); }
.np-item:last-child { border-bottom: 0; }
.np-item:hover { background: var(--surface-2); text-decoration: none; }
.np-item.unread { background: #f6fbf9; }
.np-item.unread:hover { background: #eef7f3; }
.np-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.np-icon .i { width: 16px; height: 16px; }
.np-icon.k-lead { background: var(--info-50); color: var(--info); }
.np-icon.k-handoff { background: var(--warn-50); color: var(--warn); }
.np-icon.k-demo { background: var(--primary-50); color: var(--primary); }
.np-icon.k-demo-cancel { background: var(--bad-50); color: var(--bad); }
.np-icon.k-fee { background: var(--ok-50); color: var(--ok); }
.np-icon.k-fee-overdue { background: var(--bad-50); color: var(--bad); }
.np-icon.k-billing { background: var(--gold-50); color: var(--gold); }
.np-icon.k-support { background: var(--plum-50); color: var(--plum); }
.np-text { min-width: 0; flex: 1; }
.np-title { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.np-item.unread .np-title { font-weight: 600; }
.np-body { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-time { display: block; font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.np-dot { position: absolute; right: 14px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.np-remove { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; display: none; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; }
.np-remove .i { width: 14px; height: 14px; }
.np-remove:hover { background: var(--surface-3); color: var(--text); }
.np-item:hover .np-remove, .np-item:focus-within .np-remove { display: grid; }
.np-item:hover .np-dot, .np-item:focus-within .np-dot { display: none; }
.np-foot { padding: 9px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 0 0 12px 12px; }

/* top loading bar for slow actions */
.loadbar { position: fixed; left: 0; top: 0; height: 2px; width: 0; z-index: 200; background: var(--primary); box-shadow: 0 0 8px rgba(15, 107, 80, .5); transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .3s; opacity: 0; }
.loadbar.on { width: 85%; opacity: 1; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head p, .ph-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.back-link .i { width: 15px; height: 15px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 24px 0 10px; }

/* ---------------------------------------------------------------- cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head p, .card-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.card-head .actions { margin-left: auto; }
.card-foot { margin: 16px -20px -18px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.card > .card-foot:last-child, .card form > .card-foot:last-child { margin-bottom: -18px; }
.card-flush { padding: 0; }
.card-flush > .card-head { padding: 16px 20px 0; margin-bottom: 12px; }
.card .table-wrap { margin-left: -20px; margin-right: -20px; }
.card .table-wrap:last-child { margin-bottom: -18px; }
.card .table-wrap:last-child tbody tr:last-child td { border-bottom: 0; }
.card .table-wrap th:first-child, .card .table-wrap td:first-child { padding-left: 20px; }
.card .table-wrap th:last-child, .card .table-wrap td:last-child { padding-right: 20px; }
.card .table-wrap:last-child table { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.card .table-wrap:first-child { margin-top: -18px; }
.card .table-wrap:first-child table thead th:first-child { border-top-left-radius: var(--radius); }
.card .table-wrap:first-child table thead th:last-child { border-top-right-radius: var(--radius); }
.card-tight { padding: 14px 16px; }
.card-muted { background: var(--surface-2); box-shadow: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { display: grid; gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2 > .card, .grid-3 > .card, .grid-4 > .card { margin-bottom: 0; }
.grid-2.mb, .grid-3.mb, .grid-4.mb, .grid-5.mb { margin-bottom: 16px; }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.split-even { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.split-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* stats */
.stat { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.stat-icon .i { width: 16px; height: 16px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat.good .stat-value { color: var(--ok); }
.stat.warn .stat-value { color: var(--warn); }
.stat.bad .stat-value { color: var(--bad); }
.stat.good .stat-icon { background: var(--ok-50); color: var(--ok); }
.stat.warn .stat-icon { background: var(--warn-50); color: var(--warn); }
.stat.bad .stat-icon { background: var(--bad-50); color: var(--bad); }
.stat.info .stat-icon { background: var(--info-50); color: var(--info); }
.stat-value-sm { font-size: 15px; line-height: 1.7; letter-spacing: 0; }
.action-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.action-block h3 { margin-bottom: 10px; }
.action-block .help { margin-top: 0; }
.danger-zone { border-color: var(--bad-200); }
.danger-zone h3 { color: var(--bad); }
.test-block { padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
thead th { position: sticky; top: 0; }
tbody tr:hover td { background: #fafcfb; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
th .sub { display: block; font-weight: 400; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-cell { text-align: right; white-space: nowrap; }
td.actions-cell .actions { justify-content: flex-end; flex-wrap: nowrap; }
td a.row-link { color: var(--text); font-weight: 500; }
td a.row-link:hover { color: var(--primary); }
tr.is-muted td { color: var(--faint); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

/* ---------------------------------------------------------------- forms */
form { margin: 0; }
form.inline { display: inline; }
.field { display: block; margin-bottom: 14px; min-width: 0; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field > span .opt { font-weight: 400; color: var(--faint); }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.help, .field > .hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.45; }
.field > .hint { margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-2); border-radius: 8px; background: #fff;
  color: var(--text); font: inherit; font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
textarea { height: auto; min-height: 72px; padding: 8px 11px; line-height: 1.5; resize: vertical; }
select {
  appearance: none; -webkit-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='%2364716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
}
select[multiple] { height: auto; padding: 6px; background-image: none; }
input[type=file] { width: 100%; font: inherit; font-size: 13.5px; padding: 8px; border: 1px dashed var(--border-2); border-radius: 8px; background: var(--surface-2); }
input:hover, select:hover, textarea:hover { border-color: #b9c4bf; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #a3ada9; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 2px; flex: none; }
.check .help { margin-top: 2px; }
.form-row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-row-2 { display: grid; gap: 0 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { display: grid; gap: 0 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 2px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0 6px; color: var(--text-2); }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.input-icon > input { padding-left: 34px; }
.input-group { display: flex; }
.input-group > input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; height: 36px; }

/* toolbar of filters above a table */
.filters, .toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field > span { font-size: 12px; margin-bottom: 4px; }
.filters .grow, .toolbar-row .grow { flex: 1 1 240px; }
.filters select, .toolbar-row select { width: auto; min-width: 140px; max-width: 220px; text-overflow: ellipsis; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* segmented control & tabs */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg .is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.seg .count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.tab .i { width: 16px; height: 16px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; text-align: center; font-variant-numeric: tabular-nums; }
.tab.is-active .count { background: var(--primary-50); color: var(--primary); }
.seg-tabs { overflow-x: auto; scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }

/* a key to badges: what each status means */
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 24px; margin: 0; font-size: 13px; }
.legend > div { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.legend dt { flex: none; width: 128px; }
.legend dd { margin: 0; color: var(--text-2); line-height: 1.45; }
.routine { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; font-size: 13px; }
.routine b { display: block; margin-bottom: 2px; }
.routine span { color: var(--text-2); }
.template-langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 12px; }
.wa-preview { margin: 8px 0; padding: 9px 12px; border-radius: 9px; border-top-left-radius: 2px; background: var(--wa-bubble); box-shadow: 0 1px 1px rgba(0, 0, 0, .08); font-size: 13.5px; line-height: 1.5; color: #111b21; word-break: break-word; }
.template-raw { word-break: break-word; }
@media (max-width: 900px) { .routine { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 13px;
  border: 1px solid var(--border-2); border-radius: 8px; background: #fff; color: var(--text); box-shadow: var(--shadow-xs);
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.btn .i { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(10, 74, 56, .25), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-green { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-green:hover { background: #0f5f35; border-color: #0f5f35; }
.btn-danger { background: #fff; border-color: var(--bad-200); color: var(--bad); }
.btn-danger:hover { background: var(--bad-50); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #9a1d14; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-sm .i { width: 14px; height: 14px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
button.link, .link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 500; color: var(--primary); cursor: pointer; }
button.link:hover, .link-btn:hover { text-decoration: underline; }
.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .18); border-top-color: var(--text-2); animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after, .btn-green.is-loading::after, .btn-danger-solid.is-loading::after { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--primary); animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- badges, chips */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; flex: none; }
.badge.plain::before { display: none; }
.badge-trialing, .badge-new, .badge-pending, .badge-open, .badge-testing, .badge-booked, .badge-scheduled, .badge-info, .badge-queued, .badge-upcoming {
  background: var(--info-50); border-color: var(--info-200); color: var(--info); }
.badge-active, .badge-paid, .badge-admitted, .badge-attended, .badge-won, .badge-sent, .badge-delivered, .badge-read, .badge-done,
.badge-rewarded, .badge-on, .badge-ok, .badge-present, .badge-completed, .badge-connected {
  background: var(--ok-50); border-color: var(--ok-200); color: var(--ok); }
.badge-past_due, .badge-overdue, .badge-engaged, .badge-report_ready, .badge-demo_booked, .badge-visited, .badge-pilot,
.badge-warn, .badge-needs_counsellor, .badge-partial, .badge-due, .badge-rescheduled {
  background: var(--warn-50); border-color: var(--warn-200); color: var(--warn); }
.badge-paused, .badge-lost, .badge-failed, .badge-no_show, .badge-void, .badge-cancelled, .badge-off, .badge-bad, .badge-absent,
.badge-missed, .badge-expired, .badge-opted_out {
  background: var(--bad-50); border-color: var(--bad-200); color: var(--bad); }
.badge-demo_attended, .badge-ai { background: var(--plum-50); border-color: #e1d3f2; color: var(--plum); }
.badge-gold { background: var(--gold-50); border-color: var(--gold-200); color: var(--gold); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.chip .i { width: 13px; height: 13px; color: var(--faint); }
.chip.is-on { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* plan locks */
.plan-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; height: 19px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--gold-50); color: var(--gold); border: 1px solid var(--gold-200); white-space: nowrap; vertical-align: middle; letter-spacing: 0; text-transform: none; }
.plan-tag .i { width: 11px; height: 11px; stroke-width: 2; }
.sidebar .plan-tag { background: rgba(220, 192, 138, .1); border-color: rgba(220, 192, 138, .25); color: #d9bf8b; }
h1 .plan-tag, h2 .plan-tag { font-size: 11.5px; }
.locked-card { display: flex; gap: 16px; align-items: flex-start; border-color: var(--gold-200); background: linear-gradient(180deg, #fffaf0 0%, #fff 70%); }
.locked-card h2 { margin: 0 0 4px; font-size: 15px; }
.locked-card.compact { padding: 14px 16px; box-shadow: none; }
.locked-card.compact h2 { font-size: 14px; }
.locked-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--gold-50); color: var(--gold); border: 1px solid var(--gold-200); }
.locked-body { min-width: 0; }
.locked-points { margin: 8px 0 14px; padding-left: 18px; font-size: 13.5px; }
.locked-points li { margin-bottom: 3px; }
.locked-preview-wrap { position: relative; }
.locked-preview { filter: blur(2.5px) grayscale(.4); opacity: .55; pointer-events: none; user-select: none; }
.sample-label { position: absolute; top: -10px; right: 12px; z-index: 1; background: var(--text); color: #fff; font-size: 11.5px; font-weight: 500; padding: 2px 10px; border-radius: 999px; }
fieldset.locked, fieldset.feature { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.locked { opacity: .55; }
th.current, td.current { background: var(--primary-50) !important; }

/* ---------------------------------------------------------------- banners & flash */
.banner, .flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid; border-radius: var(--radius); font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.banner > .i, .flash > .i { flex: none; }
.banner-text, .flash-text { flex: 1; min-width: 0; }
.banner .btn { flex: none; }
.banner-info { background: var(--info-50); border-color: var(--info-200); color: #173f6b; }
.banner-info > .i { color: var(--info); }
.banner-warn { background: var(--warn-50); border-color: var(--warn-200); color: #6a3f06; }
.banner-warn > .i { color: var(--warn); }
.banner-danger { background: var(--bad-50); border-color: var(--bad-200); color: #7a1a12; }
.banner-danger > .i { color: var(--bad); }
.banner-ok { background: var(--ok-50); border-color: var(--ok-200); color: #0f4f2d; }
.banner-ok > .i { color: var(--ok); }
.banner-neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.flash-ok { background: var(--ok-50); border-color: var(--ok-200); color: #0f4f2d; }
.flash-ok > .i { color: var(--ok); }
.flash-error { background: var(--bad-50); border-color: var(--bad-200); color: #7a1a12; }
.flash-error > .i { color: var(--bad); }
.flash-close { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: .6; cursor: pointer; }
.flash-close:hover { opacity: 1; background: rgba(0, 0, 0, .05); }
.flash-close .i { width: 14px; height: 14px; }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.note > .i { color: var(--muted); margin-top: 1px; }
.note p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- empty states, lists, key-values */
.empty-state { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty-state .es-icon { width: 40px; height: 40px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--faint); }
.empty-state .es-icon .i { width: 20px; height: 20px; }
.es-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text); }
.es-text { margin: 0 auto; max-width: 440px; font-size: 13px; }
.es-actions { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empty-state.compact { padding: 18px 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); margin: 0; min-width: 0; }
.list-row:first-child { padding-top: 2px; }
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { display: block; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.list-title:hover { color: var(--primary); text-decoration: none; }
.list-sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-side { flex: none; text-align: right; font-size: 12.5px; color: var(--muted); }
.date-tile { width: 42px; flex: none; text-align: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.date-tile b { display: block; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.date-tile small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; background: var(--primary-50); color: var(--primary); font-weight: 600; line-height: 1.6; }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv dd .sub { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; }
.kv.kv-counts { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
.kv.kv-counts dt, .kv.kv-counts dd { padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv.kv-counts dd { text-align: right; }
.kv.kv-counts dt:last-of-type, .kv.kv-counts dd:last-of-type { border-bottom: 0; }

/* funnel */
.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.funnel .step { position: relative; padding: 14px 16px; background: #fff; border-right: 1px solid var(--border); }
.funnel .step:last-child { border-right: 0; }
.funnel .step .step-label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.funnel .step b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.funnel .step .step-rate { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--primary); font-weight: 500; }
.funnel .step .step-rate.none { color: var(--faint); }
.funnel .step::after { content: ""; position: absolute; right: -7px; top: 50%; width: 12px; height: 12px; background: #fff; border-top: 1px solid var(--border); border-right: 1px solid var(--border); transform: translateY(-50%) rotate(45deg); z-index: 1; }
.funnel .step:last-child::after { display: none; }
.funnel .step.final { background: var(--primary-50); }
.funnel .step.final b { color: var(--primary-700); }

.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.bar-row .bar { grid-column: 1 / -1; }
.pager { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pager-pages { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager-pages .btn { min-width: 32px; justify-content: center; }
.pager-pages .is-current { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); font-weight: 600; cursor: default; }
.pager-gap { padding: 0 2px; }
.sid { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: 11.5px; letter-spacing: .02em; color: var(--text-2, inherit); background: var(--surface-3, #eef1ef); border-radius: 4px; padding: 0 5px; }
.pager-per a, .pager-per b { margin-left: 6px; }
.pager-per b { color: var(--text); }

/* ---------------------------------------------------------------- dialogs */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px -16px rgba(6, 20, 15, .4); color: var(--text); overflow: hidden; }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
dialog.modal::backdrop { background: rgba(9, 20, 16, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.modal-body { padding: 18px 20px 6px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }

/* collapsible panels */
details.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow-xs); }
details.panel > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.panel[open] > summary::after { transform: rotate(-135deg); }
details.panel > summary .summary-sub { font-weight: 400; color: var(--muted); font-size: 13px; }
details.panel > .panel-body { padding: 0 20px 18px; }

/* ---------------------------------------------------------------- conversation thread & simulator */
.thread { background: #efeae2; border-radius: var(--radius); padding: 14px; max-height: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 78%; padding: 7px 10px; border-radius: 9px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); font-size: 13.5px; line-height: 1.45; word-wrap: break-word; color: #111b21; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.bubble.out { align-self: flex-end; background: var(--wa-bubble); border-top-right-radius: 2px; }
.bubble .meta { display: block; font-size: 11px; color: #667781; margin-top: 3px; text-align: right; }
.bubble .meta.error { color: var(--bad); text-align: left; }
.bubble .opts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; border-top: 1px solid rgba(0, 0, 0, .08); padding-top: 6px; }
.bubble .opts button, .bubble .opts span { background: #fff; border: 1px solid #d1d7db; color: #027eb5; border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; cursor: pointer; text-align: center; }
.bubble .opts button:hover { background: #f0f9ff; }
.bubble .opts button:disabled { color: #94a3b8; cursor: default; }
.bubble .opts .row-desc { display: block; font-size: 11.5px; color: var(--muted); }
.bubble.system { align-self: center; max-width: 90%; background: #fff8c5; font-size: 12.5px; color: #54460b; }
.bubble.error { align-self: center; background: var(--bad-50); color: var(--bad); font-size: 12.5px; }
.bubble.note { align-self: center; background: rgba(255, 255, 255, .85); color: var(--muted); font-size: 12.5px; }
.bubble .meta .trace-link { color: var(--info); }
.phone { max-width: 430px; margin: 0 auto; border-radius: 22px; overflow: hidden; border: 1px solid var(--border-2); box-shadow: 0 16px 40px -12px rgba(18, 27, 24, .25); background: #efeae2; }
.phone-head { background: var(--wa-dark); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.phone-head .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--wa); color: #fff; display: grid; place-items: center; font-weight: 600; }
.phone-head small { display: block; opacity: .8; }
.phone .thread { border-radius: 0; height: 520px; max-height: 60vh; }
.composer { display: flex; gap: 8px; padding: 10px; background: #f0f2f5; }
.composer input { border-radius: 999px; border: 0; padding: 0 16px; height: 40px; box-shadow: none; }
.composer button { border-radius: 999px; background: var(--wa-dark); color: #fff; border: 0; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; }
.composer button:disabled { opacity: .6; cursor: default; }
.typing { align-self: flex-start; font-size: 12px; color: #667781; padding: 2px 6px; }
.ai-strip { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--muted); border-bottom: 1px solid var(--border-2); }
.ai-strip .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex: none; }
.ai-strip.on { background: var(--primary-50); color: var(--primary-700); }
.ai-strip.on .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(15, 107, 80, .18); }
.bubble .ai-tag { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; padding: 1px 7px; border-radius: 999px; background: var(--primary-50); color: var(--primary-700); font-size: 11px; font-weight: 600; }
.bubble .ai-tag .i { width: 11px; height: 11px; }

/* ---------------------------------------------------------------- bot setup interview */
.q-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 2px; margin: 0 0 14px; background: #fff; }
.q-block legend { font-weight: 600; padding: 0 6px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(244, 246, 245, .94); padding: 12px 0; border-top: 1px solid var(--border); z-index: 5; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* rupee amount input: the ₹ sits in the box, people type only the number */
.input-affix, .field > .input-affix { display: flex; align-items: stretch; min-width: 0; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.input-affix .affix { display: inline-flex; align-items: center; padding: 0 11px; border: 1px solid var(--border-2); border-right: 0; border-radius: 8px 0 0 8px; background: var(--surface-3); color: var(--text-2); font-size: 14px; font-weight: 500; }
.input-affix input { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; min-width: 0; font-variant-numeric: tabular-nums; }

/* courses in the set-up questions: one collapsible block per course */
.course-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
details.course-block { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
details.course-block[open] { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
details.course-block > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; border-radius: var(--radius); }
details.course-block > summary::-webkit-details-marker { display: none; }
details.course-block > summary:hover { background: var(--surface-2); }
details.course-block > summary::after { content: ""; margin-left: auto; flex: none; width: 8px; height: 8px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.course-block[open] > summary::after { transform: rotate(-135deg); }
details.course-block[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.cb-mark { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--primary-50); color: var(--primary); }
.cb-mark.is-new { background: var(--surface-3); color: var(--muted); }
.cb-mark .i { width: 17px; height: 17px; }
.cb-text { min-width: 0; display: block; }
.cb-text b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-text small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-body { padding: 16px 16px 4px; }
.cb-grid { display: grid; gap: 0 14px; grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr); }
details.more { margin: 2px 0 14px; }
details.more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; color: var(--primary); margin-bottom: 12px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary .opt { color: var(--faint); font-weight: 400; }

/* days-and-timings picker */
.sched-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.sched-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.sched-row.is-invalid { border-color: var(--warn-200); background: var(--warn-50); }
.sched-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 32px; padding: 0 8px; border: 1px solid var(--border-2); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; user-select: none; transition: background .12s, border-color .12s, color .12s; }
.day-chip span:hover { border-color: var(--primary); color: var(--primary); }
.day-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-chip input:focus-visible + span { box-shadow: var(--ring); }
.sched-times { display: flex; align-items: center; gap: 6px; }
.sched-times select { width: auto; min-width: 112px; height: 32px; }
.sched-to { font-size: 13px; color: var(--muted); }
.sched-remove { width: 30px; height: 30px; color: var(--faint); }
.sched-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.sched-presets .link-btn { font-size: 12.5px; }
.sched-foot { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 8px; }
.sched-preview { font-size: 13px; color: var(--muted); }
.sched-preview b { color: var(--text); font-weight: 600; }
.sched-preview.is-warn { color: var(--warn); font-weight: 500; }
.sched-legacy { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-50); border: 1px solid var(--warn-200); font-size: 13px; }
.sched-legacy p { margin: 0 0 8px; }
.sched-legacy .check { margin-bottom: 0; }
@media (max-width: 640px) {
  .cb-grid { grid-template-columns: minmax(0, 1fr); }
  .cb-body { padding: 14px 12px 2px; }
  details.course-block > summary { padding: 10px 12px; gap: 10px; }
  .sched-row { padding: 8px; }
  .day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); width: 100%; gap: 3px; }
  .day-chip span { min-width: 0; width: 100%; padding: 0; font-size: 12px; }
  .sched-times { width: 100%; }
  .sched-times select { flex: 1; min-width: 0; }
}
details.course-block, .cb-body, .sched, .sched-rows, .sched-row, .sched-main { min-width: 0; }

/* ---------------------------------------------------------------- slot picker (review calls) */
.slot-picker { display: grid; gap: 12px; max-height: 340px; overflow-y: auto; padding: 2px 4px 2px 0; margin-bottom: 14px; }
.slot-day { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; }
.slot-day-label { font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.slot-day-label b { display: block; color: var(--text); font-weight: 600; font-size: 13.5px; }
.slot-times { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { position: relative; }
.slot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slot span { display: inline-block; min-width: 76px; text-align: center; padding: 5px 10px; border: 1px solid var(--border-2); border-radius: 7px; background: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color .12s, background .12s; }
.slot span:hover { border-color: var(--primary); color: var(--primary); }
.slot input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot input:focus-visible + span { box-shadow: var(--ring); }
label.chip { cursor: pointer; user-select: none; }
label.chip:hover { border-color: var(--border-2); }
.copied { background: var(--ok-50) !important; border-color: var(--ok-200) !important; color: var(--ok) !important; }
@media (max-width: 640px) { .slot-day { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* ---------------------------------------------------------------- simple bar charts (no JS) */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 6px; border-bottom: 1px solid var(--border); }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 2px; }
.chart-col span { display: block; width: 100%; min-height: 2px; background: var(--primary); border-radius: 3px 3px 0 0; opacity: .9; }
.chart-col:hover span { opacity: 1; background: var(--primary-700); }
.chart-hours { height: 110px; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.chart-labels { display: flex; gap: 3px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.chart-labels span { flex: 1; min-width: 0; text-align: center; overflow: hidden; }

/* ---------------------------------------------------------------- plan cards (billing) */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan-card { position: relative; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
.plan-card.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card .plan-name { font-size: 15px; font-weight: 600; }
.plan-card .plan-price { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.plan-card .plan-price small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan-card ul { list-style: none; padding: 0; margin: 12px 0 16px; font-size: 13px; flex: 1; }
.plan-card li { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.plan-card li .i { width: 15px; height: 15px; color: var(--primary); margin-top: 2px; }
.plan-card li.off { color: var(--faint); }
.plan-card li.off .i { color: var(--faint); }
.plan-flag { position: absolute; top: 14px; right: 14px; }

/* ---------------------------------------------------------------- payment / public pages */
body.public { background: var(--bg); }
.public-wrap { max-width: 560px; margin: 0 auto; padding: 48px 16px 64px; }
.public-wrap.wide, .public-wrap.medium { max-width: 760px; }
.public-wrap.full { max-width: none; padding-top: 16px; }
.public-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.public-head .logo { font-weight: 600; font-size: 17px; color: var(--text); letter-spacing: -.01em; }
.public-head .sb-logo { width: 32px; height: 32px; }
.auth-card { padding: 28px 28px 24px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .lead-text { color: var(--muted); margin-bottom: 20px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.pay-card { text-align: center; }
.pay-card .amount { font-size: 34px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0; font-variant-numeric: tabular-nums; }
.pay-card img.qr { width: 220px; height: 220px; margin: 10px auto; display: block; }
.otp-input { letter-spacing: .5em; font-size: 20px !important; text-align: center; font-variant-numeric: tabular-nums; height: 46px !important; }

/* ---------------------------------------------------------------- printable report / invoice */
.doc { background: #fff; max-width: 820px; margin: 24px auto; padding: 36px 40px; border: 1px solid var(--border); border-radius: 12px; }
.doc h1 { font-size: 22px; }
.doc .big { font-size: 30px; font-weight: 600; color: var(--bad); margin: 4px 0 8px; }
.doc .big.good { color: var(--ok); }
.doc table td, .doc table th { padding: 7px 8px; }
.doc .callout { background: var(--primary-50); border-radius: 10px; padding: 14px 18px; margin: 16px 0; }
.doc .cta { background: var(--sb-bg); color: #fff; border-radius: 12px; padding: 18px 22px; margin-top: 20px; }
.doc .cta h2 { color: #fff; }
.doc .cta a { color: var(--sb-accent); }
.toolbar { max-width: 820px; margin: 16px auto 0; display: flex; gap: 8px; justify-content: flex-end; }

/* invoices you send to institutes */
.invoice { font-size: 13.5px; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 2px solid var(--text); }
.inv-seller { color: var(--text-2); line-height: 1.6; }
.inv-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--text); margin-bottom: 4px; }
.inv-brand .sb-logo { width: 30px; height: 30px; }
.inv-address { white-space: pre-line; }
.inv-title { text-align: right; flex: none; }
.inv-title h1 { margin: 0; font-size: 20px; text-transform: uppercase; letter-spacing: .08em; }
.inv-number { font-size: 15px; margin-top: 4px; color: var(--text); }
.inv-parties { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin-bottom: 20px; line-height: 1.6; }
.inv-label { margin: 0 0 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.inv-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.inv-facts dt { color: var(--muted); }
.inv-facts dd { margin: 0; text-align: right; font-weight: 500; }
.inv-items th { background: var(--surface-3); }
.inv-items .inv-n { width: 36px; color: var(--muted); }
.inv-items tfoot td { border-bottom: 0; padding-top: 5px; padding-bottom: 5px; text-align: right; color: var(--text-2); }
.inv-items tfoot td.num { color: var(--text); }
.inv-items tfoot tr:first-child td { padding-top: 12px; }
.inv-items .inv-total td { padding-top: 10px; border-top: 2px solid var(--text); font-size: 16px; font-weight: 600; color: var(--text); }
.inv-words { margin: 12px 0 18px; }
.inv-paid { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: var(--ok-50); border: 1px solid var(--ok-200); color: #0f4f2d; }
.inv-paid .i { color: var(--ok); }
.inv-bank { max-width: 440px; margin: 16px 0; padding: 14px 16px; border: 1px dashed var(--border-2); border-radius: 10px; }
.inv-bank .inv-facts dd { text-align: left; }
.inv-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.inv-foot p { margin: 0 0 4px; }
.invoice .pay-card { margin: 16px 0; padding: 18px; border: 1px solid var(--border); border-radius: 12px; }
@media (max-width: 640px) {
  .inv-head, .inv-parties { display: block; }
  .inv-title { text-align: left; margin-top: 14px; }
  .inv-parties > div { margin-bottom: 14px; }
  .inv-facts dd { text-align: left; }
  .doc { padding: 22px 18px; }
}
@media print {
  .inv-items th { background: #f0f2f1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.highlight td { background: var(--bad-50) !important; font-weight: 600; }
.print-only { display: none; }

/* ---------------------------------------------------------------- monitoring: live charts, logs, AI traces */
.btn[hidden], .table-wrap[hidden] { display: none; }
.small { font-size: 12.5px; }
.monitor-bar { margin-bottom: 6px; }
.monitor-updated { font-size: 12.5px; color: var(--muted); }
.monitor-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.chart-hint { margin: 0 0 14px; font-size: 12.5px; color: var(--faint); }
.chart-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.chart-grid > .card { margin-bottom: 0; }
.chart-card { padding: 14px 16px 10px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h3 { margin: 0; font-size: 14px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.legend-item:hover { border-color: var(--border-2); }
.legend-item b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.legend-item.solo { cursor: default; }
.legend-item.is-off { opacity: .45; text-decoration: line-through; }
.sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.lchart { position: relative; width: 100%; touch-action: pan-y; outline: none; user-select: none; -webkit-user-select: none; }
.lchart:focus-visible { box-shadow: var(--ring); border-radius: 6px; }
.lchart-svg { display: block; }
.lchart-grid line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.lchart-axis { font-size: 11px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.lchart-cross { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.lchart-sel { fill: rgba(15, 107, 80, .12); stroke: var(--primary); stroke-width: 1; }
.lchart-overlay { fill: transparent; cursor: crosshair; }
.lchart-empty { height: 100%; display: grid; place-items: center; font-size: 13px; color: var(--faint); }
.lchart-tip { position: absolute; z-index: 5; min-width: 170px; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: rgba(18, 27, 24, .94); color: #fff; font-size: 12px; pointer-events: none; box-shadow: var(--shadow-md); }
.lt-time { font-weight: 600; margin-bottom: 4px; color: var(--primary-100); }
.lt-row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.lt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-row b { font-variant-numeric: tabular-nums; }
.stat.kpi .stat-value { font-size: 22px; }

/* rows that need attention are tinted, not just their text */
tr.row-bad td { background: var(--bad-50); }
tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.row-warn td { background: var(--warn-50); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 #d08a10; }
tr.row-dim td { color: var(--faint); }

.log-table td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.log-time { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.log-time .sub { font-family: var(--font); }
.log-level .lv { display: inline-block; min-width: 64px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: .03em; background: var(--surface-3); color: var(--muted); text-align: center; }
.log-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text); }
.log-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.log-exc { margin: 6px 0 0; }
.log-exc > summary { margin-bottom: 6px; }
tr.lv-warning td { background: var(--warn-50); }
tr.lv-warning td:first-child { box-shadow: inset 3px 0 0 #d08a10; }
tr.lv-warning .lv { background: var(--warn-200); color: #6e4206; }
tr.lv-error td { background: var(--bad-50); }
tr.lv-error td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.lv-error .lv { background: var(--bad-200); color: #8a1a12; }
tr.lv-critical td { background: #fbdcd8; }
tr.lv-critical td:first-child { box-shadow: inset 4px 0 0 #7a1610; }
tr.lv-critical .lv { background: #7a1610; color: #fff; }
tr.is-new td { animation: log-new 2.5s ease-out; }
@keyframes log-new { from { background-color: var(--info-200); } }
.log-key { display: inline-flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.lk { padding: 2px 8px; border-radius: 4px; border-left: 3px solid; }
.lk-warning { background: var(--warn-50); border-color: #d08a10; color: #6e4206; }
.lk-error { background: var(--bad-50); border-color: var(--bad); color: #8a1a12; }
.lk-critical { background: #fbdcd8; border-color: #7a1610; color: #7a1610; }
.code-block { margin: 0; padding: 10px 12px; max-height: 420px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.trace-q { min-width: 260px; }
.trace-chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.tc-msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }
.tc-msg p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.tc-who { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tc-in { align-self: flex-start; background: #fff; }
.tc-out { align-self: flex-end; background: var(--primary-50); border-color: var(--primary-100); }
.tc-none { align-self: flex-end; background: var(--surface-2); border-style: dashed; color: var(--muted); }
.wf { display: flex; flex-direction: column; gap: 2px; }
.wf-row { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr) 70px; gap: 12px; align-items: center; padding: 5px 6px; border-radius: 6px; color: var(--text); font-size: 13px; }
.wf-row:hover { background: var(--surface-2); text-decoration: none; }
.wf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-track { position: relative; height: 14px; background: var(--surface-3); border-radius: 4px; }
.wf-bar { position: absolute; top: 0; bottom: 0; min-width: 3px; border-radius: 4px; background: var(--primary); }
.wf-bar.st-hit { background: var(--info); }
.wf-bar.st-flagged, .wf-bar.st-withheld, .wf-bar.st-degraded { background: #d08a10; }
.wf-bar.st-blocked, .wf-bar.st-error, .wf-bar.st-unreadable { background: var(--bad); }
.wf-ms { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.step-num { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-size: 12px; color: var(--muted); }
.step-h { margin: 14px 0 6px; font-size: 13px; color: var(--text-2); }
.step-h:first-child { margin-top: 0; }
.prompt-msgs { display: flex; flex-direction: column; gap: 6px; }
.pm { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.pm pre { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 13px; }
.pm-role { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pm-assistant { background: var(--primary-50); border-color: var(--primary-100); }
.rank-table td { padding-top: 6px; padding-bottom: 6px; }
.fail-list { margin: 0; padding-left: 16px; color: var(--bad); }
.fail-list li { margin-bottom: 2px; }
.eval-checks { min-width: 190px; }
.index-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.index-status > span { display: inline-flex; align-items: center; gap: 6px; }
.index-status .i { width: 14px; height: 14px; flex: none; }
@media (max-width: 1020px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .wf-row { grid-template-columns: minmax(0, 1fr) 60px; }
  .wf-track { grid-column: 1 / -1; grid-row: 2; }
  .lchart-tip { max-width: 220px; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1020px) {
  .grid-3, .split, .split-even { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel .step:nth-child(2) { border-right: 0; }
  .funnel .step:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .funnel .step::after { display: none; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: var(--sidebar-w) !important; box-shadow: none; }
  .shell { margin-left: 0 !important; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-md); }
  body.nav-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(9, 20, 16, .4); }
  body.nav-collapsed .sb-label, body.nav-collapsed .sb-org-text, body.nav-collapsed .sb-item .plan-tag { display: initial; }
  body.nav-collapsed .sb-item { justify-content: flex-start; padding: 0 10px; }
  body.nav-collapsed .sb-section { font-size: 11px; height: auto; padding: 16px 10px 6px; margin: 0; background: none; }
  body.nav-collapsed .sb-item:hover::after { display: none; }
  .sb-foot { display: none; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .top-search kbd, .user-name, .top-context { display: none; }
  .content { padding: 18px 14px 56px; }
  .form-row-2, .form-row-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .funnel { grid-template-columns: minmax(0, 1fr); }
  .funnel .step { border-right: 0; border-bottom: 1px solid var(--border); }
  .page-head { align-items: flex-start; }
  .notif-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
  .filters .grow, .toolbar-row .grow { flex-basis: 100%; }
  .filters select, .toolbar-row select { flex: 1 1 calc(50% - 4px); max-width: none; min-width: 0; }
  .card .table-wrap > table { min-width: 560px; }
  .kv.kv-counts { grid-template-columns: minmax(0, 1fr) auto; gap: 0; }
  .kv.kv-counts dd { margin-bottom: 0; }
}

@media print {
  @page { margin: 14mm; }
  body, body.public { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .toolbar, .no-print, .flash, .sb-scrim, .ph-actions, .filters, .toolbar-row, .loadbar, .banner .btn, .acting-bar { display: none !important; }
  .shell { margin: 0 !important; }
  .content { padding: 0; max-width: none; }
  .doc { border: 0; margin: 0; padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .card .table-wrap { margin-left: 0; margin-right: 0; }
  thead th { position: static; }
  a { color: inherit; }
  .print-only { display: block; }
}
/* Teachers & demo times: how parents book demos; role checkboxes on team logins */
.mode-choices { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.mode-choice input { margin-top: 3px; flex: none; }
.mode-choice small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mode-choice:has(input:checked) { border-color: var(--primary-100); background: var(--primary-50); }
.role-checks { border: 0; padding: 0; margin: 4px 0 0; }
.role-checks legend { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
@media (max-width: 640px) { .mode-choices { grid-template-columns: minmax(0, 1fr); } }
/* Class timetable: the week grid (screen, print and the parents' page), batches and rooms */
.tt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tt-toolbar form.row { flex-wrap: wrap; }
.tt-toolbar select { width: auto; min-width: 170px; max-width: 100%; }
.week-nav { gap: 6px; }
.week-label { font-weight: 600; font-size: 14px; min-width: 150px; text-align: center; font-variant-numeric: tabular-nums; }
.tt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* The week as a calendar: an hour per row; a class is placed at its start and is as tall as it lasts */
.cal { --hour-h: 64px; display: grid; grid-template-columns: 58px repeat(var(--days), minmax(112px, 1fr)); min-width: 720px; border: 1px solid var(--border); border-radius: 10px; overflow: clip; background: var(--surface, #fff); }
.cal-corner, .cal-dayhead { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 8px 10px; font-size: 12.5px; font-weight: 600; }
.cal-dayhead { border-left: 1px solid var(--border); }
.cal-corner { position: sticky; left: 0; z-index: 3; }  /* with the hours, stays put when the days scroll sideways */
/* The time now: dotted across the week, solid with a dot on today (moved every minute by app.js) */
.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dotted var(--bad); opacity: .45; z-index: 4; pointer-events: none; }
.cal-day.is-today .cal-now { border-top-style: solid; opacity: 1; }
/* Overlapping classes: a red band across the time they share */
.cal-clash { position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none; border-top: 1px solid var(--bad); border-bottom: 1px solid var(--bad); background: repeating-linear-gradient(135deg, rgba(180, 35, 24, .16) 0, rgba(180, 35, 24, .16) 6px, rgba(180, 35, 24, .05) 6px, rgba(180, 35, 24, .05) 12px); }
.cal .cal-ev.is-clash { border-color: var(--bad); border-left-color: var(--bad); }
/* The planner: drag subjects and classes onto the week */
.plan-palette .palette-courses { display: grid; gap: 10px; }
.palette-course { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.palette-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 220px; }
.palette-switch { margin: 12px 0 0; }
.palette-switch a { font-weight: 500; }
.palette-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-chip { cursor: grab; touch-action: none; user-select: none; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--primary-100); border-left: 3px solid var(--primary); background: var(--primary-50); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; }
.plan-chip:hover { border-color: var(--primary); }
.plan-chip:active, body.is-planning, body.is-planning * { cursor: grabbing !important; }
body.is-planning { user-select: none; }
.cal.is-planner .cal-ev[data-id] { cursor: grab; touch-action: none; user-select: none; }
.cal.is-planner .cal-ev[data-over], .cal.is-planner .cal-ev.is-cancelled { cursor: pointer; }
.cal.is-planner .cal-ev.is-dragging { opacity: .35; }
.cal.is-planner .cal-day.is-past { background-color: rgba(0, 0, 0, .025); }
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.cal-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 18px; margin-left: -9px; border-top: 2px solid var(--border-2, #c9cfcc); border-radius: 2px; opacity: 0; }
.cal-ev:hover .cal-resize::after { opacity: 1; }
.cal-ghost { position: absolute; left: 3px; right: 3px; z-index: 5; box-sizing: border-box; padding: 3px 7px; border: 2px dashed var(--primary); border-radius: 8px; background: rgba(16, 122, 87, .12); color: var(--primary-700); font-size: 12px; font-weight: 600; overflow: hidden; pointer-events: none; }
.cal-ghost.is-clash { border-color: var(--bad); background: rgba(180, 35, 24, .1); color: var(--bad); }
.plan-modal { width: min(640px, calc(100vw - 32px)); }
.plan-choice { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.plan-choice legend { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.plan-clash { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--bad-200); border-radius: 8px; background: var(--bad-50); color: var(--bad); font-size: 13px; }
.plan-clash ul { margin: 6px 0 8px 18px; padding: 0; }
.plan-clash .check span { color: var(--text); }
.plan-tell { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.plan-affected { margin: 6px 0 0 30px; padding: 0; font-size: 12.5px; color: var(--text-2); }
.plan-affected.is-off { opacity: .45; text-decoration: line-through; }
.plan-undo form { margin-left: auto; }
.plan-legend .lg { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin-right: 5px; border-radius: 2px; }
.plan-legend .lg-clash { background: repeating-linear-gradient(135deg, rgba(180, 35, 24, .35) 0, rgba(180, 35, 24, .35) 3px, rgba(180, 35, 24, .1) 3px, rgba(180, 35, 24, .1) 6px); }
.plan-legend .lg-now { height: 0; border-top: 2px solid var(--bad); vertical-align: 3px; border-radius: 0; }
.cal-day.is-today .cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.cal-dayhead .sub { display: block; font-weight: 400; color: var(--muted); }
.cal-dayhead.is-today { background: var(--primary-50); color: var(--primary-700); }
.cal-times { position: sticky; left: 0; z-index: 3; height: calc(var(--hours) * var(--hour-h)); background: var(--surface-2); }
.cal-times span { display: block; height: var(--hour-h); padding: 3px 8px 0 0; text-align: right; font-size: 11.5px; color: var(--text-2); white-space: nowrap; border-top: 1px solid var(--border); }
.cal-times span:first-child { border-top: 0; }
.cal-day { position: relative; height: calc(var(--hours) * var(--hour-h)); border-left: 1px solid var(--border);
  background-image: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px, transparent var(--hour-h)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-h) / 2), var(--surface-3, #eef1ef) calc(var(--hour-h) / 2), var(--surface-3, #eef1ef) calc(var(--hour-h) / 2 + 1px), transparent calc(var(--hour-h) / 2 + 1px), transparent var(--hour-h)); }
.cal-day.is-today { background-color: rgba(16, 122, 87, .04); }
.cal .cal-ev { position: absolute; box-sizing: border-box; margin: 0; padding: 3px 7px; overflow: hidden; z-index: 1; border-width: 1px 1px 1px 3px; border-left-color: var(--primary); font-size: 12px; line-height: 1.25; box-shadow: 0 0 0 1px var(--surface, #fff); }
.cal .cal-ev + .cal-ev { margin-top: 0; }
.cal .cal-ev b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .cal-ev span, .cal-ev em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .cal-ev .cal-when { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal .cal-ev.is-short { padding-top: 2px; padding-bottom: 2px; white-space: nowrap; text-overflow: ellipsis; }
.cal .cal-ev.is-short b, .cal-ev.is-short .cal-when { display: inline; margin-right: 6px; }
.cal .cal-ev.is-narrow { padding-left: 5px; padding-right: 4px; }
.cal a.cal-ev:hover, .cal a.cal-ev:focus-visible { z-index: 2; border-color: var(--primary); }
.cal .cal-ev.is-extra { border-left-color: var(--plum, #7a4b8c); }
.cal .cal-ev.is-test { border-left-color: var(--gold, #b8860b); }
.cal .cal-ev.is-bad { border-left-color: var(--bad); }
.cal .cal-ev.is-cancelled { border-left-color: var(--border-2); }
.tt { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.tt th, .tt td { border: 1px solid var(--border); padding: 6px; vertical-align: top; text-align: left; }
.tt thead th { background: var(--surface-2); font-size: 12.5px; font-weight: 600; }
.tt thead th.is-today { background: var(--primary-50); color: var(--primary-700); }
.tt .tt-time { width: 96px; font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; background: var(--surface-2); }
.tt-class { display: block; padding: 6px 8px; border-radius: 8px; background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--text); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.tt-class + .tt-class { margin-top: 6px; }
a.tt-class:hover { text-decoration: none; border-color: var(--primary); }
.tt-class b { display: block; font-size: 13px; font-weight: 600; }
.tt-class span, .tt-class em { display: block; color: var(--text-2); font-style: normal; }
.tt-class.is-extra { background: var(--plum-50); border-color: var(--border-2); }
.tt-class.is-test { background: var(--gold-50); border-color: var(--gold-200); }
.tt-class.is-cancelled { background: var(--surface-2); border-style: dashed; color: var(--muted); }
.tt-class.is-cancelled b { text-decoration: line-through; }
.tt-class.is-bad { background: var(--bad-50); border-color: var(--bad-200); }
.pick-list { display: grid; gap: 4px 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: 260px; overflow-y: auto; padding: 4px 0; }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }
.modal-extra { border-top: 1px solid var(--border); padding-bottom: 14px; }
.form-row.align-end { align-items: end; }
.form-row.align-end > .btn { margin-bottom: 14px; }
.mt-0 { margin-top: 0 !important; }
.public-wrap.timetable { max-width: 1080px; padding-top: 28px; }
.public-wrap.timetable .public-head { flex-direction: column; gap: 2px; }
.public-wrap.timetable .public-head p { margin: 0; }
@media print {
  .tt { min-width: 0; }
  .tt-wrap { overflow: visible; }
  .tt-class { background: #fff !important; border-color: #9aa3a0 !important; break-inside: avoid; }
  .cal { --hour-h: 46px; min-width: 0; break-inside: avoid; }
  .cal-times { position: static; }
  .cal-now { display: none; }
  .cal-day { background-image: repeating-linear-gradient(to bottom, #c9cfcc 0, #c9cfcc 1px, transparent 1px, transparent var(--hour-h)) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tt thead th, .tt .tt-time { background: #f0f2f1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Class log: tap the absent students; syllabus progress bars */
.absent-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.absent-pick { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.absent-pick input { width: 18px; height: 18px; flex: none; }
.absent-pick .ap-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.absent-pick .ap-tag { display: none; font-size: 12px; font-weight: 600; color: var(--bad); }
.absent-pick:has(input:checked) { border-color: var(--bad-200); background: var(--bad-50); }
.absent-pick:has(input:checked) .ap-tag { display: inline; }
.absent-pick:has(input:disabled) { cursor: default; opacity: .75; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
/* Weekly report preview and report card */
.wa-preview { background: #e7f6e9; border: 1px solid #cfe9d3; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
ol.facts { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.55; }
ol.facts li + li { margin-top: 6px; }
ul.plain-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
/* Teacher pages: class cards, today's summary, the week board (day columns; a day-by-day list on phones) */
.today-summary { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 12px 16px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.cc-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cc { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 13px; }
.cc::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--primary); }
.cc.is-test::before { background: var(--gold); }
.cc.is-demo::before { background: var(--plum); }
.cc.is-off { opacity: .6; }
.cc.is-off::before { background: var(--border-2); }
.cc.is-now { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); }
.cc-time { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.cc-live { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; }
.cc-title { font-weight: 600; font-size: 14px; }
.cc-sub { color: var(--muted); }
.cc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.cc-foot .btn { margin-left: auto; }
.cc-status { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; min-width: 0; }
.cc-status .i { width: 14px; height: 14px; }
.cc-status .i.ok { color: var(--ok); }
.week-board { display: grid; gap: 10px; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); align-items: start; overflow-x: auto; padding-bottom: 4px; }
.wb-day { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px; border-radius: 12px; background: var(--surface-2); scroll-margin-top: 80px; }
.wb-day.is-today { background: var(--primary-50); }
.wb-day.is-past .cc { opacity: .75; }
.wb-head { margin: 0 2px 2px; font-size: 13px; font-weight: 600; }
.wb-head span { color: var(--muted); font-weight: 400; }
.wb-head em { font-style: normal; color: var(--primary-700); font-size: 12px; margin-left: 4px; }
.wb-empty { margin: 4px 2px; color: var(--faint); font-size: 12.5px; }
.day-strip { display: none; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.day-chip { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.2; }
.day-chip:hover { text-decoration: none; border-color: var(--primary); }
.day-chip b { font-size: 15px; }
.day-chip i { font-style: normal; color: var(--primary-700); font-size: 11px; }
.day-chip.is-today { border-color: var(--primary); background: var(--primary-50); }
.list-title.wrap { white-space: normal; overflow: visible; }
@media (max-width: 760px) {
  .day-strip { display: flex; }
  .week-board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .wb-day .cc { padding: 12px 12px 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- ticking several rows */
.check-col { width: 34px; padding-right: 0 !important; }
.check-col input { width: 16px; height: 16px; accent-color: var(--primary); }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; margin-bottom: 10px; border: 1px dashed var(--border); border-radius: var(--radius, 10px); background: var(--surface-2, #f7f9f8); }
.bulk-bar.is-active { border-style: solid; border-color: var(--primary-100); background: var(--primary-50); }
.bulk-bar .bulk-count { font-size: 13px; color: var(--muted); margin-right: 6px; }
.mb-sm { margin-bottom: 8px; }
.scroll-list { max-height: 420px; overflow-y: auto; }
.list-row[hidden], [data-filter-group][hidden], details[data-filter-text][hidden] { display: none; }

/* Feature flights: one compact row each, open for the controls; Plans & features grid */
.flight-row > summary { align-items: flex-start; }
.flight-sum { display: grid; gap: 4px; flex: 1; min-width: 0; }
.flight-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flight-bar { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.flight-bar .progress { width: 160px; flex: none; margin: 0; }
.progress.ok > span { background: var(--ok); }
.flight-desc { margin: 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flight-row[open] .flight-desc { white-space: normal; }
.plan-grid th, .plan-grid td { vertical-align: middle; }
.plan-grid th.center .sub { display: block; font-weight: 400; }
.plan-grid td:first-child .sub { display: block; max-width: 520px; }
.plan-grid input[type=checkbox] { width: 18px; height: 18px; }

/* Question bank and test papers */
.paper-no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3, #eef1ef); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.q-text { white-space: pre-wrap; }
.q-choices { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px 18px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); font-size: 13px; }
.q-choices li.is-answer { font-weight: 600; color: var(--ok); }
.paper-sheet { max-width: 820px; margin: 0 auto; }
.paper-sheet header { text-align: center; border-bottom: 2px solid var(--text, #111); padding-bottom: 10px; margin-bottom: 16px; }
.paper-sheet header h1 { margin: 0 0 4px; font-size: 20px; }
.paper-sheet .paper-meta { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; }
.paper-sheet ol.paper-qs { padding-left: 22px; }
.paper-sheet ol.paper-qs > li { margin-bottom: 14px; break-inside: avoid; }
.paper-sheet .q-marks { float: right; font-size: 12px; color: var(--muted); }
.paper-sheet .q-answer { margin-top: 4px; font-size: 13px; color: var(--ok); }

/* Money: receipts, discounts, expenses, income vs expenses */
.receipt-sheet { max-width: 820px; margin: 0 auto 16px; padding: 28px 32px; position: relative; }
.receipt-sheet.is-void { border-color: var(--bad-200); }
.receipt-void { margin: -8px 0 16px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bad-50); color: var(--bad); font-weight: 600; font-size: 13px; }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 2px solid var(--text); }
.receipt-head h1 { margin: 0 0 2px; font-size: 20px; }
.receipt-head p { margin: 2px 0; }
.receipt-no { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; font-size: 13px; }
.receipt-no b { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
.receipt-to { margin-bottom: 14px; }
.receipt-lines tfoot td { font-weight: 500; border-top: 1px solid var(--border); }
.receipt-lines tfoot td:first-child { text-align: right; }
.receipt-lines .receipt-total td { font-weight: 700; font-size: 14px; border-top: 2px solid var(--text); }
.receipt-foot { margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--border-2); }
.receipt-sheet.is-void .receipt-lines { opacity: .55; text-decoration: line-through; }
.fee-discounts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.fee-discounts h3 { margin: 0; font-size: 14px; }
.fee-discounts .list { margin-top: 8px; }
.inline-form { display: inline; margin-left: 6px; }
.expense-totals { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-stat { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.chip-stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip-stat.is-total { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.money-trend { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; padding-top: 6px; }
.mt-col { display: flex; flex-direction: column; align-items: stretch; height: 100%; min-width: 0; color: var(--muted); text-decoration: none; border-radius: 6px; }
.mt-col:hover { background: var(--surface-2); }
.mt-col:focus-visible { outline: none; box-shadow: var(--ring); }
.mt-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 2px; }
.mt-in, .mt-out { display: block; width: 42%; max-width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; }
.mt-in { background: var(--primary); }
.mt-out { background: var(--gold-200); border: 1px solid var(--gold); border-bottom: 0; }
.mt-label { padding: 4px 0 0; font-size: 11.5px; text-align: center; }
.plan-legend .lg-in { background: var(--primary); }
.plan-legend .lg-out { background: var(--gold-200); border: 1px solid var(--gold); }
.ledger-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; margin-top: 10px; }
.ledger-grid > div { grid-column: 1 / -1; }
@media print {
  .receipt-sheet { border: 0; padding: 0; max-width: none; }
  .receipt-void { border: 1px solid var(--bad); }
}
.receipt-sheet .table-wrap { margin-left: 0; margin-right: 0; }
.card .table-wrap > table.receipt-lines { min-width: 0; }
@media (max-width: 640px) {
  .receipt-sheet { padding: 20px 16px; }
  .receipt-no { align-items: flex-start; text-align: left; }
}

/* The printed timetable: a classic grid for paper */
.paper-sheet { max-width: 1100px; margin: 0 auto 16px; padding: 28px 32px; page: timetable; }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--text); }
.paper-head > div:first-child { text-align: left; }
.paper-head h1 { margin: 0 0 4px; font-size: 22px; }
.paper-head p { margin: 1px 0; font-size: 13px; color: var(--text-2); }
.paper-head .paper-branch { font-size: 15px; font-weight: 600; color: var(--text); }
.paper-title { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.paper-title b { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; }
.paper-title span { font-size: 13px; color: var(--text-2); }
.paper-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 12px 0 14px; }
.paper-meta div { display: flex; gap: 6px; align-items: baseline; }
.paper-meta dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.paper-meta dd { margin: 0; font-weight: 600; }
.paper-grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.paper-grid th, .paper-grid td { border: 1px solid #3b4440; padding: 7px 8px; vertical-align: middle; text-align: center; }
.paper-grid thead th { background: #e9eeec; font-weight: 700; }
.paper-grid thead th span { display: block; font-weight: 500; font-size: 12px; }
.paper-grid th.paper-day { width: 110px; text-align: left; background: #e9eeec; font-weight: 700; }
.paper-grid tbody th.paper-day span { display: block; font-weight: 400; font-size: 12px; color: var(--text-2); }
.paper-grid td b { display: block; font-size: 14px; }
.paper-grid td span { display: block; font-size: 12px; color: var(--text-2); }
.paper-grid td .paper-time { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.paper-grid td em { display: block; font-size: 11px; font-style: normal; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text); }
.paper-grid td.is-cancelled b, .paper-grid td.is-cancelled span { text-decoration: line-through; color: var(--muted); }
.paper-grid td.paper-closed { color: var(--text-2); font-style: italic; letter-spacing: .02em; }
.paper-grid td.paper-free { background: repeating-linear-gradient(135deg, transparent 0 6px, #f1f3f2 6px 7px); }
.paper-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--text-2); }
.paper-foot p { margin: 0; }
.paper-sign { min-width: 180px; margin-top: 32px; padding-top: 4px; text-align: center; border-top: 1px solid var(--text); }
.tabs-inline { display: flex; gap: 6px; flex-wrap: wrap; }
@page timetable { size: A4 landscape; margin: 10mm; }
@media print {
  .cal-now { display: none !important; }
  .paper-sheet { border: 0; padding: 0; max-width: none; margin: 0; }
  .paper-grid thead th, .paper-grid th.paper-day, .paper-grid td.paper-free { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper-grid { font-size: 12px; }
  .paper-grid th, .paper-grid td { padding: 6px; }
  .paper-grid tr { break-inside: avoid; }
}
@media (max-width: 640px) {
  .paper-sheet { padding: 16px 12px; overflow-x: auto; }
  .paper-grid { min-width: 640px; }
  .paper-title { align-items: flex-start; text-align: left; }
}
