/* Tokens, type and controls shared by every screen. XPSR colours (as on
   xpsr.site) and Geist, self-hosted. */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #05245A;
  --navy-hover: #0A3270;
  --ink: #0F172A;
  --body: #334155;
  --label: #475569;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --soft: #F1F5F9;
  --page: #F6F8FB;
  --card: #FFFFFF;
  --blue: #0163C2;
  --blue-soft: #EAF1FB;
  --teal: #00B8C8;
  --danger: #B91C1C;
  --nest-bg: #EEF2F7;
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  --font: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.35;
  background: var(--page);
  color: var(--ink);
}
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #94A3B8; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--navy-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 36px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--label); }
.field input, .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 600;
}
.field select { font-weight: 500; font-size: 13px; padding: 0 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.seg { display: inline-flex; }
.seg button {
  height: 32px; padding: 0 12px; margin-left: -1px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--body);
  font-weight: 600; font-size: 13px;
}
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; position: relative; }
.seg.dim button { opacity: 0.45; }

.chip {
  height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-weight: 600; font-size: 12px;
}
.chip[aria-pressed="true"] { background: var(--blue-soft); color: var(--navy); border-color: #9DB8DC; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Dialogs (ui/dialog.js). */
dialog.app-dialog { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow); max-width: min(520px, calc(100vw - 32px)); width: 100%; color: var(--ink); }
dialog.app-dialog::backdrop { background: rgba(15, 23, 42, 0.35); }
.app-dialog-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dialog-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-heading-row h2 { margin: 0; font-size: 17px; }
.small-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dialog-actions button { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-weight: 600; font-size: 13px; }
.dialog-actions button.secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.dialog-actions button.danger { background: var(--danger); border-color: var(--danger); }
.dialog-close-x { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--soft); font-size: 20px; line-height: 1; }
.app-dialog p { margin: 0; color: var(--body); }
.app-dialog ul { margin: 0; padding-left: 18px; color: var(--body); }
.dialog-fallback-active { position: fixed; inset: 0; margin: auto; z-index: 1001; height: fit-content; }
.dialog-fallback-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35); z-index: 1000; display: none; }
.dialog-fallback-backdrop.is-visible { display: block; }
