/* Tokens, typography and base controls. Layout lives in layout.css. */

:root {
  --bg: #f5f4ee;
  --surface: #ffffff;
  --surface-2: #eeede5;
  --text: #1e271e;
  --muted: #5d685a;
  --border: #d9dbd0;
  --border-strong: #b9bdaf;
  --accent: #3f7d3a;
  --accent-hover: #356a31;
  --accent-soft: #e3f0df;
  --accent-contrast: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --focus: #2f6fb3;
  --shadow: 0 1px 2px rgb(20 30 20 / 0.06), 0 4px 16px rgb(20 30 20 / 0.06);
  --shadow-lg: 0 12px 40px rgb(20 30 20 / 0.18);

  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121813;
    --surface: #1b231c;
    --surface-2: #232d24;
    --text: #e4eae1;
    --muted: #9aa596;
    --border: #2f3a30;
    --border-strong: #46534a;
    --accent: #6fb862;
    --accent-hover: #83c877;
    --accent-soft: #24361f;
    --accent-contrast: #0d160c;
    --danger: #f2a49d;
    --danger-soft: #3a1c1a;
    --focus: #8ab8ea;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #121813;
  --surface: #1b231c;
  --surface-2: #232d24;
  --text: #e4eae1;
  --muted: #9aa596;
  --border: #2f3a30;
  --border-strong: #46534a;
  --accent: #6fb862;
  --accent-hover: #83c877;
  --accent-soft: #24361f;
  --accent-contrast: #0d160c;
  --danger: #f2a49d;
  --danger-soft: #3a1c1a;
  --focus: #8ab8ea;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 620; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-icon { width: 36px; padding: 0; }

/* ----------------------------------------------------------------- inputs */

.field { display: grid; gap: 4px; }
.field > label, .field > .label { font-weight: 550; font-size: 0.9rem; }
.field .hint { font-size: 0.82rem; color: var(--muted); }
.field .error { font-size: 0.82rem; color: var(--danger); min-height: 0; }
.field .error:empty { display: none; }

.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }

.field-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.field-row .times { padding-bottom: 8px; color: var(--muted); }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented label { display: flex; align-items: center; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.segmented label + label { border-left: 1px solid var(--border-strong); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--accent-soft); color: var(--text); font-weight: 620; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }

.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
