@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url("fonts/fira-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url("fonts/fira-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 700; font-display: swap; src: url("fonts/fira-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Mono"; font-weight: 400; font-display: swap; src: url("fonts/fira-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  --paper: #ffffff;
  --ink: #0b2239;
  --ink-soft: #4a5b6e;
  --blue: #006ec7;
  --blue-deep: #00508f;
  --wash: #eaf2fa;
  --line: #d3dde8;
  --amber: #9a5500;
  --amber-wash: #fff4e0;
  --green: #17693f;
  --sans: "Fira Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "Fira Mono", ui-monospace, "Cascadia Mono", monospace;
  --gutter: 4.5rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #f2f5f9; color: var(--ink); font: 400 1rem/1.5 var(--sans); }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: var(--blue-deep); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---- header: one slim navy bar ---- */
.top { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 1.5rem;
  padding: 0 clamp(1rem, 2.5vw, 2rem); height: 3.5rem; flex: none; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; flex: none; }
.brand-logo { height: 2.5rem; width: auto; display: block; }
.brand-product { font-weight: 500; font-size: 1.05rem; color: #9fd0f7; }
.top h1 { font-size: 1.1rem; font-weight: 500; padding-left: 1.5rem; border-left: 1px solid rgba(255,255,255,.25);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-note { margin-left: auto; color: rgba(255,255,255,.75); font-size: .88rem; white-space: nowrap; }
.top-links { display: flex; gap: 1rem; font-size: .85rem; }
.top-links a { color: rgba(255,255,255,.75); }

/* ---- workspace: fills the viewport on a desktop, nothing scrolls but the result list ---- */
.page { padding: clamp(.75rem, 1.6vw, 1.25rem) clamp(1rem, 2.5vw, 2rem); max-width: 90rem; margin: 0 auto; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: clamp(.75rem, 1.6vw, 1.25rem); align-items: start; }
.main-col, .rail { min-width: 0; }
.rail { display: grid; gap: clamp(.75rem, 1.6vw, 1.25rem); }
.step, .ladder-box, .example { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.step { padding: 1.25rem 1.5rem 1.4rem; display: flex; flex-direction: column; min-height: 0; }
.step h2 { font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: .65rem; letter-spacing: -.01em; }
.step h3 { font-size: .98rem; font-weight: 700; margin: 1.1rem 0 .3rem; }
.step-no { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: .9rem; font-weight: 700; flex: none; }
.lead { margin: .7rem 0 1rem; color: var(--ink-soft); max-width: 48rem; }
.hint { color: var(--ink-soft); font-size: .88rem; }
.field-label { display: block; font-weight: 500; margin-bottom: .35rem; }

textarea, input:not([type=checkbox]):not([type=radio]), select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid #aab7c5; border-radius: 4px; padding: .5rem .65rem; }
#targets { font-family: var(--mono); font-size: .93rem; line-height: 1.6; resize: none; flex: 1 1 9rem; min-height: 9rem;
  background: #f7fafd; border-color: var(--line); padding: .8rem .95rem; }
#targets:focus { background: #fff; border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(0,110,199,.18); }
textarea::placeholder { color: #8795a5; }
#limits-hint { margin-top: .4rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .8rem 0 0; font-size: .95rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; margin-top: .18rem; accent-color: var(--blue); flex: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: 1rem; }
.btn { font: 500 .98rem var(--sans); padding: .6rem 1.1rem; border-radius: 4px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; padding: .7rem 1.4rem; }
.btn.primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.small { padding: .35rem .8rem; font-size: .88rem; border-color: #aab7c5; }
.btn.link { border: 0; background: none; padding: 0; color: var(--blue-deep); text-decoration: underline; text-underline-offset: 2px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.wide { width: 100%; }
.status { font-size: .9rem; color: var(--amber); }

.bar { height: .6rem; background: var(--wash); border-radius: 1rem; overflow: hidden; margin: 1.2rem 0 .7rem; max-width: 32rem; }
.bar-fill { height: 100%; width: 4%; background: var(--blue); transition: width .5s ease; }
.notice { border-left: 4px solid var(--amber); background: var(--amber-wash); padding: 1rem 1.2rem; max-width: 44rem; border-radius: 0 4px 4px 0; }
.notice h2, .notice h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
.rejected { font-size: .9rem; }
#rejected .notice { margin-bottom: .6rem; max-width: none; padding: .6rem .9rem; }

/* ---- the ledger: one compact line per application, details on demand ---- */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#step-result > .hint { margin: .45rem 0 .7rem; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -1.5rem -1.4rem; padding: 0 1.5rem 1rem; border-top: 1px solid var(--line); }
.entry { border-bottom: 1px solid var(--line); }
.entry > details > summary { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; align-items: center; gap: .2rem .9rem;
  padding: .6rem 0; cursor: pointer; list-style: none; }
.entry > details > summary::-webkit-details-marker { display: none; }
.entry > details > summary:hover .entry-name { color: var(--blue-deep); }
.entry-count { font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--blue); font-variant-numeric: tabular-nums; text-align: center; }
.entry.off .entry-count { color: #9aa7b5; }
.entry.off .entry-name { text-decoration: line-through; color: var(--ink-soft); }
.entry-title { min-width: 0; display: block; }
.entry-name, .entry-sub { display: block; }
.entry-name { font-family: var(--mono); font-size: 1rem; overflow-wrap: anywhere; }
.entry-sub { font-size: .84rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; align-items: center; }
.entry-meta::after { content: ""; width: .5rem; height: .5rem; margin: 0 .2rem 0 .5rem; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg) translateY(-2px); }
.entry > details[open] .entry-meta::after { transform: rotate(-135deg) translateY(-2px); }
.tag { font-size: .78rem; font-weight: 500; padding: .1rem .5rem; border-radius: 3px; background: var(--wash); color: var(--blue-deep); white-space: nowrap; }
.tag.env { background: #eef0f3; color: var(--ink); }
.tag.approach { background: var(--ink); color: #fff; }
.tag.warn { background: var(--amber-wash); color: var(--amber); border: 1px solid #e6c48f; }
.entry-count { white-space: nowrap; }
#discovered-block .result-head h3 { margin-bottom: 0; }
.entry-body { padding: 0 0 1rem 3.5rem; }
.hosts { font-size: .88rem; }
.hosts li { display: grid; grid-template-columns: minmax(0, auto) 1fr; gap: .1rem .8rem; padding: .12rem 0; }
.hosts .h, .skipped .h { font-family: var(--mono); overflow-wrap: anywhere; }
.hosts .why { color: var(--ink-soft); }
.evidence { margin-top: .4rem; font-size: .88rem; color: var(--ink-soft); }
.evidence li { padding-left: 1rem; text-indent: -1rem; }
.evidence li::before { content: "– "; }
.entry-notes { font-size: .88rem; color: var(--ink-soft); }
.entry-notes > div { background: #f3f6f9; border-left: 3px solid var(--line); padding: .3rem .65rem; margin-top: .4rem; border-radius: 0 3px 3px 0; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .7rem 1.2rem; margin-top: .8rem;
  padding: .9rem 1rem; background: var(--wash); border-radius: 4px; }
.form label { display: block; font-size: .88rem; font-weight: 500; }
.form label > select, .form label > input { margin-top: .25rem; font-weight: 400; }
.form .check { margin: 0; font-weight: 400; }
.form .help { display: block; font-weight: 400; color: var(--ink-soft); font-size: .8rem; margin-top: .2rem; line-height: 1.35; }
.form .span { grid-column: 1 / -1; }

.skipped li { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: .2rem .9rem; align-items: center;
  border-bottom: 1px solid var(--line); padding: .45rem 0; font-size: .88rem; }
.skipped .zero { font-size: 1.3rem; font-weight: 700; color: #9aa7b5; text-align: center; }
.skipped .why { color: var(--ink-soft); }
.skipped .check { margin: 0; font-size: .82rem; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.chips li { font-family: var(--mono); font-size: .82rem; padding: .1rem .5rem; border: 1px solid var(--line); border-radius: 3px; }

/* ---- the question step: one application at a time, plain choices ---- */
.q-progress { display: flex; align-items: center; gap: 1rem; margin: .7rem 0 .2rem; font-size: .88rem; color: var(--ink-soft); }
.q-progress .bar { flex: 1; margin: 0; max-width: none; height: .4rem; }
#q-body { border-top: 0; padding-top: .4rem; }
.q-app { font-family: var(--mono); font-size: 1.2rem; overflow-wrap: anywhere; }
.q-seen { color: var(--ink-soft); font-size: .9rem; margin: .2rem 0 .2rem; }
.q { margin-top: 1.1rem; }
.q-title { font-weight: 700; font-size: 1.02rem; }
.q-help { color: var(--ink-soft); font-size: .88rem; margin-top: .1rem; max-width: 46rem; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: block; padding: .5rem .95rem; border: 1.5px solid #aab7c5; border-radius: 4px; background: #fff; font-size: .95rem; }
.choice small { display: block; color: var(--ink-soft); font-size: .8rem; }
.choice input:checked + span { border-color: var(--blue); background: var(--wash); box-shadow: inset 0 0 0 1px var(--blue); font-weight: 500; }
.choice input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.q-number { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; font-size: .95rem; }
.q-number input { width: 5.5rem; }
.q-found { margin-top: .5rem; font-size: .86rem; color: var(--ink-soft); columns: 2 16rem; }
.q-found li { font-family: var(--mono); break-inside: avoid; }
.q-actions { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); justify-content: space-between; }

/* ---- rail ---- */
.example { padding: 1rem 1.1rem 1.1rem; display: grid; gap: .45rem; }
.example figcaption, .box-head h2 { font-size: .98rem; font-weight: 700; }
.ex-row { display: grid; grid-template-columns: minmax(0, 1fr) 2.4rem; column-gap: .8rem; align-items: center;
  background: var(--wash); border-left: 3px solid var(--blue); padding: .5rem .75rem .55rem; border-radius: 0 4px 4px 0; }
.ex-row ul { font-family: var(--mono); font-size: .8rem; line-height: 1.45; overflow-wrap: anywhere; }
.ex-n { grid-row: 1 / span 2; grid-column: 2; font-size: 2rem; font-weight: 700; line-height: 1; text-align: right; color: var(--blue); }
.ex-why { grid-column: 1; font-size: .8rem; color: var(--ink-soft); margin-top: .15rem; }
.ex-row.none { border-left-color: #b9c4d0; background: #f3f5f7; }
.ex-row.none .ex-n, .ex-row.none ul { color: #8a97a6; }

.tally { background: var(--ink); color: #fff; padding: 1.1rem 1.25rem 1.2rem; border-radius: 6px; box-shadow: 0 10px 30px -14px rgba(11,34,57,.6); }
.tally-main { display: flex; align-items: baseline; gap: .7rem; margin-bottom: .7rem; }
.tally-count { font-size: 3.6rem; font-weight: 700; line-height: .95; font-variant-numeric: tabular-nums; }
.tally-label { font-size: 1rem; opacity: .85; }
.tally-price > div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-top: 1px solid rgba(255,255,255,.2); font-size: .93rem; }
.tally-price .total { font-weight: 700; font-size: 1.12rem; }
.tally-note { font-size: .84rem; opacity: .85; margin: .5rem 0 .9rem; min-height: 1.2em; }
.tally-legal { font-size: .78rem; line-height: 1.4; opacity: .75; margin: -.3rem 0 .9rem; }
.tally .btn.primary { border-color: #fff; background: #fff; color: var(--ink); }
.tally .btn.primary:hover { background: var(--wash); }

.ladder-box { padding: 1rem 1.1rem 1.1rem; }
.box-head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-bottom: .6rem; }
.ladder li { isolation: isolate; position: relative; display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .5rem; align-items: center;
  padding: .32rem .6rem; font-size: .9rem; font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.ladder li::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--wash); border-radius: 3px; z-index: -1; }
.ladder li.on { font-weight: 700; box-shadow: inset 4px 0 0 var(--blue); }
.ladder li.on::before { background: #b5d6f2; }
.ladder .pct { color: var(--ink-soft); }
.ladder li.on .pct { color: var(--ink); }
.ladder-box .hint { margin-top: .55rem; font-size: .82rem; }

/* ---- dialogs ---- */
.sheet { border: 0; border-radius: 8px; padding: 1.6rem 1.75rem; width: min(38rem, calc(100vw - 2rem)); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(11,34,57,.6); }
.sheet::backdrop { background: rgba(11,34,57,.55); }
.sheet h2 { font-size: 1.3rem; margin-bottom: .6rem; }
.sheet p { margin-bottom: .6rem; }
.rules { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .93rem; margin-top: .4rem; }
.rules dt { font-weight: 700; }
.rules dd { color: var(--ink-soft); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .7rem 1rem; margin: .8rem 0; }
#request-form label { display: block; font-weight: 500; font-size: .92rem; }
#request-form label > input, #request-form label > textarea { margin-top: .25rem; font-weight: 400; }
.optional { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }

/* Desktop: the page is exactly one screen. */
@media (min-width: 60rem) and (min-height: 38rem) {
  html, body { height: 100%; overflow: hidden; }
  body { display: flex; flex-direction: column; }
  .page { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; }
  .workspace { flex: 1 1 auto; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .main-col { display: flex; flex-direction: column; min-height: 0; }
  .main-col > .step { flex: 1 1 auto; }
  .rail { align-content: start; overflow-y: auto; min-height: 0; }
}
@media (max-width: 60rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .top { height: auto; padding-block: .7rem; flex-wrap: wrap; gap: .4rem 1rem; }
  .top h1 { border: 0; padding: 0; white-space: normal; flex-basis: 100%; order: 3; }
  body { padding-bottom: 4.5rem; }
  .scroll { overflow: visible; }
  .tally { position: fixed; inset: auto 0 0 0; z-index: 5; border-radius: 0; padding: .55rem 1rem;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0 .9rem; }
  .tally-main { margin: 0; }
  .tally-label, .tally-note, .tally-legal, .tally-price > div:first-child { display: none; }
  .tally-count { font-size: 2.2rem; }
  .tally-price .total { border: 0; padding: 0; display: block; font-size: 1rem; }
  .tally-price .total dt { font-weight: 400; font-size: .78rem; opacity: .8; }
  .tally .btn.wide { width: auto; padding: .55rem .9rem; }
  .entry > details > summary, .skipped li { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .entry-meta { grid-column: 2; justify-content: flex-start; }
  .skipped .check { grid-column: 2; }
  .entry-body { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
@media (max-width: 60rem) {
  .top-note { display: none; }
  .top-links { margin-left: auto; }
  .result-head { flex-wrap: wrap; }
  .step { padding: 1rem 1rem 1.1rem; }
  .scroll { margin: 0 -1rem -1.1rem; padding: 0 1rem 1rem; }
}
#q-next { margin-left: auto; }
.q { margin-top: .85rem; }
.choice span { padding: .4rem .85rem; }
#step-questions > .hint { margin-top: .3rem; }

/* ---- admin page ---- */
.narrow { max-width: 30rem; margin: 3rem auto 0; flex: none !important; }
.admin #create-form label { display: block; font-weight: 500; font-size: .92rem; margin-top: .6rem; }
.admin #create-form input { margin-top: .25rem; font-weight: 400; }
.admin .grid2 { grid-template-columns: 1fr 1fr; margin: 0; }
.created { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.created input { font-family: var(--mono); font-size: .82rem; margin-top: .35rem; }
.invites { width: 100%; border-collapse: collapse; font-size: .92rem; }
.invites th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: .84rem; padding: .6rem .6rem .4rem 0; position: sticky; top: 0; background: var(--paper); }
.invites td { padding: .55rem .6rem .55rem 0; border-top: 1px solid var(--line); vertical-align: middle; }
.invites td:first-child { font-weight: 500; overflow-wrap: anywhere; }
.invites td .tag { margin-left: .5rem; }
.invites tr.off td { color: var(--ink-soft); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: .35rem; }
.top-links .btn.link { color: rgba(255,255,255,.8); }
.admin .top-links { margin-left: auto; }
