/* Shared look for the demo: paper background, one calm blue, system fonts (Inter when installed). Light only. */
:root {
  --paper: #F8FAFC;
  --surface: #ffffff;
  --ink: #021D29;
  --ink-2: #212529;
  --muted: #475569;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --accent: #0069BA;
  --accent-ink: #00548F;
  --accent-soft: #E6F0F8;
  --accent-line: #B3D1EA;
  --ok: #1B7F3B;
  --ok-soft: #E7F5EC;
  --warn: #7A4A00;
  --warn-soft: #FDF3DC;
  --bad: #b42318;
  --bad-soft: #FEF3F2;
  --gold: #B9B06C;
  --gold-text: #6B6430;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.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; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.sm { font-size: 0.875rem; }
.ic { width: 20px; height: 20px; flex: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
.h1 { font-size: 1.6rem; font-weight: 700; }
.h2 { font-size: 1.15rem; font-weight: 650; }
.h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }

/* the demo notice: on every page, always */
.demo-banner { background: var(--warn-soft); border-bottom: 1px solid #f1d9a8; color: #4a3200; font-size: 0.8125rem; line-height: 1.4; text-align: center; padding: 6px 16px; }
.demo-banner p { max-width: 70rem; margin: 0 auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer; line-height: 1.2; transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--gold); border-radius: 30px; }
.btn.primary:hover { background: var(--ink); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--accent); border-color: var(--accent-line); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn.danger-ghost { background: var(--surface); color: var(--bad); border-color: #efc2bd; }
.btn.danger-ghost:hover { background: var(--bad-soft); }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn[disabled], .btn.disabled { opacity: 0.55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }

/* language switch */
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.lang-btn { min-width: 44px; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 0.875rem; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* forms */
.field { display: grid; gap: 6px; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .f-sel > span { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.field > legend { padding: 0; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin-top: -2px; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; font-size: 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid rgba(31, 95, 173, 0.18); outline-offset: 0; }
input[readonly] { background: var(--paper); color: var(--ink-2); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.err { display: flex; gap: 6px; align-items: flex-start; color: var(--bad); font-size: 0.875rem; font-weight: 500; }
.err .ic { width: 16px; height: 16px; margin-top: 2px; }
.radio-list { display: grid; gap: 8px; }
.radio, .check { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; }
.radio:hover, .check:hover { border-color: var(--accent-line); }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.radio input, .check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.radio span small { display: block; }

/* notes and callouts */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); font-size: 0.9rem; margin: 0 0 16px; }
.note .ic { color: var(--accent); margin-top: 1px; }
.note.subtle { background: transparent; padding: 4px 0; color: var(--muted); }
.note.subtle .ic { color: var(--muted); width: 18px; height: 18px; }
.note.strong { background: var(--ok-soft); color: #134e33; }
.note.strong .ic { color: var(--ok); }
.note.warn { background: var(--warn-soft); color: #4a3200; }
.note.warn .ic { color: var(--warn); }
.err-box { padding: 12px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); display: grid; gap: 6px; margin: 0 0 14px; font-size: 0.9rem; }
.err-box p { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill .ic { width: 15px; height: 15px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cf; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); color: var(--accent); text-decoration: none; font-weight: 600; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* the brand line and footers */
.app-glyph { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; flex: none; }
.app-glyph .ic { width: 20px; height: 20px; }
.app-glyph.lg { width: 64px; height: 64px; border-radius: 16px; }
.app-glyph.lg .ic { width: 34px; height: 34px; }
.brand-line { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-line strong { display: block; font-size: 0.98rem; line-height: 1.2; }
.brand-line small { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.foot { padding: 28px 16px 36px; color: var(--muted); font-size: 0.85rem; text-align: center; display: grid; gap: 10px; justify-items: center; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; align-items: center; }
.made-by { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.labs-mark { width: 18px; height: 18px; flex: none; }
.noscript { padding: 24px; }

/* toast and dialogs */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 0.9rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #14532d; }
.toast.warn { background: #7a3e00; }
dialog { border: 0; padding: 0; border-radius: 16px; box-shadow: var(--shadow-lg); max-width: min(520px, calc(100vw - 32px)); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(22, 32, 46, 0.45); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* an icon inside a plain text link sits on the text line */
a:not(.btn):not(.tile):not(.chip):not(.brand-line):not(.app-title) > .ic { display: inline-block; vertical-align: -4px; width: 18px; height: 18px; }
@media (max-width: 600px) { .demo-banner { font-size: 0.75rem; padding: 5px 12px; } }
