/* ===========================================================================
   DataTools — static layout-review stylesheet
   ---------------------------------------------------------------------------
   Faithful reproduction of the live Streamlit app's design system for human
   review of page layouts. Tokens are copied verbatim from src/gui/theme.py
   (§3 color + type scale) and the component values from
   src/gui/components/_legacy.py:_DESIGN_TOKENS_CSS.

   The live app applies these styles to Streamlit's data-testid DOM; here we
   re-express the same look against clean semantic classes so the static HTML
   stays readable. Where the app uses real .dt-* classes (page header, files
   card, findings, stats) the class names are kept identical.
   =========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0,0&display=block");

:root {
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ink: #1c1917;
  --ink-secondary: #57534e;
  --ink-tertiary: #a8a29e;
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-hover: #f8f7f3;
  --border: #e7e5dc;
  --border-strong: #d6d3c7;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-fill: #fef4ed;
  --accent-fill-strong: #fde4d3;

  --warn: #b45309;
  --warn-fill: #fef3c7;
  --info: #0369a1;
  --info-fill: #e0f2fe;
  --success: #15803d;
  --success-fill: #dcfce7;
  --danger: #b91c1c;
  --danger-fill: #fee2e2;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv01", "cv11";
  -webkit-font-smoothing: antialiased;
}

/* ---------- Type scale (theme.py §4) ---------- */
h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; margin: 0 0 4px; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 18px; font-weight: 500; letter-spacing: -0.018em; line-height: 1.25; margin: 1.25rem 0 0.5rem; }
h4 { font-size: 15px; font-weight: 500; letter-spacing: -0.012em; line-height: 1.35; margin: 1rem 0 0.5rem; }
p  { font-size: 14px; font-weight: 400; line-height: 1.55; color: var(--ink); margin: 0 0 0.6rem; }
strong { font-weight: 500; color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code, .dt-mono { font-family: var(--font-mono); font-size: 0.92em; font-feature-settings: "ss02"; }

/* ===========================================================================
   App frame — sidebar + main + sticky footer
   =========================================================================== */
.dt-app { display: flex; min-height: 100vh; }

/* ---------- Sidebar (cream paper) ---------- */
.dt-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #f5f4ef;
  border-right: 1px solid var(--border);
  padding: 18px 14px 90px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}
.dt-brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 18px; }
.dt-brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--ink); color: var(--accent-fill);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: -0.04em; line-height: 1; flex-shrink: 0;
}
.dt-brand-name { display: flex; flex-direction: column; gap: 1px; line-height: 1.05; }
.dt-brand-eyebrow {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-tertiary); line-height: 1;
}
.dt-brand-word { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; color: var(--ink); }

.dt-nav { display: flex; flex-direction: column; }
.dt-nav-section {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-tertiary); font-weight: 500;
  padding: 14px 10px 4px; margin: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.dt-nav-section .dt-nav-indicator { font-size: 16px; color: var(--ink-tertiary); }
.dt-nav-link {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-secondary); font-size: 13px; font-weight: 500; line-height: 1.3;
  padding: 5px 10px; border-radius: var(--r-sm); margin-bottom: 1px;
  text-decoration: none; transition: background 0.12s ease, color 0.12s ease;
}
.dt-nav-link:hover { background: rgba(0,0,0,0.04); color: var(--ink); text-decoration: none; }
.dt-nav-link.is-active { background: rgba(0,0,0,0.04); color: var(--ink); font-weight: 600; }
.dt-nav-link .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; color: var(--ink-secondary); line-height: 1; }
.dt-nav-link.is-active .dt-mi { color: var(--ink); }
.dt-nav-link.is-soon { opacity: 0.55; }

/* "Start here" front-door item — weightier than ordinary nav links so the
   obvious entry point reads at a glance. Accent-fill ground + accent-hover ink,
   slightly larger hit area, with bottom margin to part it from the groups below.
   Layers on .dt-nav-link, so the .is-active treatment still overrides cleanly. */
