:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dde1e7;
  --text: #1a1d23; --muted: #5f6b7a; --accent: #2557d6; --accent-text: #ffffff;
  --p0: #8b0d1f; --p1: #d1293d; --p2: #e07b1a; --p3: #c9a400; --p4: #6b7a8f;
  --ok: #1d8a4e; --bad: #d1293d; --warn-bg: #fff6e0; --warn-text: #7a5600;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --surface: #1a1d24; --surface-2: #232731; --border: #303644;
    --text: #e6e9ef; --muted: #98a2b3; --accent: #6b93ff; --accent-text: #0b0f1a;
    --p0: #ff5c74; --p1: #ff6b6b; --p2: #ffa94d; --p3: #ffd43b; --p4: #9aa7b8;
    --ok: #51cf66; --bad: #ff6b6b; --warn-bg: #3a3017; --warn-text: #ffd98a;
  }
}
/* Extra themes (chosen in the header; "system" follows Windows light / dark) */
:root[data-theme="dark"] {
  --bg: #111318; --surface: #1a1d24; --surface-2: #232731; --border: #303644;
  --text: #e6e9ef; --muted: #98a2b3; --accent: #6b93ff; --accent-text: #0b0f1a;
  --p0: #ff5c74; --p1: #ff6b6b; --p2: #ffa94d; --p3: #ffd43b; --p4: #9aa7b8;
  --ok: #51cf66; --bad: #ff6b6b; --warn-bg: #3a3017; --warn-text: #ffd98a;
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dde1e7;
  --text: #1a1d23; --muted: #5f6b7a; --accent: #2557d6; --accent-text: #ffffff;
  --p0: #8b0d1f; --p1: #d1293d; --p2: #e07b1a; --p3: #c9a400; --p4: #6b7a8f;
  --ok: #1d8a4e; --bad: #d1293d; --warn-bg: #fff6e0; --warn-text: #7a5600;
}
:root[data-theme="midnight"] {
  --bg: #0b1020; --surface: #121a2f; --surface-2: #1a2440; --border: #26324f;
  --text: #e4e9f7; --muted: #8f9bbd; --accent: #8b7bff; --accent-text: #0b1020;
  --p0: #ff5c8a; --p1: #ff6b6b; --p2: #ffa94d; --p3: #ffd43b; --p4: #8f9bbd;
  --ok: #4fd1a5; --bad: #ff6b81; --warn-bg: #2f2a1a; --warn-text: #ffd98a;
}
:root[data-theme="ocean"] {
  --bg: #eef5fa; --surface: #ffffff; --surface-2: #e3eef6; --border: #c9dbe8;
  --text: #0f2433; --muted: #4b6577; --accent: #0b7a9e; --accent-text: #ffffff;
  --p0: #8b0d1f; --p1: #c92a3d; --p2: #d9731a; --p3: #b79500; --p4: #5d7488;
  --ok: #157a52; --bad: #c92a3d; --warn-bg: #fff4dc; --warn-text: #6e4f00;
}
:root[data-theme="forest"] {
  --bg: #0f1612; --surface: #16201a; --surface-2: #1e2b23; --border: #2c3d32;
  --text: #e3ece5; --muted: #93a798; --accent: #5cc98a; --accent-text: #0b130e;
  --p0: #ff5c74; --p1: #ff6b6b; --p2: #ffa94d; --p3: #e8c547; --p4: #93a798;
  --ok: #5cc98a; --bad: #ff6b6b; --warn-bg: #33301a; --warn-text: #f0d98a;
}
:root[data-theme="contrast"] {
  --bg: #000000; --surface: #000000; --surface-2: #121212; --border: #ffffff;
  --text: #ffffff; --muted: #e0e0e0; --accent: #ffd400; --accent-text: #000000;
  --p0: #ff4d6d; --p1: #ff5c5c; --p2: #ff9f1c; --p3: #ffe600; --p4: #cfcfcf;
  --ok: #3dff8a; --bad: #ff5c5c; --warn-bg: #332b00; --warn-text: #ffe680;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; padding: 12px 0; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0;
                  padding: 14px 12px 12px; color: var(--muted); font-weight: 600; }
