/* /portal — an organization's own portal (templates/org/).
   Built on the Portal Design System: a fixed ink left rail beside a light
   page of rounded cards. Tokens come from brand.css; this file adds the
   scale, the dark theme and every component. */

:root {
  /* spacing scale — every gap/pad is one of these */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* size + shape */
  --ctrl: 2.5rem;
  --radius-card: 18px;
  --radius-control: 10px;
  --radius-avatar: 13px;
  --pill: 999px;
  --rail-w: 248px;
  /* the portal's own ground and hairlines (design D) over brand.css's */
  --paper: #eef3f1;
  --line: #e3efe9;
  /* surfaces this portal adds on top of brand.css */
  --surface-2: #f6faf8;
  --faint: #8794a2;
  --rail: var(--ink);
  /* the rail: ink deepening downward, a mint glow under the logo and a
     faint signal-blue one at the foot — Symmy's three colours, quietly */
  --rail-bg:
    radial-gradient(120% 45% at 0% 0%, rgba(59, 216, 149, 0.16), transparent 70%),
    radial-gradient(110% 40% at 100% 100%, rgba(52, 82, 248, 0.22), transparent 70%),
    linear-gradient(180deg, #03342e 0%, #022b26 45%, #011f1b 100%);
  /* the page: symmy.com's airy hero wash, mint to blue */
  --paper-bg: linear-gradient(150deg, #eaf6f1 0%, #f3f7f9 45%, #eef1fd 100%);
  --dot: #d9e0ea;
  --shadow-sm: 0 1px 2px rgba(2, 43, 38, 0.05);
  --shadow-card: 0 16px 40px -28px rgba(2, 43, 38, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #061e1a;
    --surface: #0b2a25;
    --surface-2: #0e2f29;
    --line: #173f38;
    --line-strong: #215349;
    --text: #e7f0ed;
    --slate: #95aaa2;
    --faint: #6f867d;
    --signal: #6d82ff;
    --signal-deep: #8798ff;
    --signal-wash: rgba(109, 130, 255, 0.15);
    --mint-deep: #3bd895;
    --mint-wash: rgba(59, 216, 149, 0.14);
    --danger: #ff7360;
    --danger-wash: rgba(255, 115, 96, 0.14);
    --amber: #e3a83f;
    --amber-wash: rgba(227, 168, 63, 0.14);
    --rail: #04231e;
    --rail-bg:
      radial-gradient(120% 45% at 0% 0%, rgba(59, 216, 149, 0.12), transparent 70%),
      radial-gradient(110% 40% at 100% 100%, rgba(52, 82, 248, 0.18), transparent 70%),
      linear-gradient(180deg, #05302a 0%, #04231e 50%, #021713 100%);
    --paper-bg: linear-gradient(150deg, #072520 0%, #061e1a 50%, #08192a 100%);
    --dot: #123029;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 16px 40px -24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--paper);
  background-image: none;  /* brand.css's dot grid: the wash below instead */
}
/* The page's wash, pinned to the viewport on a layer of its own —
   background-attachment: fixed is ignored by iOS and seams on long pages. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--paper-bg);
}

a { color: var(--signal); text-underline-offset: 3px; }
a:hover { color: var(--signal-deep); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--signal) 45%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

code, pre, .mono, .tool, .prefix { font-family: var(--mono); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ shell ============ */
.shell {
  display: flex; min-height: 100vh; align-items: stretch;
  /* the rail's colour all the way down, however long the page */
  background: linear-gradient(to right, var(--rail) var(--rail-w), transparent var(--rail-w));
}

.rail {
  width: var(--rail-w);
  flex: none;
  background: var(--rail-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s4);
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail-brand { display: block; padding: var(--s1) var(--s3) var(--s5); flex: none; }
.rail-brand svg { height: 1.2rem; width: auto; color: #fff; display: block; }
.rail-org {
  padding: 0 var(--s3) var(--s2);
  font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}
.rail-nav { display: flex; flex-direction: column; gap: var(--s1); }
.rail-nav a {
  display: flex; align-items: center; gap: var(--s3);
  padding: 11px 13px; border-radius: var(--radius-control);
  color: rgba(255, 255, 255, 0.72); font-weight: 600; text-decoration: none;
  transition: color 0.12s, background 0.12s;
}
.rail-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.rail-nav a[aria-current="page"] { color: #fff; background: rgba(59, 216, 149, 0.16); }
.rail-nav .ico { width: 19px; height: 19px; }
.rail-foot { margin-top: auto; padding-top: var(--s4); }
.rail-avatar {
  flex: none; display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: #3bd895; color: #022b26; font-weight: 700; font-size: 0.8rem;
}

/* ============ the user menu (rail foot) ============ */
.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3);
  border-radius: 14px; background: rgba(255, 255, 255, 0.06); cursor: pointer;
  list-style: none; color: #fff; transition: background 0.12s;
}
.user-trigger::-webkit-details-marker { display: none; }
.user-trigger:hover, .user-menu[open] .user-trigger { background: rgba(255, 255, 255, 0.12); }
.user-trigger-name { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user-trigger-name b { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-trigger-name span { font-size: 0.74rem; color: rgba(255, 255, 255, 0.6); }
.user-trigger-chevron { width: 16px; height: 16px; color: rgba(255, 255, 255, 0.6); transition: transform 0.15s; }
.user-menu[open] .user-trigger-chevron { transform: rotate(180deg); }
.user-pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 50;
  padding: var(--s2); background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.45);
}
.user-pop-head { display: flex; flex-direction: column; padding: var(--s2) var(--s3) var(--s3); border-bottom: 1px solid var(--line); margin-bottom: var(--s1); line-height: 1.3; }
.user-pop-head b { font-size: 0.9rem; overflow-wrap: anywhere; }
.user-pop-head span { font-size: 0.8rem; color: var(--faint); overflow-wrap: anywhere; }
.user-pop a, .user-pop-logout {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  padding: var(--s2) var(--s3); border-radius: var(--radius-control);
  color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 500;
  text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left;
}
.user-pop a:hover, .user-pop-logout:hover { background: var(--surface-2); }
.user-pop a[aria-current="page"] { background: var(--signal-wash); color: var(--signal-deep); }
.user-pop .ico { width: 16px; height: 16px; color: var(--slate); }
.user-pop-sep { height: 1px; margin: var(--s1) 0; background: var(--line); }
.user-pop form { margin: 0; }
.user-pop-logout { color: var(--danger); }
.user-pop-logout .ico { color: var(--danger); }

.narrow-sm { max-width: 32rem; }
.readonly-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }

/* ============ page ============ */
.page {
  flex: 1 1 auto; min-width: 0;
  padding: var(--s6) var(--s6) var(--s7);
  max-width: 82rem;
}
.page-head { margin-bottom: var(--s6); max-width: 48rem; }
.title {
  margin: 0; font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.45rem, 2.6vw, 1.75rem); line-height: 1.15; letter-spacing: -0.01em;
  color: var(--text);
}
.lede { margin: var(--s3) 0 0; color: var(--slate); font-size: 1rem; max-width: 42rem; }

/* page header with its one primary action on the right (design D) */
.head-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s5);
}
.head-row .page-head { margin-bottom: 0; }
.head-row > .btn { flex: none; }

/* ============ stat cards ============ */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: var(--s4); margin-bottom: var(--s5);
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: var(--s4) var(--s5); box-shadow: var(--shadow-card);
}
.stat.accent { background: var(--mint-wash); border-color: color-mix(in srgb, var(--mint) 45%, transparent); box-shadow: none; }
.stat .k { color: var(--slate); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.stat.accent .k { color: var(--mint-deep); }
.stat .v { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.stat.accent .v { color: var(--mint-deep); }

/* a form card below the table (the header button jumps to it) */

/* ============ panel / card ============ */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: var(--s5); align-items: start; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); min-width: 0;
}
.panel-pad { padding: var(--s5); }
.panel + .panel { margin-top: var(--s5); }
.split > .panel { margin-top: 0; }
aside.panel { position: sticky; top: var(--s5); }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: 3.6rem; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line);
}
.section-title { margin: 0; font-family: var(--font-head); font-size: 0.95rem; font-weight: 700; letter-spacing: 0; color: var(--text); }
.count {
  font-weight: 600; font-size: 0.85rem; color: var(--faint);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 2px 10px; border-radius: var(--pill);
}
.hint { margin: 0 0 var(--s5); color: var(--slate); font-size: 0.9rem; }

