/* Jacket Airlock. Rhapsody brand: Poppins Light, Rhapsody Blue, teal and orange accents, flat colours. */
@font-face {
  font-family: Poppins;
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(vendor/fonts/poppins-latin-300-normal.woff2) format('woff2');
}
:root {
  --blue: #1A81F4; --teal: #23C5BF; --orange: #FA7E2E;
  --black: #050F19; --gray: #7E858C; --light: #D9DFE6; --white: #FFFFFF;
  --bg: var(--white); --fg: var(--black); --muted: var(--gray); --line: var(--light); --img: var(--black);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: var(--black); --fg: var(--white); --muted: var(--light); --line: var(--gray); }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Poppins, Arial, sans-serif; font-weight: 300; color: var(--fg); background: var(--bg); line-height: 1.55; font-size: 16px; }
b, strong, th, h1, h2, h3, button, input, select, textarea { font-weight: 300; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none; }
[hidden] { display: none !important; }

.top { background: var(--blue); color: var(--white); position: sticky; top: 0; z-index: 20; }
.synth { background: var(--orange); color: var(--black); text-align: center; font-size: 14px; line-height: 1.3; padding: 5px 20px; }
.bar { display: flex; align-items: center; gap: 18px; min-height: 56px; flex-wrap: wrap; }
.brand { font-size: 22px; letter-spacing: .3px; margin-right: auto; }
nav a { color: var(--white); text-decoration: none; margin-left: 16px; font-size: 14px; }
nav a:hover, nav a:focus { text-decoration: underline; }
.pill { border: 1.5px solid var(--white); color: var(--white); border-radius: 999px; padding: 4px 14px; font-size: 14px; text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.out { background: var(--white); color: var(--blue); }

.hero { padding-top: 34px; }
h1 { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.12; margin: 0 0 14px; color: var(--blue); text-wrap: balance; }
h2 { font-size: 30px; margin: 54px 0 8px; color: var(--blue); scroll-margin-top: 100px; display: flex; align-items: center; gap: 12px; }
h3 { font-size: 19px; margin: 0 0 10px; }
.step { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--blue); align-items: center; justify-content: center; font-size: 17px; flex: none; }
section { scroll-margin-top: 100px; }
p { max-width: 900px; margin: 0 0 12px; }
.lead { font-size: 18px; }
.small { font-size: 14px; color: var(--muted); }
.note { font-size: 14px; border: 1px solid var(--line); border-left: 4px solid var(--teal); padding: 10px 14px; max-width: 900px; margin: 12px 0; }
.banner { border: 1.5px solid var(--orange); border-left-width: 6px; border-radius: 8px; padding: 10px 14px; margin: 10px 0; max-width: 900px; font-size: 15px; }
.banner.info { border-color: var(--blue); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* architecture figure */
.diagram { margin: 6px 0 14px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption { font-size: 14px; color: var(--muted); max-width: 900px; margin-top: 6px; }
.a-zone { fill: none; stroke-width: 1.5; }
.a-site { stroke: var(--blue); }
.a-cloud { stroke: var(--teal); }
.a-zt { font-family: Poppins, Arial, sans-serif; font-weight: 300; font-size: 14px; fill: var(--fg); letter-spacing: .4px; }
.a-box { fill: var(--bg); stroke: var(--gray); stroke-width: 1.5; }
.a-keep { stroke: var(--blue); }
.a-t { font-family: Poppins, Arial, sans-serif; font-weight: 300; font-size: 16px; fill: var(--fg); }
.a-s { font-family: Poppins, Arial, sans-serif; font-weight: 300; font-size: 11.5px; fill: var(--muted); }
.a-flow { stroke: var(--gray); stroke-width: 1.5; fill: none; }
.a-dash { stroke-dasharray: 5 4; }
.a-head { fill: var(--gray); }
.a-out { stroke: var(--blue); stroke-width: 2; }
.a-headb { fill: var(--blue); }
.a-gate { stroke-width: 1.5; }
#arch-gate.closed .a-gate { fill: var(--orange); stroke: var(--orange); }
#arch-gate.open .a-gate { fill: var(--teal); stroke: var(--teal); }
.a-gt { font-family: Poppins, Arial, sans-serif; font-weight: 300; font-size: 16px; fill: var(--black); }
.a-gs { font-family: Poppins, Arial, sans-serif; font-weight: 300; font-size: 12px; fill: var(--black); }

/* controls */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.row.tight { margin: 0; flex-wrap: nowrap; }
.row.tight input { flex: 1; min-width: 0; }
.btn { font: inherit; background: var(--blue); color: var(--white); border: 1.5px solid var(--blue); border-radius: 8px; padding: 8px 20px; cursor: pointer; display: inline-block; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--blue); }
.btn:disabled { background: transparent; border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .item:focus-visible, .chip:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
input[type=text], input[type=password], input[type=number], select, textarea { font: inherit; color: var(--fg); background: var(--bg); padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; max-width: 100%; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; }
label { font-size: 14px; }
label.inline { font-size: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 14px 0; }
.panel { border: 1.5px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.panel.wide { grid-column: span 2; }
.form { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 10px 12px; align-items: center; }
.form > label { color: var(--muted); }
.form > * { min-width: 0; }
.form select, .form input[type=text], .form input[type=password], .form input[type=number] { width: 100%; min-width: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.keybox { border: 1.5px solid var(--orange); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.hexline { display: block; overflow-wrap: anywhere; user-select: all; padding: 6px 0; }
.switch { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.switch input { margin-top: 5px; }

/* sources */
.drop { border: 2px dashed var(--blue); border-radius: 12px; padding: 26px 20px; text-align: center; }
.drop.over { border-style: solid; border-color: var(--teal); }
.drop p { margin: 0 auto 10px; }
.stubs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; }
.stub { border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px 16px; }
.stub h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 4px; font-size: 12px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { background: var(--teal); color: var(--black); border-color: var(--teal); }
.tag.warn { background: var(--orange); color: var(--black); border-color: var(--orange); }
.tag.info { background: var(--blue); color: var(--white); border-color: var(--blue); }

/* tables */
.tablewrap { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; background: var(--blue); color: var(--white); padding: 7px 10px; white-space: nowrap; }
td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.txt, td.num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
td.num { text-align: right; white-space: nowrap; }
#ledger-table td:first-child { white-space: nowrap; }
tr.blocked td { color: var(--muted); }
tr.refused td { border-bottom-color: var(--orange); }

/* progress and stats */
.progress { height: 8px; border: 1px solid var(--line); border-radius: 4px; margin: 10px 0 14px; overflow: hidden; }
#bar { height: 100%; width: 0; background: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.card { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.card .big { font-size: 28px; line-height: 1.15; color: var(--blue); font-variant-numeric: tabular-nums; }
.card .lab { font-size: 13px; color: var(--muted); }
.card.warn .big { color: var(--orange); }
.status { border-radius: 10px; padding: 14px 18px; font-size: 20px; margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.status.zero { background: var(--teal); color: var(--black); }
.status.out { background: var(--blue); color: var(--white); }
.status.refusal { background: var(--orange); color: var(--black); }
.status small { display: block; font-size: 14px; }
.policy { white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin: 10px 0; }

/* review */
.review { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 16px; align-items: start; }
.review-list { border: 1.5px solid var(--line); border-radius: 10px; max-height: 78vh; overflow: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.chip { font: inherit; font-size: 13px; border: 1.5px solid var(--line); background: transparent; color: var(--fg); border-radius: 999px; padding: 2px 12px; cursor: pointer; }
.chip[aria-selected="true"] { border-color: var(--blue); color: var(--blue); }
.group { padding: 8px 12px 4px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; }
.item { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: 100%; text-align: left; font: inherit; font-size: 14px; color: var(--fg); background: transparent; border: 0; border-left: 4px solid transparent; padding: 6px 12px; cursor: pointer; }
.item:hover { border-left-color: var(--line); }
.item[aria-selected="true"] { border-left-color: var(--blue); }
.item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.review-detail { border: 1.5px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.detail-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head h3 { margin: 0; overflow-wrap: anywhere; }
.reason { border: 1.5px solid var(--orange); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 8px; }
.viewer { position: relative; overflow: auto; background: var(--img); border-radius: 8px; max-height: 72vh; }
.stage { position: relative; line-height: 0; }
.stage img { display: block; width: 100%; height: auto; image-rendering: auto; }
.stage img.over { position: absolute; left: 0; top: 0; }
.stage .cut { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); pointer-events: none; }
.viewctl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; font-size: 14px; }
.viewctl input[type=range] { flex: 1; min-width: 160px; accent-color: var(--blue); }
.diff { border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 60vh; }
.diff .dhead, .diff .drow { display: grid; grid-template-columns: 1fr 1fr; }
.diff .dhead { position: sticky; top: 0; background: var(--blue); color: var(--white); font-size: 13px; z-index: 1; }
.diff .dhead div { padding: 5px 10px; }
.diff .drow > div { padding: 2px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); min-width: 0; }
.diff .drow > div:first-child { border-right: 1px solid var(--line); }
.diff .del { background: var(--orange); color: var(--black); }
.diff .ins { background: var(--teal); color: var(--black); }
.diff .gone { color: var(--muted); }
pre.json { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; max-height: 50vh; font-size: 12.5px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.legend { font-size: 13px; color: var(--muted); margin: 6px 0; }
.legend span { padding: 0 6px; border-radius: 3px; }

.foot { margin-top: 56px; padding-top: 16px; padding-bottom: 36px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .review { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  nav a { margin-left: 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* interface modules: js/ui-*.js */
.ui-bar { height: 10px; border: 1px solid var(--line); border-radius: 5px; margin: 8px 0; overflow: hidden; position: relative; }
.ui-bar > div { height: 100%; width: 0; background: var(--blue); }
.ui-bar.indet > div { width: 35%; position: absolute; animation: ui-slide 1.2s linear infinite; }
@keyframes ui-slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .ui-bar.indet > div { animation: none; left: 0; width: 100%; opacity: .4; } }
.ft { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-height: 320px; overflow: auto; font-size: 14px; margin: 8px 0; }
.ft .ft-dir > summary { cursor: pointer; }
.ft .ft-dir .ft-dir, .ft .ft-dir .ft-leaf { margin-left: 18px; }
.ft .ft-leaf { padding-left: 14px; }
.ft-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.linkbtn { font: inherit; background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; text-align: left; text-decoration: underline; overflow-wrap: anywhere; }
.small-btn { padding: 2px 12px; font-size: 13px; }
#held-table tr[aria-selected="true"] td { background: color-mix(in srgb, var(--blue) 10%, transparent); }
.held-imgs { display: flex; gap: 12px; flex-wrap: wrap; }
.held-imgs figure { margin: 0; max-width: 100%; }
.held-imgs img { max-width: min(100%, 420px); height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--img); }
.small.bad { color: var(--orange); }
