/* EventWrangler — design system
   Tokens and measurements are from design_handoff_eventwrangler/README.md.
   Four color jobs: smart-blue structure, french-blue action, coral status
   ("needs a person or a dollar"), gold estimate ("this number is a guess").
   Tangerine appears exactly once, on the landing eyebrow. */

:root {
  color-scheme: light dark;
  --canvas: #f2f4fa;  --surface: #ffffff;  --surface-2: #eef0f6;
  --line: #dee2ed;    --line-2: #bdc4db;
  --ink: #121621;     --ink-2: #364163;    --muted: #475785;
  --action: #3d528f;  --action-hov: #2e3d6b; --action-ink: #ffffff; --action-tint: #edf0f7;
  --status: #c31909;  --status-tint: #fee9e7; --status-ink: #921207;
  --est: #eec644;     --est-tint: #fbf1d0;   --est-ink: #8c6e0d;
  --warm: #f1560e;    --warm-tint: #feeee7;

  --sans: 'Libre Franklin', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --gutter: 16px;
  --numcol: 78px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0c0f17; --surface: #151a28; --surface-2: #242b42;
    --line: #364163;   --line-2: #475785;
    --ink: #eef0f6;    --ink-2: #dee2ed;   --muted: #9ca7c9;
    --action: #7085c2; --action-hov: #94a3d1; --action-ink: #0f1424; --action-tint: #1f2947;
    --status: #f8786d; --status-tint: #310602; --status-ink: #faa59e;
    --est: #f2d473;    --est-tint: #2f2504;   --est-ink: #f6e3a2;
    --warm: #f79a6e;   --warm-tint: #301103;
  }
}

* { box-sizing: border-box; }

/* Must outrank the display values set below: .scrim is display:flex, which
   would otherwise beat the user agent's [hidden] rule and leave the claim
   dialog open on load. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--action); text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) { a:hover { color: var(--action-hov); } }

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

input, button, textarea, select { font: inherit; color: inherit; }

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

/* ---------- layout ---------- */

.shell { max-width: 480px; margin: 0 auto; }
.gutter { padding-inline: var(--gutter); }
.stack { display: grid; gap: 16px; }
.stack-18 { display: grid; gap: 18px; }
.pad-block { padding-block: 18px; }

/* ---------- type ---------- */

h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
.display { font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -0.025em; }
.title   { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.section { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.item    { font-size: 17px; line-height: 1.35; font-weight: 600; }
.small   { font-size: 14px; line-height: 1.45; }
.muted   { color: var(--muted); }
.ink2    { color: var(--ink-2); }
p { margin: 0; }

.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.label-status { color: var(--status-ink); }
.label-warm { color: var(--warm); }

/* ---------- numbers ---------- */

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* A gold dotted underline means: this figure is a guess. Cleared for good on edit. */
.est { border-bottom: 2px dotted var(--est); }

.est-note {
  background: var(--est-tint);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.est-tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.09em;
  color: var(--est-ink);
  flex: none;
}

.status-note {
  background: var(--status-tint);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--status-ink);
}

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 8px;
  border: 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { min-height: 56px; background: var(--action); color: var(--action-ink); }
.btn-secondary {
  min-height: 48px;
  background: var(--surface);
  color: var(--action);
  border: 1.5px solid var(--line-2);
  font-size: 15px;
}
@media (hover: hover) {
  .btn-primary:hover { background: var(--action-hov); }
  .btn-secondary:hover { border-color: var(--action); }
}

/* Disclosure rows are tappable, so they clear 48px too. */
.disclosure {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--action);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding-inline: var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .wordmark { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); }
.topbar .centre { font-size: 15px; font-weight: 600; }
/* Bar controls are short words, so the hit area is set explicitly: nothing
   tappable falls under 48px, even when the label is five characters. */
.topbar a.plain, .topbar .end {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.topbar .end { font-weight: 600; color: var(--action); }

/* ---------- cards and grouped lists ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-action { border: 2px solid var(--action); border-radius: 20px; background: var(--surface); overflow: hidden; }
.card-status { border: 1.5px solid var(--status); border-radius: 10px; padding: 14px; background: var(--surface); }
.card-quiet { background: var(--action-tint); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }

.row {
  display: grid;
  grid-template-columns: 1fr var(--numcol) var(--numcol);
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row-2col { grid-template-columns: 1fr auto; }
.row-name { font-size: 15.5px; font-weight: 500; }
.row .num { font-size: 15px; }
.row-editing { background: var(--action-tint); }
.row-editing .row-name { font-weight: 600; }
.row-help {
  grid-column: 1 / -1;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  padding-top: 2px;
}
/* The quantity cell is the most-tapped control in the planner. The negative
   block margin claims the row's padding as hit area, so the target is 48px
   while the row stays at its designed 52px. */
.row button.cell-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 48px;
  margin-block: -10px;
  padding: 0 4px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.row button.cell-btn.est { border-bottom: 2px dotted var(--est); }

.row input.cell {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 1.5px solid var(--action);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  text-align: right;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.total-row .num { font-size: 17px; }

/* ---------- progress ---------- */

.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--action); }
.bar-status-track { background: var(--status-tint); height: 12px; }
.bar-fill.over { background: var(--status); }

/* ---------- forms ---------- */

.field { display: grid; gap: 6px; }
.field input, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  font-size: 16px; /* never below 16 — iOS zooms the page on focus otherwise */
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus { border-color: var(--action); }

/* ---------- segmented control (post-event review) ---------- */

.segmented { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.seg {
  min-height: 52px;
  border-radius: 8px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}
.seg[aria-pressed="true"] {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-ink);
  font-weight: 600;
}
/* A shortfall is a status, so it reads as one. Overshooting is not a failure. */
.seg.short[aria-pressed="true"] {
  background: var(--status-tint);
  border-color: var(--status);
  color: var(--status-ink);
}

/* ---------- bottom sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 33, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 3px solid var(--action);
  border-radius: 12px 12px 0 0;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 14px;
  animation: rise 200ms ease-out;
}
@keyframes rise { from { transform: translateY(12px); } to { transform: none; } }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 20px var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
  font-size: 13.5px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}
.foot nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- legal pages ---------- */

.prose { max-width: 68ch; }
.prose h2 { font-size: 20px; line-height: 1.25; font-weight: 600; margin-top: 28px; }
.prose h3 { font-size: 17px; font-weight: 600; margin-top: 20px; }
.prose p, .prose li { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose p { margin-top: 12px; }

/* ---------- desktop: the planner is the only two-column view ---------- */

.desktop-only { display: none; }

@media (min-width: 900px) {
  :root { --gutter: 24px; --numcol: 84px; }
  .shell { max-width: 1100px; }
  .shell-wide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 24px;
    align-items: start;
  }
  .desktop-only { display: revert; }
  .row-desktop { grid-template-columns: 1fr var(--numcol) var(--numcol) var(--numcol); }
}
