/*
 * brifta design tokens (docs/ux/design-system.md, ADR-0011): the one source of brand colors and type for the desktop
 * UI (src/desktop/ui) and the hosted account pages (Brifta.Api). Each color holds its light and dark value; the page
 * picks one with `color-scheme` (the app from the theme setting, SET-1; the hosted pages from the browser).
 * The palette comes from the logo: petrol blue, ink, slate gray, and the recording red.
 */
:root {
  /* Surfaces */
  --surface: light-dark(#ffffff, #161b1e);
  --surface-muted: light-dark(#f3f5f6, #1c2226);
  --surface-raised: light-dark(#ffffff, #232b30);
  --selected: light-dark(#e4ebef, #26323a);

  /* Text and lines */
  --fg: light-dark(#183038, #e6edf0);
  --fg-muted: light-dark(#5a6b72, #9aaab1);
  --line: light-dark(#d8dfe3, #333e44);

  /* Brand: petrol (the logo's blue) for actions and focus; red only for recording and destructive actions. */
  --accent: light-dark(#21608f, #6fb3e3);
  --accent-fg: light-dark(#ffffff, #0b2233);
  --danger: light-dark(#c42b1c, #ff7b6e);
  --danger-fg: light-dark(#ffffff, #2b0606);
  /* APP-7: the recording bar's light red tint. */
  --recording-bg: light-dark(#fdf0ef, #2e1b1a);

  /* The logo's mark (microphone and page); lighter in dark so it keeps its shape on a dark surface. */
  --logo-mic: light-dark(#21608f, #6fb3e3);
  --logo-page: light-dark(#6b7a81, #9aa9b0);

  /* Status hints (always next to text, A11Y-1) */
  --success: light-dark(#1d7a4c, #4cc38a);
  --caution: light-dark(#b45309, #f0a04b);

  /* Banners */
  --warning-bg: light-dark(#fff1d6, #3a2e12);
  --warning-fg: light-dark(#5c3d00, #f5d58e);
  --info-bg: light-dark(#e2eef6, #16303f);
  --info-fg: light-dark(#1a4f77, #9bd0f2);
  --error-bg: light-dark(#fde8e6, #431c1d);
  --error-fg: light-dark(#7c1d14, #ffd0cc);

  /* CAL-10: calendar sources (feeds, accounts, scheduled in brifta); never a status. */
  --source-feed: light-dark(#0f7b6c, #4fd1bf);
  --source-account: light-dark(#6a43c9, #b69cff);
  --source-scheduled: light-dark(#b4570b, #f5a25d);

  /* Type: the OS's UI font (Segoe UI Variable on Windows, SF Pro on macOS); Caladea for document headings, the serif
     the exported documents use (Brifta.Documents); a monospace for timestamps. */
  --type-ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --type-document: Caladea, Cambria, Georgia, serif;
  --type-mono: "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;
}

@supports not (color: light-dark(#000, #fff)) {
  :root {
    --surface: #ffffff;
    --surface-muted: #f3f5f6;
    --surface-raised: #ffffff;
    --selected: #e4ebef;
    --fg: #183038;
    --fg-muted: #5a6b72;
    --line: #d8dfe3;
    --accent: #21608f;
    --accent-fg: #ffffff;
    --danger: #c42b1c;
    --danger-fg: #ffffff;
    --recording-bg: #fdf0ef;
    --logo-mic: #21608f;
    --logo-page: #6b7a81;
    --success: #1d7a4c;
    --caution: #b45309;
    --warning-bg: #fff1d6;
    --warning-fg: #5c3d00;
    --info-bg: #e2eef6;
    --info-fg: #1a4f77;
    --error-bg: #fde8e6;
    --error-fg: #7c1d14;
    --source-feed: #0f7b6c;
    --source-account: #6a43c9;
    --source-scheduled: #b4570b;
  }
}
:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-muted); color: var(--fg); font: 15px/1.5 var(--type-ui); }
.page { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.masthead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0 0 .75rem; margin: 0 0 1.5rem; border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; gap: .5rem; color: var(--fg); }
.logo .mark { height: 2rem; width: auto; }
.logo .wordmark { height: 1.3rem; width: auto; }
.logo .mic { fill: var(--logo-mic); }
.logo .page { fill: var(--logo-page); }
.sections { display: flex; gap: .25rem; flex-wrap: wrap; margin: 0 0 0 auto; }
.sections a { padding: .4rem .75rem; text-decoration: none; color: var(--fg-muted); border-radius: .375rem; }
.sections a:hover { background: var(--selected); color: var(--fg); }
.sections a[aria-current="page"] { color: var(--fg); background: var(--selected); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
section { background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: 1.25rem 1.5rem; margin: 1rem 0; }
.muted { color: var(--fg-muted); }
.banner { background: var(--info-bg); color: var(--info-fg); border-radius: .375rem; padding: .6rem .9rem; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
dt { color: var(--fg-muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.plans { list-style: none; padding: .5rem 0 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; }
.plan { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan h3 { font-size: 1.05rem; }
.plan ul { margin: 0; padding-left: 1.1rem; color: var(--fg-muted); font-size: .9rem; flex: 1; }
.price { font-weight: 700; font-size: 1.25rem; margin: 0; font-variant-numeric: tabular-nums; }
.tag { margin: 0; color: var(--accent); font-weight: 600; }
.plan.current .tag { position: absolute; top: -.7rem; right: .75rem; padding: .05rem .6rem; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: .8rem; }
form { margin: 0; }
button, .button { font: inherit; font-weight: 600; font-size: .95rem; padding: .45rem .9rem; border-radius: .375rem; border: 1px solid var(--line); background: var(--surface-raised); color: var(--fg); cursor: pointer; }
button { width: 100%; }
button:hover, .button:hover { background: var(--selected); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.button { display: block; text-align: center; text-decoration: none; }
.banner.change { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: .5rem 0 1rem; }
.banner.change p { margin: 0; }
.banner.change button { width: auto; }
.cancel-row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cancel-row p { margin: 0; }
.cancel-row .button, .cancel-row button { width: auto; }
.actions { display: flex; gap: .75rem; margin-top: 1.5rem; }
.actions .button, .actions button { width: auto; display: inline-block; }
.stack { display: flex; flex-direction: column; gap: .5rem; max-width: 22rem; }
.cap button, .stack button { width: auto; align-self: flex-start; justify-self: start; }
.cap { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: .6rem; row-gap: .75rem; max-width: 30rem; }
.cap > :not(.switch, .switch-label) { grid-column: 1 / -1; }
.cap .cap-hours { display: flex; flex-direction: column; gap: .5rem; }
.cap .cap-hours input { max-width: 8rem; }
.cap #allow:not(:checked) ~ .cap-hours { display: none; }
.switch-label { cursor: pointer; }
input.switch { appearance: none; width: 2.25rem; height: 1.25rem; margin: 0; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-muted); position: relative; cursor: pointer; transition: background-color .15s; }
input.switch::before { content: ""; position: absolute; top: .125rem; left: .125rem; width: .875rem; height: .875rem; border-radius: 50%; background: var(--fg-muted); transition: transform .15s; }
input.switch:checked { background: var(--accent); border-color: var(--accent); }
input.switch:checked::before { transform: translateX(1rem); background: var(--accent-fg); }
label { font-weight: 600; font-size: .95rem; }
input { font: inherit; padding: .45rem .6rem; border-radius: .375rem; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
input[aria-invalid="true"] { border-color: var(--danger); }
.error { color: var(--error-fg); background: var(--error-bg); border-radius: .375rem; padding: .4rem .7rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg-muted); font-weight: 600; font-size: .9rem; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }