/* Spend Lens — theme via [data-theme] on <html>, set by theme.js before paint.
 * Accent is a cyan/teal family in both themes, so a cost figure and a savings
 * figure never rely on hue alone to be told apart: severity and confidence carry
 * a label as well as a colour everywhere they appear. */

:root[data-theme="light"] {
  --bg: #f4f7fc; --panel: #ffffff; --ink: #151d2c; --muted: #57627a;
  --line: #dbe2ee; --accent: #0e7490; --accent-ink: #ffffff;
  --red: #c02b2b; --red-bg: #fdf1f1; --yellow: #a06a00; --yellow-bg: #fdf7ea;
  --warn: #a06a00; --warn-bg: #fdf7ea; --ok: #1d7a4a; --ok-bg: #eef8f1;
  --code-bg: #eef1f6; --shadow: 0 1px 3px rgba(18, 30, 50, 0.08);
}
:root[data-theme="dark"] {
  --bg: #0d131f; --panel: #161e2d; --ink: #e5ecf7; --muted: #93a1b8;
  --line: #27334a; --accent: #67e8f9; --accent-ink: #06212b;
  --red: #f08080; --red-bg: #2a1c1e; --yellow: #e0b45c; --yellow-bg: #282215;
  --warn: #e0b45c; --warn-bg: #282215; --ok: #6fce9e; --ok-bg: #14261d;
  --code-bg: #202b3c; --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

/* --- Header ------------------------------------------------------------ */
header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.4rem; border-bottom: 1px solid var(--line); background: var(--panel);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand .mark { width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand h1 { font-size: 1.15rem; margin: 0; }
.tagline { margin: 0; font-size: 0.82rem; color: var(--muted); }
.session { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.home-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.home-link svg { width: 14px; height: 14px; }
.home-link:hover { color: var(--ink); }
.credits { color: var(--ok); font-weight: 600; }
.topup { color: var(--accent); font-size: 0.85rem; }

button { font: inherit; cursor: pointer; border-radius: 8px; }
.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  padding: 0.35rem 0.8rem; font-size: 0.85rem;
}
.ghost:hover { border-color: var(--accent); }
.ghost.theme-toggle { width: 2.1rem; height: 2.1rem; padding: 0; position: relative; }
.ghost.theme-toggle::after { content: "\2600"; font-size: 1rem; position: absolute; inset: 0; display: grid; place-items: center; }
:root[data-theme="dark"] .ghost.theme-toggle::after { content: "\263D"; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  padding: 0.45rem 1.1rem; font-weight: 600;
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.55; cursor: default; }
.big { padding: 0.65rem 1.5rem; font-size: 1rem; border-radius: 10px; }
button.big:not(.primary) { background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
.linkish { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

/* --- Layout ------------------------------------------------------------ */
main { max-width: 980px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.klabel {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
textarea, input[type="text"], input[type="date"], select {
  width: 100%; font: inherit; color: var(--ink); background: transparent;
  border: none; outline: none; padding: 0.8rem 0.9rem;
}
textarea { resize: vertical; min-height: 10rem; display: block; }
.card.dragging { outline: 2px dashed var(--accent); outline-offset: 3px; }
input[type="file"] { font-size: 0.85rem; color: inherit; max-width: 46%; }

.options { margin-top: 1rem; }
.options summary { cursor: pointer; }
.options textarea {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  min-height: 6rem; margin-top: 0.4rem; font-size: 0.92rem;
}
.row.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-top: 1rem; }
.row.four label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--muted); }
.row.four select, .row.four input { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0.5rem 0.6rem; }
@media (max-width: 820px) { .row.four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .row.four { grid-template-columns: 1fr; } }
.row.two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; margin-top: 1rem; }
.row.two label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--muted); }
.row.two select, .row.two input { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0.5rem 0.6rem; width: 100%; box-sizing: border-box; }
@media (max-width: 620px) { .row.two { grid-template-columns: 1fr; } }
.row.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-top: 1rem; }
.row.three label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--muted); }
.row.three select, .row.three input { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0.5rem 0.6rem; width: 100%; box-sizing: border-box; }
@media (max-width: 520px) { .row.three { grid-template-columns: 1fr; } }
.pair { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; align-items: start; }
.pair > .doc-field { margin-top: 0; }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; } }
.actions { display: flex; align-items: center; gap: 0.9rem; margin-top: 1.2rem; flex-wrap: wrap; }
.meter { font-size: 0.8rem; color: var(--muted); }

