/* Agent Passport prototype — GOV.UK service world. White ground, ink text,
   one colour per meaning, zero radius, zero gradients. Boldness is spent on
   the verification console only. */

:root {
  --ink: #0b0c0c;
  --ink-2: #505a5f;
  --line: #b1b4b6;
  --line-soft: #e5e7e8;
  --ground: #ffffff;
  --panel: #f3f2f1;
  --blue: #1d70b8;
  --blue-dark: #003078;
  --green: #00703c;
  --green-dark: #002d18;
  --green-soft: #cce2d8;
  --red: #d4351c;
  --red-dark: #55150b;
  --red-soft: #f6d7d2;
  --amber: #f47738;
  --amber-ink: #6e3619;
  --amber-soft: #fcd6c3;
  --focus: #ffdd00;
  --term-bg: #0b0c0c;
  --term-fg: #d7dadb;
  --term-dim: #7d8386;
  --term-green: #43d17a;
  --term-amber: #ffb000;
  --term-red: #ff5c46;
  --font: "Helvetica Neue", Arial, Helvetica, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: 1.1875rem; line-height: 1.32;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
code, pre, .mono { font-family: var(--mono); }
.mono { font-size: .94em; }
.small { font-size: 1rem; line-height: 1.4; }
.hint { color: var(--ink-2); font-size: 1rem; margin: 0 0 .75rem; }
.hint code { font-size: .92em; }
em { font-style: italic; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

.skip {
  position: absolute; left: -999px; top: 0; padding: .5rem 1rem;
  background: var(--focus); color: var(--ink); text-decoration: none;
}
.skip:focus { left: 0; z-index: 10; outline: 3px solid var(--ink); }

:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 0;
  box-shadow: 0 0 0 6px var(--ink); z-index: 1;
}

/* ── Masthead ─────────────────────────────────────────── */
.masthead { background: var(--ink); color: #fff; border-bottom: 10px solid var(--blue); }
.masthead__row { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }
.masthead__brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; }
.masthead__crest { width: 1.75rem; height: 1.75rem; display: block; border: 4px solid #fff; }
.masthead__sep { color: var(--line); font-weight: 400; margin: 0 .1em; }
.masthead__tag { font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; color: var(--line); }

.phase { background: var(--ground); border-bottom: 1px solid var(--line); font-size: 1rem; }
.phase .wrap { display: flex; gap: .9rem; align-items: flex-start; padding-top: .8rem; padding-bottom: .8rem; }
.phase .tag { flex: 0 0 auto; margin-top: .1rem; }

.tag {
  display: inline-block; padding: .2rem .55rem .15rem; font-size: .875rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; line-height: 1.2; white-space: nowrap;
}
.tag--blue { background: var(--blue); color: #fff; }
.tag--green { background: var(--green-soft); color: var(--green-dark); }
.tag--red { background: var(--red-soft); color: var(--red-dark); }
.tag--amber { background: var(--amber-soft); color: var(--amber-ink); }
.tag--grey { background: var(--line-soft); color: var(--ink-2); }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs { border-bottom: 1px solid var(--line); background: var(--panel); }
.tabs__row { display: flex; gap: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs__tab {
  appearance: none; background: none; border: 0; border-bottom: 4px solid transparent;
  padding: .9rem 1.1rem .7rem; color: var(--blue); font-weight: 700; font-size: 1.0625rem;
  cursor: pointer; white-space: nowrap; display: inline-flex; flex-direction: column; align-items: flex-start; gap: .1rem;
}
.tabs__tab:hover { color: var(--blue-dark); background: #e8e8e6; }
.tabs__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); background: var(--ground); }
.tabs__sub { font-weight: 400; font-size: .85rem; color: var(--ink-2); }

/* ── Layout ────────────────────────────────────────────── */
.view { padding: 2rem 0 3rem; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 3rem; }
.col-side { border-top: 2px solid var(--blue); padding-top: 1rem; font-size: 1rem; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; gap: 1.5rem; } .col-side { border-top: 1px solid var(--line); padding-top: 1rem; } }

.caption { display: block; color: var(--ink-2); font-size: 1rem; margin-bottom: .4rem; }
.h1 { font-size: 2.25rem; line-height: 1.1; font-weight: 700; margin: 0 0 1rem; letter-spacing: -.01em; text-wrap: balance; }
.h2 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 .75rem; line-height: 1.15; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.h2__meta { font-size: 1rem; font-weight: 400; color: var(--ink-2); }
.h3 { font-size: 1.1875rem; font-weight: 700; margin: 0 0 .5rem; }
.h4 { font-size: 1rem; font-weight: 700; margin: 0 0 .4rem; }
.lede { font-size: 1.25rem; margin: 0 0 1.5rem; max-width: 42em; }
.prose { max-width: 42em; }
.prose h2 { margin-top: 2rem; }
.prose li { margin: .35rem 0; }

/* summary list */
.summary { margin: 0 0 1rem; }
.summary div { display: grid; grid-template-columns: 34% 1fr; gap: 1rem; border-bottom: 1px solid var(--line); padding: .6rem 0; }
.summary dt { font-weight: 700; margin: 0; }
.summary dd { margin: 0; }
.summary dd .mono { font-size: 1rem; }
.summary dd .sub { display: block; color: var(--ink-2); font-size: 1rem; }
@media (max-width: 560px) { .summary div { grid-template-columns: 1fr; gap: .1rem; } }

.kv div { display: grid; grid-template-columns: 1fr 1.4fr; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.layers { list-style: none; counter-reset: layer; margin: 0; padding: 0; }
.layers li { counter-increment: layer; display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.layers li::before { content: counter(layer); font-weight: 700; color: var(--ink-2); }
.layers li strong { display: block; grid-column: 2; }
.layers li span { display: block; grid-column: 2; color: var(--ink-2); font-size: .95rem; }
.layers li::before { grid-row: 1 / span 2; }
.layers__new { background: #eef4fa; margin: .4rem -0.6rem 0; padding: .6rem !important; border-bottom: 0 !important; }
.layers__new::before { color: var(--blue) !important; }

/* buttons */
.btn {
  appearance: none; display: inline-flex; align-items: center; gap: .5rem;
  background: var(--green); color: #fff; border: 2px solid transparent;
  padding: .55rem 1rem .5rem; font-weight: 400; font-size: 1.1875rem; line-height: 1.2;
  box-shadow: 0 2px 0 var(--green-dark); cursor: pointer; text-decoration: none;
}
.btn:hover { background: #005a30; }
.btn:active { top: 2px; position: relative; box-shadow: none; }
.btn:focus-visible { background: var(--focus); color: var(--ink); box-shadow: 0 2px 0 var(--ink); outline: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--start { font-weight: 700; font-size: 1.375rem; padding: .6rem 1.1rem; }
.btn__arrow { width: 0; height: 0; border: .55em solid transparent; border-left: .8em solid currentColor; border-right: 0; margin-left: .1rem; }
.btn--warning { background: var(--red); box-shadow: 0 2px 0 var(--red-dark); }
.btn--warning:hover { background: #aa2a16; }
.btn--secondary { background: var(--panel); color: var(--ink); box-shadow: 0 2px 0 #929191; }
.btn--secondary:hover { background: #dbdad9; }
.btn--small { font-size: 1rem; padding: .4rem .8rem .35rem; }
.link { appearance: none; background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: .12em; cursor: pointer; font: inherit; }
.link:hover { color: var(--blue-dark); text-decoration-thickness: 3px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.actions__note { color: var(--ink-2); font-size: 1rem; }

/* confirmation panel */
.panel--confirm { background: var(--green); color: #fff; padding: 2rem; margin: 1.5rem 0; text-align: center; }
.panel__title { font-size: 2rem; margin: 0 0 1rem; line-height: 1.1; }
.panel__ref { font-size: 1.25rem; margin: 0 0 1rem; }
.panel__ref strong { font-size: 1.6rem; font-family: var(--mono); }
.panel--confirm .link { color: #fff; }

.empty { border: 1px solid var(--line); padding: 1rem 1.25rem; color: var(--ink-2); background: var(--panel); }
.empty p { margin: 0; }

/* checks table */
.checks { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 1rem; }
.checks th, .checks td { text-align: left; padding: .55rem .6rem .5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.checks th { font-weight: 700; }
.checks td:first-child { font-family: var(--mono); white-space: nowrap; color: var(--ink-2); }
.checks tr.pending td:last-child { color: var(--ink-2); }
@media (max-width: 640px) { .checks thead { display: none; } .checks tr { display: grid; grid-template-columns: 4.5rem 1fr; padding: .5rem 0; border-bottom: 1px solid var(--line); } .checks td { border: 0; padding: .1rem .5rem .1rem 0; } .checks td:nth-child(3), .checks td:nth-child(4) { grid-column: 2; } }

/* passport card */
.passport { border: 3px solid var(--ink); margin: .5rem 0 1rem; position: relative; }
.passport__head { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; background: var(--ink); color: #fff; font-weight: 700; }
.passport__body { display: grid; grid-template-columns: 1fr 1fr; }
.passport__body > div { padding: .6rem 1rem; border-bottom: 1px solid var(--line-soft); display: grid; gap: .15rem; }
.passport__body > div:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.passport__k { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.passport__v { font-size: 1.0625rem; overflow-wrap: anywhere; }
.passport--revoked .passport__head { background: var(--red); }
.passport--revoked::after { content: "Revoked"; position: absolute; right: 1rem; bottom: 1rem; border: 4px solid var(--red); color: var(--red); font-weight: 700; font-size: 1.6rem; text-transform: uppercase; letter-spacing: .1em; padding: .1rem .6rem; transform: rotate(-8deg); background: rgba(255,255,255,.9); }
@media (max-width: 560px) { .passport__body { grid-template-columns: 1fr; } .passport__body > div:nth-child(odd) { border-right: 0; } }

.jwt { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .8rem 0; margin: 1.5rem 0; }
.jwt summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.jwt summary:hover { color: var(--blue-dark); }
.jwt__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 800px) { .jwt__grid { grid-template-columns: 1fr; } }
.code { background: var(--panel); border: 1px solid var(--line-soft); padding: .75rem; margin: 0 0 1rem; font-size: .8rem; line-height: 1.45; overflow-x: auto; white-space: pre; }
.code--wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* supervisory log */
.log { list-style: none; margin: 0; padding: 0; font-size: 1rem; }
.log li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.log li time { color: var(--ink-2); font-family: var(--mono); font-size: .9rem; }
.log__empty { color: var(--ink-2); grid-template-columns: 1fr !important; }

/* rules list */
.rules { margin: 1rem 0 0; padding-left: 1.4rem; font-size: 1rem; }
.rules li { margin: .4rem 0; }
.rules code { background: var(--panel); padding: .05rem .3rem; }

/* ── Verification console ────────────────────────────── */
.strip { display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 2rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); padding: .9rem 0; margin: 0 0 1.5rem; }
.strip > div { display: grid; gap: .15rem; align-content: start; }
.strip__k { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.strip__v { font-size: 1.25rem; font-weight: 700; }
.meter { display: block; height: .55rem; background: var(--line-soft); margin-top: .35rem; position: relative; overflow: hidden; }
.meter__fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: var(--green); transition: transform 250ms cubic-bezier(.2,.8,.2,1), background 250ms; }
.meter__fill.warn { background: var(--amber); }
.meter__fill.over { background: var(--red); }
@media (max-width: 560px) { .masthead__brand { font-size: 1.05rem; } }
@media (max-width: 720px) { .strip { grid-template-columns: 1fr 1fr; gap: 1rem; } .strip__meter { grid-column: 1 / -1; } }

.console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .console { grid-template-columns: 1fr; } }

.beats { list-style: none; margin: 0 0 1rem; padding: 0; counter-reset: beat; }
.beats li { counter-increment: beat; border-bottom: 1px solid var(--line-soft); }
.beat {
  appearance: none; width: 100%; background: none; border: 0; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: center; padding: .7rem .4rem .65rem 0; font-size: 1rem;
}
.beat::before { content: counter(beat); color: var(--ink-2); font-weight: 700; }
.beat:hover { background: var(--panel); }
.beat:focus-visible { outline: 3px solid var(--focus); box-shadow: inset 0 0 0 3px var(--ink); }
.beat[disabled] { cursor: not-allowed; color: var(--ink-2); }
.beat__label { display: grid; gap: .1rem; }
.beat__label small { color: var(--ink-2); font-size: .9rem; }
.beat__expect { font-family: var(--mono); font-size: .8rem; color: var(--ink-2); white-space: nowrap; }

.terminal { background: var(--term-bg); color: var(--term-fg); font-family: var(--mono); font-size: .875rem; line-height: 1.5; min-height: 26rem; display: flex; flex-direction: column; }
.terminal__bar { display: flex; justify-content: space-between; padding: .5rem .9rem; color: var(--term-dim); border-bottom: 1px solid #2a2d2e; font-size: .8rem; }
.terminal__lines { list-style: none; margin: 0; padding: .6rem .9rem; overflow-y: auto; max-height: 34rem; flex: 1; }
.terminal__lines li { padding: .35rem 0; border-bottom: 1px solid #1c1f20; display: grid; grid-template-columns: 4.6rem 1fr; gap: .7rem; animation: stamp 220ms cubic-bezier(.2,.9,.2,1) both; }
@keyframes stamp { from { opacity: 0; transform: translateY(4px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { .terminal__lines li { animation: none; } .meter__fill { transition: none; } }
.terminal__hint { color: var(--term-dim); grid-template-columns: 1fr !important; }
.t-time { color: var(--term-dim); }
.t-body { display: grid; gap: .1rem; }
.t-head { display: flex; gap: .7rem; flex-wrap: wrap; align-items: baseline; }
.t-action { color: #fff; }
.t-verdict { font-weight: 700; padding: 0 .4rem; color: var(--term-bg); letter-spacing: .06em; }
.t-verdict--ALLOW { background: var(--term-green); }
.t-verdict--ESCALATE { background: var(--term-amber); }
.t-verdict--DENY { background: var(--term-red); }
.t-rule { color: var(--term-amber); }
.t-reason { color: var(--term-fg); }
.t-meta { color: var(--term-dim); font-size: .8rem; }
.t-meta b { color: #9aa0a3; font-weight: 400; }

/* footer */
.footer { border-top: 1px solid var(--line); background: var(--panel); font-size: .95rem; color: var(--ink-2); margin-top: 2rem; }
.footer__row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
