/* ==========================================================================
   Adobe Tags Container Exporter
   ========================================================================== */

:root {
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f2f4f7;
  --surface-3:     #e9ecf1;
  --border:        #e0e4ea;
  --border-strong: #cfd5de;
  --text:          #14181f;
  --text-2:        #4a5261;
  --muted:         #6b7280;

  --accent:        #d7251b;
  --accent-hover:  #b81d15;
  --accent-soft:   #fdecea;
  --audit:         #4f46e5;
  --audit-hover:   #4338ca;
  --audit-soft:    #eeecfd;

  --critical:      #c02626;
  --critical-bg:   #fdeaea;
  --high:          #b45309;
  --high-bg:       #fdf0e0;
  --medium:        #8a6d0b;
  --medium-bg:     #fdf8e1;
  --low:           #2f5fb5;
  --low-bg:        #ecf1fc;
  --pass:          #17734a;
  --pass-bg:       #e6f5ec;

  --radius:   14px;
  --radius-s: 9px;
  --shadow:   0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .16);
  --shadow-lg:0 2px 4px rgba(16, 24, 40, .05), 0 24px 48px -20px rgba(16, 24, 40, .28);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Theme: `auto` follows the OS, `light`/`dark` are set by the toggle.
   The dark palette is declared twice — once for the explicit attribute and
   once inside the media query for `auto` — because CSS cannot combine an
   attribute selector with a media query in a single rule. */
:root[data-theme="auto"]  { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

:root[data-theme="dark"] {
  --bg:            #0d1117;
  --surface:       #161b23;
  --surface-2:     #1c222c;
  --surface-3:     #232a36;
  --border:        #2a323f;
  --border-strong: #3a4353;
  --text:          #e9edf3;
  --text-2:        #b6bECC;
  --muted:         #8d97a6;

  --accent:        #ff5c4d;
  --accent-hover:  #ff7466;
  --accent-soft:   #3a1a17;
  --audit:         #8b85f5;
  --audit-hover:   #a29cf8;
  --audit-soft:    #23214a;

  --critical:      #ff8b83;
  --critical-bg:   #3a1c1c;
  --high:          #f0b070;
  --high-bg:       #392713;
  --medium:        #ddc76a;
  --medium-bg:     #332d12;
  --low:           #8fb4ee;
  --low-bg:        #1a2438;
  --pass:          #74d3a4;
  --pass-bg:       #14301f;

  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 48px -20px rgba(0,0,0,.7);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:            #0d1117;
    --surface:       #161b23;
    --surface-2:     #1c222c;
    --surface-3:     #232a36;
    --border:        #2a323f;
    --border-strong: #3a4353;
    --text:          #e9edf3;
    --text-2:        #b6becc;
    --muted:         #8d97a6;
    --accent:        #ff5c4d;
    --accent-hover:  #ff7466;
    --accent-soft:   #3a1a17;
    --audit:         #8b85f5;
    --audit-hover:   #a29cf8;
    --audit-soft:    #23214a;
    --critical:      #ff8b83;
    --critical-bg:   #3a1c1c;
    --high:          #f0b070;
    --high-bg:       #392713;
    --medium:        #ddc76a;
    --medium-bg:     #332d12;
    --low:           #8fb4ee;
    --low-bg:        #1a2438;
    --pass:          #74d3a4;
    --pass-bg:       #14301f;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 48px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }

/* A class that sets `display` outranks the UA's `[hidden] { display: none }`,
   so `hidden` silently stops working on anything styled with one — .btn did
   exactly that. Make the attribute authoritative. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono { font-family: var(--mono); font-size: .88em; }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .08em .38em;
}

.wrap { width: min(1220px, 100% - 2.5rem); margin-inline: auto; }

/* Keep anchored sections clear of the sticky header. */
:target, section[id] { scroll-margin-top: 5rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 0;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand-mark svg { width: 32px; height: 32px; display: block; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: #fff; }
.brand-text strong { display: block; font-size: .97rem; letter-spacing: -.01em; }
.brand-text small { display: block; color: var(--muted); font-size: .74rem; }

.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 600;
  padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--border);
}
.pill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill-privacy { color: var(--pass); background: var(--pass-bg); border-color: transparent; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* --------------------------------------------------------------- info tips */

.info {
  position: relative;
  display: inline-grid; place-items: center; vertical-align: text-top;
  width: 14px; height: 14px; margin-left: .3rem; padding: 0;
  border: 0; border-radius: 50%; cursor: help;
  background: var(--surface-3); color: var(--muted);
  font: inherit; font-size: 9px; font-weight: 700; line-height: 1;
  transition: background .15s, color .15s;
}
.info:hover, .info:focus-visible { background: var(--audit); color: #fff; outline: none; }
.info-mark { display: block; font-style: italic; transform: translateY(-.5px); }

.info-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  z-index: 60; width: max-content; max-width: min(280px, 70vw);
  padding: .6rem .75rem; border-radius: var(--radius-s);
  background: var(--text); color: var(--bg);
  font-size: .78rem; font-weight: 400; font-style: normal;
  line-height: 1.45; text-align: left; letter-spacing: 0;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateX(-50%) translateY(3px);
  transition: opacity .14s, visibility .14s, transform .14s;
  pointer-events: none; /* the bubble must never block what is under it */
}
.info-tip b { display: block; margin-bottom: .2rem; font-weight: 700; }

/* The little arrow, drawn as a rotated square behind the bubble. */
.info-tip::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  background: var(--text); transform: rotate(45deg);
}

.info:hover .info-tip,
.info:focus-visible .info-tip,
.info:focus .info-tip {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* Near the right edge a centred bubble would run off screen. */
@media (max-width: 760px) {
  .info-tip { left: auto; right: -6px; transform: translateY(3px); }
  .info-tip::after { left: auto; right: 8px; margin-left: 0; }
  .info:hover .info-tip,
  .info:focus-visible .info-tip,
  .info:focus .info-tip { transform: translateY(0); }
}

/* -------------------------------------------------------------------- hero */

.view { padding-block: 2.4rem 4rem; }

.hero { text-align: center; padding-top: 1.4rem; }
.hero h1 {
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  line-height: 1.14; letter-spacing: -.028em;
  margin: 0 auto .9rem; max-width: 21ch;
}
.hero-sub {
  color: var(--text-2); font-size: 1.03rem;
  max-width: 62ch; margin: 0 auto 2.2rem;
}

.dropzone {
  position: relative;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: 20px;
  padding: 2.8rem 1.5rem 2.2rem;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
  box-shadow: var(--shadow);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--surface); }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.006); }