/* --- Instant prescan ---------------------------------------------------- */
.prescan { margin-top: 1.1rem; }
.prescan-body { display: grid; gap: 0.55rem; margin-top: 0.3rem; }
.ps-item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 0.55rem 0.8rem; background: var(--panel); }
.ps-item.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.ps-item.kind-resource { border-left-color: var(--accent); background: var(--panel); }
.ps-item.kind-flag { border-left-color: var(--warn); }
.ps-item.kind-warn { border-left-color: var(--red); background: var(--red-bg); }
.ps-label { font-weight: 700; font-size: 0.9rem; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0 0.3rem; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 0.1rem 0.6rem; font-size: 0.76rem; white-space: nowrap;
}
.ps-why { font-size: 0.85rem; color: var(--muted); }

/* --- Progress ------------------------------------------------------------ */
.progress-panel { margin-top: 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.steps { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.45rem; }
.step { display: flex; align-items: center; gap: 0.6rem; font-size: 0.92rem; color: var(--muted); }
.step-ic { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.step.live { color: var(--ink); }
.step.live .step-ic { border-color: var(--accent); animation: pulse 1.2s infinite; }
.step.done { color: var(--ink); }
.step.done .step-ic { background: var(--ok); border-color: var(--ok); }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* --- Result ------------------------------------------------------------ */
.result { margin-top: 1.6rem; display: grid; gap: 1.3rem; }
.res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.res-head h2 { margin: 0.15rem 0 0.3rem; font-size: 1.35rem; }
.verdict { margin: 0.3rem 0 0; color: var(--muted); font-style: italic; max-width: 46rem; }
.dl-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
#partialNote:not(.hidden) { display: block; padding: 10px 14px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-bg); }

.summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.summary-card p { margin: 0.5rem 0 0; }
.arch-text p { margin: 0.5rem 0 0; }

/* --- Tables (resources, network segments) ------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; min-width: 40rem; font-size: 0.9rem; }
.data-table thead th {
  text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--code-bg); }
.net-zone .table-wrap .data-table { min-width: 28rem; }
.topo-tag { border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 0.1rem 0.65rem; }
.net-desc { margin: 0.2rem 0 0.7rem; }

/* --- Identity ----------------------------------------------------------- */
.ident-list { margin: 0.5rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.ident-list li { font-size: 0.93rem; }

/* --- WAF pillars -------------------------------------------------------- */
.waf-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.7rem; margin-top: 0.5rem; }
@media (max-width: 900px) { .waf-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .waf-row { grid-template-columns: 1fr; } }
.waf-card { background: var(--panel); border: 1px solid var(--line); border-top-width: 4px; border-radius: 10px; padding: 0.7rem 0.85rem; box-shadow: var(--shadow); }
.waf-card.st-aligned { border-top-color: var(--ok); }
.waf-card.st-risk { border-top-color: var(--yellow); }
.waf-card.st-gap { border-top-color: var(--red); }
.waf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; flex-wrap: wrap; }
.waf-pillar { font-weight: 700; font-size: 0.88rem; }
.waf-badge {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 999px; padding: 0.1rem 0.5rem;
}
.waf-badge.aligned { background: var(--ok-bg); color: var(--ok); }
.waf-badge.risk { background: var(--yellow-bg); color: var(--yellow); }
.waf-badge.gap { background: var(--red-bg); color: var(--red); }
.waf-note { margin: 0.4rem 0 0; font-size: 0.83rem; color: var(--muted); }

/* --- Risks -------------------------------------------------------------- */
.flag-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; }
.flag-head h3 { margin: 0; font-size: 1.02rem; }
.flag-dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; flex: none; }
.flag-head.red .flag-dot { background: var(--red); }
.count { color: var(--muted); }
.flag-list { display: grid; gap: 0.7rem; }
.flag-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; box-shadow: var(--shadow); }
.flag-card.sev-high { border-left: 4px solid var(--red); background: var(--red-bg); }
.flag-card.sev-medium { border-left: 4px solid var(--yellow); background: var(--yellow-bg); }
.flag-card.sev-low { border-left: 4px solid var(--line); }
.fc-head { display: flex; gap: 0.8rem; align-items: baseline; flex-wrap: wrap; }
.fc-sev { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; border-radius: 999px; padding: 0.1rem 0.55rem; }
.fc-sev.high { background: var(--red-bg); color: var(--red); }
.fc-sev.medium { background: var(--yellow-bg); color: var(--yellow); }
.fc-sev.low { background: var(--code-bg); color: var(--muted); }
.fc-cat { font-weight: 700; font-size: 0.9rem; }
.fc-copy { margin-left: auto; font-size: 0.75rem; padding: 2px 8px; }
.fc-problem { margin: 0.4rem 0 0; font-size: 0.93rem; }
.fc-fix { margin: 0.6rem 0 0; padding: 0.6rem 0.75rem; font-size: 0.78rem; }

