/* Vocando — shared stylesheet of the gateway's pages (/app, /app/console, /app/dashboard).
   Served at GET /app/ui.css (include_str!, cached an hour — bump the ?v= in the pages' <link>
   when this file changes). Tokens and shapes come from the marketing site
   (website/site/assets/style.css): green accent, 12 px radius, system fonts, light and dark from
   the same names. Dark follows the OS unless <html data-theme="light|dark"> pins it.
   Pages keep only their own rules inline (charts, tiles, the record button). */

/* ---- tokens ---- */
:root {
  color-scheme: light;
  --bg: #ffffff; --bg-2: #f4f6f7; --text: #14171a; --muted: #56606b; --border: #dde2e6;
  --accent: #0b6e5f; --accent-hover: #095a4e; --accent-soft: #e4f3ef; --on-accent: #ffffff;
  --ok: #067647; --ok-soft: #e6f6ee; --danger: #b42318; --danger-soft: #fdecea;
  --warn-ink: #9a6700; --warn-soft: #fff4d6;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
  /* the names the pages are written against */
  --page: var(--bg-2); --surface: var(--bg); --ink: var(--text); --ink2: var(--muted); --faint: #7c868f;
  --ring: var(--border); --ghost: rgba(20,23,26,.05);
  --side-w: 220px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1316; --bg-2: #161c20; --text: #e8ecef; --muted: #9aa5ae; --border: #2a3238;
    --accent: #3ccfb4; --accent-hover: #63dcc6; --accent-soft: #123129; --on-accent: #06201b;
    --ok: #47cd89; --ok-soft: #10301f; --danger: #f97066; --danger-soft: #3a1512;
    --warn-ink: #f0c25a; --warn-soft: #3a2e0e;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    --page: var(--bg); --surface: var(--bg-2); --faint: #77838c; --ghost: rgba(232,236,239,.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1316; --bg-2: #161c20; --text: #e8ecef; --muted: #9aa5ae; --border: #2a3238;
  --accent: #3ccfb4; --accent-hover: #63dcc6; --accent-soft: #123129; --on-accent: #06201b;
  --ok: #47cd89; --ok-soft: #10301f; --danger: #f97066; --danger-soft: #3a1512;
  --warn-ink: #f0c25a; --warn-soft: #3a2e0e;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  --page: var(--bg); --surface: var(--bg-2); --faint: #77838c; --ghost: rgba(232,236,239,.06);
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-width: 0; }
[hidden]:not([hidden="until-found"]) { display: none !important; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.2rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 20px 0 10px; font-weight: 650; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
h2 small { font-weight: 400; color: var(--ink2); font-size: .8rem; }
h3 { font-size: .86rem; margin: 0 0 8px; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
p, li { color: var(--ink2); }
.hint { color: var(--faint); font-size: .78rem; }
.hint b { color: var(--ink2); font-weight: 600; }
.muted { color: var(--muted); }
.err { color: var(--danger); }
.ok { color: var(--ok); }
.empty { color: var(--faint); font-size: .8rem; padding: 10px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }

/* ---- buttons: a bare <button> or .btn is the secondary shape; .pri the green primary; .small the table size; .danger for destructive ---- */
button, .btn { font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; min-height: 32px; text-decoration: none; line-height: 1.3; }
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.pri, .btn.pri { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.pri:hover, .btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.small, .btn.small { font-size: .76rem; padding: 3px 9px; min-height: 26px; border-radius: 7px; }
button.danger, .btn.danger { color: var(--danger); }
button.danger:hover, .btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
button:disabled, .btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }

/* ---- forms ---- */
input:not([type="checkbox"]):not([type="radio"]), select, textarea { font: inherit; font-size: .84rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 32px; max-width: 100%; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly], input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--page); }
textarea { width: 100%; min-height: 70px; line-height: 1.4; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; }
label { color: var(--ink2); }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
label.check input { margin: 0; }

