/* app.css — one stylesheet for every screen, so buttons, type and spacing stay identical everywhere.
   Same palette and fonts as the clickable prototype. */
:root {
  --bg: #F2F4F3; --surface: #FFFFFF; --surface-2: #EBF0EE; --ink: #16252A; --muted: #56666A; --line: #D6DEDB;
  --accent: #0D5B56; --accent-ink: #FFFFFF; --accent-soft: #DCEAE7;
  --ok: #24724A; --ok-soft: #DFF0E5; --warn: #8E5A00; --warn-soft: #FAEED3; --crit: #AE2318; --crit-soft: #FAE3E0;
  --f-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0E1618; --surface: #152023; --surface-2: #1B292D; --ink: #E3EBE9; --muted: #98A9AC; --line: #2A393D;
  --accent: #62B8AE; --accent-ink: #08201D; --accent-soft: #183835;
  --ok: #6CC290; --ok-soft: #15301F; --warn: #E3B256; --warn-soft: #382A0F; --crit: #F1897F; --crit-soft: #3B1916;
  color-scheme: dark; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--f-display); font-weight: 600; font-size: 1.6rem; line-height: 1.2; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.note { font-size: .84rem; color: var(--muted); }

.top { position: sticky; top: 0; z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-family: var(--f-display); font-size: 1.25rem; font-weight: 600; }
.brand span { color: var(--muted); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; }

.shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.shell.no-rail { grid-template-columns: minmax(0, 1fr); }
.rail { border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.rail a { padding: 8px 10px; border-radius: var(--r); color: var(--muted); font-weight: 500; text-decoration: none; }
.rail a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail a:hover { color: var(--ink); }
main { min-width: 0; padding: 24px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
@media (min-width: 900px) { main { padding-left: 32px; padding-right: 32px; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: var(--r); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.pad { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.narrow { max-width: 760px; }

.banner { padding: 10px 14px; border-radius: 6px; font-size: .92rem; margin-bottom: 16px; }
.banner.crit { background: var(--crit-soft); color: var(--crit); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

.landing { max-width: 880px; margin: 24px auto; display: grid; gap: 20px; }
.landing .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.landing .card { display: flex; flex-direction: column; gap: 10px; }
.landing .card .btn { align-self: flex-start; margin-top: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld label { font-size: .82rem; font-weight: 600; }
.in { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 9px; min-width: 0; }
.in[aria-invalid="true"] { border-color: var(--crit); }
.err { font-size: .8rem; color: var(--crit); }
.entity { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 12px; }
.entity-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 22px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 6px; font-size: .9rem; max-width: min(420px, calc(100vw - 32px)); z-index: 20; }
.lead { margin-top: 8px; max-width: 62ch; }