/* --- Next steps & IaC ---------------------------------------------------- */
.fix-list { margin: 0.5rem 0 0; padding-left: 1.3rem; display: grid; gap: 0.4rem; }
.fix-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.92rem; }
.fc-snippet {
  margin: 0.6rem 0 0; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.6rem 0.8rem; overflow-x: auto; max-height: 24rem;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre;
}
.run-meta { color: var(--muted); font-size: 0.8rem; }

.raw-result { margin-top: 1.4rem; }
.raw-output { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; overflow-x: auto; font-size: 0.82rem; white-space: pre-wrap; }

/* --- How it works ------------------------------------------------------- */
.how { margin-top: 2.2rem; }
.how-lead { color: var(--muted); }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 0.8rem; }
@media (max-width: 720px) { .how-grid { grid-template-columns: 1fr; } }
.how-step { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; }
.step-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.9rem; }
.how-step h3 { margin: 0.6rem 0 0.3rem; font-size: 0.98rem; }
.how-step p { margin: 0; font-size: 0.88rem; color: var(--muted); }
.how-credit { margin-top: 1rem; font-size: 0.82rem; color: var(--muted); }
.how-credit a { color: var(--accent); }
#historyList li { margin-bottom: 6px; }
#historyList .linkish { margin-left: 6px; }

/* --- Footer & toasts ------------------------------------------------------ */
footer { border-top: 1px solid var(--line); padding: 1rem 1.4rem; text-align: center; font-size: 0.85rem; color: var(--muted); }
footer a { color: var(--muted); }
.foot-sep { margin: 0 0.5rem; }
.toasts { position: fixed; bottom: 1rem; right: 1rem; display: grid; gap: 0.5rem; z-index: 50; max-width: min(420px, 90vw); }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.88rem; box-shadow: var(--shadow);
  transition: opacity 0.5s;
}
.toast.err { border-left-color: var(--red); }
.toast.gone { opacity: 0; }
.toast a { color: var(--accent); margin-left: 0.4rem; }