/* ============ table ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead th {
  position: sticky; top: 0; background: var(--surface);
  text-align: left; font-weight: 600; color: var(--slate);
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td {
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
  vertical-align: middle; font-variant-numeric: tabular-nums;
}
thead th, tbody td { padding-left: var(--s4); padding-right: var(--s4); }
thead th:first-child, tbody td:first-child { padding-left: var(--s5); }
thead th:last-child, tbody td:last-child { padding-right: var(--s5); }
td > .person-email { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.1s; }
@media (hover: hover) { tbody tr:hover td { background: var(--surface-2); } }
td.num, th.num { text-align: right; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
.nowrap { white-space: nowrap; }
.cell-token { min-width: 12rem; }
.empty-row td { padding: var(--s8) var(--s5); text-align: center; color: var(--slate); }
.sub { display: block; color: var(--faint); font-size: 0.82rem; }
.muted { color: var(--slate); }
.tool { font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.prefix { color: var(--faint); font-size: 0.82rem; }

/* ============ person / avatar ============ */
.person { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.avatar {
  flex: none; display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: var(--radius-avatar);
  background: var(--mint-wash); color: var(--mint-deep);
  font-weight: 700; font-size: 0.82rem;
}
.avatar.off { background: color-mix(in srgb, var(--slate) 16%, transparent); color: var(--slate); }
.person-name { font-weight: 600; color: var(--text); line-height: 1.3; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.person-email { color: var(--faint); font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; }

/* ============ tags / state ============ */
.tag { font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: var(--pill); white-space: nowrap; }
.tag.admin { background: var(--mint-wash); color: var(--mint-deep); }
.tag.staff { background: var(--signal-wash); color: var(--signal-deep); }
.tag:not(.admin):not(.staff) { background: var(--signal-wash); color: var(--signal-deep); }

.state { display: inline-flex; align-items: center; gap: var(--s2); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.on { color: var(--mint-deep); }
.state.off { color: var(--faint); }
.state.bad { color: var(--danger); }
.state.warn { color: var(--amber); }

/* ============ buttons ============ */
.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  height: var(--ctrl); padding: 0 var(--s4);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border-radius: var(--radius-control); border: 1px solid transparent; white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn-sm { height: 2rem; padding: 0 var(--s3); font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--signal); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--signal-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--signal); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--signal-wash); border-color: var(--signal); }
.btn-quiet { background: var(--surface-2); color: var(--slate); border-color: var(--line); }
@media (hover: hover) {
  .btn-quiet:hover { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
}
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-wash); }
button[data-copy][data-copied] { color: var(--mint-deep); border-color: var(--mint); }

