/* Dark is the default so the app looks unchanged for anyone who never touches
   the toggle. theme.js sets data-theme="light" on <html> from localStorage
   before first paint. Every colour below comes from a token declared in both
   blocks - never hardcode a literal in a rule, or it will only work in one
   theme. */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #07111f;
  --glow: #163a5b;
  --panel: #0e1c2f;
  --panel-2: #13253b;
  --sunken: #071321;
  --nested: #061826;
  --line: #263b55;
  --card-shadow: #0005;

  /* text */
  --text: #edf5ff;
  --muted: #9eb1c8;
  --quote-text: #d7e5f5;

  /* accents */
  --cyan: #0284c7;
  --cyan-soft: #0e2a47;
  --blue: #0284c7;
  --red: #ff6577;
  --amber: #ffbd5c;
  --green: #53d68a;

  /* form controls */
  --input-bg: #071321;
  --input-border: #38506b;
  --input-text: #ffffff;
  --btn-text: #ffffff;
  --btn-grad-2: #38bdf8;
  --danger-bg: #6d2330;
  --danger-text: #ffffff;

  /* status tones: soft background paired with the matching accent */
  --tone-good-bg: #153c2a;
  --tone-bad-bg: #4a1721;
  --tone-warn-bg: #42321a;
  --tone-info-bg: #182f4f;
  --tone-info-fg: #7eb3ff;

  /* message blocks */
  --error-bg: #4a1721;
  --error-border: #9d3547;
  --error-text: #ffd8de;
  --warn-bg: #392d1b;
  --warn-border: #8b692d;
  --warn-text: #ffe0a6;
  --notice-bg: #392d1b66;
  --notice-text: #caddf2;

  /* code and clause blocks */
  --code-bg: #050d17;
  --code-text: #e0f2fe;
  --code-panel-bg: #0b223d66;
  --code-panel-border: #1e4570;
  --quote-text: #e1ebf4;
  --linked-border: #1e4570;
  --nested: #0e2034;

  /* PDF Highlight variables */
  --yellow-hl: rgba(254, 240, 138, 0.78);
  --yellow-border: #eab308;
  --yellow-glow: rgba(234, 179, 8, 0.4);
  --yellow-badge-bg: #854d0e;
  --yellow-badge-text: #fef08a;

  /* sidebar: a shade below the page so the content column reads as raised */
  --rail-bg: #050e1a;
  --rail-line: #1b2c42;
  --rail-active-bg: #0f253d;

  /* evidence ticks: violet, deliberately none of the status colours, because an
     asserted item is neither observed-pass nor still-outstanding */
  --evidence-fg: #b39bff;
  --evidence-bg: #241f3d;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f1f6fb;
  --glow: #d3e6f7;
  --panel: #ffffff;
  --panel-2: #e9f1f8;
  --sunken: #f6fafd;
  --nested: #eef5fb;
  --line: #ccdbe8;
  --card-shadow: #102a4216;

  --text: #0b1c2e;
  --muted: #4c6379;
  --quote-text: #29405a;

  /* the dark cyan/red/green would fail contrast on white, so each accent is
     darkened rather than reused */
  --cyan: #0284c7;
  --cyan-soft: #e0f2fe;
  --blue: #0284c7;
  --red: #c22539;
  --amber: #96590a;
  --green: #14724a;

  --input-bg: #ffffff;
  --input-border: #b4c8da;
  --input-text: #0b1c2e;
  --btn-text: #ffffff;
  --btn-grad-2: #0369a1;
  --danger-bg: #bd3143;
  --danger-text: #ffffff;

  --tone-good-bg: #dbf2e5;
  --tone-bad-bg: #fbdfe3;
  --tone-warn-bg: #fceed5;
  --tone-info-bg: #dee9ff;
  --tone-info-fg: #1c4da4;

  --error-bg: #fce9ed;
  --error-border: #e7a5b1;
  --error-text: #8d1023;
  --warn-bg: #fcf2df;
  --warn-border: #ddba79;
  --warn-text: #74480a;
  --notice-bg: #fcf2dfcc;
  --notice-text: #35485c;

  --code-bg: #0d1f31;
  --code-text: #0369a1;
  --code-panel-bg: #f0f7ff;
  --code-panel-border: #bae6fd;
  --linked-border: #93c5fd;

  --rail-bg: #ffffff;
  --rail-line: #dce8f2;
  --rail-active-bg: #e0f2fe;

  /* the dark violet would wash out on white, so it darkens rather than repeats */
  --evidence-fg: #6c4fd8;
  --evidence-bg: #ece8fb;

  /* PDF Highlight variables */
  --yellow-hl: rgba(254, 240, 138, 0.9);
  --yellow-border: #ca8a04;
  --yellow-glow: rgba(202, 138, 4, 0.35);
  --yellow-badge-bg: #fef9c3;
  --yellow-badge-text: #854d0e;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Noto Sans Thai", sans-serif; }

