/* Shared design for the planner (/) and the organisers' area (/admin).
   Layout: sticky top bar, then a single centred column (max 1080px). */

:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --fg: #15201a;
  --muted: #5d6c63;
  --line: #e0e6e1;
  --line-strong: #c9d3cc;
  --accent: #1e6a44;
  --accent-hover: #17573a;
  --accent-soft: #e2f0e8;
  --accent-fg: #ffffff;
  --sea: #1c5d88;
  --sea-soft: #e1edf6;
  --warn: #a8510d;
  --warn-soft: #fbeee2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgba(20, 32, 26, 0.06), 0 4px 16px rgba(20, 32, 26, 0.05);

  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --wrap: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1310; --surface: #141c17; --surface-2: #1a241e; --fg: #e5ece7; --muted: #97a99e;
    --line: #243029; --line-strong: #33423a; --accent: #5cbf89; --accent-hover: #74cf9c; --accent-soft: #17311f;
    --accent-fg: #0d1310; --sea: #72b6e2; --sea-soft: #13283a; --warn: #f0a25c; --warn-soft: #362316;
    --danger: #f8786c; --danger-soft: #3a1714; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1310; --surface: #141c17; --surface-2: #1a241e; --fg: #e5ece7; --muted: #97a99e;
  --line: #243029; --line-strong: #33423a; --accent: #5cbf89; --accent-hover: #74cf9c; --accent-soft: #17311f;
  --accent-fg: #0d1310; --sea: #72b6e2; --sea-soft: #13283a; --warn: #f0a25c; --warn-soft: #362316;
  --danger: #f8786c; --danger-soft: #3a1714; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.08; margin: 0; text-wrap: balance; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 700; }
p { margin: 0; max-width: 72ch; }
a { color: var(--sea); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wrap {
  max-width: var(--wrap); margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.stack { display: grid; gap: 16px; align-content: start; }
.stack-lg { display: grid; gap: 40px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spread { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 24px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- top bar ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-family: var(--display); font-weight: 800; font-size: 1.25rem; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }
.nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 7px 12px; border-radius: var(--radius-sm); white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.theme-switch { margin-left: auto; display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex: none; }
.theme-switch button { font: inherit; font-size: 0.8rem; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.theme-switch svg { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .theme-switch .lbl { display: none; }
  .brand .brand-text { display: none; }
  .nav { margin-left: 0; }
  .nav a { padding: 7px 8px; font-size: 0.9rem; }
  .topbar .wrap { gap: 8px; }
  .theme-switch button { padding: 5px 7px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-tight { padding: 14px 16px; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; }
.callout.warn { background: var(--warn-soft); }
.callout.sea { background: var(--sea-soft); }
.callout h3 { font-size: 1.15rem; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- buttons ---------- */
.btn { font: inherit; font-weight: 600; font-size: 0.95rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--fg); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn svg { width: 16px; height: 16px; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--fg); white-space: nowrap; }
.badge { display: inline-block; font-family: var(--mono); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.sea { background: var(--sea-soft); color: var(--sea); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
table.t th, table.t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t thead th { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.t tr.hl td { background: var(--accent-soft); }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.t tr.hl:hover td { background: var(--accent-soft); }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; font-size: 0.9rem; font-weight: 600; min-width: 0; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="tel"], input[type="search"], select, textarea {
  font: inherit; font-weight: 400; font-size: 0.95rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; font-size: 0.93rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

/* ---------- segmented tabs ---------- */
.segmented { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: var(--radius-sm); gap: 2px; overflow-x: auto; max-width: 100%; }
.segmented button, .segmented a { font: inherit; font-size: 0.9rem; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 5px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.segmented [aria-selected="true"], .segmented [aria-current="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; }
.stat .v { font-family: var(--display); font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 0.85rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding-block: 24px 40px; color: var(--muted); font-size: 0.85rem; }
.site-footer .wrap { display: grid; gap: 8px; }