nav.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.header-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; padding: 8px 0; }
.header-tools select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border);
                       background: var(--surface); color: var(--text); }
.help-btn { font-size: 13px; padding: 5px 12px; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 30; overflow-y: auto;
              background: var(--surface); border-left: 1px solid var(--border); padding: 20px;
              box-shadow: -8px 0 24px rgba(0, 0, 0, .18); }
.help-panel h4 { margin: 16px 0 6px; font-size: 13.5px; }
.help-panel ul { margin: 0; padding-left: 18px; }
.help-panel li { margin-bottom: 6px; }
.help-panel .help-summary { font-size: 14px; margin: 10px 0 0; }
.help-foot { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 12px; word-break: break-all; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 64px; }
h2 { font-size: 18px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
button, .btn { font: inherit; border-radius: 8px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--border);
               background: var(--surface); color: var(--text); text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
.notice { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }
.error { color: var(--bad); font-weight: 600; }
.muted, .count { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 12px; }

/* sources */
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.source { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.source.inactive { opacity: .6; }
.source .name { font-weight: 700; }
.source .meta { font-size: 12px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px;
        border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.inv { border-color: var(--accent); color: var(--accent); }
.pill.bad { border-color: var(--bad); color: var(--bad); }
.pill.ok { border-color: var(--ok); color: var(--ok); }
details.files { margin-top: 12px; }
details.files summary { cursor: pointer; color: var(--muted); font-size: 13px; }
table.files { margin-top: 8px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; text-align: left; }
button.tile { cursor: pointer; }
.tile.active { outline: 2px solid var(--accent); }
.tile .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12px; color: var(--muted); }
/* Vulnerabilities -> Summary: headline figures (read-only) apart from the priority filter boxes (clickable) */
.stat-strip { display: flex; flex-wrap: wrap; gap: 10px 40px; padding: 14px 18px; margin-bottom: 16px;
  background: var(--surface-2); border-radius: 10px; }
.stat .n { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.filter-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.filter-label span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.tier-filter button.tile { transition: border-color .15s, transform .15s; }
.tier-filter button.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.meter > div { height: 100%; background: var(--ok); }
.meter.mid > div { background: var(--p2); } .meter.low > div { background: var(--bad); }

/* filters + tables */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters input[type=search], select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
                                      background: var(--surface); color: var(--text); }
.filters input[type=search] { flex: 1 1 220px; }
.chk { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); user-select: none; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.up-replace { background: var(--warn-bg); color: var(--warn-text); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.up-replace p { margin: 0 0 6px; }
.dg-text { max-height: 480px; overflow: auto; white-space: pre-wrap; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin: 12px 0 0; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--accent); }
th.src, td.src { text-align: center; }
tr.main-row { cursor: pointer; } tr.main-row:hover td { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { white-space: nowrap; }
.yes { color: var(--bad); font-weight: 700; } .no { color: var(--muted); }
.tick { color: var(--ok); font-weight: 700; } .cross { color: var(--bad); font-weight: 700; } .na { color: var(--border); }
.skill { color: var(--muted); max-width: 240px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: #fff; }
.t-P0 { background: var(--p0); } .t-P1 { background: var(--p1); } .t-P2 { background: var(--p2); }
.t-P3 { background: var(--p3); color: #222; } .t-P4 { background: var(--p4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: #111; } }
.tier-counts { white-space: nowrap; }
.tier-counts span { display: inline-block; min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.tier-counts .zero { color: var(--border); }
tr.detail td { background: var(--surface-2); }
.detail-grid { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; font-size: 13px; }
.detail-grid dt { color: var(--muted); } .detail-grid dd { margin: 0; word-break: break-word; }
.detail-grid a, a.link { color: var(--accent); }
@media (max-width: 720px) { .detail-grid { grid-template-columns: 1fr; } .detail-grid dt { margin-top: 6px; } }
.more { text-align: center; padding: 10px; }

/* vuln report picker */
.report-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
#up-type { max-width: 100%; font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
@media (max-width: 820px) { .report-grid { grid-template-columns: minmax(0, 1fr); } }
.file-list { border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; }
.file-list-head { padding: 6px 12px; border-bottom: 1px solid var(--border); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.file-row:last-child { border-bottom: 0; }
.file-row .mono { flex: 1; }
.file-row.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%;
        min-height: 120px; border: 2px dashed var(--border); border-radius: 8px; padding: 16px; cursor: pointer; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--surface-2); }
.cols { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.bar.indeterminate > div { width: 30%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
td.fix { max-width: 520px; }
td.fix .fix-text { font-weight: 600; }
.riskbar { display: inline-block; width: 60px; height: 6px; background: var(--surface-2); border-radius: 3px;
           overflow: hidden; vertical-align: middle; margin-right: 6px; }
.riskbar > div { height: 100%; background: var(--accent); }
pre.solution { white-space: pre-wrap; font: inherit; margin: 0; }
/* detail pages */
button.back { margin-bottom: 12px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h2 { font-size: 22px; margin: 0; font-family: var(--mono); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 16px 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-size: 18px; font-weight: 700; }
.fact .s { font-size: 12px; color: var(--muted); word-break: break-word; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 8px; }
.section-head h3 { margin: 0; font-size: 16px; }
a.link { cursor: pointer; }
.tip { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; cursor: help; }

/* reports */
.rp-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.rp-label { width: 100px; color: var(--muted); font-size: 13px; }
.rp-row select { flex: 1 1 0; min-width: 0; max-width: 100%; text-overflow: ellipsis; }  /* long option text stays inside the card */
.rp-row input[type=text], .rp-row input[type=search] { flex: 1 1 200px; font: inherit; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); }
details.collapsible > summary { cursor: pointer; font-size: 15px; }
details.collapsible[open] > summary { margin-bottom: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.start-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border);
              border-radius: 8px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.start-link:hover { border-color: var(--accent); }
.start-link span { color: var(--muted); font-size: 13px; }
#up-drop, #ud-drop { height: auto; min-height: 120px; margin-top: 8px; }
.account-box { max-width: 420px; }
#adm-add input[type=text] { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
                            background: var(--surface); color: var(--text); }
.secret-box { margin-top: 12px; padding: 12px; border: 1px solid var(--ok); border-radius: 8px; }
.secret-box code { font-size: 15px; user-select: all; }
.getstarted { border-color: var(--accent); }
.gs-steps { margin: 0; padding-left: 22px; }
.gs-steps li { padding: 8px 0; border-top: 1px solid var(--border); }
.gs-steps li:first-child { border-top: 0; }
.gs-steps li.done > div:first-child b::after { content: "  ✓ done"; color: var(--ok); font-size: 12.5px; }
.gs-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.gs-actions:empty { display: none; }
.ask-card { border: 2px solid var(--accent); padding: 20px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ask-head { display: flex; gap: 14px; align-items: flex-start; }
.ask-head h3 { font-size: 18px; margin: 0; }
.ask-icon { font-size: 28px; line-height: 1; }
.ask-form { display: flex; gap: 8px; margin: 14px 0 10px; }
.ask-form input { flex: 1; font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
                  background: var(--surface); color: var(--text); }
.ask-card .chips { padding: 0; }
.guides { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ask-nudge { display: block; margin: -4px 0 16px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 8px;
             color: var(--text); text-decoration: none; background: var(--surface); }
.ask-nudge:hover { background: var(--surface-2); }
.design-box { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px;
              background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.design-head { margin-bottom: 8px; }
.design-box input[type=text] { flex: 1 1 200px; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
                               background: var(--surface); color: var(--text); }
.manage-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; align-items: start; }
.manage-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 70px; }
.manage-nav button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; color: var(--muted);
                     font-weight: 600; border-left: 3px solid transparent; }
.manage-nav button:hover { background: var(--surface-2); color: var(--text); }
.manage-nav button.active { background: var(--surface); color: var(--text); border-left-color: var(--accent); }
.mg-intro { margin-top: 0; }
@media (max-width: 820px) {
  .manage-layout { grid-template-columns: minmax(0, 1fr); }
  .manage-nav { flex-direction: row; flex-wrap: wrap; position: static; }
}
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.delta { font-size: 12px; font-weight: 700; margin-left: 6px; }
.delta.up { color: var(--bad); } .delta.down { color: var(--ok); }
.sample-pick { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.sample-pick .chk { display: block; margin: 2px 0; }
.samples-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 8px; }
.sample { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface-2);
          display: flex; flex-direction: column; gap: 6px; }
.sample .count { font-size: 12.5px; }
.sample .row { margin-top: auto; }
.up-manual { margin-top: 10px; }
.up-manual summary { cursor: pointer; }
.up-results { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.up-results li { padding: 3px 0; }
.up-unsorted { border: 1px solid var(--p2); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.up-unsorted .row { margin-top: 6px; font-size: 13px; }
.up-unsorted .row { flex-wrap: wrap; min-width: 0; }
.up-unsorted select, .up-unsorted input { max-width: 100%; min-width: 0; }   /* long option names stay inside the box */
.up-clear { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
button.danger { color: var(--bad); border-color: var(--bad); }
.env-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.env-row:first-child { border-top: 0; }
.env-row input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
#env-new input { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); flex: 1 1 220px; }
.up-source { border-top: 1px solid var(--border); padding: 8px 0; }
.up-source:first-child { border-top: 0; }
.up-files { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
.up-files li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.report-panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.report-panels .card { display: flex; flex-direction: column; margin: 0; }
.report-panels .rp-downloads { margin-top: auto; padding-top: 8px; }
.rp-downloads { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
a.primary-btn { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.mini { width: 100%; font-size: 13px; }
.mini td, .mini th { padding: 5px 8px; }

/* actions */
.action { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.action-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.action-head .t { font-weight: 700; }
.action-body { border-top: 1px solid var(--border); padding: 12px 14px; }
.status { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.status.s-Open { color: var(--p1); border-color: var(--p1); } .status.s-Inprogress { color: var(--p2); border-color: var(--p2); }
.status.s-Done { color: var(--ok); border-color: var(--ok); } .status.s-Riskaccepted { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: start; margin-bottom: 12px; }
.form-grid label { color: var(--muted); font-size: 13px; padding-top: 6px; }
.form-grid input, .form-grid select, .form-grid textarea, .tickets input, .tickets select {
  font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%; }
.form-grid textarea { min-height: 60px; resize: vertical; }
.tickets td { padding: 4px 6px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
button.small, a.small { padding: 2px 10px; font-size: 12px; }
button.danger { color: var(--bad); border-color: var(--bad); }

/* glossary */
#gl-body { margin-top: 12px; }
.gl-group { margin-bottom: 20px; }
.gl-group h3 { font-size: 15px; margin-bottom: 8px; }
.gl-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.gl-item .term { font-weight: 700; }
.gl-item .full { color: var(--muted); margin-left: 6px; }
.gl-item p { margin: 4px 0 0; }

.subnav { display: flex; gap: 2px; flex-wrap: wrap; margin: -4px 0 16px; padding: 4px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); width: fit-content; max-width: 100%; }
.subnav button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; color: var(--muted); }
.subnav button:hover { color: var(--text); background: var(--surface-2); }
.subnav button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.pill.exc { border-color: var(--muted); color: var(--muted); border-style: dashed; }
.pill.watch { border-color: var(--accent); color: var(--accent); }
.copy-btn { border: 0; background: none; padding: 0 4px; font-size: 13px; color: var(--muted); cursor: pointer; line-height: 1; }
.copy-btn:hover { color: var(--accent); }
.copy-btn.done { color: var(--ok); }
.chips.ex-os { padding: 0; }
.chips.ex-os button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.ex-affected { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 160px; overflow: auto; margin-bottom: 8px; }
.ex-affected:empty { display: none; }
#ex-assets { width: 100%; min-height: 50px; }
.wl-comment { width: 100%; min-width: 160px; }
.expired { color: var(--bad); font-weight: 600; }
.trend-chart { width: 100%; max-width: 760px; height: auto; display: block; margin: 8px 0 4px; }
.trend-chart text { fill: var(--muted); font-size: 11px; }
.trend-chart .grid { stroke: var(--border); }
.trend-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.trend-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tile.waiting { cursor: default; opacity: .75; }
.bell-btn { position: relative; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
#bell-list h4 { margin: 14px 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
#bell-list .note { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
#bell-list .note:hover { background: var(--surface-2); }
#bell-list .note.unread { background: color-mix(in srgb, var(--accent) 10%, transparent); }
#bell-list .note > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.note-icon { width: 20px; text-align: center; }
.site-pick select { font-weight: 600; }
.test-banner { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--text); }
.test-banner a { color: var(--accent); font-weight: 600; }
.full-banner { background: var(--bad); color: #fff; }
.page-foot { margin-top: 28px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 4px 0 14px; }
.segmented button { border: 0; border-radius: 0; }
.segmented button.active { background: var(--accent); color: var(--accent-text); }
.row-do { white-space: nowrap; text-align: right; }
.row-do button { margin-left: 4px; }
tr.flash td { background: color-mix(in srgb, var(--accent) 16%, transparent); transition: background 1.5s; }
.pill.warn { border-color: var(--warn-text); color: var(--warn-text); }
.pattern { border-left: 4px solid var(--border); }
.pattern.sev-high { border-left-color: var(--bad); }
.pattern.sev-medium { border-left-color: var(--warn-text); }
.pattern h3 { margin: 6px 0 4px; }
.pattern .next { margin: 8px 0 0; }
.pattern .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pattern details { margin-top: 10px; }
.pattern .evidence { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 8px; }
@media (max-width: 720px) { .pattern .evidence { grid-template-columns: minmax(0, 1fr); } }
.pattern .assets { font-size: 12.5px; line-height: 1.7; }
/* Pattern analysis with AI */
.pa-headline { font-size: 15.5px; line-height: 1.6; }
.pa-theme.pri-high { border-left-color: var(--bad); }
.dc-evidence { margin-top: 10px; font-size: 12.5px; }
.dc-evidence summary { cursor: pointer; }
.dc-evidence pre { max-height: 260px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 6px; font-size: 11.5px; white-space: pre-wrap; }
.dc-rule { border-left: 4px solid var(--border); }
.dc-rule.still { border-left-color: var(--warn-text); }
.dc-rule.clear { border-left-color: var(--ok); }
.pa-theme.pri-medium { border-left-color: var(--warn-text); }
.pa-theme ol { margin: 6px 0 0; padding-left: 22px; }
.pa-theme .basis { margin-top: 10px; font-size: 12.5px; }
.pa-theme .basis a { margin-right: 10px; }
.pa-ai-spotted { border-left: 4px dashed var(--accent); }
.pattern.flash { outline: 2px solid var(--accent); outline-offset: 2px; }
/* AI panels (test site) */
.ai-panel { border-left: 4px dashed var(--accent); }
.ai-panel.compact { padding: 8px 12px; margin: 6px 0; background: var(--surface-2); border-radius: 8px; }
.ai-panel .ai-note { margin: 4px 0 0; }
.ai-panel .ai-err:empty { display: none; }
.ai-panel ul { padding-left: 20px; }
#draft-ai .ai-panel { margin: 0 0 10px; }
/* VM Agent */
.agent-panel { border-left: 4px solid var(--accent); }
#agent-brief .ai-out { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.msg .steps.knows { color: var(--accent); font-weight: 600; }
.proposal { margin-top: 8px; padding: 6px 10px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 13px; }
.action.flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color 1.5s; }
#ac-summary { margin: 0 0 10px; }
.subtabs { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.subtabs button { border: 0; border-radius: 0; }
.subtabs button.active { background: var(--accent); color: var(--accent-text); }

.demo-banner { background: var(--warn-bg); color: var(--warn-text); text-align: center; padding: 6px 16px; font-size: 13px; }

/* home / chat */
.chat { padding: 0; overflow: hidden; }
.chat-log { height: calc(100vh - 430px); min-height: 260px; max-height: 520px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
/* flex-shrink: 0 - messages keep their full height and the log scrolls, rather than each one being squashed into its own scroll box */
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; line-height: 1.55; overflow-x: auto; overflow-y: hidden; flex-shrink: 0; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.bot.error { border: 1px solid var(--bad); }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 22px; }
.msg.bot h4 { margin: 8px 0 4px; font-size: 14px; }
.msg.bot table { margin: 6px 0; font-size: 12.5px; background: var(--surface); }
.msg.bot code { background: var(--surface); padding: 0 4px; border-radius: 4px; }
.msg.bot a { color: var(--accent); }
.msg .steps { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.msg.thinking { color: var(--muted); font-style: italic; }
.chat-empty { color: var(--muted); text-align: center; margin: auto; max-width: 460px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chips button { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form textarea { flex: 1; font: inherit; resize: vertical; min-height: 42px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.chat .row { padding: 0 16px 10px; }

/* draft modal + untracked list */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center;
         padding: 40px 16px; z-index: 20; overflow-y: auto; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; width: min(860px, 100%);
             box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.draft-input { width: 100%; font: 13px/1.5 var(--mono); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
               background: var(--surface-2); color: var(--text); margin: 2px 0 10px; }
textarea.draft-input { resize: vertical; }
details.untracked { padding: 10px 14px; }
details.untracked summary { cursor: pointer; }
.untracked-list { max-height: 340px; overflow-y: auto; margin-top: 10px; }

/* home: threat news */
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
@media (max-width: 820px) { .news-grid { grid-template-columns: 1fr; } }
.news h4 { margin: 0 0 6px; font-size: 13.5px; }
.news-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.news-list li { padding: 6px 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.news-list li:last-child { border-bottom: 0; }
.news-list .when { color: var(--muted); font-size: 12px; margin-right: 6px; white-space: nowrap; }
.news-list .estate { color: var(--bad); font-weight: 700; white-space: nowrap; }
.news-list li.hit { border-left: 4px solid var(--bad); padding-left: 8px; background: color-mix(in srgb, var(--bad) 6%, transparent); }
.news-list li.maybe { border-left: 4px solid var(--warn-text); padding-left: 8px; }
.news-list li.divider { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 0 2px; border-bottom: 0; }
.news-list .lead { display: inline-flex; gap: 4px; align-items: center; margin-right: 6px; vertical-align: middle; }
.news-list .lead:empty { display: none; }
.news-list a.ai-verdict { text-decoration: none; color: inherit; }
.news-list .ai-check { padding: 1px 8px; font-size: 11.5px; }
.news-list a { color: var(--text); text-decoration: none; } .news-list a:hover { text-decoration: underline; }
.news-list a.cve-id { color: var(--accent); font-family: var(--mono); font-size: 12px; }

/* home: scrolling highlights + news tickers */
.ticker { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
          overflow: hidden; margin-bottom: 10px; }
.ticker-label { display: flex; align-items: center; padding: 0 16px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
                text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--border); white-space: nowrap; }
.ticker-viewport { flex: 1; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent);
                   mask-image: linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent); }
.ticker-track { display: flex; width: max-content; animation: ticker-scroll 60s linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.tick-run { display: flex; align-items: center; white-space: nowrap; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tick { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; margin: 6px 2px; font-size: 15px; color: var(--text);
        text-decoration: none; border-radius: 6px; }
.tick:hover { background: var(--surface-2); }
.tick b { font-size: 19px; font-variant-numeric: tabular-nums; }
.tick.bad b { color: var(--bad); } .tick.ok b { color: var(--ok); }
.tick-sep { color: var(--border); padding: 0 2px; }
.tick.estate { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-weight: 600; }
.tick.product { background: color-mix(in srgb, var(--p2) 16%, transparent); }
.tick .pill { font-size: 10.5px; }
.ticker-more { display: flex; align-items: center; padding: 0 12px; font-size: 12px; color: var(--accent); border-left: 1px solid var(--border);
               white-space: nowrap; }
.chat-head { padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
/* Respect "reduce motion": no scrolling animation - scroll by hand instead */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .tick-run[aria-hidden="true"] { display: none; }
}

/* Corporate: warm off-white, deep navy, strong blue, a blue-coral-amber gradient as the signature, square cards and
   pill buttons. The default on the production demo ([site] theme = "corporate"); anyone can pick it in the header. */
:root[data-theme="corporate"] {
  --bg: #f6f3f0; --surface: #ffffff; --surface-2: #efebe6; --border: #dcdce0;
  --text: #1d2833; --muted: #5d6470; --accent: #004aac; --accent-text: #ffffff;
  --p0: #9b1027; --p1: #d1293d; --p2: #e07b1a; --p3: #b38f00; --p4: #6b7a8f;
  --ok: #1d7a4a; --bad: #c8233a; --warn-bg: #fdf1e4; --warn-text: #7a4a00;
  --orange: #ff7e51; --orange-bright: #ff9900;
  --brand-gradient: linear-gradient(90deg, #6fa1ff 0%, #ff7e51 55%, #ff9900 100%);
}
:root[data-theme="corporate"] body { font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; }
:root[data-theme="corporate"] header { background: #ffffff; border-bottom: 0; box-shadow: 0 1px 0 var(--border); }
:root[data-theme="corporate"] header::after { content: ""; display: block; height: 3px; background: var(--brand-gradient); }
:root[data-theme="corporate"] .brand { color: #0e1020; letter-spacing: -0.01em; }
:root[data-theme="corporate"] nav.tabs button { color: #0e1020; font-weight: 500; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; background: none; }
:root[data-theme="corporate"] nav.subnav button, :root[data-theme="corporate"] .manage-nav button, :root[data-theme="corporate"] .subtabs button {
  border-color: transparent; }
:root[data-theme="corporate"] nav.tabs button.active { border-bottom-color: var(--orange); }
:root[data-theme="corporate"] nav.tabs button:hover { color: var(--orange); }
:root[data-theme="corporate"] nav.subnav button.active, :root[data-theme="corporate"] .manage-nav button.active {
  box-shadow: inset 0 -2px 0 var(--orange); }
:root[data-theme="corporate"] section > h2::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 6px;
  background: var(--orange-bright); }
:root[data-theme="corporate"] .ask-card { border: 1px solid var(--border); border-left: 4px solid var(--orange-bright);
  background: #fffaf6; }
:root[data-theme="corporate"] .card h3 { border-left: 3px solid var(--orange); padding-left: 8px; }
:root[data-theme="corporate"] .tick:not(.bad):not(.ok) b { color: var(--orange); }
:root[data-theme="corporate"] h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; color: #1d2833; }
:root[data-theme="corporate"] h3 { font-weight: 600; letter-spacing: -0.01em; }
:root[data-theme="corporate"] .card { border-radius: 4px; box-shadow: 0 1px 2px rgba(29, 40, 51, 0.04); }
:root[data-theme="corporate"] button, :root[data-theme="corporate"] .btn { border-radius: 999px; border-color: #1d2833; color: #1d2833; background: transparent; }
:root[data-theme="corporate"] button.primary, :root[data-theme="corporate"] .btn.primary-btn {
  background: #0e1020; border-color: #0e1020; color: #ffffff; text-transform: uppercase; letter-spacing: 0.06em; font-size: 12.5px; }
:root[data-theme="corporate"] button.primary:hover { background: var(--orange); border-color: var(--orange); }
:root[data-theme="corporate"] button:hover, :root[data-theme="corporate"] .btn:hover { border-color: var(--orange); }
:root[data-theme="corporate"] button.danger { border-color: var(--bad); color: var(--bad); }
:root[data-theme="corporate"] .tile { border-radius: 4px; padding-top: 13px;
  background: var(--brand-gradient) top / 100% 3px no-repeat, var(--surface); }
:root[data-theme="corporate"] .pill { border-radius: 999px; }
:root[data-theme="corporate"] .subnav, :root[data-theme="corporate"] .manage-nav { border-radius: 4px; }
:root[data-theme="corporate"] a.link, :root[data-theme="corporate"] a { color: var(--accent); }
:root[data-theme="corporate"] a.link:hover, :root[data-theme="corporate"] a:hover { color: var(--orange); }

/* CVE lookup */
.lookup-bar { display: flex; gap: 8px; max-width: 720px; margin: 8px 0 10px; }
.lookup-bar input { flex: 1; font-size: 16px; padding: 10px 12px; }
.lookup-recent { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.lookup-recent .pill { text-decoration: none; }
