/* Ventosys Solution Desk. Light surface, Ventosys blue as the single accent; amber and red only for state.
   0.4.4: the bars never squash (flex: none), sticky staff header and sidebar, visible scrollbars where lists scroll, phone layout.
   0.4.1: one card system (soft shadow, 12px radius), capitalised headings, aligned action columns, a denser Settings grid. */
:root {
  --bg: #f4f6f9; --bg-deep: #eceff4; --panel: #ffffff; --ink: #14202e; --muted: #5b6673; --line: #e2e7ee; --line-strong: #c9d2dd; --soft: #f3f6fa;
  --accent: #0149af; --accent-ink: #ffffff; --accent-soft: #e6eefb; --accent-dark: #013a8c; --accent-line: #b9cdf0;
  --ok: #1c6b29; --ok-soft: #e4f4e6; --ok-line: #b5dcba; --warn: #7a4a00; --warn-soft: #fdf2dc; --warn-line: #e9c984;
  --bad: #a8261f; --bad-soft: #fbe6e4; --bad-line: #e7b3ae;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --grid: #e3e7ed;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 32, 46, .04), 0 6px 20px -8px rgba(20, 32, 46, .12);
  --shadow-lift: 0 2px 4px rgba(20, 32, 46, .06), 0 14px 32px -12px rgba(1, 73, 175, .22);
  --shadow-bar: 0 1px 0 var(--line), 0 6px 16px -10px rgba(20, 32, 46, .18);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); background-image: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 320px); background-repeat: no-repeat; color: var(--ink); font: 16px/1.5 var(--font); -webkit-user-select: none; user-select: none; -webkit-font-smoothing: antialiased; }
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; font-weight: 650; text-wrap: balance; letter-spacing: -.01em; overflow-wrap: anywhere; }
@media (max-width: 760px) { h1 { font-size: 24px; } }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -.005em; text-transform: capitalize; }
h2.plain { text-transform: none; }
h3 { font-size: 16px; font-weight: 650; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.center-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px 16px 28px; }
/* the sign-in family of screens: a modest logo and a card that fits a laptop screen without scrolling */
.logo-xl { width: min(220px, 60vw); height: auto; display: block; }
.center-screen > .card.narrow { padding: 22px 24px; }
.center-screen > .card.narrow .stack.tight.small { gap: 4px; }
.center-screen > .card.narrow h1 { font-size: 24px; }
@media (max-height: 760px) { .logo-xl { width: 170px; } .center-screen { gap: 12px; padding-top: 12px; } }
.logo-lg { width: min(260px, 60vw); height: auto; display: block; }
.logo-sm { height: 44px; width: auto; display: block; }