/* ---- tabs (a horizontal tablist under a heading) ---- */
nav.tabs { display: flex; gap: 4px; margin: 0 0 4px; border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs [role=tab] { font: inherit; font-size: .82rem; font-weight: 500; padding: 7px 12px; min-height: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink2); cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
nav.tabs [role=tab]:hover { background: var(--ghost); color: var(--ink); border-color: transparent; }
nav.tabs [role=tab][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
nav.tabs [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[role=tabpanel][hidden] { display: none; }

/* ---- cards and grids ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.grid + .grid { margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.card.span { grid-column: 1 / -1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 8px; min-width: 0; }
.kpi .l { font-size: .74rem; color: var(--ink2); }
.kpi .v { font-size: 1.55rem; font-weight: 650; line-height: 1.15; margin-top: 2px; letter-spacing: -.01em; }
.kpi .v small { font-size: .8rem; font-weight: 500; color: var(--ink2); margin-left: 2px; }
.kpi .d { font-size: .72rem; color: var(--ink2); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.notice { border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.notice.good { background: var(--ok-soft); color: var(--ok); }
.notice.soft { background: var(--accent-soft); color: var(--text); }

/* ---- tables (wrap a wide one in .tw to scroll sideways) ---- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: .8rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--faint); font-weight: 600; font-size: .7rem; letter-spacing: .02em; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* ---- status dots and pills (.tag is the console's older name for a pill) ---- */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.dot.good { background: var(--ok); } .dot.crit, .dot.bad { background: var(--danger); } .dot.info { background: var(--accent); }
.pill, .tag { display: inline-flex; gap: 5px; align-items: center; font-size: .72rem; line-height: 1.4; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--ring); color: var(--ink2); white-space: nowrap; margin: 1px 0; vertical-align: middle; }
.pill svg { width: 11px; height: 11px; }
.pill.good, .tag.fix { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.pill.warn, .tag.fb { color: var(--warn-ink); border-color: var(--warn-ink); background: var(--warn-soft); }
.pill.bad, .tag.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.pill.accent, .tag.accent { color: var(--accent); border-color: transparent; background: var(--accent-soft); font-weight: 600; }

/* ---- page shell: fixed sidebar + content column with a sticky top bar; below 900 px the sidebar is a drawer
   (open with body.nav-open — the dashboard — or .shell.menu — the console) ---- */
.skip { position: absolute; left: 16px; top: -100px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.shell { display: flex; min-height: 100vh; }
.side { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px 12px; z-index: 30; overflow-y: auto; overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; padding: 2px 8px 14px; white-space: nowrap; min-width: 0; }
.brand:hover { color: var(--text); }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: .72rem; font-weight: 800; flex: none; letter-spacing: -.02em; }
.brand .t { line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand .t small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1 0 auto; }
.side nav :is(a, button) { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; padding: 8px 10px; min-height: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); text-decoration: none; text-align: left; font-weight: 550; font-size: .9rem; line-height: 1.3; white-space: nowrap; cursor: pointer; }
.side nav :is(a, button):hover { background: var(--ghost); color: var(--text); border-color: transparent; }
.side nav :is(a[aria-current="page"], button.on) { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.side nav a.on { color: var(--text); font-weight: 650; }
.side nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side nav .label { overflow: hidden; text-overflow: ellipsis; }
.side nav .spacer { flex: 1; }
.side nav .sep { border-top: 1px solid var(--border); margin: 8px 6px; }
.side nav ul.sub { list-style: none; margin: 0 0 4px; padding: 0 0 0 12px; display: flex; flex-direction: column; gap: 1px; }
.side nav ul.sub a { font-size: .84rem; padding: 6px 10px; font-weight: 500; border-radius: 0 8px 8px 0; box-shadow: inset 2px 0 0 var(--border); }
.side nav ul.sub a[aria-current="page"] { background: transparent; box-shadow: inset 2px 0 0 var(--accent); color: var(--accent); font-weight: 650; }
.side .foot { margin-top: auto; font-size: .72rem; color: var(--faint); padding: 10px 10px 0; line-height: 1.4; }
.side .foot a { color: var(--muted); }
.side .foot a.strong { color: var(--accent); font-weight: 650; text-decoration: none; }
.side .foot a.strong:hover { text-decoration: underline; }
.content { margin-left: var(--side-w); flex: 1; min-width: 0; padding: 0 20px 40px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--page); display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topbar .title { min-width: 0; flex: 1 1 260px; }
.topbar .sub { color: var(--ink2); font-size: .76rem; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar label { font-size: .78rem; color: var(--ink2); display: inline-flex; gap: 6px; align-items: center; }
.topbar .brand { padding: 0; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu, .brand-sm, .backdrop { display: none; }
.menu { font: inherit; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; align-items: center; justify-content: center; flex: none; }
.menu:hover { border-color: var(--accent); color: var(--accent); }
.menu svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.view[hidden] { display: none; }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .18s ease; width: min(280px, 85vw); }
  body.nav-open .side, .shell.menu .side { transform: none; box-shadow: var(--shadow); }
  body.nav-open .backdrop, .shell.menu .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .content { margin-left: 0; padding: 0 16px 32px; }
  .menu { display: inline-flex; }
  .brand-sm { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: .95rem; white-space: nowrap; }
  .brand-sm .mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: .66rem; font-weight: 800; }
  .topbar .title { order: 10; flex-basis: 100%; }
}
@media (max-width: 480px) { .brand-sm .adm { display: none; } .brand-sm { font-size: .9rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- switch: one look on every page (moved from the console 2026-10-06; min-height 0 so a table or form
   rule cannot stretch it — the style rules' switches were 26×28 under `td input { min-height: 28px }`) ---- */
input.sw { appearance: none; -webkit-appearance: none; width: 26px; height: 15px; border-radius: 8px; background: var(--border); position: relative; margin: 0; border: 0; padding: 0; min-height: 0; min-width: 0; flex: none; cursor: pointer; transition: background .15s; vertical-align: middle; }
input.sw::after { content: ""; position: absolute; top: 1px; left: 1px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: left .15s; }
input.sw:checked { background: var(--accent); } input.sw:checked::after { left: 12px; }
input.sw:disabled { opacity: .4; cursor: default; }

/* ---- icon button: a disk saves, a bin deletes (Peter 2026-10-06: the typical icons save room in the rows) ---- */
button.ico { width: 30px; height: 30px; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
button.ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

/* ---- the Vocando brand mark (brand/vocando, 2026-10-06): replaces the "MS" tile; mint on dark green in dark mode ---- */
.brand .mark, .brand-sm .mark { background: url(/app/brand/brand-mark.svg) center / contain no-repeat; color: transparent; font-size: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .mark, :root:not([data-theme="light"]) .brand-sm .mark { background-image: url(/app/brand/brand-mark-dark.svg); } }
:root[data-theme="dark"] .brand .mark, :root[data-theme="dark"] .brand-sm .mark { background-image: url(/app/brand/brand-mark-dark.svg); }