/* ============ forms ============ */
form.inline { display: inline; margin: 0; }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field + .field, form .field + .btn, .field + .btn { margin-top: var(--s4); }
.field-label { font-weight: 600; font-size: 0.86rem; }
.field-note { color: var(--slate); font-size: 0.82rem; }
.field input, .field select, input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="datetime-local"], select {
  height: var(--ctrl); width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-control); padding: 0 var(--s3);
  transition: border-color 0.12s, box-shadow 0.12s;
}
select, .field select {
  cursor: pointer; appearance: none; padding-right: 2.4rem;
  /* Lucide chevron-down, in the faint grey, instead of the OS's arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238794a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px;
}
input::placeholder { color: var(--faint); }
/* A value shown but not editable here (a peer admin's own address). */
.field input[readonly] { background: var(--paper); color: var(--slate); cursor: default; }
.field input:focus, .field select:focus, input:focus, select:focus {
  outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-wash);
}
form .btn-block { margin-top: var(--s5); }

/* ============ filters / pager ============ */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--s3); align-items: end; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
}
.filters .field-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate); }
.filters-actions { display: flex; gap: var(--s2); align-items: center; }
.pager { display: flex; justify-content: space-between; padding: var(--s4) var(--s5); border-top: 1px solid var(--line); }

/* ============ alert ============ */
.alert {
  display: flex; align-items: flex-start; gap: var(--s2);
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  background: var(--danger-wash); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius-control); font-size: 0.9rem; font-weight: 500;
}
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* ============ icons (Lucide, templates/ui/_icons.html) ============ */
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn .ico { width: 18px; height: 18px; }
.btn-primary .ico { transition: transform 0.15s; }
.btn-primary:hover .ico { transform: translateX(3px); }
/* a submit on its way (static/ui.js): the arrow becomes a spinner */
.btn[aria-busy="true"] { pointer-events: none; opacity: 0.85; }
.btn[aria-busy="true"] .ico { display: none; }
.btn[aria-busy="true"]::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ signed-out pages: login, forgot, reset ============ */
/* Symmy's customer-portal login: a light picture of what the product does,
   and the form on an ink panel — the rail's colour — with the app's own
   fields and buttons. */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 460px; }