/* cards: one surface everywhere */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); }
.card.narrow { width: 100%; max-width: 520px; }
.card.wide { width: 100%; max-width: 860px; }
.card > h2:first-child, .card > .row:first-child > h2, .card > .stack > h2:first-child { padding-bottom: 2px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 24px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.end { align-items: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 240px; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.wrap-any { overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
label.field > span { font-weight: 600; color: #3d4754; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=date], input[type=number], input[type=search], textarea, select {
  min-height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; color: var(--ink); width: 100%;
  box-shadow: inset 0 1px 2px rgba(20, 32, 46, .04); transition: border-color .12s, box-shadow .12s;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { padding: 12px 14px; resize: vertical; line-height: 1.5; }
input.code { font-family: var(--mono); }
input[type=search] { padding-left: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235b6673' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 13px center; }
.check { display: flex; align-items: center; gap: 10px; min-height: 34px; color: var(--ink); font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check.sub { padding-left: 18px; }
.check.small { min-height: 28px; font-size: 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
.two-col .check { align-items: flex-start; line-height: 1.25; padding: 4px 0; }

.btn { min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 32, 46, .05); transition: background .12s, box-shadow .12s, transform .12s, border-color .12s; }
.btn:hover { background: var(--soft); border-color: #b3bfcc; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, #1a5cc0, var(--accent)); border-color: var(--accent-dark); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(1, 58, 140, .25), 0 6px 14px -6px rgba(1, 73, 175, .55); }
.btn.primary:hover { background: linear-gradient(180deg, #1552ad, var(--accent-dark)); }
.btn.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.btn.danger { border-color: var(--bad-line); color: var(--bad); background: #fff; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn[disabled]:hover { background: #fff; border-color: var(--line-strong); }
.btn.primary[disabled]:hover { background: linear-gradient(180deg, #1a5cc0, var(--accent)); border-color: var(--accent-dark); }
.btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn.primary:focus-visible { box-shadow: 0 0 0 3px var(--accent-line); }
.btn, .linkbtn, nav.tabs button, .seg button, .settings-nav button { -webkit-tap-highlight-color: transparent; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.linkbtn:hover { color: var(--accent-dark); }

.alert { padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--soft); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.alert.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.pill.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.pill.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.pill.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* The bars above and below the work area keep their own height: the scrolling happens inside the work area, never by
   squeezing the header, the tab strip or the footer (flex: none is what stops a long page from crushing them). */
header.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 24px; background: var(--panel); box-shadow: var(--shadow-bar); position: sticky; top: 0; z-index: 6; flex: none; }
header.bar h1 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.testmode { padding: 6px 24px; background: var(--warn-soft); color: var(--warn); font-size: 14px; border-bottom: 1px solid var(--warn-line); flex: none; }
.unlockbar { padding: 16px 24px; background: var(--warn-soft); border-bottom: 1px solid var(--warn-line); flex: none; }
.layout { flex: 1 1 auto; min-height: 0; display: flex; flex-wrap: wrap; align-items: stretch; }
aside.side { flex: 1 1 320px; max-width: 420px; min-width: 0; padding: 24px; border-right: 1px solid var(--line); background: #f8fafc; display: flex; flex-direction: column; gap: 32px; }
/* the clipboard and history keep pace with the page: they stay in view while a long answer scrolls, and scroll on
   their own when they are the longer side */
.side-sticky { position: sticky; top: 94px; display: flex; flex-direction: column; gap: 32px; max-height: calc(100vh - 118px); overflow-y: auto; margin: -4px; padding: 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@media (max-width: 760px) { .side-sticky { position: static; max-height: none; overflow: visible; } }
main.main { flex: 999 1 560px; min-width: 0; padding: 20px 32px 32px; display: flex; flex-direction: column; gap: 20px; }
/* superadmin: the window never scrolls as a whole; the main area scrolls only when a tab holds more than fits, and a
   section marked .fill takes whatever room is left so its table scrolls inside the screen */
.app.fixed { height: 100vh; height: 100dvh; overflow: hidden; }
.app.fixed header.bar { position: relative; }
main.main.admin { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 16px 28px 20px; gap: 16px; }
main.main.admin > * { flex: none; }
main.main.admin > .fill { flex: 1 1 auto; min-height: 300px; display: flex; flex-direction: column; }
main.main.admin > .fill.tall { min-height: min(58vh, 640px); }
.fill > .tablewrap { flex: 0 1 auto; min-height: 0; overflow: auto; }
.fill > .tablewrap thead th { position: sticky; top: 0; z-index: 1; }
footer.foot { padding: 10px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--panel); flex: none; }
@media (max-width: 760px) {
  aside.side { max-width: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 16px; gap: 22px; }
  main.main { padding: 20px 16px 40px; }
  main.main.admin { padding: 12px 14px 16px; }
  header.bar { padding: 10px 14px; gap: 8px 10px; }
  header.bar h1 { font-size: 17px; }
  header.bar .logo-sm { height: 34px; }
  .testmode, footer.foot { padding-left: 14px; padding-right: 14px; }
}
/* Scrollbars stay visible where something scrolls, so a cut-off list reads as "more below" rather than as a glitch. */
main.main.admin, .scrollbox, .tablewrap, nav.tabs { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
main.main.admin::-webkit-scrollbar, .scrollbox::-webkit-scrollbar, .tablewrap::-webkit-scrollbar { width: 10px; height: 10px; }
main.main.admin::-webkit-scrollbar-thumb, .scrollbox::-webkit-scrollbar-thumb, .tablewrap::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; background-clip: padding-box; border-radius: 999px; }
main.main.admin::-webkit-scrollbar-thumb:hover, .scrollbox::-webkit-scrollbar-thumb:hover, .tablewrap::-webkit-scrollbar-thumb:hover { background-color: #a9b6c6; }
main.main.admin::-webkit-scrollbar-track, .scrollbox::-webkit-scrollbar-track, .tablewrap::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.home-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 0; }
.home-hero h1 { font-size: 26px; }
.compose.stack { gap: 12px; }
.compose .alert { padding: 8px 12px; font-size: 14px; }
.home-hero p { font-size: 15px; }
.compose { width: 100%; max-width: 760px; margin: 0 auto; }
.clip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(20, 32, 46, .04); transition: border-color .12s, box-shadow .12s, transform .12s; }
button.clip:hover { border-color: var(--accent-line); box-shadow: var(--shadow); transform: translateY(-1px); }
button.clip:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button.clip { text-align: left; width: 100%; }
.clip b { overflow-wrap: anywhere; }
@media (max-width: 760px) { .card { padding: 16px; } .option { padding: 16px; } .results .clip { flex-direction: column; align-items: flex-start; } }
.clip.on { border-color: var(--accent); background: var(--accent-soft); }
/* search results: one line per answer, product at the end */
.results .clip { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.results .clip b { font-weight: 600; }
.hist { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.chip { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 14px; }
.option { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.option ol, .option ul { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 8px; }
.bubble-q { align-self: flex-end; max-width: 80%; padding: 10px 14px; border-radius: 12px 12px 2px 12px; background: var(--accent-soft); }
.bubble-a { align-self: flex-start; max-width: 80%; padding: 10px 14px; border-radius: 12px 12px 12px 2px; background: var(--soft); white-space: pre-line; }
.answer-wrap { width: 100%; max-width: 900px; margin: 0 auto; }

/* superadmin tabs */
nav.tabs { flex: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 20px 0; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
nav.tabs button { min-height: 46px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; background: none; color: var(--muted); font-weight: 600; white-space: nowrap; text-transform: capitalize; transition: color .12s, background .12s; }
nav.tabs button:hover { color: var(--ink); background: var(--soft); }
nav.tabs button:focus-visible { outline-offset: -2px; }
nav.tabs button[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) { nav.tabs { padding: 4px 8px 0; gap: 0; } nav.tabs button { min-height: 40px; padding: 0 10px; font-size: 14px; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis.six, .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis { gap: 10px; } }
@media (min-width: 1380px) { .kpis.eight { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; } .kpis.eight .kpi { padding: 10px 12px; } .kpis.eight .kpi .v { font-size: 24px; } .kpis.eight .kpi .k, .kpis.eight .kpi .s { font-size: 12px; } }
@media (max-width: 1000px) { .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--accent), #5b8fe0); border-radius: 4px 0 0 4px; }
.kpi .v { font: 650 26px/1.15 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .k { font-size: 13px; font-weight: 650; color: var(--ink); text-transform: capitalize; }
.kpi .s { font-size: 13px; color: var(--muted); }
.tablewrap { overflow-x: auto; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dense th, .dense td { padding: 5px 10px; }
.dense input[type=number] { min-height: 34px; }
td .row.row { gap: 6px; }
td .btn.sm { white-space: nowrap; }
td .nowrap, .nowrap { white-space: nowrap; }
th { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--soft); white-space: nowrap; }
tbody tr:hover td { background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.q { min-width: 260px; overflow-wrap: anywhere; vertical-align: top; }
td .btn.sm { min-height: 36px; }
.flag { background: var(--panel); border: 1px solid var(--warn-line); border-left-width: 4px; border-radius: var(--r); padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.flag.done { border-color: var(--line); border-left-color: var(--ok-line); }
.flag ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.grid2.stretch { align-items: stretch; }
.grid2.stretch > .card { height: 100%; }
/* a narrow column of controls beside a wide column of results; one column when the screen is narrow */
.grid2.split { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); }
.grid2.split.narrow { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.grid2.three-two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid2 > * { min-width: 0; }
@media (max-width: 960px) { .grid2.split, .grid2.split.narrow, .grid2.three-two { grid-template-columns: minmax(0, 1fr); } }
.creds td { font-family: var(--mono); font-size: 14px; }
.creds td:first-child { font-family: var(--font); font-size: 15px; }

/* a list of things to do, each with its button in one aligned column */
.todo { display: flex; flex-direction: column; }
.todo > div { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.todo > div:first-child { border-top: 0; padding-top: 4px; }
.todo > div > .btn { width: 100%; }
@media (max-width: 700px) { .todo > div { grid-template-columns: minmax(0, 1fr); } }
/* a section heading that sits above a table or a list, outside a card */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 2px 0; }

/* chart */
.viz { --surface: #ffffff; }
.viz .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); }
.viz .legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz svg { width: 100%; max-width: 860px; height: auto; display: block; }
.viz .axis { font: 12px var(--font); fill: var(--muted); }
.viz .hit { fill: transparent; }
.viz .hit:hover { fill: rgba(20, 32, 46, .05); }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45; max-width: 260px; }
.tip b { font-weight: 650; }

/* protection: nothing can be selected, dragged or printed; staff screens carry a traceable watermark */
* { -webkit-user-drag: none; }
img, a { -webkit-user-drag: none; user-select: none; }
@media print { html, body { display: none !important; } }
.wm { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); grid-auto-rows: 140px; align-items: center; justify-items: center; }
.wm span { transform: rotate(-22deg); font-size: 15px; font-weight: 650; color: rgba(1, 73, 175, .12); white-space: nowrap; }
tfoot td { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 0; }

/* cover shown when the app is not in front, or nobody has touched it for a while */
.veil { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; color: var(--muted); font-size: 18px; }
.veil p { max-width: 40ch; }
.meter { height: 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; min-width: 90px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.warn i { background: #c98a12; }
.meter.bad i { background: var(--bad); }
.bigcode { font: 650 30px/1.3 var(--mono); letter-spacing: .06em; overflow-wrap: anywhere; }
.qa { display: flex; flex-direction: column; gap: 14px; }
td input[type=number] { min-width: 110px; }

/* settings: three columns on a wide screen (two on a narrower one), panes stretch to their row, the long pane spans two
   rows, each pane's button sits at its foot; fields are a little more compact than elsewhere so everything fits with
   less scrolling */
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: 20px; align-items: stretch; }
.settings-grid > .card { display: flex; flex-direction: column; gap: 12px; height: 100%; min-width: 0; padding: 18px 20px; }
.settings-grid > .card.span2 { grid-row: span 2; }
.settings-grid > .card > .actions { margin-top: auto; padding-top: 6px; }
.settings-grid > .card > p.muted { font-size: 13px; line-height: 1.45; }
.settings-grid .alert.small { padding: 8px 12px; font-size: 13px; }
.settings-grid ul { font-size: 14px; }
.settings-grid input[type=text], .settings-grid input[type=password], .settings-grid input[type=number] { min-height: 40px; padding: 0 12px; font-size: 15px; }
.settings-grid label.field { gap: 4px; font-size: 13px; }
.settings-grid .check { min-height: 34px; font-size: 14px; }
.settings-grid .sub-head { font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 2px; }
.settings-grid .sub-head:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
@media (max-width: 1320px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } .settings-grid > .card.span2 { grid-row: auto; } }
@media (max-width: 560px) { .fields { grid-template-columns: minmax(0, 1fr); } }
/* lists that can grow long scroll inside their own box */
.scrollbox { max-height: 46vh; overflow-y: auto; padding-right: 6px; }
.tablewrap.scrollbox { padding-right: 0; }
.tablewrap.scrollbox thead th { position: sticky; top: 0; z-index: 1; }
details > summary::-webkit-details-marker { display: none; }
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 32px; border-radius: 6px; -webkit-user-select: none; user-select: none; }
details > summary::before { content: "▸"; color: var(--accent); width: 12px; flex: none; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--ink); }
details > summary:focus-visible { outline-offset: 0; }
.daymark { font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 10px; }

/* The question box with its attach bar */
.askbox { border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; overflow: hidden; box-shadow: inset 0 1px 2px rgba(20, 32, 46, .04); }
.askbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.askbox textarea { border: 0; border-radius: 0; display: block; min-height: 110px; box-shadow: none; }
.askbox textarea:focus-visible { outline: none; box-shadow: none; }
.askbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-top: 1px solid var(--line); background: var(--soft); }
/* dictation: the microphone button turns red with a pulsing dot while it listens; the words being recognised show beside it */
.btn.mic { display: inline-flex; align-items: center; gap: 6px; }
.btn.mic.on { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.btn.mic.on svg { animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.88); } }
.dict-live { font-style: italic; min-width: 0; overflow-wrap: anywhere; }

/* the solved-answers search: an empty state that invites a search, and results that read as a list */
.search-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 12px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--soft); }
.search-empty b { color: var(--ink); }
.results-head { font-size: 13px; font-weight: 650; color: var(--muted); padding: 4px 2px 0; }

/* a two-way switch inside a tab (Costs: usage or limits) */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(20, 32, 46, .05); }
.seg button { min-height: 40px; padding: 0 16px; border: 0; background: none; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-selected=true] { background: var(--accent-soft); color: var(--accent); }

/* settings as sections: a list on the left, one pane on the right, nothing to scroll */
.settings-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; flex: 1 1 0; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow); }
.settings-nav button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; min-height: 48px; padding: 6px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font-weight: 600; text-transform: capitalize; }
.settings-nav button .small { font-weight: 500; text-transform: none; }
.settings-nav button:hover { background: var(--soft); }
.settings-nav button[aria-current=page] { background: var(--accent-soft); color: var(--accent); }
.settings-pane.settings-grid { display: block; }
.settings-pane > .card { height: auto; padding: 16px 20px 14px; }
.settings-pane > .card > .actions { margin-top: 4px; }
.settings-pane .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .settings-pane .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .settings-shell { grid-template-columns: minmax(0, 1fr); } .settings-nav { flex-direction: row; flex-wrap: wrap; } }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; align-items: start; }
.cols2 > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cols2 .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.cols2 .sub-head:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
@media (max-width: 1000px) { .cols2 { grid-template-columns: minmax(0, 1fr); } }
.settings-pane > .card { max-width: 1100px; }
.cols2 > div:last-child .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card.compact { padding: 12px 16px; }
/* a lone primary button in a wide form sits at the left at its natural width rather than stretching across the card */
main.main.admin form.card > .btn.primary { align-self: flex-start; min-width: 220px; }
.grid2.split form.card > .btn.primary { align-self: stretch; }
.card.compact details > summary { min-height: 28px !important; }
.cols2 label.field { font-size: 12px; line-height: 1.3; gap: 3px; }
.cols2 .sub-head { padding-top: 4px; }
/* the one-line confirmation that opens under a person's row before they are removed */
tr.confirm-row td { background: var(--bad-soft); border-top: 1px solid var(--bad-line); border-bottom: 1px solid var(--bad-line); padding: 10px 12px; }