.dt-nav-start {
  background: var(--accent-fill); color: var(--accent-hover); font-weight: 600;
  padding: 8px 10px; margin-bottom: 12px;
}
.dt-nav-start:hover { background: var(--accent-fill-strong); color: var(--accent-hover); }
.dt-nav-start .dt-mi { color: var(--accent); }
.dt-nav-start.is-active { background: var(--accent-fill-strong); color: var(--accent-hover); }
.dt-nav-start.is-active .dt-mi { color: var(--accent); }
.dt-nav-soon-tag {
  margin-left: auto; font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-tertiary);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px;
}

.dt-sidebar-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.dt-sidebar-label { font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-tertiary); margin-bottom: 4px; }
.dt-license-badge { font-size: 12.5px; color: var(--ink-secondary); }

/* ---------- Main column ---------- */
.dt-main { flex: 1; min-width: 0; padding: 40px 56px 96px; }
.dt-main-inner { max-width: 920px; margin: 0 auto; }

/* Review banner above every mockup */
.dt-review-banner {
  max-width: 920px; margin: 0 auto 20px; display: flex; gap: 10px; align-items: center;
  background: var(--info-fill); color: var(--info);
  border: 1px solid transparent; border-radius: var(--r-md);
  padding: 8px 14px; font-size: 12.5px; line-height: 1.4;
}
.dt-review-banner a { color: var(--info); text-decoration: underline; }
.dt-review-banner .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; }

/* ---------- Sticky footer ---------- */
.dt-footer {
  position: fixed; bottom: 0; left: var(--sidebar-w); right: 0;
  background: rgba(255,255,255,0.97); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-strong);
  padding: 8px 20px; z-index: 50;
  display: flex; align-items: center; gap: 8px;
}
.dt-footer-btn {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-secondary); font-size: 13px; font-weight: 500; line-height: 1.3;
  padding: 5px 10px; border-radius: var(--r-sm);
  background: transparent; border: none; cursor: pointer; text-decoration: none;
}
.dt-footer-btn:hover { background: rgba(0,0,0,0.04); color: var(--ink); text-decoration: none; }
.dt-footer-btn .dt-mi { font-family: "Material Symbols Outlined"; font-size: 16px; }

/* ===========================================================================
   Page header (brand + privacy pill) — .dt-page-* mirror the live app
   =========================================================================== */
.dt-page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 0 0 24px; padding-bottom: 22px; border-bottom: 1px solid var(--border);
}
.dt-page-brand { display: flex; flex-direction: column; gap: 8px; }
.dt-page-brand-row { display: flex; align-items: center; gap: 18px; }
.dt-page-brand-mark {
  width: 56px; height: 56px; border-radius: 14px; background: var(--ink);
  color: var(--accent-fill); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 32px; letter-spacing: -0.04em; line-height: 1; flex-shrink: 0;
}
.dt-page-brand-words { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.dt-page-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-tertiary); line-height: 1.2; }
.dt-page-wordmark { margin: 0; font-weight: 600; font-size: 32px; letter-spacing: -0.035em; line-height: 1.1; color: var(--ink); }
.dt-page-subtitle { margin: 4px 0 0; color: var(--ink-secondary); font-size: 14px; line-height: 1.5; }
.dt-privacy-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  background: var(--success-fill); color: var(--success); border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.dt-privacy-pill svg { width: 13px; height: 13px; stroke-width: 2; }

/* ---------- Tool header (title + Help popover) ---------- */
.dt-tool-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dt-tool-header h1 { margin: 0; }
.dt-help-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 9px 16px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; flex-shrink: 0; margin-top: 6px;
}
.dt-help-btn .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; }
.dt-tool-caption { font-size: 12.5px; color: var(--ink-tertiary); line-height: 1.5; margin: 2px 0 0; }
/* Right-side actions cluster in a tool header: the local-first privacy pill +
   the Help button. One shared class so every tool page aligns identically
   (replaces per-page inline flex/gap/margin drift). */