.auth-visual {
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s7); padding: var(--s8) var(--s7);
}
.auth-flow { width: 100%; max-width: 44rem; height: auto; overflow: visible; }
.auth-node {
  fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5;
  filter: drop-shadow(0 6px 12px rgba(2, 43, 38, 0.05));
}
.auth-lane { stroke: var(--line-strong); stroke-width: 1.5; }
.auth-node-erp { fill: var(--mint-wash); stroke: color-mix(in srgb, var(--mint) 45%, transparent); }
.auth-node-ai { fill: var(--signal-wash); stroke: color-mix(in srgb, var(--signal) 28%, transparent); }
.auth-ico { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.auth-ico-erp { stroke: var(--mint-deep); }
.auth-ico-ai { stroke: var(--signal); }
.auth-node-label { font-family: var(--font); font-size: 14px; font-weight: 600; fill: var(--text); }
.auth-node-sub { font-family: var(--font); font-size: 11px; fill: var(--faint); }
.auth-lane-label { font-family: var(--font); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; }
.auth-packet { animation: auth-right 4.5s linear infinite; }
.auth-packet-back { animation-name: auth-left; }
@keyframes auth-right {
  0% { transform: translateX(0); opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { transform: translateX(150px); opacity: 0; }
}
@keyframes auth-left {
  0% { transform: translateX(0); opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { transform: translateX(-150px); opacity: 0; }
}
.auth-visual-title {
  margin: 0; max-width: 28rem; text-align: center;
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.25; color: var(--text); text-wrap: balance;
}

.auth-panel {
  position: relative; overflow: hidden;
  background: #3452f8; color: #fff;
  display: flex; flex-direction: column; padding: var(--s5) var(--s6);
}
/* one soft radial, so the flat blue does not read as an error page */
.auth-panel::before {
  content: ""; position: absolute; inset: -30% -10% auto -10%; height: 70%;
  background: radial-gradient(60% 60% at 50% 0%, rgba(59, 216, 149, 0.18), transparent 70%);
  pointer-events: none;
}
.auth-panel > * { position: relative; }
/* the wordmark on the form's left edge */
.auth-brand { align-self: center; width: 100%; max-width: 22rem; }
/* the green wordmark on the blue, as on Symmy's other customer logins */
.auth-brand svg { height: 1.25rem; width: auto; color: #3bd895; display: block; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--s6) 0 var(--s8); }
.auth-card { width: 100%; max-width: 22rem; }
.auth-title {
  margin: 0 0 var(--s5); font-family: var(--font-head); font-size: 1.4rem; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.25; color: #fff; text-wrap: balance;
}
.auth-text { margin: calc(-1 * var(--s3)) 0 var(--s5); color: rgba(255, 255, 255, 0.75); }
.auth-text strong { color: #fff; overflow-wrap: anywhere; }
.auth-form { display: flex; flex-direction: column; gap: var(--s3); }
.auth-form .field + .field { margin-top: 0; }
.auth-form .btn-block { margin-top: var(--s2); }
/* On the blue: white fields without a border, a size up from the app's
   (48px, 16px type — the one form on the page), and a mint focus ring,
   since a blue one would vanish into the panel. */
.auth-panel input { height: 3rem; font-size: 1rem; border-color: transparent; background: #fff; color: #102522; }
.auth-panel .input-icon > input { padding-left: 2.75rem; }
.auth-panel .input-icon > .ico { left: 0.95rem; }
.auth-panel input:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(59, 216, 149, 0.4); }
.auth-panel .input-icon:focus-within > .ico { color: #1fa56b; }
.auth-panel .caps-hint { color: #ffe08a; }
/* The primary action on the blue is the brand green, as on Symmy's other
   customer logins: a blue button would sink into the panel. */
.auth-panel .btn-primary { height: 3.25rem; font-size: 1rem; background: #3bd895; color: #022b26; box-shadow: none; }
.auth-panel .btn-primary:hover { background: #2ec07f; color: #022b26; }
.auth-links { margin: var(--s5) 0 0; text-align: center; font-size: 0.9rem; }
.auth-links a { color: rgba(255, 255, 255, 0.85); }
.auth-links a:hover { color: #fff; }
.auth-status {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  margin-bottom: var(--s4); background: rgba(255, 255, 255, 0.16); color: #3bd895;
}
.auth-status .ico { width: 26px; height: 26px; }
.auth-status-warn { background: rgba(255, 255, 255, 0.16); color: #ffe08a; }

/* an input with a leading icon */
.input-icon { position: relative; display: block; }
.input-icon > .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--faint); pointer-events: none; transition: color 0.12s;
}
.input-icon > input { padding-left: 42px; }
.input-icon:focus-within > .ico { color: var(--signal); }
.input-password > input { padding-right: 44px; }
.reveal {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent;
  color: var(--faint); display: grid; place-items: center; cursor: pointer;
}
.reveal:hover { color: var(--text); background: var(--surface-2); }
.reveal .ico-hide { display: none; }
.reveal[aria-pressed="true"] .ico-show { display: none; }
.reveal[aria-pressed="true"] .ico-hide { display: block; }
.caps-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--amber); }
.caps-hint .ico { width: 14px; height: 14px; }

.notice {
  display: flex; align-items: flex-start; gap: var(--s2);
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  background: var(--mint-wash); color: var(--mint-deep);
  border: 1px solid color-mix(in srgb, var(--mint) 40%, transparent);
  border-radius: var(--radius-control); font-size: 0.9rem; font-weight: 500;
}
.notice .ico { margin-top: 1px; }

/* ============ dialogs (templates/ui/_macros.html) ============ */
.modal {
  width: min(32rem, calc(100vw - 2 * var(--s4)));
  max-height: calc(100vh - 2 * var(--s5));
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(2, 43, 38, 0.45);
}
.modal-wide { width: min(44rem, calc(100vw - 2 * var(--s4))); }
.modal::backdrop { background: rgba(2, 43, 38, 0.45); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in 0.18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
}
.modal-title { margin: 0; font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; letter-spacing: 0; }
.modal-body { padding: var(--s5); }
.modal-body .hint { margin-bottom: var(--s4); }
.modal-text { margin: 0 0 var(--s5); color: var(--slate); }
.modal-text strong { color: var(--text); }
.modal-form { display: flex; flex-direction: column; gap: var(--s4); }
.modal-form .field + .field { margin-top: 0; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: var(--s2);
  margin-top: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line);
  /* a long dialog keeps its buttons in view */
  position: sticky; bottom: calc(-1 * var(--s5)); z-index: 1;
  margin-bottom: calc(-1 * var(--s5)); padding-bottom: var(--s5); background: var(--surface);
}
form > .modal-actions:first-child { margin-top: 0; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }
.form-section { margin: var(--s2) 0 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--slate); }
.form-section:first-of-type { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .field + .field { margin-top: 0; }
.span-2 { grid-column: span 2; }
.input-with-action { display: flex; gap: var(--s2); }
.input-with-action > input { flex: 1; min-width: 0; }

/* ============ the token's one showing ============ */
.narrow { max-width: 46rem; }
.back-link {
  display: inline-flex; align-items: center; gap: var(--s2); margin-bottom: var(--s4);
  font-size: 0.9rem; font-weight: 600; color: var(--slate); text-decoration: none;
}
.back-link:hover { color: var(--text); }
.back-link .ico { width: 16px; height: 16px; }
.issued { padding: var(--s6); display: flex; flex-direction: column; gap: var(--s4); }
.issued-head { display: flex; align-items: center; gap: var(--s4); }
.issued-head .lede { margin-top: var(--s1); }
.issued-badge {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--mint-wash); color: var(--mint-deep);
}
.issued-badge .ico { width: 28px; height: 28px; }
.secret-field {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-control);
}
.secret-field code { flex: 1; min-width: 0; font-size: 0.92rem; overflow-wrap: anywhere; color: var(--text); }
.secret-field-cmd code { font-size: 0.8rem; color: var(--slate); }
.field-label .ico { width: 15px; height: 15px; vertical-align: -2px; }
.notice-warn { background: var(--amber-wash); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.issued .form-section { margin-top: var(--s2); }
.issued-actions { display: flex; justify-content: flex-end; padding-top: var(--s4); border-top: 1px solid var(--line); }

/* ============ chips: a state with its pictogram ============ */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 10px 3px 7px; border-radius: var(--pill);
  font-size: 0.82rem; font-weight: 600;
}
.chip .ico { width: 15px; height: 15px; }
.chip-ok { background: var(--mint-wash); color: var(--mint-deep); }
.chip-warn { background: var(--amber-wash); color: var(--amber); }
.chip-bad { background: var(--danger-wash); color: var(--danger); }
.chip-off { background: var(--surface-2); color: var(--slate); }
/* a role: the same quiet chip for every role — no role is the highlighted one */
.chip-role { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.chip-role .ico { color: var(--slate); }
.person-name .chip { font-size: 0.75rem; padding: 2px 8px 2px 6px; }
.person-name .chip .ico { width: 13px; height: 13px; }

/* a filter in a card's head (the token holder) */
.head-filter { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.head-filter select { height: 2.25rem; width: 16rem; max-width: 100%; padding-left: 2.4rem; text-overflow: ellipsis; }
.head-filter .input-icon > .ico { left: 0.8rem; width: 16px; height: 16px; }

/* ============ icon buttons in rows ============ */
.icon-btn {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border: 1px solid transparent; border-radius: var(--radius-control);
  color: var(--slate); background: transparent; cursor: pointer; text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
@media (hover: hover) {
  .icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
  .icon-btn-danger:hover { background: var(--danger-wash); color: var(--danger); border-color: transparent; }
}
.row-actions { display: inline-flex; align-items: center; gap: var(--s1); }
.icon-btn-on { color: var(--mint-deep); }
.pager .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.row-actions form.inline { margin-right: var(--s1); }

/* ============ read-only cards (organization) ============ */
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; margin-bottom: var(--s5); }
.cards-2 > .panel + .panel { margin-top: 0; }
.panel-body { padding: var(--s4) var(--s5) var(--s5); }
.panel-note { margin: 0; padding: var(--s3) var(--s5) 0; color: var(--slate); font-size: 0.88rem; }
.deflist { display: grid; gap: var(--s3); margin: 0; }
.deflist > div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--s3); align-items: baseline; }
.deflist dt { color: var(--slate); font-size: 0.88rem; }
.deflist dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.copy-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.copy-row code { font-size: 0.85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

/* ============ audit ============ */
.audit-filters { padding: var(--s4) var(--s5) var(--s5); margin-bottom: var(--s5); }
.period-bar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control);
}
.segmented a {
  padding: 6px 14px; border-radius: 7px; font-size: 0.88rem; font-weight: 600;
  color: var(--slate); text-decoration: none; white-space: nowrap;
}
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.filter-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); align-items: end;
}
.filter-grid .field + .field { margin-top: 0; }
.filter-grid .filters-actions { grid-column: span 2; }

.stats-5 { grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr)); }
.stat .d { margin-top: var(--s2); color: var(--faint); font-size: 0.82rem; }
.stat .d a { color: var(--danger); font-weight: 600; text-decoration: none; }
.stat .d a:hover { text-decoration: underline; }

