/* Shared design tokens. Themes swap only the surface + ink ramps; the accent
   is set per-meeting from Admin > Settings and injected as --accent. */

:root {
  --accent: #c9a227;
  --accent-ink: #1a1508;      /* text drawn ON an accent block */
  --accent-text: #c9a227;     /* accent-coloured TEXT, contrast-fitted at runtime */

  --bg-0: #0a0d14;
  --bg-1: #10141d;
  --bg-2: #171d29;
  --bg-3: #202839;
  --line: #2b3446;

  --ink-0: #f4f6fa;
  --ink-1: #c3cbdb;
  --ink-2: #8b95a9;
  --ink-3: #5d6779;

  --ok: #46c98b;
  --warn: #e8b339;
  --err: #ef5f6b;
  --live: #ff4d5e;

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,.45);
  --shadow-3: 0 24px 64px rgba(0,0,0,.55);

  /* Animated-background strength. Colour washes that read as "atmospheric" on
     a dark screen read as "smudged" on a white one, so light themes turn these
     down rather than every effect carrying its own light-theme override. */
  --fx-wash: 30%;      /* blurred colour fields */
  --fx-line: 20%;      /* hairlines and grids */
  --fx-blend: screen;  /* light themes need multiply to darken instead */
}

[data-theme="slate"] {
  --bg-0: #0d0f11; --bg-1: #14171a; --bg-2: #1c2024; --bg-3: #262b31; --line: #333a42;
}

[data-theme="ivory"] {
  --bg-0: #f7f5f0; --bg-1: #fffdf8; --bg-2: #efece4; --bg-3: #e4e0d6; --line: #d4cec0;
  --ink-0: #1a1814; --ink-1: #45403a; --ink-2: #6f6960; --ink-3: #9a9389;
  --shadow-1: 0 1px 2px rgba(0,0,0,.08);
  --shadow-2: 0 8px 24px rgba(0,0,0,.10);
  --shadow-3: 0 24px 64px rgba(0,0,0,.14);
}

[data-theme="oxford"] {
  --bg-0: #071122; --bg-1: #0c1a30; --bg-2: #12253f; --bg-3: #1a3253; --line: #23406a;
}

/* ---- light themes ---- */

[data-theme="paper"] {
  --bg-0: #ffffff; --bg-1: #fbfbfc; --bg-2: #f3f4f7; --bg-3: #e7e9ee; --line: #dcdfe6;
  --ink-0: #14171c; --ink-1: #3d434e; --ink-2: #6a7180; --ink-3: #99a0ad;
  --shadow-1: 0 1px 2px rgba(16,20,28,.07);
  --shadow-2: 0 8px 24px rgba(16,20,28,.09);
  --shadow-3: 0 24px 64px rgba(16,20,28,.12);
  --fx-wash: 26%; --fx-line: 22%; --fx-blend: multiply;
}

[data-theme="mist"] {
  --bg-0: #f9fbfd; --bg-1: #ffffff; --bg-2: #eef2f7; --bg-3: #e2e8f0; --line: #d3dbe6;
  --ink-0: #101720; --ink-1: #38424f; --ink-2: #64707f; --ink-3: #949fad;
  --shadow-1: 0 1px 2px rgba(15,23,42,.06);
  --shadow-2: 0 8px 24px rgba(15,23,42,.08);
  --shadow-3: 0 24px 64px rgba(15,23,42,.11);
  --fx-wash: 28%; --fx-line: 23%; --fx-blend: multiply;
}

[data-theme="ivory"] {
  --fx-wash: 30%; --fx-line: 24%; --fx-blend: multiply;
}

* { box-sizing: border-box; }

/* The hidden attribute only carries UA display:none, which any later
   display:flex/grid rule silently beats. Several elements here toggle via
   hidden, so make it authoritative once rather than per-selector. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

/* ---- button busy state ----
   Set by /js/ui-busy.js while a button's own handler is in flight. The lock is
   what stops the double click; the spinner only appears once the work has run
   past ~180ms, so fast actions never flash one. */

@keyframes dm-busy-spin { to { transform: rotate(360deg); } }

[data-busy] {
  pointer-events: none !important;
  cursor: default !important;
}

/* Inputs cannot carry a pseudo-element, so they just dim. */
input[data-busy] { opacity: .55; }

[data-busy-spin] {
  color: transparent !important;
  text-shadow: none !important;
}
[data-busy-spin] > * { visibility: hidden; }

[data-busy-spin]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--dm-busy-ink, currentColor) 25%, transparent);
  border-top-color: var(--dm-busy-ink, #999);
  animation: dm-busy-spin .6s linear infinite;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-busy-spin]::after { animation-duration: 1.6s; }
}

/* ---- in-app dialogs (/js/ui-dialog.js) ----
   Replaces window.confirm/alert/prompt, which cannot be themed and announce
   the hostname above whatever the app was trying to say. */

.ui-dlg {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  color: var(--ink-0);
  box-shadow: var(--shadow-3);
  padding: 0;
  width: min(30rem, calc(100vw - 2rem));
  font-family: var(--font-ui);
}
.ui-dlg::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }

.ui-dlg-form { padding: 1.4rem 1.5rem 1.2rem; margin: 0; }

.ui-dlg-title {
  margin: 0 0 .6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.ui-dlg-msg {
  margin: 0;
  color: var(--ink-1);
  font-size: .9rem;
  line-height: 1.5;
  white-space: pre-wrap;   /* callers separate paragraphs with \n\n */
}

.ui-dlg-field { display: block; margin-top: 1rem; }
.ui-dlg-field span {
  display: block;
  margin-bottom: .35rem;
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.ui-dlg-field input {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-0);
}
.ui-dlg-field input:focus { outline: none; border-color: var(--accent); }

.ui-dlg-row {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.4rem;
}
.ui-dlg-btn {
  padding: .5rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-1);
  font-size: .85rem;
  cursor: pointer;
}
.ui-dlg-btn:hover { background: var(--bg-3); color: var(--ink-0); }
.ui-dlg-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.ui-dlg-btn.primary:hover { filter: brightness(1.08); }
.ui-dlg-btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.ui-dlg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