.dt-tool-header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-top: 6px; }
.dt-tool-header-actions .dt-help-btn { margin-top: 0; }

/* ===========================================================================
   Buttons
   =========================================================================== */
.dt-btn {
  border-radius: var(--r-md); font-family: var(--font-sans); font-weight: 500;
  font-size: 13.5px; letter-spacing: -0.005em; line-height: 1; padding: 9px 16px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.dt-btn:hover { background: var(--surface-hover); border-color: var(--ink-tertiary); }
.dt-btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dt-btn-primary:hover { background: #292524; border-color: #292524; color: var(--bg); }
.dt-btn-tertiary { background: transparent; border: none; color: var(--ink-tertiary); padding: 4px 8px; }
.dt-btn-tertiary:hover { background: var(--danger-fill); color: var(--danger); }
.dt-btn:disabled, .dt-btn.is-disabled {
  background: var(--surface-hover); color: var(--ink-tertiary);
  border: 1px solid var(--border); cursor: not-allowed;
}
.dt-btn-block { width: 100%; }
.dt-btn .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; }

.dt-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dt-btn-row > .dt-btn { flex: 1; }

/* ===========================================================================
   File uploader (cream dropzone)
   =========================================================================== */
.dt-uploader {
  background: var(--surface-hover); border: 1px dashed var(--border-strong);
  border-radius: var(--r-md); padding: 22px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.dt-uploader-text { display: flex; flex-direction: column; gap: 2px; }
.dt-uploader-text .hint { font-size: 14px; color: var(--ink); }
.dt-uploader-text .sub { font-size: 12.5px; color: var(--ink-tertiary); }
.dt-uploader .dt-mi { font-family: "Material Symbols Outlined"; font-size: 24px; color: var(--ink-tertiary); }

/* Staged-file chip */
.dt-file-chip {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 14px; margin-top: 10px;
}
.dt-file-chip .name { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-feature-settings: "ss02"; }
.dt-file-chip .size { font-family: var(--font-mono); font-size: 12px; color: var(--ink-tertiary); margin-left: auto; }

/* ===========================================================================
   Expanders / bordered cards
   =========================================================================== */
.dt-expander {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: 0 1px 2px rgba(28,25,23,0.03); margin: 10px 0;
}
.dt-expander > summary, .dt-expander-head {
  background: var(--surface-hover); border-bottom: 1px solid var(--border);
  padding: 12px 16px; font-weight: 500; color: var(--ink); font-size: 14px;
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
}
.dt-expander > summary::-webkit-details-marker { display: none; }
.dt-expander > summary::before {
  content: "expand_more"; font-family: "Material Symbols Outlined"; font-size: 20px;
  color: var(--ink-tertiary); transition: transform 0.15s ease;
}
.dt-expander[open] > summary::before { transform: rotate(180deg); }
.dt-expander-body, .dt-expander > .dt-expander-body { padding: 14px 16px; }
.dt-expander:not([open]) > summary { border-bottom: none; }

.dt-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(28,25,23,0.03); padding: 16px; margin: 10px 0;
}

/* ===========================================================================
   Alerts
   =========================================================================== */
.dt-alert {
  border-radius: var(--r-md); border: 1px solid transparent;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.45; margin: 10px 0;
  display: flex; gap: 10px; align-items: flex-start;
}
.dt-alert .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.dt-alert.info    { background: var(--info-fill);    color: var(--info); }
.dt-alert.success { background: var(--success-fill); color: var(--success); }
.dt-alert.warn    { background: var(--warn-fill);    color: var(--warn); }
.dt-alert.error   { background: var(--danger-fill);  color: var(--danger); }
.dt-alert code { background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 4px; }

/* Next-step strip — slim single-line "what to do next" suggestion shown at the
   end of a tool's results. Subtle accent ground + left accent rule so it nudges
   without competing with alerts; the trailing dismiss control is unobtrusive. */
.dt-next-step {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-fill); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: 10px 14px; margin: 16px 0;
  font-size: 13.5px; line-height: 1.4; color: var(--ink);
}
.dt-next-step .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; color: var(--accent); flex-shrink: 0; }
.dt-next-step a { color: var(--accent); font-weight: 500; }
.dt-next-step a:hover { color: var(--accent-hover); }
.dt-next-step-dismiss {
  margin-left: auto; background: transparent; border: none; cursor: pointer;
  color: var(--ink-tertiary); font-size: 13px; line-height: 1; padding: 2px 4px;
}
.dt-next-step-dismiss:hover { color: var(--ink-secondary); }