/* --- Print: just the plan -------------------------------------------------- */
@media print {
  header, footer, form, .prescan, .how, .toasts, .dl-actions, .progress-panel { display: none !important; }
  body { background: #fff; color: #000; }
  .result { display: grid !important; }
  .flag-card, .summary-card, .waf-card, .table-wrap { break-inside: avoid; box-shadow: none; }
  .fc-snippet { max-height: none; white-space: pre-wrap; }
}

/* Verdict tint + status cells: posture verdict tint + status cells */
.verdict.lv-block { color: var(--red); font-style: normal; font-weight: 600; }
.verdict.lv-fix-first { color: var(--yellow); font-style: normal; font-weight: 600; }
.verdict.lv-ship { color: var(--ok); font-style: normal; font-weight: 600; }
.ck-pass { color: var(--ok); font-weight: 600; }
.ck-fail { color: var(--red); font-weight: 600; }
.ck-na { color: var(--muted); }

/* --- Spend Lens additions ---------------------------------------------------- */

/* The export box and the two context boxes. A cost export is wide, monospaced and
   pasted in bulk, so it is set in a mono face at a small size and the card itself
   carries the drop target; the prose context fields stay in the body face. */
.doc-field { margin-top: 1.1rem; }
.doc-field .card textarea { font-size: 0.93rem; }
#bill {
  min-height: 12rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* Every result block that owns a table or a list gets the same vertical rhythm,
   so the report reads as one document rather than a stack of widgets. */
.table-zone { display: grid; gap: 0.5rem; }

/* --- The five-factor score bars -------------------------------------------- */
/* A weighted score is not comparable across rows unless the bar is normalised to
   its own weight, so each fill is a percentage of that factor's ceiling and the
   raw n/weight sits alongside it. */
.score-bars { display: grid; gap: 0.35rem; margin-top: 0.2rem; }
.sb-row { display: grid; grid-template-columns: 11rem 1fr 4.5rem; align-items: center; gap: 0.6rem; }
@media (max-width: 620px) { .sb-row { grid-template-columns: 7.5rem 1fr 4rem; } }
.sb-label { font-size: 0.85rem; color: var(--muted); }
.sb-track { height: 0.55rem; border-radius: 999px; background: var(--code-bg); border: 1px solid var(--line); overflow: hidden; }
.sb-fill { display: block; height: 100%; border-radius: 999px; background: var(--muted); }
.sb-fill.good { background: var(--ok); }
.sb-fill.mid { background: var(--yellow); }
.sb-fill.bad { background: var(--red); }
.sb-num { font-size: 0.78rem; color: var(--muted); text-align: right; }

/* --- The answer block ------------------------------------------------------- */
/* This is the single field a user copies most, so it is set as the artifact it is
   — a heading and a paragraph, at reading size, not audit-table size. */
.ans-heading { margin: 0.6rem 0 0.3rem; font-size: 1.05rem; }
.ans-text { margin: 0; font-size: 1rem; line-height: 1.65; max-width: 46rem; }

/* --- Findings and FAQ pairs -------------------------------------------------- */
.finding-list { display: grid; gap: 0.7rem; }
.finding {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 10px; padding: 0.8rem 1rem; box-shadow: var(--shadow);
}
.finding.sev-critical { border-left-color: var(--red); background: var(--red-bg); }
.finding.sev-high { border-left-color: var(--red); }
.finding.sev-medium { border-left-color: var(--yellow); background: var(--yellow-bg); }
.finding.sev-low { border-left-color: var(--line); }
.f-head { display: flex; gap: 0.7rem; align-items: baseline; flex-wrap: wrap; }
.sev-badge {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 999px; padding: 0.1rem 0.55rem; background: var(--code-bg); color: var(--muted);
}
.sev-critical .sev-badge { background: var(--red-bg); color: var(--red); }
.sev-high .sev-badge { background: var(--red-bg); color: var(--red); }
.sev-medium .sev-badge { background: var(--yellow-bg); color: var(--yellow); }
.f-where { font-weight: 700; font-size: 0.92rem; }
.f-problem { margin: 0.45rem 0 0; font-size: 0.93rem; }
.f-fix {
  margin: 0.6rem 0 0.5rem; font-size: 0.88rem; line-height: 1.6;
  background: var(--code-bg); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 0.55rem 0.8rem;
}
.finding .linkish { font-size: 0.8rem; }

/* A warn-note inside a table cell must stay a cell, not become a callout box. */
td.warn-note { background: none; border: none; padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--line); margin: 0; border-radius: 0; }

/* The generated JSON-LD is a copy target, so it keeps its indentation and scrolls. */
#jsonLdOut { max-height: 26rem; white-space: pre; }