/* ── App shell: fixed sidebar, scrolling content ──
   The rail is sticky and full height; the content column carries its own
   padding so nothing sits against the divider. */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.rail {
  background: var(--rail-bg); border-right: 1px solid var(--rail-line);
  padding: 22px 0 18px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 0 20px; display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: var(--cyan-soft); color: var(--cyan); border: 1px solid var(--code-panel-border);
  display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: .02em;
}
.brand-text strong { display: block; font-size: 13.5px; font-weight: 700; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 20px 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 20px; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600;
  background: none; border: 0; border-left: 2px solid transparent; cursor: pointer;
}
.nav-item:hover { color: var(--text); background: var(--rail-active-bg); }
.nav-item.active { color: var(--cyan); background: var(--rail-active-bg); border-left-color: var(--cyan); }
.nav-item .ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav-item .count { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 100px; background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .count:empty { display: none; }
.nav-item.active .count { background: var(--cyan-soft); color: var(--cyan); }

.rail-foot { margin-top: auto; padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.ghost-btn {
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 12.5px;
  cursor: pointer; text-align: center; text-decoration: none; display: block;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }
.user-nav, .theme-nav { gap: 8px; }
.language-toggle { min-width: 46px; font-weight: 800; }
.rail-user { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--rail-line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--tone-info-bg); color: var(--tone-info-fg); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.rail-user .who { min-width: 0; }
.rail-user .who b { display: block; font-size: 12px; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 15px 30px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar-signout { flex: none; }
.mobile-menu-toggle, .mobile-menu-backdrop { display: none; }
.chip-safe { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--green); background: var(--tone-good-bg); border-radius: 100px; padding: 4px 11px; }
.chip-safe .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.content { padding: 26px 30px 70px; display: flex; flex-direction: column; gap: 20px; width: min(1180px, 100%); }
.content > [hidden] { display: none !important; }

.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
/* The topbar already names the current view, so section headings no longer
   carry hero weight - they sit one step below it. */
h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.03em; line-height: 1.1; margin: 10px 0 16px; }
h2 { margin: 6px 0; font-size: 21px; letter-spacing: -.015em; }
h3 { margin: 0 0 14px; }
p { color: var(--muted); line-height: 1.65; }
.scan-card, article, .finding { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 12px; }
.standards-section { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
.standard-card h2 { font-size: 23px; }
.standard-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.standard-head h2 { margin: 4px 0 0; }
#wss-panel { margin-top: 14px; }
.download-link { display: inline-flex; margin-top: 8px; padding: 10px 14px; border: 1px solid var(--cyan); border-radius: 9px; color: var(--cyan); font-weight: 750; text-decoration: none; }
.download-link:hover { background: var(--cyan-soft); }
.source-link { display: block; width: fit-content; margin-top: 10px; color: var(--muted); font-size: 13px; }
.scan-card { padding: 20px; }
label { display: block; font-weight: 700; margin-bottom: 10px; }
.input-row { display: flex; gap: 12px; }
input, select { flex: 1; min-width: 0; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 11px; padding: 15px 16px; color: var(--input-text); font: inherit; }
input:focus, select:focus { outline: 2px solid var(--cyan); border-color: transparent; }
button { border: 0; border-radius: 11px; padding: 13px 18px; font: inherit; font-weight: 800; cursor: pointer; color: var(--btn-text); background: linear-gradient(120deg, var(--cyan), var(--btn-grad-2)); }
button:disabled { opacity: .55; cursor: wait; }
button.secondary, .tab { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.theme-toggle { padding: 7px 12px; font-size: 12px; font-weight: 700; border-radius: 9px; white-space: nowrap; }
.safe-note { color: var(--muted); margin-top: 12px; font-size: 13px; }
.hidden { display: none !important; }
.error { margin-top: 16px; background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-text); padding: 13px; border-radius: 10px; }
.access-message { margin-bottom: 18px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); padding: 13px; border-radius: 10px; }
.admin-shell { max-width: 1180px; margin: 0 auto; padding: 48px 16px 80px; }
.admin-login { max-width: 430px; margin: 60px auto; }
.admin-login form { display: grid; gap: 12px; }
.admin-login input { width: 100%; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-layout { display: grid; grid-template-columns: 215px minmax(0, 1fr); gap: 22px; align-items: start; }
.admin-sidebar { display: grid; gap: 16px; position: sticky; top: 16px; }
.admin-menu { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.admin-menu .nav-label { padding: 6px 10px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.admin-menu-item { width: 100%; text-align: left; background: transparent; color: var(--muted); border: 0; border-left: 3px solid transparent; border-radius: 8px; padding: 11px 12px; font-size: 13.5px; }
.admin-menu-item:hover, .admin-menu-item.active { background: var(--rail-active-bg); color: var(--cyan); border-left-color: var(--cyan); }
.admin-workspace { min-width: 0; }
.admin-filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-filter-bar input { padding: 8px 12px; font-size: 13px; border-radius: 9px; min-width: 240px; }
.admin-filter-bar button { padding: 8px 13px; font-size: 12.5px; border-radius: 9px; }
.admin-domain-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.admin-domain-icon { width: 24px; height: 24px; border-radius: 6px; background: var(--cyan-soft); color: var(--cyan); display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 800; flex: none; }
.admin-subtext { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.admin-pqc-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-pqc-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.admin-pqc-pill.enforced { background: rgba(16, 185, 129, 0.16); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.35); }
.admin-pqc-pill.preferred { background: rgba(59, 130, 246, 0.16); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.35); }
.admin-pqc-pill.client { background: rgba(245, 158, 11, 0.16); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.35); }
.admin-pqc-pill.classical { background: var(--sunken); color: var(--muted); border: 1px solid var(--line); }
.admin-subtable-row > td { background: var(--sunken); padding: 14px 18px; }
.admin-subtable-wrap { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; background: var(--panel); }
.admin-json-pre { margin: 10px 0 0; padding: 12px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); font-size: 11.5px; max-height: 360px; overflow: auto; white-space: pre; }
.company-summaries { display: grid; gap: 18px; }
.company-summary-card { padding: 20px; min-width: 0; }
.company-summary-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.company-summary-head h3 { margin: 4px 0 0; }
.company-total { text-align: right; display: grid; }
.company-total b { color: var(--cyan); font-size: 26px; }
.company-total span { color: var(--muted); font-size: 11px; }
.company-chart { display: grid; gap: 9px; margin-bottom: 18px; }
.company-bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(140px, 2fr) 32px; gap: 10px; align-items: center; font-size: 12px; }
.company-bar-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.company-bar-row > b { text-align: right; color: var(--cyan); }
.company-bar-track { height: 9px; overflow: hidden; border-radius: 99px; background: var(--sunken); }
.company-bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--btn-grad-2)); }
.access-request { margin-bottom: 18px; padding: 16px; border: 1px solid var(--warn-border); border-radius: 10px; background: var(--warn-bg); }
.access-gate { max-width: 760px; margin: 8vh auto 0; }
.access-gate .access-message { margin-bottom: 0; }
.access-gate .access-message + .access-request:not(.hidden) { margin-top: 16px; }
.access-locked .nav-group { display: none; }
.access-locked .topbar .crumb,
.access-locked .topbar .chip-safe,
.access-locked .topbar .mobile-menu-toggle { display: none; }
.access-locked [data-panel] { display: none !important; }
.dga-context { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.dga-context li { color: var(--muted); line-height: 1.6; margin: 8px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
/* Column headings are labels, not links - uppercase and quiet, with the accent
   saved for things that are actually actionable. */
th { color: var(--muted); white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
td { color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sunken); }
td.num, .table-wrap time { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 7px 9px; font-size: 12px; }
.danger { background: var(--danger-bg); color: var(--danger-text); }
.status-pill { padding: 3px 8px; border-radius: 99px; font-weight: 800; }
.status-pending { color: var(--amber); background: var(--tone-warn-bg); }
.status-allowed { color: var(--green); background: var(--tone-good-bg); }
.status-blocked { color: var(--red); background: var(--tone-bad-bg); }
.progress { margin-top: 20px; color: var(--muted); }
.progress span { display: block; height: 3px; width: 100%; margin-bottom: 12px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); background-size: 50% 100%; animation: load 1.2s linear infinite; }
@keyframes load { to { background-position: 200% 0; } }
#report { display: flex; flex-direction: column; gap: 20px; }
.report-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-head .actions button { padding: 7px 11px; font-size: 12px; font-weight: 700; border-radius: 8px; }
.executive-summary { display: none; }


/* Summary tiles: these four counts are what the page is for, so they get the
   one big-number treatment on the screen. */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; }