.audit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); margin-bottom: var(--s5); align-items: start; }
.audit-grid > .panel + .panel { margin-top: 0; }
.chart-panel { grid-column: 1 / -1; }
.legend { display: inline-flex; align-items: center; gap: var(--s2); font-size: 0.8rem; color: var(--slate); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: var(--s2); }
.lg-ok { background: var(--mint); }
.lg-err { background: var(--danger); }
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 9rem;
  padding: var(--s4) var(--s5) 0;
}
.chart-col { flex: 1 1 0; min-width: 2px; height: 100%; display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%; min-height: 2px; background: var(--mint); border-radius: 4px 4px 1px 1px;
  display: flex; flex-direction: column; justify-content: flex-start; overflow: hidden;
  transition: filter 0.1s;
}
.chart-col:hover .chart-bar { filter: brightness(0.9); }
.chart-err { width: 100%; background: var(--danger); }
.chart-axis {
  display: flex; justify-content: space-between; padding: var(--s2) var(--s5) var(--s4);
  font-size: 0.75rem; color: var(--faint);
}
.rank { list-style: none; margin: 0; padding: var(--s2) var(--s3) var(--s3); }
.rank a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--s3);
  padding: var(--s2) var(--s3); border-radius: var(--radius-control);
  color: var(--text); text-decoration: none;
}
.rank a:hover { background: var(--surface-2); }
.rank-label { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-n { font-size: 0.85rem; color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-n small { color: var(--danger); font-size: inherit; }
.rank-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--signal); border-radius: 2px; opacity: 0.75; }

