/* Lottie Ship — an engineering surface, not a canvas: dense tables, honest
 * severity colour, one accent. Dark by default, real light theme. */

:root[data-theme="dark"] {
  --bg: #0a0d12;
  --panel: #10141b;
  --panel-2: #151a23;
  --panel-3: #1b212c;
  --line: #232a36;
  --text: #e7ecf4;
  --muted: #8f9cb0;
  --accent: #7dd3fc;
  --accent-ink: #06283a;
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --checker-a: #1a1f29;
  --checker-b: #12161e;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}
:root[data-theme="light"] {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --panel-3: #e4e9f0;
  --line: #d9e0ea;
  --text: #141a22;
  --muted: #586474;
  --accent: #0369a1;
  --accent-ink: #ffffff;
  --violet: #6d28d9;
  --ok: #047857;
  --warn: #b45309;
  --bad: #dc2626;
  --checker-a: #e6eaf0;
  --checker-b: #f7f9fc;
  --shadow: 0 8px 24px rgba(20, 26, 34, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
a { color: var(--accent); }
h2 { font-size: 15px; margin: 0; letter-spacing: 0.2px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* --- Header ------------------------------------------------------------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 16px 26px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; gap: 14px; align-items: center; min-width: 260px; }
.brand .mark { width: 38px; height: 38px; color: var(--accent); flex: none; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.session { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; }
.home-link svg { width: 13px; height: 13px; }
.home-link:hover { color: var(--text); }
.credits { padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); }
.topup { font-size: 12.5px; text-decoration: none; border-bottom: 1px dotted currentColor; }

/* --- Buttons ------------------------------------------------------------ */
button { font: inherit; cursor: pointer; border-radius: 8px; }
.ghost {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 6px 12px; font-size: 13px;
}
.ghost:hover:not(:disabled) { background: var(--panel-3); }
.ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.ghost.small { padding: 4px 9px; font-size: 12.5px; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  padding: 9px 18px; font-weight: 620; font-size: 14px;
}
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.theme-toggle { width: 32px; height: 30px; padding: 0; }

/* --- Lane switcher ------------------------------------------------------ */
.lanes {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.lane-stage { display: flex; flex-direction: column; gap: 6px; }
.stage-name { font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.lane-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lane {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 7px 14px; text-align: left; min-width: 132px;
}
.lane:hover { background: var(--panel-3); }
.lane.active { border-color: var(--accent); background: var(--panel-3); box-shadow: inset 0 -2px 0 var(--accent); }
.lane-title { font-size: 13.5px; font-weight: 600; }
.lane-sub { font-size: 11.5px; color: var(--muted); }

/* --- Layout ------------------------------------------------------------- */
main { padding: 22px 26px 40px; }
.workspace { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .workspace { grid-template-columns: 1fr; } }
.panel-left, .panel-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

form {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.klabel { font-size: 13px; font-weight: 600; }
label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 3px; }
textarea, input[type="number"], input[type="text"], input[type="search"], select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 13.5px;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
#ctxCompat, #ctxEmbed { font-family: inherit; font-size: 13.5px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; gap: 10px; }
.row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .row.three { grid-template-columns: 1fr; } }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.run-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.drop { position: relative; border: 1px dashed var(--line); border-radius: 10px; padding: 8px; transition: border-color 0.15s, background 0.15s; }
.drop.over { border-color: var(--accent); background: var(--panel-2); }
.drop textarea { border: none; background: transparent; padding: 4px 2px; }
.drop-hint { margin: 4px 2px 0; font-size: 11.5px; color: var(--muted); }

fieldset.lane-opts {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px;
  margin: 0; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2);
}
fieldset.lane-opts legend { font-size: 12px; font-weight: 640; padding: 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.target-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
@media (max-width: 560px) { .target-list { grid-template-columns: 1fr; } }
.target-list label { display: flex; align-items: flex-start; gap: 7px; color: var(--text); font-size: 13px; margin: 0; cursor: pointer; }
.target-list input { margin-top: 3px; flex: none; accent-color: var(--accent); }
.target-list .t-blurb { display: block; color: var(--muted); font-size: 11.5px; }

/* --- Cards -------------------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-actions input[type="search"] { width: 180px; }
.card.empty h2 { margin-bottom: 8px; }
.card.empty p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.card.empty p strong { color: var(--text); }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-weight: 500; vertical-align: middle; margin-left: 6px; }
.chip.free { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }

/* --- Preview stage ------------------------------------------------------ */
.stage {
  min-height: 260px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; overflow: hidden;
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-color: var(--checker-b);
}
.stage.solid-dark { background-image: none; background-color: #0b0b0d; }
.stage.solid-light { background-image: none; background-color: #ffffff; }
.stage svg, .stage canvas { max-width: 100%; max-height: 420px; display: block; }
.transport { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.transport input[type="range"] { flex: 1 1 140px; min-width: 120px; accent-color: var(--accent); }

/* --- Probe report ------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.stat .v { font-size: 17px; font-weight: 640; margin-top: 1px; }
.stat .v small { font-size: 11.5px; font-weight: 400; color: var(--muted); }

.sect { margin-top: 16px; }
.sect > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 8px; font-weight: 640; }

.finding { display: flex; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); margin-bottom: 7px; }
.finding .sev {
  flex: none; width: 8px; border-radius: 4px; align-self: stretch;
}
.finding.block .sev { background: var(--bad); }
.finding.warn .sev { background: var(--warn); }
.finding.info .sev { background: var(--muted); }
.finding .body { min-width: 0; flex: 1; }
.finding .t { font-weight: 600; font-size: 13.5px; }
.finding .t .n { color: var(--muted); font-weight: 400; font-size: 12px; }
.finding .where { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-word; }
.finding .fix { font-size: 12.5px; margin-top: 5px; color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 620px; }
table.matrix th, table.matrix td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.matrix thead th { background: var(--panel-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 620; }
table.matrix tbody tr:last-child td { border-bottom: none; }
table.matrix td.feat { white-space: normal; min-width: 160px; }
table.matrix td.feat .n { color: var(--muted); font-size: 11.5px; }
.lvl { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.lvl::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lvl.yes { color: var(--ok); } .lvl.yes::before { background: var(--ok); }
.lvl.partial { color: var(--warn); } .lvl.partial::before { background: var(--warn); }
.lvl.no { color: var(--bad); } .lvl.no::before { background: var(--bad); }

.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin-bottom: 12px; }
.verdict { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--panel-2); border-left-width: 3px; }
.verdict.clean { border-left-color: var(--ok); }
.verdict.caveats { border-left-color: var(--warn); }
.verdict.blocked { border-left-color: var(--bad); }
.verdict .r { font-weight: 640; font-size: 13px; }
.verdict .h { font-size: 12px; color: var(--muted); margin-top: 2px; }
.verdict ul { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); }

.bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.contrib { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.contrib + .action { font-size: 12px; color: var(--muted); margin: 3px 0 10px; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }
ul.plain li:last-child { border-bottom: none; }
ul.plain li .r { color: var(--muted); font-size: 12px; white-space: nowrap; }
.none { color: var(--muted); font-size: 13px; font-style: italic; }

/* --- Callouts, toast, steps -------------------------------------------- */
.callout { border-radius: 9px; padding: 9px 12px; font-size: 13px; margin: 0; border: 1px solid var(--line); background: var(--panel-2); }
.callout.err { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.callout.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.steps li .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line); flex: none; }
.steps li.doing { color: var(--text); }
.steps li.doing .dot { background: var(--accent); border-color: var(--accent); }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 16px; box-shadow: var(--shadow); font-size: 13.5px; z-index: 40; max-width: min(560px, 92vw);
}
.toast.err { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }

/* --- Result ------------------------------------------------------------- */
#resultMeta { margin-bottom: 10px; }
.rsect { margin-top: 16px; }
.rsect h3 { font-size: 13.5px; margin: 0 0 6px; }
.rsect p { margin: 0 0 8px; font-size: 13.5px; }
.item { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin-bottom: 9px; }
.item.block { border-left-color: var(--bad); }
.item.warn { border-left-color: var(--warn); }
.item.info { border-left-color: var(--muted); }
.item .l { font-weight: 600; font-size: 13.5px; }
.item .d { font-size: 13px; margin-top: 2px; }
.item .f { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
pre.code, pre.raw {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.5; margin: 0; white-space: pre;
}
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0 5px; }
.code-head .fn { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 4px 0; }
.checklist li::before { content: "\2610"; color: var(--muted); flex: none; }
.verdict-banner { border-radius: 9px; padding: 10px 13px; border: 1px solid var(--line); border-left-width: 4px; background: var(--panel-2); margin-bottom: 12px; }
.verdict-banner.ship { border-left-color: var(--ok); }
.verdict-banner.ship-with-changes { border-left-color: var(--warn); }
.verdict-banner.do-not-ship { border-left-color: var(--bad); }
.verdict-banner .vv { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.verdict-banner .vs { font-size: 13.5px; margin-top: 3px; }
.handoff { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.handoff .hl { font-size: 13px; color: var(--muted); margin-right: 4px; }

/* --- History ------------------------------------------------------------ */
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-list li { border-top: 1px solid var(--line); padding: 9px 0; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hist-list li:first-child { border-top: none; }
.hist-list .ht { font-size: 13.5px; font-weight: 600; }
.hist-list .hm { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.hist-list .ha { display: flex; gap: 5px; flex: none; }

/* --- Footer ------------------------------------------------------------- */
footer { border-top: 1px solid var(--line); padding: 20px 26px 34px; color: var(--muted); font-size: 12.5px; background: var(--panel); }
footer p { margin: 0 0 8px; max-width: 96ch; }
.footer-links a { margin-right: 2px; }

/* --- api.html code groups ---------------------------------------------- */
.code-group { margin: 14px 0 22px; }
.lang-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.lang-tabs button {
  padding: 4px 10px; font-size: 12.5px; border-radius: 6px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); cursor: pointer;
}
.lang-tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.code-group pre {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; overflow-x: auto; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55;
}
.doc-main { padding: 22px 26px 40px; max-width: 1080px; margin: 0 auto; }
.doc-main table { border-collapse: collapse; width: 100%; margin-top: 10px; font-size: 13px; }
.doc-main th, .doc-main td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-main ul, .doc-main ol { font-size: 13.5px; color: var(--muted); padding-left: 20px; }
.doc-main ul li, .doc-main ol li { margin: 4px 0; }

/* --- A preview that refused to build is evidence, not an app error -------- */
.stage-fail { font-size: 13px; }
.stage-fail .sf-head { font-weight: 650; color: var(--bad); font-size: 13.5px; }
.stage-fail .sf-cause { margin-top: 3px; font-weight: 600; }
.stage-fail .sf-fix { margin-top: 5px; color: var(--text); }
.stage-fail .sf-others { margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.stage-fail .sf-raw {
  margin-top: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted); word-break: break-word;
}
.stage-fail .sf-note { margin-top: 7px; font-size: 12px; color: var(--muted); }
.stage-fail .sf-btn { margin-top: 10px; }
.stage-fail.repaired .sf-head { color: var(--warn); }
#stageError:has(.stage-fail.repaired) { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--text); }
/* The offer sits on a preview that built fine and is still wrong, so it must
   not wear the failure colour. */
.stage-fail.offer .sf-head { color: var(--warn); }
#stageError:has(.stage-fail.offer) { color: var(--text); }
.stage-fail .sf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stage-fail .sf-actions .sf-btn { margin-top: 0; }

/* --- Sign-in inside the gate, and the slim export ------------------------- */
.gate-signin { margin-left: 10px; vertical-align: middle; }

.slim-export .slim-opts { display: grid; gap: 8px; margin: 4px 0 12px; }
.slim-opt { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.slim-opt input { margin-top: 3px; flex: none; accent-color: var(--accent); }
.slim-opt .so-t { display: block; font-weight: 600; }
.slim-opt .so-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.so-tag {
  display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--muted);
}
.so-tag.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ok); }
.so-tag.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); color: var(--warn); }
.slim-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* --- What changed since the last probe of this document ------------------- */
ul.diff-list li.better .r { color: var(--ok); }
ul.diff-list li.worse .r { color: var(--bad); }
