/* DataDiag — Fluent (Windows 11) report UI. Shared by the app (WebView2), benchmark.localhost, HTML export and shared links. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, monospace;
  --radius: 8px;
  --radius-lg: 12px;

  --bg: #f3f3f3;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e6effa 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #eef3f8 0%, transparent 55%);
  --card: #ffffff;
  --card-2: #f9f9f9;
  --card-hover: #f6f6f6;
  --stroke: rgba(0, 0, 0, 0.0578);
  --stroke-strong: rgba(0, 0, 0, 0.1);
  --text: #1a1a1a;
  --text-2: #5d5d5d;
  --text-3: #8a8a8a;
  --accent: #005fb8;
  --accent-text: #ffffff;
  --accent-soft: #e5f0fa;
  --crit: #c42b1c;
  --crit-bg: #fde7e9;
  --warn: #9d5d00;
  --warn-bg: #fff4ce;
  --info: #005fb8;
  --info-bg: #e5f0fa;
  --ok: #0f7b0f;
  --ok-bg: #dff6dd;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #202020;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1d2a38 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #242a31 0%, transparent 55%);
    --card: #2b2b2b;
    --card-2: #323232;
    --card-hover: #333333;
    --stroke: rgba(255, 255, 255, 0.0698);
    --stroke-strong: rgba(255, 255, 255, 0.12);
    --text: #ffffff;
    --text-2: #c5c5c5;
    --text-3: #9a9a9a;
    --accent: #60cdff;
    --accent-text: #000000;
    --accent-soft: #1f3445;
    --crit: #ff99a4;
    --crit-bg: #442726;
    --warn: #fce100;
    --warn-bg: #433519;
    --info: #60cdff;
    --info-bg: #1f3445;
    --ok: #6ccb5f;
    --ok-bg: #393d1b;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.26), 0 0 1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #202020;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1d2a38 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #242a31 0%, transparent 55%);
  --card: #2b2b2b;
  --card-2: #323232;
  --card-hover: #333333;
  --stroke: rgba(255, 255, 255, 0.0698);
  --stroke-strong: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --text-2: #c5c5c5;
  --text-3: #9a9a9a;
  --accent: #60cdff;
  --accent-text: #000000;
  --accent-soft: #1f3445;
  --crit: #ff99a4;
  --crit-bg: #442726;
  --warn: #fce100;
  --warn-bg: #433519;
  --info: #60cdff;
  --info-bg: #1f3445;
  --ok: #6ccb5f;
  --ok-bg: #393d1b;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.26), 0 0 1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* Very dark (pure black) theme for OLED screens */