/* ===========================================================================
   Inputs (static representations of Streamlit widgets)
   =========================================================================== */
.dt-field { margin: 10px 0; }
.dt-label { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 5px; display: block; }
.dt-label .req { color: var(--accent); }
.dt-input, .dt-select, .dt-textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 8px 11px; font-family: var(--font-sans);
  font-size: 13.5px; color: var(--ink);
}
.dt-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-tertiary) 50%), linear-gradient(135deg, var(--ink-tertiary) 50%, transparent 50%); background-position: calc(100% - 16px) 14px, calc(100% - 11px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.dt-textarea { min-height: 76px; resize: vertical; font-family: var(--font-mono); font-size: 13px; }
.dt-help-text { font-size: 12px; color: var(--ink-tertiary); margin-top: 4px; }

/* Multiselect — chips inside a box */
.dt-multiselect {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 6px 8px; min-height: 38px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.dt-ms-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--accent-fill);
  color: var(--accent-hover); border-radius: var(--r-sm); padding: 3px 8px;
  font-size: 12.5px; font-weight: 500;
}
.dt-ms-chip .x { color: var(--accent); font-size: 13px; }
.dt-ms-placeholder { color: var(--ink-tertiary); font-size: 13px; padding: 2px 4px; }

/* Checkbox / radio */
.dt-check { display: flex; align-items: center; gap: 9px; margin: 8px 0; font-size: 13.5px; color: var(--ink); }
.dt-check .box {
  width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border-strong);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dt-check.on .box { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.dt-check.on .box .dt-mi { font-family: "Material Symbols Outlined"; font-size: 14px; }
.dt-radio-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0; }
.dt-radio { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.dt-radio .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); display: inline-block; flex-shrink: 0; }
.dt-radio.on .dot { border: 5px solid var(--ink); }

/* Strategy precedence legend + overridden state (Fix Missing Values).
   Makes the preset -> global -> per-column resolution order legible and
   visibly dims a layer when a more specific layer wins. */
.dt-precedence {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-hover); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 13px; margin: 0 0 14px;
  font-size: 12.5px; color: var(--ink-secondary); line-height: 1.4;
}
.dt-precedence .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; color: var(--ink-tertiary); flex-shrink: 0; }
.dt-precedence strong { color: var(--ink); font-weight: 600; }
.dt-radio-row.is-overridden { opacity: 0.5; }
.dt-radio-row.is-overridden .dt-radio { text-decoration: line-through; text-decoration-color: var(--ink-tertiary); }

/* Slider */
.dt-slider { margin: 14px 0 6px; }
.dt-slider .track { position: relative; height: 4px; background: var(--border-strong); border-radius: 2px; }
.dt-slider .fill { position: absolute; left: 0; top: 0; height: 4px; background: var(--ink); border-radius: 2px; }
.dt-slider .knob { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }
.dt-slider .val { font-family: var(--font-mono); font-size: 12px; color: var(--ink-secondary); margin-top: 8px; }

/* ===========================================================================
   Layout helpers
   =========================================================================== */