table.calls tr.day-row th {
  position: static; text-align: left; text-transform: none; letter-spacing: 0;
  padding: var(--s3) var(--s5) var(--s2); font-size: 0.82rem; font-weight: 700; color: var(--text);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.pager { align-items: center; }
.pager .btn .ico { width: 16px; height: 16px; }

/* ============ AI activity: the list ============ */
.scope-line { display: flex; align-items: center; gap: var(--s2); margin: calc(-1 * var(--s2)) 0 var(--s4); color: var(--slate); font-size: 0.9rem; }
.scope-line .ico { width: 16px; height: 16px; }
.scope-line strong { color: var(--text); }
.chart-wrap { position: relative; }
.chart-peak {
  position: absolute; top: calc(var(--s5) - 0.55rem); right: var(--s5); padding-left: var(--s2);
  background: var(--surface); font-size: 0.72rem; line-height: 1.1rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.chart-wrap .chart { border-top: 1px dashed var(--line); margin: var(--s5) var(--s5) 0; padding: 0; }
.chart-bar.is-empty { background: var(--line); min-height: 2px; }
table.calls tr.day-row th span { color: var(--slate); font-weight: 500; }
.cell-ask { max-width: 30rem; }
table.calls td:nth-child(4) { white-space: nowrap; }
.ask {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  margin-top: 2px; color: var(--slate); font-size: 0.82rem; overflow-wrap: break-word;
}
.ask-err { color: var(--danger); margin-top: var(--s1); }
.ask-link { text-decoration: none; color: var(--text); display: block; }
.ask-link:hover { color: var(--signal); }
tr.row-link { cursor: pointer; }
@media (hover: hover) { tr.row-link:hover td { background: var(--signal-wash); } }

/* ============ AI activity: one question ============ */
.title-agenda { margin: var(--s2) 0 0; }
.title-agenda .code-inline { font-size: 0.9rem; }
.title-sub { font-size: 0.6em; font-weight: 600; color: var(--slate); letter-spacing: 0; vertical-align: middle; margin-left: var(--s2); }
.chip-lg { padding: 7px 14px 7px 11px; font-size: 0.95rem; }
.chip-lg .ico { width: 18px; height: 18px; }
.error-card {
  display: flex; gap: var(--s4); align-items: flex-start; margin-bottom: var(--s5);
  padding: var(--s4) var(--s5); border-radius: var(--radius-card);
  background: var(--danger-wash); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger);
}
.error-card-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 14%, transparent); }
.error-card-ico .ico { width: 22px; height: 22px; }
.error-card-title { font-weight: 700; }
.error-card p { margin: var(--s1) 0 0; color: var(--text); overflow-wrap: anywhere; }
.section-title .ico { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; color: var(--slate); }
.code-inline {
  display: inline-block; max-width: 100%; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 0.82rem; overflow-wrap: anywhere;
}
.code-wrap { display: block; margin-top: var(--s1); white-space: pre-wrap; }
.deflist dd .sub { margin-top: 2px; }
.raw { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
.raw summary { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; color: var(--signal); font-weight: 600; font-size: 0.88rem; }
.raw summary .ico { width: 16px; height: 16px; }
.code-block {
  margin: var(--s3) 0 0; padding: var(--s4); max-height: 22rem; overflow: auto;
  background: #022b26; color: #d7f7e8; border-radius: var(--radius-control);
  font-size: 0.8rem; line-height: 1.5;
}
.timeline { list-style: none; margin: 0; padding: var(--s3) var(--s5) var(--s5); }
.timeline li { position: relative; }
.timeline li + li::before {
  content: ""; position: absolute; left: 7px; top: -12px; height: 24px; border-left: 2px solid var(--line);
}
.timeline a {
  display: grid; grid-template-columns: 16px 5.5rem minmax(0, 1fr) auto; gap: var(--s3); align-items: start;
  padding: var(--s2) var(--s2); border-radius: var(--radius-control); color: var(--text); text-decoration: none;
}
.timeline a:hover { background: var(--surface-2); }
.timeline-dot { width: 12px; height: 12px; margin: 4px 0 0 1px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--surface); }
.timeline li.is-error .timeline-dot { background: var(--danger); }
.timeline li.is-current a { background: var(--signal-wash); }
.timeline li.is-current .timeline-dot { background: var(--signal); }
.timeline-time { color: var(--slate); font-size: 0.85rem; padding-top: 1px; }
.timeline-meta { color: var(--faint); font-size: 0.82rem; white-space: nowrap; padding-top: 1px; }