@media print {
  .finding, .summary-card, .table-wrap { break-inside: avoid; box-shadow: none; }
  #jsonLdOut { max-height: none; white-space: pre-wrap; }
}

/* --- Banner Forge additions ------------------------------------------------ */

.size-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.35rem 0.9rem; margin: 0.4rem 0 0.6rem;
}
.size-check {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem;
  padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer;
}
.size-check input { accent-color: var(--accent); }
.brand-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.35rem; }
.check-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.check-inline input { accent-color: var(--accent); }
.brand-pick { display: inline-flex; align-items: center; gap: 0.7rem; }
.swatch-label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); }
.swatch-label input[type="color"] {
  width: 2.1rem; height: 1.5rem; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: none; cursor: pointer;
}
.studio-bar { margin-bottom: 0.6rem; }
.studio-bar select { max-width: 14rem; }

.preview-grid { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.7rem; }
.banner-frame {
  flex: 1 1 300px; max-width: 100%; min-width: 240px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 0.6rem; box-shadow: var(--shadow);
}
.banner-svg { overflow-x: auto; border-radius: 6px; line-height: 0; }
.banner-svg svg { width: 100%; height: auto; display: block; border-radius: 6px; }
.banner-cap { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.45rem; flex-wrap: wrap; }

.opt-card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-top: 1rem;
}
.option-zone { margin-top: 0.6rem; }
.swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.45rem; margin: 0.5rem 0; }
.swatch {
  width: 1.15rem; height: 1.15rem; border-radius: 5px; display: inline-block;
  border: 1px solid var(--line);
}
.swatch-hex { margin-right: 0.5rem; }