.dt-row { display: flex; gap: 16px; }
.dt-row > * { flex: 1; min-width: 0; }
.dt-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dt-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dt-divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.dt-caption { font-size: 12.5px; color: var(--ink-tertiary); line-height: 1.5; }
.dt-spacer { height: 12px; }

/* ===========================================================================
   DataFrame / preview table
   =========================================================================== */
.dt-table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin: 8px 0; }
table.dt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dt-table th {
  background: var(--surface-hover); color: var(--ink-secondary); font-weight: 500;
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; text-transform: none; white-space: nowrap;
}
table.dt-table td {
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); font-feature-settings: "ss02"; white-space: nowrap;
}
table.dt-table tr:last-child td { border-bottom: none; }
table.dt-table tr:nth-child(even) td { background: #fcfbf8; }
table.dt-table td.idx { color: var(--ink-tertiary); background: var(--surface-hover); }
.dt-cell-flag { color: var(--warn); }
.dt-cell-del { color: var(--danger); text-decoration: line-through; }
.dt-cell-add { color: var(--success); }

/* ===========================================================================
   Stats overview (home) — copied from _legacy.py
   =========================================================================== */
.dt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 20px; }
.dt-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: 0 1px 2px rgba(28,25,23,0.03); }
.dt-stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-tertiary); font-weight: 500; margin-bottom: 6px; line-height: 1.4; }
.dt-stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; color: var(--ink); display: flex; align-items: baseline; gap: 6px; }
.dt-stat-unit { font-size: 12px; font-weight: 400; color: var(--ink-tertiary); letter-spacing: 0; }
.dt-stat.is-warn .dt-stat-value { color: var(--warn); }
.dt-stat.is-info .dt-stat-value { color: var(--info); }
.dt-stat.is-success .dt-stat-value { color: var(--success); }
@media (max-width: 900px) { .dt-stats { grid-template-columns: repeat(2, 1fr); } }

/* Metric (st.metric) */
.dt-metrics { display: flex; gap: 28px; flex-wrap: wrap; margin: 6px 0 14px; }
.dt-metric .label { font-size: 12.5px; color: var(--ink-tertiary); margin-bottom: 4px; }
.dt-metric .value { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); line-height: 1; }
.dt-metric .delta { font-size: 12.5px; margin-top: 3px; }
.dt-metric .delta.up { color: var(--success); }
.dt-metric .delta.down { color: var(--danger); }

/* ===========================================================================
   Files card (home) — copied from _legacy.py
   =========================================================================== */
.dt-files-section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 10px; gap: 12px; }
.dt-files-section-head h2 { margin: 0; }
.dt-section-meta { font-size: 12.5px; color: var(--ink-tertiary); }
.dt-file-row { display: flex; align-items: center; gap: 12px; }
.dt-file-icon-chip { width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--accent-fill); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dt-file-icon-chip svg { width: 14px; height: 14px; stroke-width: 1.8; }
.dt-file-name { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-feature-settings: "ss02"; }
.dt-file-size { font-family: var(--font-mono); font-size: 12px; color: var(--ink-tertiary); font-feature-settings: "ss02"; }
.dt-file-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px; background: var(--surface-hover);
  border: none; border-top: 1px dashed var(--border-strong);
  border-radius: 0 0 var(--r-lg) var(--r-lg); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--ink-secondary); margin-top: 14px;
}
.dt-file-add:hover { background: var(--accent-fill); color: var(--accent); }
.dt-file-add svg { width: 14px; height: 14px; stroke-width: 2; }

/* ===========================================================================
   Findings panel — copied from _legacy.py
   =========================================================================== */