:root[data-theme="black"] {
  --bg: #000000;
  --bg-grad: none;
  --card: #0a0a0a;
  --card-2: #121212;
  --card-hover: #161616;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f2f2;
  --text-2: #b5b5b5;
  --text-3: #8a8a8a;
  --accent: #60cdff;
  --accent-text: #000000;
  --accent-soft: #0e2433;
  --crit: #ff99a4;
  --crit-bg: #2a1213;
  --warn: #fce100;
  --warn-bg: #2a2208;
  --info: #60cdff;
  --info-bg: #0e2433;
  --ok: #6ccb5f;
  --ok-bg: #12200e;
  --shadow: none;
  --shadow-lg: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
button { font: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------------------------------------------------------------- Header */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(160%) blur(24px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--stroke);
}
.topbar .inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.brand img { width: 28px; height: 28px; }
.topbar .meta { color: var(--text-2); font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 5px 12px;
  border-radius: 4px; border: 1px solid var(--stroke-strong);
  background: var(--card); color: var(--text); cursor: pointer;
  box-shadow: 0 1px 0 var(--stroke);
}
.btn:hover { background: var(--card-hover); }
.btn:active { opacity: 0.85; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.subtle { border-color: transparent; background: transparent; box-shadow: none; }
.btn.subtle:hover { background: var(--card-hover); }
.btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- Hero */
.hero { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-top: 20px; }
.card {
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px;
}
.score-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.gauge { width: 190px; height: 190px; position: relative; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .value b { font-family: var(--font-display); font-size: 54px; font-weight: 600; line-height: 1; letter-spacing: -1px; }
.gauge .value span { color: var(--text-2); font-size: 13px; }
.verdict { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.verdict-sub { color: var(--text-2); font-size: 13px; max-width: 240px; }

.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cat { background: var(--card-2); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 12px 14px; }
.cat .name { color: var(--text-2); font-size: 12.5px; }
.cat .num { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.bar { height: 4px; border-radius: 2px; background: var(--stroke-strong); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 2px; }
.counts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.chip.critical { background: var(--crit-bg); color: var(--crit); }
.chip.warning { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.neutral { background: var(--card-2); color: var(--text-2); border: 1px solid var(--stroke); }
.summary-specs { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 13px; }
.summary-specs div { display: flex; gap: 8px; min-width: 0; }
.summary-specs dt { color: var(--text-2); flex: 0 0 auto; }
.summary-specs dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Banners */
.banner { margin-top: 16px; border-radius: var(--radius-lg); padding: 16px 18px; border: 1px solid var(--stroke); display: flex; gap: 14px; align-items: flex-start; }
.banner.reinstall { background: var(--crit-bg); }
.banner.note { background: var(--info-bg); }
.banner h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; }
.banner p { margin: 0; color: var(--text); }
.banner .icon { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; }

/* ---------------------------------------------------------------- Findings */
h2.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 32px 0 12px; display: flex; align-items: center; gap: 10px; }
h2.section-title small { font-family: var(--font); font-size: 13px; color: var(--text-2); font-weight: 400; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }

.finding { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px 16px 14px 18px; margin-bottom: 8px; position: relative; overflow: hidden; }
.finding::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.finding.critical::before { background: var(--crit); }
.finding.warning::before { background: var(--warn); }
.finding.info::before { background: var(--info); }
.finding .head { display: flex; align-items: flex-start; gap: 10px; }
.finding .head .sev { flex: 0 0 auto; margin-top: 1px; }
.finding .title { font-weight: 600; font-size: 15px; flex: 1; }
.finding .cat-tag { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.finding .simple { margin: 6px 0 0; }
.finding .action { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--stroke); display: flex; gap: 8px; }
.finding .action b { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.finding .buttons { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
details.tech { margin-top: 8px; }
details.tech summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; line-height: 1; }
details.tech[open] summary::before { transform: rotate(90deg); }
details.tech .tech-body { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--card-2); border: 1px solid var(--stroke); font-size: 13px; }
details.tech dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
details.tech dt { color: var(--text-2); }
details.tech dd { margin: 0; word-break: break-word; }
details.tech ul { margin: 8px 0 0; padding-left: 18px; max-height: 260px; overflow: auto; }
details.tech li { font-family: var(--mono); font-size: 12px; margin: 2px 0; word-break: break-all; }
.empty-ok { text-align: center; padding: 28px; color: var(--ok); font-weight: 600; }

/* ---------------------------------------------------------------- Reinstall guide */
.guide ol { margin: 10px 0 0; padding-left: 22px; }
.guide li { margin: 8px 0; }
.guide .why { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--stroke); }
.cols-2 { columns: 2; column-gap: 24px; font-size: 13px; margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- Detail sections */
details.section { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 8px; }
details.section > summary { cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 12px; list-style: none; font-weight: 600; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary .chev { margin-left: auto; transition: transform .15s; color: var(--text-2); width: 20px; height: 20px; flex: 0 0 auto; }
details.section[open] > summary .chev { transform: rotate(180deg); }
details.section > summary .sub { color: var(--text-2); font-weight: 400; font-size: 13px; }
details.section > summary .ico { width: 20px; height: 20px; color: var(--accent); flex: 0 0 auto; }
.section-body { padding: 0 18px 18px; overflow-x: auto; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 24px; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--stroke); min-width: 0; }
.kv dt { color: var(--text-2); flex: 0 0 auto; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
h4.sub-title { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-2); padding: 6px 10px; border-bottom: 1px solid var(--stroke-strong); white-space: nowrap; position: sticky; top: 0; background: var(--card); }
table.data td { padding: 6px 10px; border-bottom: 1px solid var(--stroke); vertical-align: top; overflow-wrap: break-word; word-break: normal; }
table.data tr:hover td { background: var(--card-hover); }
.table-scroll { max-height: 460px; overflow: auto; border: 1px solid var(--stroke); border-radius: var(--radius); }
.yes { color: var(--ok); font-weight: 600; }
.no { color: var(--text-2); }
.bad { color: var(--crit); font-weight: 600; }
.masked { color: var(--text-3); font-style: italic; }
.note { color: var(--text-2); font-size: 12.5px; margin: 8px 0 0; }
.chart { width: 100%; height: 180px; margin-top: 8px; }
.chart text { fill: var(--text-2); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.delta-up { color: var(--ok); font-weight: 600; }
.delta-down { color: var(--crit); font-weight: 600; }

footer.foot { margin-top: 36px; color: var(--text-3); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- Responsive & print */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .cats { grid-template-columns: repeat(2, 1fr); }
  .compare-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar .meta { display: none; }
  .summary-specs { grid-template-columns: 1fr; }
  .cols-2 { columns: 1; }
  .gauge { width: 160px; height: 160px; }
}
@media print {
  body { background: #fff; color: #000; }
  .topbar, .toolbar, .filters, .buttons, .no-print { display: none !important; }
  .card, .finding, details.section { box-shadow: none; break-inside: avoid; }
  details.section > summary .chev { display: none; }
  .table-scroll { max-height: none; overflow: visible; }
}

/* ---------------------------------------------------------------- v1.1 additions */
.empty-ok svg, .chip svg { width: 18px; height: 18px; vertical-align: -4px; }
.comp { border: 1px solid var(--stroke); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: var(--card-2); }
.comp-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.comp h5, .tech-body h5 { margin: 14px 0 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.comp .kv > div { border-bottom-color: var(--stroke); }
.links a { margin-right: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); }
.stackbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--stroke-strong); margin: 6px 0 4px; }
.stackbar i { display: block; height: 100%; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.levels .num { font-size: 20px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.zone-label { font-size: 10.5px; fill: var(--text-2); }
details.help { margin: 6px 0 14px; font-size: 13px; }
details.help summary { cursor: pointer; color: var(--accent); list-style: none; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary::before { content: "? "; font-weight: 700; }
details.help p { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--info-bg); border: 1px solid var(--stroke); }
.speedbars { display: grid; gap: 8px; margin: 6px 0 12px; }
.speedbar { display: grid; grid-template-columns: minmax(140px, 260px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.speedbar .bar { height: 8px; border-radius: 4px; background: var(--stroke-strong); overflow: hidden; }
.speedbar .bar i { display: block; height: 100%; border-radius: 4px; }
.speedbar .val { color: var(--text-2); white-space: nowrap; }
.share { margin-top: 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.share .name { color: var(--text-2); font-size: 12.5px; }
.share-id { font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.share-actions { display: flex; gap: 8px; margin-left: auto; }
.qr { flex-basis: 100%; display: flex; justify-content: center; }
.qr svg { border-radius: 8px; }
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); text-decoration: none; }
.feed-item:hover { background: var(--card-hover); text-decoration: none; }
.feed-hw { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-hw b, .feed-hw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-hw span, .feed-meta { color: var(--text-2); font-size: 12.5px; }
.feed-meta { text-align: right; white-space: nowrap; }
@media (max-width: 560px) {
  .speedbar { grid-template-columns: 1fr; }
  .share-actions { margin-left: 0; }
}
/* Every inline icon gets an explicit size (an SVG without one fills its container). */
.ico, .chev, .icon, .sev svg, .btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.sev svg { width: 18px; height: 18px; }

.warn-text { color: var(--warn); font-weight: 600; }
.nowrap { white-space: nowrap; }
