/* Draft without brand direction: ENERGY 1 / RHYTHM 1 / MOTION 1.
   Palette: paper + ink neutrals, one orange accent for the active tab, focus
   and primary hover; green/amber/red only as budget status. */
:root {
  --paper: #f4f1ea;
  --card: #fffdf8;
  --ink: #1b1a17;
  --muted: #5f5a50;
  --line: #d9d2c3;
  --accent: #c2410c;
  --ok: #2f7d4f;
  --warn: #a16207;
  --over: #b91c1c;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15140f; --card: #1e1d18; --ink: #efe9dc; --muted: #b3ab9b;
    --line: #3a372e; --accent: #fb923c; --ok: #5cbf86; --warn: #e3b13f; --over: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums;
  min-height: 100vh; display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button, label:has(input[type=checkbox]) { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }

.bar {
  display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 48px); border-bottom: 2px solid var(--ink);
  background: var(--paper); position: sticky; top: 0; z-index: 5;
}
.mark { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
nav { display: flex; gap: 4px; }
nav button {
  border: 0; background: none; padding: 0 12px; min-height: 44px; font-weight: 600;
  border-bottom: 3px solid transparent;
}
nav button:hover { border-color: var(--line); }
nav button.on { border-color: var(--accent); }
#who { margin-left: auto; display: flex; gap: 16px; align-items: center; color: var(--muted); flex-wrap: wrap; }

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 48px) 64px; flex: 1; }
footer { border-top: 1px solid var(--line); padding: 14px clamp(16px, 4vw, 48px); color: var(--muted); font-size: 13px; }
footer code { font-family: var(--mono); color: var(--ink); }
h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.03em; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }

.card { background: var(--card); border: 1.5px solid var(--ink); padding: 22px; margin-bottom: 24px; }

.login { max-width: 380px; margin: 6vh auto; }
.login form { display: grid; gap: 14px; margin-top: 20px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  border: 1.5px solid var(--ink); background: var(--card); padding: 0 11px; min-height: 44px; width: 100%;
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.primary, .ghost, .danger {
  border: 1.5px solid var(--ink); padding: 0 16px; min-height: 44px; font-weight: 600;
  background: var(--ink); color: var(--paper);
}
.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.ghost { background: transparent; color: var(--ink); }
.ghost:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.danger { background: transparent; color: var(--over); border-color: var(--over); }
.danger:hover:not(:disabled) { background: var(--over); color: var(--paper); }
.link { border: 0; background: none; padding: 0 4px; min-height: 44px; text-decoration: underline; color: inherit; }
.link:hover { color: var(--accent); }
.err { color: var(--over); min-height: 1.2em; margin: 0; font-weight: 600; }

.big { font-size: clamp(34px, 6vw, 52px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.big small { font-size: 0.38em; color: var(--muted); letter-spacing: 0; font-weight: 400; }
.meter { height: 12px; border: 1.5px solid var(--ink); margin: 14px 0 8px; background: var(--paper); }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.warn i { background: var(--warn); }
.meter.over i { background: var(--over); }
.mini { width: 120px; height: 8px; margin: 4px 0 0; }

.facts { display: flex; flex-wrap: wrap; gap: 16px 32px; margin: 18px 0 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 12px; border: 1px solid var(--ink); padding: 1px 7px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td .link { min-height: 0; padding: 0; text-align: left; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row label { flex: 1 1 200px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head h2 { margin: 0; }

.reveal { border: 2px dashed var(--accent); padding: 14px; margin-top: 14px; background: var(--paper); }
.reveal code { display: block; font-family: var(--mono); font-size: 13px; word-break: break-all; margin: 8px 0; user-select: all; }
pre { font-family: var(--mono); font-size: 12px; background: var(--ink); color: var(--paper); padding: 12px; overflow-x: auto; margin: 10px 0 0; }

/* The dialog is the only raised surface: it sits above the page. */
dialog { border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 6px 6px 0 var(--ink); }
dialog::backdrop { background: rgb(20 18 14 / .45); }
#dlgBody { padding: 24px; display: grid; gap: 18px; max-height: 85vh; overflow-y: auto; }
fieldset { border: 1px solid var(--line); padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
fieldset:disabled { opacity: .6; }
legend { font-weight: 800; padding: 0 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 0 16px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; min-height: 44px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
