:root {
  --ink: #14213d;
  --ink-2: #3d4a66;
  --muted: #5f687d;
  --line: #e3e6ee;
  --bg: #f6f7fb;
  --card: #ffffff;
  --accent: #fca311;
  --accent-ink: #7a4b00;
  --pass: #1f7a4d;
  --pass-bg: #e7f5ee;
  --ask: #9a5b00;
  --ask-bg: #fff4dc;
  --fail: #b42318;
  --fail-bg: #fdecea;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
code { font-family: var(--mono); font-size: 0.85em; background: #eef0f6; padding: 1px 5px; border-radius: 5px; }
a { color: var(--ink); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; font-weight: 600; }
h1 { font-weight: 500; }
h1, h2, h3 { text-wrap: balance; }
p, li span { text-wrap: pretty; }
b, strong { font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }

button, .big, select, input, textarea { font: inherit; }
button, a.ghost { cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 8px 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: background-color 160ms var(--ease), border-color 160ms var(--ease); }
button:hover { border-color: #c7ccd9; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover { background: #22325a; }
button.warn { background: var(--fail-bg); color: var(--fail); border-color: #f5c2bd; }
button.ok { background: var(--pass-bg); color: var(--pass); border-color: #b9e2cb; }
.ghost { background: transparent; }
.small { padding: 4px 12px; font-size: 0.85rem; }
.big { padding: 12px 20px; font-size: 1rem; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; color: var(--ink); }
input, select { min-height: 44px; }
textarea { width: 100%; resize: vertical; }
input#goal { flex: 1; min-width: 240px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 1.05rem; }
.brand .tag { color: var(--muted); font-size: 0.85rem; }
.modes { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 0.8rem; border-radius: 999px; padding: 4px 12px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
.chip b { font-weight: 600; }
.chip.live { border-color: #b9e2cb; background: var(--pass-bg); }
.chip.off { border-color: #f3d9a4; background: var(--ask-bg); }
.clock { display: flex; gap: 12px; align-items: center; font-size: 0.85rem; color: var(--ink-2); }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; padding: 48px 24px 32px; max-width: 1240px; margin: 0 auto; }
.eyebrow { font-size: 0.875rem; color: var(--accent-ink); font-weight: 500; margin: 0 0 12px; }
.hero h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -0.01em; }
.lede { color: var(--ink-2); font-size: 1.05rem; max-width: 56ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.story { list-style: none; margin: 0; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); counter-reset: s; align-self: start; }
.story li { counter-increment: s; position: relative; padding: 8px 12px 8px 44px; border-radius: 8px; transition: background-color 180ms var(--ease); }
.story li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: #eef0f6; display: grid; place-items: center; font-size: 0.78rem; font-weight: 600; }
.story li b { display: block; font-size: 0.95rem; }
.story li span { color: var(--muted); font-size: 0.82rem; }
.story li.now { background: var(--ask-bg); }
.story li.now::before { background: var(--accent); color: #fff; }
.story li.done::before { content: "\2713"; background: var(--pass); color: #fff; }
.story .say { margin-top: 12px; padding: 12px; background: var(--ink); color: #fff; border-radius: 8px; font-size: 0.9rem; }

.layout { display: grid; grid-template-columns: 208px 1fr; gap: 24px; max-width: 1240px; margin: 0 auto; padding: 0 24px 48px; }
.side { position: sticky; top: 72px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.side a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; font-size: 0.95rem; }
.side a:hover { background: #eceef5; }
.side a { transition: background-color 160ms var(--ease); }
.side i { font-style: normal; width: 20px; height: 20px; border-radius: 4px; background: #eceef5; display: grid; place-items: center; font-size: 0.75rem; font-weight: 600; }
main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; scroll-margin-top: 80px; }
.panel > header p { color: var(--ink-2); margin: 0 0 16px; max-width: 62ch; }
.row { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.wrap { flex-wrap: wrap; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.presets button { font-size: 0.82rem; padding: 4px 12px; background: #f3f4f8; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.rule { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.rule small { color: var(--muted); display: block; font-size: 0.78rem; }
.rule b { font-size: 1rem; }
.callout { border-radius: 8px; padding: 12px 16px; margin: 12px 0; font-size: 0.93rem; }
.callout.q { background: var(--ask-bg); color: #5c3800; }
.callout.w { background: #eef0f6; color: var(--ink-2); }
.callout.err { background: var(--fail-bg); color: var(--fail); }
.callout.ok { background: var(--pass-bg); color: var(--pass); }
.callout ul { margin: 4px 0 0; padding-left: 18px; }

.meter { height: 10px; background: #eceef5; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.kv { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0; }
.kv div small { display: block; color: var(--muted); font-size: 0.78rem; }

.decision { border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; overflow: hidden; }
.decision > .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.decision .item b { display: block; }
.decision .item span { color: var(--muted); font-size: 0.88rem; }
.verdict { font-weight: 600; border-radius: 6px; padding: 4px 12px; font-size: 0.85rem; white-space: nowrap; }
.verdict.ALLOW { background: var(--pass-bg); color: var(--pass); }
.verdict.ASK { background: var(--ask-bg); color: var(--ask); }
.verdict.DENY { background: var(--fail-bg); color: var(--fail); }
.checks { list-style: none; margin: 0; padding: 6px 16px 12px; }
.checks li { display: grid; grid-template-columns: 64px 168px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.checks li:last-child { border-bottom: 0; }
.out { font-size: 0.75rem; font-weight: 600; border-radius: 4px; padding: 2px 8px; text-align: center; align-self: start; }
.out.pass { background: var(--pass-bg); color: var(--pass); }
.out.ask { background: var(--ask-bg); color: var(--ask); }
.out.fail { background: var(--fail-bg); color: var(--fail); }
.why { padding: 0 16px 12px; color: var(--ink-2); font-size: 0.88rem; }
.actions { display: flex; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; align-items: center; }

.order { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.order .top-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 12px 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); font-size: 0.86rem; }
.timeline li { margin: 4px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); }
.timeline li.DELIVERED::before { background: var(--pass); }
.timeline li.DELAYED::before { background: var(--fail); }
.facts { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 8px 0; }
.facts td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts td:first-child { color: var(--muted); width: 192px; }
.facts td.src { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }
.deadline { font-weight: 600; }
.deadline.urgent { color: var(--fail); }
.casebox { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-top: 12px; }
.casebox textarea { margin-top: 8px; }
.by { font-size: 0.78rem; color: var(--muted); }

.audit { list-style: none; padding: 0; margin: 0; font-size: 0.84rem; max-height: 420px; overflow: auto; }
.audit li { display: grid; grid-template-columns: 40px 152px 72px 1fr; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.audit .h { font-family: var(--mono); color: var(--muted); font-size: 0.75rem; }
.members { display: grid; gap: 8px; margin: 8px 0; }
.members .m { display: grid; grid-template-columns: 1fr 1.4fr 88px 32px; gap: 8px; }
.members .m > * { min-width: 0; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 0.92rem; opacity: 0; transition: opacity 200ms var(--ease); pointer-events: none; max-width: min(90vw, 640px); }
#toast.on { opacity: 1; }
#toast.bad { background: var(--fail); }
.foot { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 20px; }

.simpage { display: grid; place-items: center; min-height: 100vh; }
.sim-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; max-width: 460px; }
.sim-badge { display: inline-block; background: var(--ask-bg); color: var(--ask); font-weight: 600; font-size: 0.78rem; padding: 4px 12px; border-radius: 99px; }
.simpage form { display: flex; gap: 12px; margin-top: 16px; }

@media (max-width: 900px) {
  .top { position: static; }
  .hero, .layout { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; }
  .checks li { grid-template-columns: 56px 1fr; }
  .checks li .d { grid-column: 1 / -1; }
  .audit li { grid-template-columns: 40px 1fr; }
  .audit li > :nth-child(n+3) { grid-column: 2; }
  .members .m { grid-template-columns: 1fr 72px 44px; }
  .members .m > input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
.results { border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 16px; margin: 14px 0; }
.results ul { list-style: none; margin: 0; padding: 0; }
.results li { padding: 8px 0; border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.results li .small { float: right; }
.results li .muted { font-size: 0.85rem; }

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