/* Shared design tokens + base styles */
:root {
  --paper: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f5f0e8;
  --ink: #1f1b16;
  --muted: #6f675c;
  --faint: #a39a8c;
  --line: #e8e1d6;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee9;
  --yes: #2f6b4f;
  --yes-soft: #e2f0e7;
  --no: #b4483a;
  --no-soft: #f8e5e1;
  --wait: #77591f;
  --wait-soft: #f6eedc;
  --gold: #8f6a2c;
  --shadow: 0 1px 2px rgba(31, 27, 22, .04), 0 8px 28px rgba(31, 27, 22, .06);
  --radius: 16px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130f;
    --surface: #1e1b16;
    --surface-2: #27231d;
    --ink: #f3eee6;
    --muted: #b3aa9c;
    --faint: #958c7e;
    --line: #36312a;
    --accent: #7fb8a3;
    --accent-ink: #10201b;
    --accent-soft: #1f3530;
    --yes: #84c9a2;
    --yes-soft: #1d3327;
    --no: #ec8f80;
    --no-soft: #3a211d;
    --wait: #e0be72;
    --wait-soft: #352c19;
    --gold: #d8ad5f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.serif { font-family: var(--serif); font-optical-sizing: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--faint); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--no); color: var(--surface); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 34px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Inputs */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.input {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }

/* Segmented control */
.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; background: var(--surface-2); border-radius: 11px; gap: 2px;
}
.segmented button {
  height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.segmented button svg { width: 15px; height: 15px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Stepper */
.stepper {
  display: inline-flex; align-items: center; height: 42px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden;
}
.stepper button {
  width: 40px; height: 100%; border: 0; background: transparent; cursor: pointer;
  font-size: 18px; color: var(--muted);
}
.stepper button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper input {
  width: 46px; height: 100%; border: 0; border-inline: 1px solid var(--line);
  background: transparent; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--accent-soft); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.yes { background: var(--yes-soft); color: var(--yes); }
.pill.no { background: var(--no-soft); color: var(--no); }
.pill.pending { background: var(--wait-soft); color: var(--wait); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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