/* ============ date picker (static/ui.js) ============ */
.datefield { position: relative; }
.datefield > input { padding-right: 2.6rem; }
.datefield-btn {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 2.5rem;
  display: grid; place-items: center; border: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: transparent; color: var(--slate); cursor: pointer;
}
.datefield-btn:hover { color: var(--signal); background: var(--surface-2); }
.datefield-btn .ico { width: 18px; height: 18px; }
.datepicker {
  position: fixed; z-index: 60; top: 0; left: 0; width: 19rem;
  padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--surface); box-shadow: 0 20px 50px -20px rgba(2, 43, 38, 0.35);
}
.datepicker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); }
.datepicker-title { font-weight: 700; text-transform: capitalize; }
.datepicker-nav {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.datepicker-nav:hover { border-color: var(--signal); color: var(--signal); }
.datepicker-nav .ico { width: 16px; height: 16px; }
.datepicker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.datepicker-dow { padding: var(--s2) 0; text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--faint); text-transform: uppercase; }
.datepicker-day {
  aspect-ratio: 1; min-height: 34px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-control); background: transparent;
  color: var(--text); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer;
}
.datepicker-day:hover { background: var(--surface-2); }
.datepicker-day:disabled { color: var(--line-strong); cursor: not-allowed; background: none; }
/* on a phone: a sheet along the bottom edge */
.datepicker.is-sheet { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; box-shadow: 0 -10px 40px -10px rgba(2, 43, 38, 0.35); }
.datepicker-day.is-outside { color: var(--faint); }
.datepicker-day.is-today { box-shadow: inset 0 0 0 1.5px var(--line-strong); font-weight: 600; }
.datepicker-day.is-selected { background: var(--signal); color: #fff; font-weight: 600; box-shadow: none; }
.datepicker-day.is-selected:hover { background: var(--signal-deep); }
.datepicker-foot { display: flex; gap: var(--s2); margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.datepicker-foot .btn { flex: 1 1 0; }

/* ============ responsive ============ */
.hide-sm { }
@media (max-width: 900px) {
  /* the rail is a top bar here: no ink stripe down the left; the logo and
     the user's avatar on one row, the sections a scrolling strip below */
  .shell { flex-direction: column; background: none; }
  .rail {
    width: auto; height: auto; position: static;
    flex-direction: row; align-items: center; gap: var(--s2) var(--s4);
    padding: var(--s3) var(--s4) var(--s2); flex-wrap: wrap;
  }
  .rail-brand { padding: 0; order: 1; }
  .rail-org { display: none; }
  .rail-foot { order: 2; margin: 0 0 0 auto; padding: 0; display: flex; align-items: center; gap: var(--s3); }
  .rail-nav {
    order: 3; flex: 1 0 100%; flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s2));
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .rail-nav a { flex: none; padding: 8px 12px; }
  .user-trigger { padding: 4px; gap: var(--s2); }
  .user-trigger-name { display: none; }
  .user-trigger-chevron { transform: rotate(180deg); }
  .user-menu[open] .user-trigger-chevron { transform: none; }
  .user-pop { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; width: 16rem; }
  .page { padding: var(--s5) var(--s4) var(--s7); }
  .split { grid-template-columns: 1fr; }
  aside.panel { position: static; }
  .cards-2, .audit-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: var(--s5) var(--s4); }
}
@media (max-width: 680px) {
  .hide-sm { display: none !important; }
  /* stat cards three abreast, smaller */
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
  .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-5 > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: var(--s3); }
  .stat .k { font-size: 0.64rem; }
  .stat .v { font-size: 1.3rem; }
  .section-title { font-size: 0.88rem; }
  .head-filter { margin-left: 0; width: 100%; }
  .head-filter .input-icon, .head-filter select { width: 100%; }
  .panel-head { flex-wrap: wrap; }
  /* tables as stacked cards: each row a block, its cells flowing */
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr:not(.day-row) {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
    padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
  }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0 !important; border: 0; }
  table.stack td:first-child { flex: 1 0 100%; }
  table.stack td.actions { margin-left: auto; width: auto; }
  table.stack tr.empty-row td { flex: 1 0 100%; padding: var(--s6) 0 !important; }
  table.stack tr.day-row { display: block; }
  table.stack tr.day-row th { display: block; }
  /* an AI question: what was asked first, then its time and outcome */
  table.calls.stack td.cell-ask { order: -1; flex: 1 0 100%; max-width: none; }
  table.calls.stack td:first-child { flex: none; color: var(--slate); font-size: 0.85rem; }
  table.stack td.cell-full { flex: 1 0 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  /* the filters two abreast: the search and the buttons a row each */
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .filter-grid .span-2, .filter-grid .filters-actions { grid-column: 1 / -1; }
  .segmented { display: flex; width: 100%; }
  .segmented a { flex: 1 1 auto; text-align: center; padding: 6px 8px; }
  .deflist > div { grid-template-columns: 1fr; gap: 2px; }
  .filters { grid-template-columns: 1fr 1fr; }
}