.stat .k { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 27px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--muted); }
.stat.pass .v { color: var(--green); }
.stat.fail .v { color: var(--red); }
.stat.rec .v { color: var(--amber); }
.stat.man .v { color: var(--tone-info-fg); }

.notice { color: var(--notice-text); border-left: 3px solid var(--amber); background: var(--notice-bg); padding: 13px 16px; border-radius: 0 10px 10px 0; }
#report-limitation { margin: 16px 0; font-weight: 700; }

/* Compliance: one shared baseline across the three requirement levels. */
.compliance-section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.section-title h3 { margin: 0; font-size: 14.5px; }
.section-title span { color: var(--muted); font-size: 11.5px; }
.compliance-charts { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; }
.level-row { display: grid; grid-template-columns: 92px 1fr 78px; align-items: center; gap: 14px; }
.level-name { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.level-name small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11px; }
/* Two segments sit side by side in one track: what the scan observed, then what
   a reviewer ticked off. The hatch keeps the asserted part visually distinct
   from the measured part even at a glance. */
.track { height: 8px; border-radius: 100px; background: var(--sunken); border: 1px solid var(--line); overflow: hidden; display: flex; }
.fill { height: 100%; }
.fill.g { background: var(--green); }
.fill.a { background: var(--amber); }
.fill.r { background: var(--red); }
.fill.evidenced {
  background: repeating-linear-gradient(-45deg, var(--evidence-fg) 0 3px, var(--evidence-bg) 3px 6px);
}
.level-val { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.level-val b { color: var(--text); }
.level-val .ev-add { color: var(--evidence-fg); font-weight: 700; }

/* Five fact panels sharing one bordered box, divided rather than boxed each. */
.details-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.details-grid article { padding: 14px 18px; border: 0; border-radius: 0; background: var(--panel); }
.details-grid h3 { margin: 0 0 9px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card-head-flex { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.card-head-flex h3 { margin: 0; }
.pqc-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; display: none; line-height: 1.2; }
.pqc-pill.ready { display: inline-flex; align-items: center; background: var(--tone-good-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }
.pqc-pill.classical { display: inline-flex; align-items: center; background: var(--tone-warn-bg); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.details-grid article.pqc-card {
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.details-grid article.pqc-card:hover {
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.details-grid article.pqc-card.ready { background: linear-gradient(180deg, var(--tone-good-bg) 0%, var(--panel) 45%); }
.details-grid article.pqc-card.ready:hover {
  background: linear-gradient(180deg, var(--tone-good-bg) 0%, var(--panel-2) 65%);
  box-shadow: inset 0 0 0 1px var(--green);
}
.pqc-card-link-wrap {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.pqc-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: .02em;
}
.details-grid article.pqc-card:hover .pqc-card-link {
  text-decoration: underline;
}
article { padding: 20px; overflow-wrap: anywhere; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.kv span { color: var(--muted); flex: none; }
.kv b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.kv b.ok { color: var(--green); }
.kv b.warn { color: var(--amber); }
.kv small { color: var(--muted); font-weight: 500; }
.fact-note { margin: 9px 0 0 !important; font-size: 11.5px !important; color: var(--muted); }
/* Underline tabs rather than pill buttons: they label the list below them
   instead of acting on it. */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600; padding: 9px 14px; cursor: pointer; }
.tab:hover { color: var(--text); background: none; }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); background: none; }

/* Requirement level is the second filter axis, so it reads as chips rather than
   another tab strip - two underline rows would look like one control split in
   half, when in fact either can be set independently of the other. */
.level-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.level-filter-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.level-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 100px;
  background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.level-chip small { font-weight: 400; font-size: 11px; opacity: .85; }
.level-chip .n { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
.level-chip:hover { color: var(--text); border-color: var(--muted); background: none; }
.level-chip.active { color: var(--cyan); border-color: var(--cyan); background: var(--cyan-soft); }
.level-chip.empty { opacity: .45; }
.empty-note { color: var(--muted); font-size: 13px; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; margin: 0; }

.findings { display: flex; flex-direction: column; gap: 9px; }
.finding { padding: 15px 17px; display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--line); }
.finding.sev-fail { border-left-color: var(--red); }
.finding.sev-recommendation { border-left-color: var(--amber); }
.finding.sev-manual_review { border-left-color: var(--tone-info-fg); }
.finding.sev-pass { border-left-color: var(--green); }

.f-top { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.f-id { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.f-title { flex-basis: 100%; order: 2; margin: 0 !important; font-size: 15px !important; }
.lvl { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.f-line { margin: 0 !important; font-size: 13px !important; }
.f-line .ev { color: var(--muted); white-space: pre-wrap; word-break: break-word; }

/* Ticking a manual-review finding records that a reviewer has seen the evidence.
   The card keeps its blue manual stripe but picks up the evidence tint, so it
   is never mistaken for something the scan itself proved. */
.ev-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.ev-check input { width: 14px; height: 14px; margin: 0; accent-color: var(--evidence-fg); cursor: pointer; flex: none; }
.ev-check:hover { color: var(--evidence-fg); }
.finding.evidenced { border-left-color: var(--evidence-fg); background: var(--evidence-bg); }
.finding.evidenced .ev-check { color: var(--evidence-fg); }

.badge { display: inline-flex; align-items: center; justify-content: center; width: fit-content; border-radius: 100px; padding: 3px 9px; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.pass { background: var(--tone-good-bg); color: var(--green); }
.fail { background: var(--tone-bad-bg); color: var(--red); }
.recommendation { background: var(--tone-warn-bg); color: var(--amber); }
.manual_review { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.finding h3 { font-size: 17px; margin: 0 0 8px; }
.finding p { margin: 4px 0; font-size: 14px; }
.mapping { color: var(--cyan) !important; font-size: 11.5px !important; margin: 0 !important; }
.nginx-guidance { margin-top: 4px; padding: 13px; border: 1px solid var(--code-panel-border); border-radius: 10px; background: var(--code-panel-bg); display: flex; flex-direction: column; gap: 10px; }
.nginx-top { display: flex; align-items: center; gap: 9px; font-size: 12.5px; flex-wrap: wrap; }
.nginx-top .tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); background: var(--cyan-soft); padding: 2px 8px; border-radius: 100px; border: 1px solid var(--code-panel-border); white-space: nowrap; }
.nginx-summary { flex: 1; min-width: 200px; }
.copy-btn { margin-left: auto; border: 1px solid var(--code-panel-border); background: none; color: var(--muted); border-radius: 7px; padding: 4px 10px; font: inherit; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.nginx-guidance pre { margin: 0; padding: 12px; overflow-x: auto; border-radius: 8px; background: var(--code-bg); color: var(--code-text); white-space: pre; }
.nginx-guidance code { font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nginx-guidance .caution { color: var(--amber); }
.directive-docs { color: var(--muted); font-size: 12px; }
.directive-docs ul { margin: 7px 0 0; padding-left: 20px; display: grid; gap: 7px; }
.directive-docs li span { display: block; margin-top: 2px; line-height: 1.5; }
.directive-docs a { color: var(--cyan); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-decoration: underline; text-underline-offset: 2px; }
.references { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.references summary { color: var(--cyan); cursor: pointer; font-weight: 750; }
.reference-note { font-size: 12px !important; }
.clause { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.clause h4 { margin: 0 0 8px; font-size: 14px; }
.clause blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--blue); color: var(--quote-text); line-height: 1.65; font-size: 13px; }
.clause a { color: var(--cyan); font-size: 13px; }
.clause.has-linked { border-color: var(--linked-border); }
.cross-ref { margin: 0 0 8px !important; font-size: 12px !important; color: var(--cyan); }
.linked-clause { margin-top: 12px; margin-left: 12px; border-left: 3px solid var(--cyan); background: var(--nested); }
.linked-clause .link-marker { margin: 0 0 6px !important; font-size: 12px !important; color: var(--muted); }

/* ── Per-user scan history ── */
.history-card { padding: 24px; margin-bottom: 20px; }
.history-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.history-head h2 { margin: 4px 0 6px; font-size: 24px; }
.history-head p { margin: 0; font-size: 13px; }
.history-card .safe-note { margin-top: 14px; }
.history-card .no-report { color: var(--muted); }
.history-card .pick { width: 17px; height: 17px; accent-color: var(--cyan); cursor: pointer; }
#history-more { margin-top: 14px; }
.history-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.outcome-success { background: var(--tone-good-bg); color: var(--green); }
.outcome-rejected { background: var(--tone-warn-bg); color: var(--amber); }
.outcome-error { background: var(--tone-bad-bg); color: var(--red); }
.outcome-busy, .outcome-running { background: var(--tone-info-bg); color: var(--tone-info-fg); }

/* ── Change over time ── */
#compare-view { padding: 24px; margin-bottom: 24px; }
.compare-tallies { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin: 18px 0 22px; }
.compare-tallies .stat .v { font-size: 24px; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.compare-grid h3 { font-size: 15px; margin: 0 0 10px; }
.compare-changes-title { margin: 24px 0 10px; font-size: 15px; }
.trend { font-weight: 800; white-space: nowrap; }
.trend.good { color: var(--green); }
.trend.bad { color: var(--red); }
.trend.flat { color: var(--muted); }
.kind-fixed { background: var(--tone-good-bg); color: var(--green); }
.kind-regressed { background: var(--tone-bad-bg); color: var(--red); }
.kind-changed, .kind-new { background: var(--tone-warn-bg); color: var(--amber); }
.kind-removed { background: var(--panel-2); color: var(--muted); }
.evidence-cell { min-width: 220px; }
.evidence-cell div + div { margin-top: 5px; }
.evidence-cell small { color: var(--cyan); font-weight: 700; }

/* ── Reference action bar & PDF Highlight Drawer (Option 1) ── */
.ref-actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.btn-pdf-drawer {
  background: linear-gradient(135deg, var(--cyan), var(--btn-grad-2));
  color: var(--btn-text);
  border: 0;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}
.btn-pdf-drawer:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
}
.ref-pdf-fallback {
  color: var(--cyan);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Overlay */
.pdf-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 12, 24, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.pdf-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Side Drawer (Desktop) */
.pdf-drawer {
  position: fixed;
  top: 0;
  right: -660px;
  width: 640px;
  max-width: 90vw;
  height: 100dvh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  box-shadow: -14px 0 38px rgba(0,0,0,0.5);
  transition: right .32s cubic-bezier(0.16, 1, 0.3, 1);
}
.pdf-drawer.open {
  right: 0;
}
.drawer-handle {
  display: none;
}

/* Drawer Header */
.drawer-header {
  padding: 14px 18px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.drawer-title-main {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-tag-pill {
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.drawer-title-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hl-status-pill {
  background: var(--yellow-badge-bg);
  color: var(--yellow-badge-text);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hl-status-pill .hl-dot {
  width: 6px;
  height: 6px;
  background: #ca8a04;
  border-radius: 50%;
  animation: hlPulse 1.5s infinite;
}
@keyframes hlPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.35); }
}
.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tool-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tool-btn.close {
  background: #3c2025;
  border-color: #6d333d;
  color: #ff9da9;
  font-size: 18px;
  line-height: 1;
  padding: 4px 10px;
}
.tool-btn.close:hover { background: #5c2830; color: #fff; }

/* Sub Navigation Bar */
.drawer-subbar {
  padding: 8px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.drawer-view-tabs {
  display: flex;
  gap: 4px;
}
.drawer-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.drawer-tab.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--cyan);
}
.drawer-quick-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.jump-btn {
  background: var(--cyan-soft);
  border: 1px solid var(--line);
  color: var(--cyan);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.jump-btn:hover {
  background: var(--cyan);
  color: #fff;
}

/* Drawer Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  background: #09121d;
  display: flex;
  flex-direction: column;
}
:root[data-theme="light"] .drawer-body {
  background: #e5edf5;
}
.drawer-view-doc, .drawer-view-pdf {
  flex: 1;
  display: none;
  padding: 24px 18px;
}
.drawer-view-doc.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.drawer-view-pdf.active {
  display: flex;
  flex-direction: column;
  padding: 0;
  width: 100%;
  height: 100%;
  flex: 1;
}
.pdf-embed-frame {
  width: 100%;
  height: 100%;
  flex: 1;
  border: 0;
  min-height: 400px;
}

/* Realistic A4 Paper Sheet */
.pdf-page-sheet {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 595.276 / 841.89;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}
.official-pdf-page {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pdf-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #222;
  padding-bottom: 7px;
  margin-bottom: 18px;
  font-size: 11px;
  color: #444;
  font-weight: 600;
}
.pdf-sheet-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #0b1c2e;
  margin-bottom: 14px;
}
.pdf-sheet-h3 {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  margin-top: 14px;
  margin-bottom: 6px;
}
.pdf-sheet-p {
  text-align: justify;
  margin-bottom: 12px;
  text-indent: 26px;
  color: #222;
}

/* Highlight Box (The core feature) */
.pdf-highlight-box {
  position: absolute;
  background: rgba(250, 204, 21, .30);
  border: 2px solid rgba(202, 138, 4, .92);
  border-radius: 3px;
  box-shadow: 0 0 16px var(--yellow-glow);
  scroll-margin-top: 36px;
  pointer-events: none;
}
.pdf-highlight-box.pulse-glow {
  animation: pdfBoxGlow 2.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pdfBoxGlow {
  0% {
    outline-color: #f59e0b;
    outline-width: 4px;
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.85);
    background-color: rgba(253, 224, 71, .48);
  }
  50% {
    outline-color: #eab308;
    outline-width: 3px;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.6);
    background-color: rgba(254, 240, 138, .38);
  }
  100% {
    outline-color: var(--yellow-border);
    outline-width: 2px;
    box-shadow: 0 0 16px var(--yellow-glow);
    background-color: rgba(250, 204, 21, .30);
  }
}
.pdf-hl-tooltip {
  position: absolute;
  top: -24px;
  left: 0;
  background: var(--yellow-badge-bg);
  color: var(--yellow-badge-text);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 10;
}

/* On narrow screens the rail becomes an off-canvas menu. The topbar remains
   available so users can always open navigation or sign out. */
@media (max-width: 900px) {
  .shell { display: block; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(82vw, 300px);
    height: 100dvh; overflow-y: auto; padding: 22px 0 18px;
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: 12px 0 32px rgba(0, 0, 0, .24);
  }
  .rail.mobile-open { transform: translateX(0); }
  .mobile-menu-toggle { display: inline-flex; align-items: center; gap: 7px; }
  .mobile-menu-backdrop {
    position: fixed; inset: 0; z-index: 19; width: 100%; height: 100%;
    border: 0; background: rgba(3, 12, 24, .56); cursor: pointer;
  }
  .mobile-menu-backdrop:not([hidden]) { display: block; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar { gap: 10px; }
  .chip-safe { display: none; }
}

@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-menu { position: static; grid-template-columns: 1fr 1fr; }
  .admin-menu .nav-label { grid-column: 1 / -1; }
  .content { padding-top: 18px; }
  .input-row, .report-head { display: grid; }
  .standards-section { grid-template-columns: 1fr; }
  .standard-head { display: grid; gap: 12px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .details-grid { grid-template-columns: 1fr; }
  .details-grid article { border: 0; }
  .level-row { grid-template-columns: 80px 1fr 64px; gap: 10px; }
  .actions, .tabs { overflow-x: auto; }

  /* Mobile Bottom Sheet conversion */
  .pdf-drawer {
    top: auto;
    bottom: -105%;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 88dvh;
    max-height: 90dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transition: bottom .32s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -12px 36px rgba(0,0,0,0.55);
  }
  .pdf-drawer.open {
    bottom: 0;
  }
  .drawer-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: var(--muted);
    border-radius: 2px;
    margin: 8px auto 2px;
    opacity: 0.6;
  }
  .pdf-page-sheet {
    padding: 24px 18px;
    font-size: 14px;
    line-height: 1.7;
    min-height: auto;
  }
  .drawer-subbar {
    padding: 6px 12px;
  }
}
/* ── Post-Quantum (PQC) Dedicated Report View ── */
.pqc-report-section {
  padding: 26px 30px;
  margin-bottom: 24px;
}
.pqc-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.pqc-head-info h2 {
  font-size: 24px;
  margin: 6px 0 8px;
  letter-spacing: -.02em;
}
.pqc-head-info p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.pqc-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pqc-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  padding: 10px 14px;
  font-size: 13px;
}
.pqc-pdf-link svg {
  width: 16px;
  height: 16px;
}

/* Overall Status Banner */
.pqc-status-banner {
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 26px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-width: 1.5px;
  border-style: solid;
}
.pqc-status-banner.ready {
  background: var(--tone-good-bg);
  border-color: var(--green);
}
.pqc-status-banner.classical {
  background: var(--tone-warn-bg);
  border-color: var(--amber);
}
.pqc-banner-badge {
  flex-shrink: 0;
  font-size: 26px;
  line-height: 1;
}
.pqc-banner-content h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.pqc-status-banner.ready .pqc-banner-content h3 { color: var(--green); }
.pqc-status-banner.classical .pqc-banner-content h3 { color: var(--amber); }
.pqc-banner-content p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.pqc-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.pqc-banner-meta span b {
  color: var(--text);
}

/* Sections inside PQC Report */
.pqc-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.pqc-section-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.pqc-section-title .section-tag {
  background: var(--cyan-soft);
  color: var(--cyan);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

/* Section 1: SSL/TLS Parameters Grid */
.pqc-param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.pqc-param-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 16px;
}
.pqc-param-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.pqc-param-card .value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.pqc-param-card .value.ok { color: var(--green); }
.pqc-param-card .value.warn { color: var(--amber); }

/* Table styling in PQC Report */
.pqc-table-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 22px;
  background: var(--panel);
}
.pqc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.5;
}
.pqc-table th {
  background: var(--panel-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.pqc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.pqc-table tr:last-child td {
  border-bottom: 0;
}
.urgency-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.urgency-badge.max { background: var(--tone-bad-bg); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.urgency-badge.high { background: var(--tone-warn-bg); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.urgency-badge.med { background: var(--tone-info-bg); color: var(--tone-info-fg); border: 1px solid rgba(14, 165, 233, 0.3); }

/* Section 2: HNDL & Mosca Model */
.hndl-explain-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 9px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.hndl-explain-card h4 {
  margin: 0 0 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--amber);
}
.hndl-explain-card p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
}
.hndl-explain-card p:last-child {
  margin-bottom: 0;
}

/* Mosca Framework Box */
.mosca-container {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.mosca-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mosca-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.mosca-formula-badge {
  background: var(--panel-2);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
}
.mosca-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0;
}
.mosca-var-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.mosca-var-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 6px;
}
.mosca-var-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.mosca-calc-result {
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 14px;
  border: 1px solid var(--line);
}
.mosca-calc-result.danger {
  background: var(--tone-bad-bg);
  border-color: var(--red);
}
.mosca-calc-result.safe {
  background: var(--tone-good-bg);
  border-color: var(--green);
}
.mosca-calc-result strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.mosca-calc-result.danger strong { color: var(--red); }
.mosca-calc-result.safe strong { color: var(--green); }
.mosca-calc-result p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

/* Section 3: Recommendations & Roadmap */
.pqc-recommendation-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 20px;
}
.pqc-recommendation-box h4 {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--cyan);
}
.pqc-code-snippet {
  background: #09121d;
  color: #7dd3fc;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
}
:root[data-theme="light"] .pqc-code-snippet {
  background: #f1f5f9;
  color: #0369a1;
}

/* 7-Step Roadmap */
.pqc-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}
.pqc-step-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  position: relative;
}
.pqc-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--cyan);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}
.pqc-step-card h5 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.pqc-step-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

/* 3-Tier Stakeholder Communication */
.pqc-stakeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0 24px;
}
.pqc-stakeholder-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.pqc-stakeholder-card h5 {
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pqc-stakeholder-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.pqc-stakeholder-card li {
  margin-bottom: 4px;
}

@media (max-width: 760px) {
  .mosca-grid, .pqc-stakeholder-grid {
    grid-template-columns: 1fr;
  }
  .pqc-report-head {
    flex-direction: column;
  }
}

@media (min-width: 761px) and (max-width: 1150px) {
  .details-grid { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  @page { size: A4; margin: 12mm; }
  :root, :root[data-theme="light"] { color-scheme: light; }
  body { background: #fff !important; color: #111 !important; }
  .rail, .topbar, .content > .scan-card:not(#pqc-report-view), .standards-section, #history-card,
  #compare-view, .report-head, #report-limitation, .tabs, .level-filter,
  .copy-btn, .pdf-drawer, .pdf-drawer-overlay, .pqc-head-actions { display: none !important; }
  .shell, .main { display: block; }
  .content { max-width: none; padding: 0; }
  body:not(.printing-pqc) #report { display: block !important; }
  body.printing-pqc #report { display: none !important; }
  body.printing-pqc #pqc-report-view { display: block !important; background: #fff !important; border: 0 !important; }
  body.printing-pqc .pqc-report-section { padding: 0 !important; background: transparent !important; border: 0 !important; }
  body.printing-pqc .pqc-status-banner,
  body.printing-pqc .pqc-param-card,
  body.printing-pqc .pqc-table-box,
  body.printing-pqc .hndl-explain-card,
  body.printing-pqc .mosca-container,
  body.printing-pqc .pqc-recommendation-box,
  body.printing-pqc .pqc-step-card,
  body.printing-pqc .pqc-stakeholder-card {
    background: #fff !important;
    color: #111 !important;
    border-color: #cbd5e1 !important;
    break-inside: avoid;
  }
  .executive-summary {
    display: flex; flex-direction: column; min-height: 270mm; padding: 7mm 7mm 5mm;
    border-top: 3mm solid #176d7c;
    margin-bottom: 0 !important;
    break-after: page; page-break-after: always;
  }
  .executive-kicker { color: #176d7c; font-size: 8.5pt; font-weight: 800; letter-spacing: .15em; }
  .executive-summary h1 { margin: 2.5mm 0 1mm; font-size: 24pt; line-height: 1.15; }
  .executive-target { margin: 0; color: #176d7c !important; font-size: 12pt; font-weight: 700; overflow-wrap: anywhere; }
  .executive-meta { margin: 1mm 0 4mm; font-size: 8pt; }
  .executive-verdict { padding: 4mm 5mm; border: 1px solid #8aaeb5; border-left: 2.5mm solid #176d7c; border-radius: 2mm; }
  .executive-verdict span { display: block; color: #52616a; font-size: 9pt; }
  .executive-verdict strong { display: block; margin: .5mm 0; font-size: 17pt; }
  .executive-verdict p { margin: 0; font-size: 8.5pt; }
  .executive-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.5mm; margin: 4mm 0; }
  .executive-counts div { padding: 3mm 2mm; border: 1px solid #c5ced2; border-radius: 2mm; text-align: center; }
  .executive-counts b, .executive-counts span { display: block; }
  .executive-counts b { font-size: 16pt; line-height: 1.1; }
  .executive-counts span { margin-top: 1mm; color: #52616a; font-size: 7.5pt; }
  .executive-body { display: grid; grid-template-columns: 1.2fr .8fr; gap: 6mm; flex: 1; }
  .executive-body > section { padding-right: 5mm; border-right: 1px solid #d5dcdf; }
  .executive-summary h2 { margin: 2mm 0 3mm; color: #263b44; font-size: 11pt; }
  .executive-priorities { margin: 0; padding-left: 6mm; }
  .executive-priorities li { margin-bottom: 2.5mm; padding-left: 1mm; break-inside: avoid; }
  .executive-priorities b, .executive-priorities span { display: block; }
  .executive-priorities b { font-size: 8.5pt; }
  .executive-priorities span { margin-top: .5mm; color: #333; font-size: 7.5pt; line-height: 1.38; }
  .executive-levels { margin-bottom: 5mm; }
  .executive-level { display: grid; grid-template-columns: 18mm 1fr 12mm; align-items: center; gap: 2mm; margin: 2.5mm 0; }
  .executive-level > span b, .executive-level > span small { display: block; }
  .executive-level > span b { font-size: 8pt; }
  .executive-level > span small { color: #68777e; font-size: 6.5pt; }
  .executive-level i { display: block; height: 2.5mm; overflow: hidden; border-radius: 2mm; background: #e5ebed; }
  .executive-level em { display: block; height: 100%; background: #20849a; }
  .executive-level > strong { font-size: 8pt; text-align: right; }
  .executive-facts { border-top: 1px solid #d5dcdf; }
  .executive-facts div { display: grid; grid-template-columns: 25mm 1fr; gap: 2mm; padding: 2mm 0; border-bottom: 1px solid #e3e8ea; }
  .executive-facts span { color: #68777e; font-size: 7pt; }
  .executive-facts b { font-size: 7.5pt; overflow-wrap: anywhere; }
  .executive-scope { margin-top: 4mm; padding: 3mm 4mm; border: 1px solid #c5ced2; background: #f4f7f8 !important; font-size: 8pt; }
  .executive-scope p { margin: 1mm 0 0; font-size: 7.5pt; line-height: 1.4; }
  #report > * { margin-bottom: 14px; break-inside: avoid; }
  .finding, .clause, .details-grid article { break-inside: avoid; }
  .scan-card, article, .finding, .details-grid { background: #fff !important; color: #111 !important; border-color: #bbb !important; }
  p, .f-line, .safe-note, .reference-note { color: #333 !important; }
  a { color: #111 !important; text-decoration: none !important; }
  details { display: block; }
  details > * { display: block !important; }
}

/* Recon uses the existing theme tokens and scrolls tables on small screens. */
.recon-panel h2 { margin-top: 8px; }
.recon-consent { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.recon-consent input { width: auto; flex: none; }
.recon-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.recon-job { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.recon-job-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.recon-delete { color: var(--red) !important; }
.recon-results { margin-top: 12px; }
.recon-results > summary { cursor: pointer; padding: 10px 0; }
.recon-table-wrap { overflow-x: auto; margin-top: 12px; }
.recon-table-wrap table { width: 100%; border-collapse: collapse; }
.recon-table-wrap th, .recon-table-wrap td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#recon-message { margin-top: 16px; }

/* CSS spinner for requests and remote jobs; follows both themes. */
.recon-waiting { display: inline-flex; align-items: center; gap: 9px; }
.recon-waiting::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid var(--line);
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  border-radius: 50%;
  animation: recon-spin 0.8s linear infinite;
}
@keyframes recon-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .recon-waiting::before { animation: none; }
}

.tls-analysis-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--cyan) 7%, var(--panel));
}
.tls-analysis-action h4 { margin: 0 0 6px; }
.tls-analysis-action p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tls-analysis-action button { flex: 0 0 auto; }
.tls-analysis-loading { margin: 14px 0; }
.tls-analysis-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.tls-analysis-summary > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.tls-analysis-summary span, .tls-analysis-summary strong { display: block; }
.tls-analysis-summary span { color: var(--muted); font-size: 12px; }
.tls-analysis-summary strong { margin-top: 3px; font-size: 22px; }
.tls-analysis-summary .critical strong, .tls-analysis-summary .high strong { color: var(--red); }
.tls-analysis-summary .medium strong { color: var(--amber); }
.tls-analysis-summary .good strong { color: var(--green); }
.tls-protocols { font-size: 13px; }
.tls-suite-table { overflow-x: auto; }
.tls-suite-table code { white-space: nowrap; }
.tls-risk { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.tls-risk-critical, .tls-risk-high { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.tls-risk-medium { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.tls-risk-good { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.tls-recommendation { margin-top: 5px; color: var(--muted); font-size: 12px; }
.tls-analysis-limit { margin: 14px 0 24px; padding: 14px; border-left: 3px solid var(--cyan); background: var(--panel); color: var(--muted); font-size: 12px; line-height: 1.55; }
.tls-analysis-refs { margin-top: 6px; }
@media (max-width: 760px) {
  .tls-analysis-action { align-items: stretch; flex-direction: column; }
  .tls-analysis-summary { grid-template-columns: repeat(2, 1fr); }
}

/* Details toggle for summary view */
details.company-summary-card { padding: 20px; min-width: 0; background: var(--panel-bg); border-radius: 12px; border: 1px solid var(--border); margin-bottom: 20px; }
summary.company-summary-head { cursor: pointer; list-style: none; margin-bottom: 0; }
summary.company-summary-head::-webkit-details-marker { display: none; }
summary.company-summary-head .details-chevron { transition: transform 0.2s ease; }
details[open] summary.company-summary-head .details-chevron { transform: rotate(180deg); }

/* Recon action button sizing */
.recon-job-actions button { padding: 4px 10px; font-size: 13px; line-height: 1.2; height: auto; }
.recon-job > p:nth-of-type(1) { font-size: 13px; color: var(--muted); margin: -10px 0 10px 0; }