.dt-finding-group-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 22px;
  border-bottom: 1px solid var(--border); background: var(--surface-hover);
  margin: -16px -16px 1.2rem; border-radius: var(--r-lg) var(--r-lg) 0 0;
  cursor: pointer; user-select: none;
}
.dt-finding-group-chevron { color: var(--ink-tertiary); font-family: "Material Symbols Outlined"; font-size: 20px; line-height: 1; flex-shrink: 0; }
.dt-severity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dt-severity-dot.warn { background: var(--warn); }
.dt-severity-dot.info { background: var(--info); }
.dt-severity-dot.error { background: var(--danger); }
.dt-severity-dot.success { background: var(--success); }
.dt-group-filename { font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; color: var(--ink); font-feature-settings: "ss02"; }
.dt-group-counts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dt-count-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.dt-count-pill.warn { background: var(--warn-fill); color: var(--warn); }
.dt-count-pill.info { background: var(--info-fill); color: var(--info); }
.dt-count-pill.error { background: var(--danger-fill); color: var(--danger); }
.dt-count-pill.success { background: var(--success-fill); color: var(--success); }
.dt-finding-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.dt-finding-row:first-of-type { border-top: none; }
.dt-finding-icon { width: 24px; height: 24px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dt-finding-icon.warn { background: var(--warn-fill); color: var(--warn); }
.dt-finding-icon.info { background: var(--info-fill); color: var(--info); }
.dt-finding-icon.error { background: var(--danger-fill); color: var(--danger); }
.dt-finding-icon .dt-mi { font-family: "Material Symbols Outlined"; font-size: 16px; line-height: 1; }
.dt-finding-body { flex: 1; min-width: 0; }
.dt-finding-title { font-size: 14px; color: var(--ink); margin: 0 0 2px; line-height: 1.4; letter-spacing: -0.005em; }
.dt-finding-title strong { font-weight: 500; }
.dt-finding-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-tertiary); line-height: 1.4; margin: 0; font-feature-settings: "ss02"; }

/* Overflow control — sits at the foot of a findings card when rows are hidden.
   Bleeds to the card edges (cancels the .dt-card 16px padding) like .dt-file-add. */
.dt-finding-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% + 32px); margin: 4px -16px -16px;
  padding: 11px 16px; background: var(--surface-hover);
  border: none; border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg); cursor: pointer;
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 500; color: var(--ink-secondary);
}
.dt-finding-more:hover { background: var(--accent-fill); color: var(--accent); }
.dt-finding-more .dt-mi { font-family: "Material Symbols Outlined"; font-size: 18px; }

/* Collapsed findings panel — the group head fills the whole card (head only,
   no body). Proper state variant so the two states don't drift; replaces the
   per-instance inline margin-bottom:-16px hack. */
.dt-card.is-collapsed { padding: 0; }
.dt-finding-group-head.is-collapsed { margin: 0; border-bottom: none; border-radius: var(--r-lg); }

/* Match-group review card (dedup) */
.dt-match-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(28,25,23,0.03); margin: 12px 0; overflow: hidden; }
.dt-match-head { background: var(--surface-hover); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.dt-match-head .title { font-weight: 500; font-size: 14px; }
.dt-match-head .conf { margin-left: auto; }
.dt-match-body { padding: 14px 16px; }
.dt-keep-row { background: var(--success-fill); }
.dt-keep-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--success-fill); color: var(--success); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 500; }

/* Progress bar */
.dt-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.dt-progress .bar { height: 100%; background: var(--ink); border-radius: 3px; }

/* Tabs */
.dt-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin: 10px 0 16px; }
.dt-tab { font-size: 13.5px; color: var(--ink-secondary); padding: 8px 2px; border-bottom: 2px solid transparent; cursor: pointer; }
.dt-tab.is-active { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }

/* Code block */
.dt-code { background: var(--surface-hover); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); white-space: pre; overflow-x: auto; font-feature-settings: "ss02"; }

@media (max-width: 1100px) {
  .dt-footer { left: 0; }
  .dt-sidebar { display: none; }
  .dt-main { padding: 28px 24px 96px; }
}