.dropzone.is-busy { pointer-events: none; opacity: .65; }

.dropzone-icon svg {
  width: 42px; height: 42px; margin-bottom: .7rem;
  fill: none; stroke: var(--accent); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.dropzone-title { margin: 0 0 .3rem; font-size: 1.12rem; font-weight: 650; letter-spacing: -.01em; }
.dropzone-hint { margin: 0; color: var(--muted); font-size: .92rem; }
.dropzone-sample { margin: 1.1rem 0 0; font-size: .86rem; color: var(--muted); }
.link { color: var(--accent); font-weight: 600; }

.linkbtn {
  background: none; border: none; padding: 0;
  color: var(--accent); font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ------------------------------------------------------------------ intake */

.intake { text-align: left; }
.intake-tabs {
  display: flex; gap: .25rem; justify-content: center;
  margin-bottom: .9rem;
}
.intake-tab {
  font: inherit; font-size: .88rem; font-weight: 600;
  padding: .42rem .95rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.intake-tab:hover { color: var(--text); }
.intake-tab.is-active { background: var(--text); border-color: var(--text); color: var(--surface); }

.dropzone-note { margin: .8rem 0 0; font-size: .8rem; color: var(--muted); }
.intake-sample { margin: 1.1rem 0 0; font-size: .86rem; color: var(--muted); text-align: center; }

.paste-label { display: block; font-size: .88rem; color: var(--text-2); margin-bottom: .5rem; }
.paste-area {
  width: 100%; min-height: 190px; resize: vertical;
  font-family: var(--mono); font-size: .82rem; line-height: 1.5;
  padding: .85rem 1rem; border-radius: var(--radius-s);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.paste-area:focus { outline: 2px solid var(--audit); outline-offset: 1px; border-color: transparent; }
.paste-actions { display: flex; gap: .5rem; margin-top: .7rem; }

.url-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.url-field {
  flex: 1 1 320px; min-width: 0;
  font: inherit; font-size: .92rem;
  padding: .62rem .85rem; border-radius: var(--radius-s);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.url-field:focus { outline: 2px solid var(--audit); outline-offset: 1px; border-color: transparent; }
.url-note { margin: .7rem 0 0; font-size: .82rem; color: var(--muted); }

.url-outcome {
  margin-top: 1rem; padding: 1rem 1.1rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); text-align: left;
}
.url-outcome-title { margin: 0 0 .4rem; font-size: .92rem; font-weight: 600; }
.url-outcome-body { margin: 0 0 .8rem; font-size: .88rem; color: var(--text-2); }

.url-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .9rem; }
.url-steps li { font-size: .88rem; color: var(--text-2); }
.url-steps b { color: var(--text); font-weight: 650; }
.url-step-action { margin-top: .5rem; }
.btn-sm { padding: .38rem .75rem; font-size: .84rem; }

.status { margin-top: 1.1rem; min-height: 1.4rem; font-size: .92rem; }
.status[data-tone="error"] { color: var(--critical); font-weight: 600; }
.status[data-tone="busy"]  { color: var(--muted); }
.status[data-tone="ok"]    { color: var(--pass); font-weight: 600; }

/* ------------------------------------------------------------------- cards */

.cards {
  margin-top: 3.4rem;
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.25rem;
}
.card h3 { margin: .85rem 0 .4rem; font-size: 1rem; letter-spacing: -.012em; }
.card p { margin: 0; color: var(--text-2); font-size: .9rem; line-height: 1.5; }
.card-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface-2);
}
.card-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card-icon[data-tone="score"]   { color: var(--audit);    background: var(--audit-soft); }
.card-icon[data-tone="orphan"]  { color: var(--critical); background: var(--critical-bg); }
.card-icon[data-tone="decode"]  { color: var(--low);      background: var(--low-bg); }
.card-icon[data-tone="code"]    { color: var(--high);     background: var(--high-bg); }
.card-icon[data-tone="graph"]   { color: var(--accent);   background: var(--accent-soft); }
.card-icon[data-tone="privacy"] { color: var(--pass);     background: var(--pass-bg); }

/* ------------------------------------------------------------------- guide */

.guide {
  margin-top: 3rem; padding: 2.2rem 2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-head { max-width: 68ch; margin-bottom: 1.8rem; }
.guide-head h2 { margin: 0 0 .5rem; font-size: 1.35rem; letter-spacing: -.02em; }
.guide-head p { margin: 0; color: var(--text-2); font-size: .95rem; }
.guide-shortcut {
  margin-top: .8rem !important; padding: .7rem .9rem;
  background: var(--surface-2); border-left: 3px solid var(--audit);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: .88rem !important;
}
.guide-shortcut b { color: var(--text); }

.guide-layout { display: grid; gap: 2rem; grid-template-columns: 264px 1fr; align-items: start; }
@media (max-width: 900px) { .guide-layout { grid-template-columns: 1fr; } }

.guide-rail { display: grid; gap: .35rem; }
@media (max-width: 900px) {
  .guide-rail { grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto; padding-bottom: .4rem; }
}
.guide-tab {
  display: flex; align-items: flex-start; gap: .7rem; text-align: left;
  font: inherit; cursor: pointer;
  padding: .7rem .8rem; border-radius: var(--radius-s);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
}
.guide-tab:hover { background: var(--surface-2); }
.guide-tab.is-active { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.guide-tab-num {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  font-size: .74rem; font-weight: 700;
}
.guide-tab.is-active .guide-tab-num { background: var(--accent); color: #fff; }
.guide-tab-text strong { display: block; font-size: .89rem; font-weight: 650; }
.guide-tab-text small { display: block; color: var(--muted); font-size: .75rem; margin-top: .1rem; }

.route-head { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.route-head h3 { margin: 0; font-size: 1.12rem; letter-spacing: -.015em; }
.route-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .18rem .55rem; border-radius: 5px;
  background: var(--surface-3); color: var(--muted);
}
.route-badge[data-tone="best"] { background: var(--pass-bg); color: var(--pass); }
.route-badge[data-tone="deep"] { background: var(--audit-soft); color: var(--audit); }

.route-lede { margin: 0 0 1.3rem; color: var(--text-2); font-size: .93rem; max-width: 70ch; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1.15rem; }
.steps > li { position: relative; padding-left: 2.3rem; counter-increment: step; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text-2); font-size: .76rem; font-weight: 700;
}
.steps > li:not(:last-child)::after {
  content: ""; position: absolute; left: 11.5px; top: 27px; bottom: -1.15rem;
  width: 1px; background: var(--border);
}
.steps h4 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 650; letter-spacing: -.008em; }
.steps p { margin: 0; color: var(--text-2); font-size: .89rem; }
.steps b { color: var(--text); font-weight: 650; }

kbd {
  font-family: var(--sans); font-size: .78em; font-weight: 600;
  padding: .1em .4em; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 var(--border-strong);
}

.snippet { position: relative; margin: .6rem 0 0; }
.snippet pre {
  margin: 0; padding: .8rem 1rem; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-size: .8rem; line-height: 1.6; color: var(--text-2);
  max-height: 340px;
}
.snippet pre code { background: none; border: none; padding: 0; }
.copy-btn {
  position: absolute; top: .5rem; right: .5rem; z-index: 1;
  font: inherit; font-size: .74rem; font-weight: 650; cursor: pointer;
  padding: .22rem .55rem; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
}
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.copy-btn.is-done { background: var(--pass-bg); color: var(--pass); border-color: transparent; }

.route-warn {
  margin: 1.4rem 0 0; padding: .8rem 1rem;
  background: var(--surface-2); border-left: 3px solid var(--high);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: .86rem; color: var(--text-2);
}
.route-warn b { color: var(--text); }

.compare { margin-top: 2.4rem; padding-top: 1.8rem; border-top: 1px solid var(--border); }
.compare h3 { margin: 0 0 .9rem; font-size: 1rem; letter-spacing: -.012em; }
.compare-grid td { white-space: nowrap; }
.compare-note { margin: .8rem 0 0; font-size: .85rem; color: var(--muted); max-width: 78ch; }

/* ----------------------------------------------------------- privacy note */

.privacy-note {
  margin-top: 3rem; padding: 2rem 1.8rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.privacy-note h2 { margin: 0 0 1.3rem; font-size: 1.12rem; letter-spacing: -.015em; }
.privacy-grid { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.privacy-grid h4 { margin: 0 0 .35rem; font-size: .93rem; }
.privacy-grid p { margin: 0; color: var(--text-2); font-size: .88rem; line-height: 1.55; }

/* ------------------------------------------------------------ report head */

.report-head {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.6rem;
}
.report-id h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.022em; }
.report-id p { margin: .25rem 0 0; font-size: .87rem; }
.report-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .58rem 1rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .14s, border-color .14s, transform .1s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn small { opacity: .7; font-weight: 600; font-size: .78em; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-audit { background: var(--audit); border-color: var(--audit); color: #fff; }
.btn-audit:hover { background: var(--audit-hover); border-color: var(--audit-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* -------------------------------------------------- input-quality warning */

.model-warning {
  margin-bottom: 1.4rem; padding: .95rem 1.1rem;
  background: var(--high-bg); border: 1px solid var(--high);
  border-left-width: 4px; border-radius: var(--radius-s);
}
.model-warning-title { margin: 0 0 .35rem; font-size: .92rem; font-weight: 650; }
.model-warning-body { margin: 0; font-size: .87rem; color: var(--text-2); }

/* ------------------------------------------------------------ score panel */

.score-panel {
  display: grid; gap: 2rem;
  grid-template-columns: 210px 1fr;
  align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.7rem;
  box-shadow: var(--shadow);
}
@media (max-width: 720px) { .score-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.score-dial { position: relative; width: 200px; height: 200px; }
.score-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: var(--surface-3); stroke-width: 15; }
/* stroke-dasharray/offset are deliberately left to the element's presentation
   attributes so JS can animate the dial without an inline style attribute. */
.dial-value {
  fill: none; stroke: var(--pass); stroke-width: 15; stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.22,.9,.3,1), stroke .4s;
}
.dial-value[data-tone="excellent"] { stroke: var(--pass); }
.dial-value[data-tone="good"]      { stroke: #3f9d6d; }
.dial-value[data-tone="fair"]      { stroke: var(--high); }
.dial-value[data-tone="poor"]      { stroke: var(--critical); }

.score-center {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center; gap: .1rem;
}
.score-number { font-size: 3.1rem; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.score-grade {
  font-size: .82rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

.score-detail h2 { margin: 0 0 .3rem; font-size: 1.1rem; letter-spacing: -.015em; }
.score-verdict { margin: 0 0 .2rem; color: var(--text-2); font-size: .97rem; }

.category-list { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .75rem; }
.category-row { display: grid; grid-template-columns: 152px 1fr 62px; gap: .8rem; align-items: center; }
@media (max-width: 560px) { .category-row { grid-template-columns: 118px 1fr 54px; } }
.category-name { font-size: .87rem; font-weight: 600; }
.category-name small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
/* border-radius on the SVG box rounds the bar without distorting an rx under
   preserveAspectRatio="none". */
.category-bar { display: block; width: 100%; height: 8px; border-radius: 999px; overflow: hidden; }
.category-track { fill: var(--surface-3); }
.category-fill { transition: width .8s cubic-bezier(.22,.9,.3,1); }
.category-fill[data-tone="excellent"] { fill: var(--pass); }
.category-fill[data-tone="good"]      { fill: #3f9d6d; }
.category-fill[data-tone="fair"]      { fill: var(--high); }
.category-fill[data-tone="poor"]      { fill: var(--critical); }
.category-score { font-size: .84rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------- KPIs */

/* Fixed tracks rather than auto-fit: the ten tiles land 5x2 or 2x5, never
   leaving a single orphan on the last row. */
.kpis {
  margin-top: 1.2rem;
  display: grid; gap: .8rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* An empty badge would still render as a small blank pill. */
.tab-count:empty { display: none; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: .9rem 1rem;
}
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .79rem; color: var(--muted); margin-top: .15rem; }
.category-title { display: inline-flex; align-items: center; }
.kpi[data-tone="bad"]  .kpi-value { color: var(--critical); }
.kpi[data-tone="warn"] .kpi-value { color: var(--high); }
.kpi[data-tone="good"] .kpi-value { color: var(--pass); }

/* -------------------------------------------------------------------- tabs */

.tabs {
  display: flex; gap: .25rem; margin: 1.8rem 0 1.1rem;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.tab {
  position: relative; flex: 0 0 auto;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: .92rem; font-weight: 600;
  color: var(--muted); padding: .6rem .85rem; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.tab-count {
  display: inline-block; margin-left: .35rem;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 999px; padding: .05rem .45rem;
  font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.panel-toolbar {
  display: flex; flex-wrap: wrap; gap: .7rem;
  align-items: center; justify-content: space-between; margin-bottom: 1rem;
}
.search {
  flex: 1 1 220px; max-width: 340px;
  font: inherit; font-size: .9rem;
  padding: .5rem .8rem; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.search:focus { outline: 2px solid var(--audit); outline-offset: 1px; border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: .3rem .7rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.chip:hover { border-color: var(--border-strong); }
.chip.is-active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip[data-sev="critical"].is-active { background: var(--critical); border-color: var(--critical); color: #fff; }
.chip[data-sev="high"].is-active     { background: var(--high);     border-color: var(--high);     color: #fff; }
.chip[data-sev="medium"].is-active   { background: var(--medium);   border-color: var(--medium);   color: #fff; }
.chip[data-sev="low"].is-active      { background: var(--low);      border-color: var(--low);      color: #fff; }

/* ---------------------------------------------------------------- findings */

.findings { display: grid; gap: .6rem; }

.finding {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-s); padding: .95rem 1.1rem;
}
.finding[data-sev="critical"] { border-left-color: var(--critical); }
.finding[data-sev="high"]     { border-left-color: var(--high); }
.finding[data-sev="medium"]   { border-left-color: var(--medium); }
.finding[data-sev="low"]      { border-left-color: var(--low); }

.finding-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.finding-title { font-weight: 650; font-size: .95rem; letter-spacing: -.01em; }
.finding-object {
  font-family: var(--mono); font-size: .82rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: .05rem .4rem;
}
.finding-detail { margin: 0 0 .55rem; color: var(--text-2); font-size: .89rem; }
.finding-why,
.finding-fix { margin: .3rem 0 0; font-size: .84rem; color: var(--muted); }
.finding-why strong,
.finding-fix strong { color: var(--text-2); font-weight: 650; }

.finding-category {
  font-size: .7rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: .12rem .4rem;
}

.finding-where-wrap {
  display: flex; gap: .6rem; align-items: baseline;
  margin: 0 0 .5rem; padding: .5rem .7rem;
  background: var(--surface-2); border-radius: var(--radius-s);
}
.finding-where-label {
  flex: 0 0 auto;
  font-size: .68rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.finding-where { margin: 0; padding: 0; list-style: none; display: grid; gap: .25rem; min-width: 0; }
.finding-where li {
  font-size: .83rem; color: var(--text-2);
  font-family: var(--mono); line-height: 1.45;
  overflow-wrap: anywhere;
}
.finding-more { font-size: .78rem; margin-bottom: .5rem; }

.badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: .16rem .5rem; border-radius: 5px;
}
.badge[data-sev="critical"] { color: var(--critical); background: var(--critical-bg); }
.badge[data-sev="high"]     { color: var(--high);     background: var(--high-bg); }
.badge[data-sev="medium"]   { color: var(--medium);   background: var(--medium-bg); }
.badge[data-sev="low"]      { color: var(--low);      background: var(--low-bg); }
.badge[data-sev="pass"]     { color: var(--pass);     background: var(--pass-bg); }

/* ------------------------------------------------------------------- rules */

.rules { display: grid; gap: .6rem; }

.rule {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); overflow: hidden;
}
.rule.is-broken { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }

.rule-head {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  width: 100%; text-align: left;
  background: none; border: none; font: inherit;
  padding: .85rem 1.05rem; cursor: pointer; color: inherit;
}
.rule-head:hover { background: var(--surface-2); }
.rule-name { font-weight: 650; font-size: .95rem; flex: 1 1 auto; letter-spacing: -.01em; }
.rule-caret { color: var(--muted); transition: transform .18s; }
.rule-caret svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.rule.is-open .rule-caret { transform: rotate(90deg); }

.tagset { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag {
  font-size: .73rem; font-weight: 600;
  padding: .12rem .48rem; border-radius: 5px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.tag[data-kind="event"]     { color: var(--audit); background: var(--audit-soft); border-color: transparent; }
.tag[data-kind="condition"] { color: var(--low);   background: var(--low-bg);     border-color: transparent; }
.tag[data-kind="action"]    { color: var(--pass);  background: var(--pass-bg);    border-color: transparent; }
.tag[data-kind="alert"]     { color: var(--critical); background: var(--critical-bg); border-color: transparent; }

.rule-body { padding: 0 1.05rem 1.05rem; border-top: 1px solid var(--border); }
.logic { display: grid; gap: .1rem; margin-top: .9rem; }
.logic-block { display: grid; grid-template-columns: 62px 1fr; gap: .8rem; padding: .5rem 0; }
@media (max-width: 560px) { .logic-block { grid-template-columns: 1fr; gap: .2rem; } }
.logic-key {
  font-size: .72rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); padding-top: .18rem;
}
.logic-key[data-key="when"] { color: var(--audit); }
.logic-key[data-key="if"]   { color: var(--low); }
.logic-key[data-key="then"] { color: var(--pass); }
.logic-items { display: grid; gap: .35rem; }
.logic-item { font-size: .9rem; color: var(--text-2); }
.logic-item b { color: var(--text); font-weight: 650; }
.logic-join { font-size: .72rem; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.logic-empty { font-size: .88rem; color: var(--muted); font-style: italic; }
.logic-empty[data-tone="bad"] { color: var(--critical); font-style: normal; font-weight: 600; }

.meta-row { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--border); font-size: .78rem; color: var(--muted); }
.meta-row span b { color: var(--text-2); font-weight: 650; }

/* ------------------------------------------------------------------ tables */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface);
}
.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
.grid th {
  position: sticky; top: 0;
  text-align: left; font-size: .74rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); padding: .6rem .85rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.grid td { padding: .6rem .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .nowrap { white-space: nowrap; }
.cell-name { font-weight: 600; }
.cell-code { font-family: var(--mono); font-size: .82rem; color: var(--text-2); }

/* -------------------------------------------------------------- code panel */

.code-list { display: grid; gap: .7rem; }
.code-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; }
.code-head {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.code-owner { font-weight: 650; }
.code-where { color: var(--muted); font-size: .8rem; }
.code-block pre {
  margin: 0; padding: .9rem 1rem; overflow-x: auto;
  font-size: .82rem; line-height: 1.55; color: var(--text-2);
  max-height: 420px;
}

/* --------------------------------------------------------------- runtime QA */

.qa-intro {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 1.2rem 1.3rem; margin-bottom: 1.1rem;
}
.qa-intro h2 { margin: 0 0 .4rem; font-size: 1.05rem; letter-spacing: -.015em; }
.qa-intro p { margin: 0; color: var(--text-2); font-size: .9rem; max-width: 80ch; }
.qa-profile {
  margin-top: .7rem !important; padding-top: .7rem;
  border-top: 1px dashed var(--border);
  font-size: .85rem !important; color: var(--muted) !important;
}

.qa-list { display: grid; gap: 1.4rem; }
.qa-group-title {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .6rem; font-size: .95rem; letter-spacing: -.01em;
}
.qa-items { display: grid; gap: .5rem; }

.qa-item {
  display: flex; gap: .8rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: .85rem 1rem;
  cursor: pointer; transition: opacity .15s;
}
.qa-item:hover { border-color: var(--border-strong); }
.qa-item.is-done { opacity: .5; }
.qa-item.is-done .qa-title { text-decoration: line-through; }

.qa-check { flex: 0 0 auto; width: 17px; height: 17px; margin-top: .15rem; accent-color: var(--pass); cursor: pointer; }
.qa-body { min-width: 0; }
.qa-top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.qa-title { font-weight: 650; font-size: .93rem; letter-spacing: -.008em; }
.qa-how {
  margin: 0 0 .35rem; color: var(--text-2); font-size: .87rem;
  white-space: pre-wrap; /* console snippets are newline-separated */
}
.qa-expected { margin: 0; font-size: .84rem; color: var(--muted); }
.qa-expected b { color: var(--text-2); font-weight: 650; }

/* ------------------------------------------------------------------ weight */

.weight-summary {
  display: grid; gap: .8rem; margin-bottom: 1.6rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) { .weight-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-note { font-size: .72rem; color: var(--muted); margin-top: .3rem; line-height: 1.35; }

.weight-heading { margin: 0 0 .8rem; font-size: 1rem; letter-spacing: -.012em; }

.weight-bars { display: grid; gap: .3rem; }
.weight-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 96px;
  gap: .9rem; align-items: center;
  padding: .5rem .7rem; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--border);
}
@media (max-width: 700px) {
  .weight-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .weight-row .weight-bar { grid-column: 1 / -1; order: 3; }
}
.weight-row.is-clickable { cursor: pointer; }
.weight-row.is-clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }

.weight-label { min-width: 0; }
.weight-name {
  display: block; font-size: .88rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.weight-label small { display: block; font-size: .74rem; color: var(--muted); }

/* Bar width is a presentation attribute, so no inline style is needed. */
.weight-bar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; }
.weight-track { fill: var(--surface-3); }
.weight-fill { transition: width .6s cubic-bezier(.22,.9,.3,1); }
.weight-fill[data-type="Rule"] { fill: var(--audit); }
.weight-fill[data-type="Data Element"] { fill: var(--low); }
.weight-fill[data-type="Extension"] { fill: var(--accent); }

.weight-value { text-align: right; font-variant-numeric: tabular-nums; }
.weight-value b { display: block; font-size: .85rem; }
.weight-value small { font-size: .72rem; color: var(--muted); }

/* -------------------------------------------------------------- compare */

.compare-block { margin-top: 2rem; }
.compare-hint { margin: .7rem 0 0; font-size: .82rem; color: var(--muted); }
.grid th.is-sortable { cursor: pointer; user-select: none; }
.grid th.is-sortable:hover { color: var(--text); }
.grid th.is-sorted { color: var(--text); }
.sort-arrow { font-size: .7em; }
.grid tbody tr.is-clickable { cursor: pointer; }

/* ------------------------------------------------------------------ empty */

.empty {
  text-align: center; padding: 2.6rem 1rem; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-s);
}
.empty strong { display: block; color: var(--text); margin-bottom: .25rem; }

.truncation-note { margin-top: .8rem; font-size: .82rem; color: var(--muted); text-align: center; }

/* ----------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--border); padding: 1.6rem 0; margin-top: 2rem; }
.footer p { margin: 0; color: var(--muted); font-size: .82rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