.chip-pass { border-color: color-mix(in srgb, var(--ok, #16a34a) 45%, var(--line)); }
.chip-warn { border-color: color-mix(in srgb, #d97706 55%, var(--line)); color: #b45309; }
.chip-fail { border-color: #dc2626; color: #dc2626; }
[data-theme="dark"] .chip-warn { color: #fbbf24; }
[data-theme="dark"] .chip-fail { color: #f87171; }

.warn-note.small { font-size: 0.85rem; }
#simQuery { max-width: 26rem; }
@media print {
  header .session, form .actions, .banner-cap button, .dl-actions, footer { display: none !important; }
}

/* --- TLDR Studio additions: workbench editor, preview, verdict tones --- */
.verdict.lv-hold { color: #b45309; font-style: normal; font-weight: 600; }
[data-theme="dark"] .verdict.lv-hold { color: #fbbf24; }
.verdict.lv-escalate { color: var(--red); font-style: normal; font-weight: 600; }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; align-items: stretch; }
@media (max-width: 860px) { .editor-grid { grid-template-columns: 1fr; } }
.page-editor {
  width: 100%; min-height: 24rem; resize: vertical;
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.82rem; line-height: 1.5;
  background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.8rem;
}
.tldr-preview {
  min-height: 24rem; overflow-x: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.9rem 1rem;
}
.tp-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.tp-desc { margin: 0.15rem 0; color: var(--muted); }
.tp-more { font-size: 0.85rem; }
.tp-exdesc { margin: 0.8rem 0 0.25rem; font-weight: 600; }
.tp-cmd {
  background: color-mix(in srgb, var(--fg) 6%, var(--panel));
  border: 1px solid var(--line); border-radius: 6px;
  padding: 0.45rem 0.6rem; font-size: 0.82rem; white-space: pre-wrap; word-break: break-word;
}
.tp-ph {
  color: #b45309; background: color-mix(in srgb, #d97706 12%, transparent);
  border-radius: 4px; padding: 0 0.15rem; font-style: italic;
}
[data-theme="dark"] .tp-ph { color: #fbbf24; }

/* --- Adaptive Card preview ------------------------------------------------- */
.ac-card {
  border: 1px solid var(--border, rgba(128,128,128,.35));
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.7rem;
  max-width: 420px;
}
.ac-tag { opacity: 0.55; font-size: 0.72rem; margin-bottom: 0.45rem; }
.ac-facts { border-collapse: collapse; margin: 0.35rem 0; }
.ac-facts td { padding: 0.12rem 0.6rem 0.12rem 0; vertical-align: top; font-size: 0.86rem; }
.ac-fact-t { font-weight: 600; white-space: nowrap; }
.ac-img {
  border: 1px dashed var(--border, rgba(128,128,128,.45));
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.75rem;
  opacity: 0.7;
  margin: 0.3rem 0;
  word-break: break-all;
}
.ac-box { margin: 0.25rem 0; }
.ac-box-emph { background: rgba(128,128,128,.08); border-radius: 8px; padding: 0.45rem 0.55rem; }
.ac-cols { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.ac-actions { display: flex; gap: 0.5rem; margin-top: 0.55rem; flex-wrap: wrap; }
.ac-action {
  display: inline-block;
  border: 1px solid var(--accent, #7c5cff);
  color: var(--accent, #7c5cff);
  border-radius: 6px;
  padding: 0.22rem 0.7rem;
  font-size: 0.8rem;
}
.ac-unknown { opacity: 0.6; font-size: 0.75rem; }

/* --- Measured facts: clickable path chooser + field table ---------------- */
.fact-pick {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  margin-top: 0.55rem;
}
.pathbtn {
  font-size: 0.78rem; padding: 0.16rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer;
}
.pathbtn:hover { border-color: var(--accent); }
.pathbtn.on {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 600;
}
.fact-table-wrap { margin-top: 0.6rem; overflow-x: auto; }
.fact-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.fact-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.25rem 0.6rem 0.25rem 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.fact-table td {
  padding: 0.22rem 0.6rem 0.22rem 0; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.fact-table tbody tr:last-child td { border-bottom: none; }
.fact-table tr.optional td { font-style: italic; color: var(--warn); }
.fact-table .ft-sample {
  max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted);
}
.ft-tag {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.05rem 0.35rem; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok);
  font-style: normal;
}

/* --- Diff against the previous bundle ----------------------------------- */
.diff-pane {
  margin-top: 0.6rem; padding: 0.7rem 0.9rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.diff-body {
  margin: 0.5rem 0; padding: 0.6rem; max-height: 26rem; overflow: auto;
  background: var(--code-bg); border-radius: 8px;
  font-size: 0.74rem; line-height: 1.45; white-space: pre;
}
.diff-body .dl { display: block; }
.dl-add { color: var(--ok); background: var(--ok-bg); }
.dl-del { color: var(--red); background: var(--red-bg); }
.dl-ctx { color: var(--muted); }

/* A standing statement of what this app is and is not. It is a direct child of
 * <main>, outside every panel that the run lifecycle hides or shows, so no code
 * path can make it disappear at the moment it matters. */
.standing-notice {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 58rem;
}

.editor-grid.single { grid-template-columns: 1fr; }

/* The engine's grounds for each admissible cause, collapsed so the break table
   still scans. Shown for free, before any model call. */
.evidence { margin-top: 0.35rem; }
.evidence > summary { cursor: pointer; font-size: 0.78rem; color: var(--muted); }
.ev-list { margin: 0.35rem 0 0; padding-left: 1.1rem; font-size: 0.78rem; line-height: 1.45; }
.ev-list li { margin: 0.15rem 0; }

/* The line diff between the engine's report and whatever is in the editor. */
pre.diff { white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; line-height: 1.45; margin: 0; }
pre.diff .diff-add { display: block; background: rgba(46, 160, 67, 0.14); }
pre.diff .diff-del { display: block; background: rgba(214, 68, 68, 0.14); }
pre.diff .diff-same { display: block; color: var(--muted); }

/* The questions asked before anyone pastes anything in - the same eight the
   page's FAQ structured data declares, plus the comparison one. */
.faq-list { margin-top: 0.9rem; display: grid; gap: 0.55rem; }
.faq-item { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; }
.faq-item > summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 0.55rem 0 0; font-size: 0.9rem; line-height: 1.55; color: var(--muted); }
