/*
 * OCR Benchmark dashboard — layout and components on the TREE(3) × Modernize design language.
 * Tokens come from brand/colors_and_type.css (loaded first). Use var(--…) here; do not introduce new hex colours.
 * Thai rules: line-height >= 1.55 for body, no letter-spacing on Thai text, >= 14px readable text.
 */

/* ─── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--neutral-50); color: var(--neutral-800); font-size: var(--text-sm); }
/* The vendored base sets negative letter-spacing on headings; our headings are Thai, so reset it. */
h1, h2, h3, h4, h5, h6 { letter-spacing: 0; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex: none; }

/* ─── App shell: sidebar + top bar (Modernize layout) ──────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--space-6) var(--space-8) var(--space-16); }

.sidebar { width: 264px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
           background: var(--neutral-0); border-right: 1px solid var(--neutral-200); z-index: 20;
           transition: transform var(--duration-base) var(--ease-out); }
.sidebar-logo { display: flex; align-items: center; height: 72px; padding: 0 var(--space-6);
                border-bottom: 1px solid var(--neutral-200); }
.sidebar-logo img { height: 40px; width: auto; display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-4); }
.nav-header { padding: var(--space-5) var(--space-3) var(--space-2); font-size: var(--text-xs); font-weight: 700;
              letter-spacing: 0.08em; color: var(--neutral-400); }
.nav-item { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3); margin-bottom: 2px;
            border-radius: var(--radius-md); color: var(--neutral-700); font-size: var(--text-sm);
            transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.nav-item:hover { background: var(--neutral-100); color: var(--blue-700); text-decoration: none; }
.nav-item.active { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.nav-item svg, .icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5;
                                  stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--neutral-200);
                font-size: var(--text-xs); color: var(--neutral-500); line-height: var(--leading-normal); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-4);
          min-height: 72px; padding: var(--space-3) var(--space-8); background: var(--neutral-0);
          border-bottom: 1px solid var(--neutral-200); }
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: var(--text-xl); font-weight: 600; line-height: var(--leading-snug); color: var(--neutral-800);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar p { font-size: var(--text-sm); color: var(--neutral-500); margin-top: 2px; }
.icon-button { display: none; width: 40px; height: 40px; padding: 0; align-items: center; justify-content: center;
               border: none; border-radius: var(--radius-md); background: transparent; color: var(--blue-700); }
.icon-button:hover:not(:disabled) { background: var(--blue-50); }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px var(--space-3); border-radius: var(--radius-full); font-size: var(--text-xs);
         font-weight: 600; letter-spacing: 0.06em; white-space: nowrap; }
.badge-neutral { background: var(--neutral-100); color: var(--neutral-600); }

/* ─── Tiles (Modernize stat cards) ─────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); margin-top: var(--space-6); }
.tile { background: var(--neutral-0); border: 1px solid var(--neutral-200); border-radius: var(--radius-xl);
        padding: var(--space-6); box-shadow: var(--shadow-sm);
        transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out); }
.tile[data-run]:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile-title { color: var(--neutral-500); font-size: var(--text-sm); font-weight: 500; }
.tile-value { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 700; color: var(--blue-700);
              line-height: var(--leading-tight); margin-top: var(--space-2); font-variant-numeric: tabular-nums; }
.tile-model { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--neutral-800);
              margin-top: var(--space-2); }
.tile-caption { color: var(--neutral-500); font-size: var(--text-sm); margin-top: var(--space-1); }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--neutral-0); border: 1px solid var(--neutral-200); border-radius: var(--radius-xl);
        padding: var(--space-8); margin-top: var(--space-6); box-shadow: var(--shadow-sm); scroll-margin-top: 96px; }
/* The first block on a page sits directly under the top bar padding. */
main > :first-child { margin-top: 0; }
.card h2 { font-size: var(--text-xl); font-weight: 600; line-height: var(--leading-snug); color: var(--neutral-800);
           margin-bottom: var(--space-1); }
.card-note { margin: 0 0 var(--space-4); color: var(--neutral-500); font-size: var(--text-sm); }
.card-note.warn { color: var(--warning); background: var(--warning-bg); padding: var(--space-3) var(--space-4);
                  border-radius: var(--radius-md); }
.scroll-x { overflow-x: auto; }
section[id] { scroll-margin-top: 96px; }

/* ─── Bar chart ─────────────────────────────────────────────────────────── */
.bar-row { display: grid; grid-template-columns: minmax(160px, 300px) 1fr; align-items: center; gap: var(--space-4);
           padding: 6px 0; cursor: pointer; border-radius: var(--radius-md);
           transition: background var(--duration-fast) var(--ease-out); }
.bar-row:hover { background: var(--neutral-100); }
.bar-row:hover .bar-label { color: var(--blue-700); }
.bar-label { text-align: right; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: flex; align-items: center; gap: var(--space-3); }
.bar { height: 20px; border-radius: var(--radius-sm); background: var(--blue-200); flex: none; }
.bar.top { background: var(--blue-700); }
.bar-value { font-family: var(--font-mono); font-weight: 600; font-size: var(--text-sm); }

/* ─── Tables ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
.scorecard th, .frontier-table th { text-align: left; font-size: var(--text-sm); color: var(--neutral-600); font-weight: 600;
                                    border-bottom: 1px solid var(--neutral-200); padding: var(--space-3); white-space: nowrap;
                                    background: var(--neutral-50); }
.scorecard th.num, .frontier-table th.num { text-align: right; }
.scorecard td, .frontier-table td { border-bottom: 1px solid var(--neutral-100); padding: var(--space-3); vertical-align: top; }
.scorecard tbody tr, .frontier-table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
.scorecard tbody tr.clickable, .frontier-table tr.clickable { cursor: pointer; }
.scorecard tbody tr.clickable:hover, .frontier-table tr.clickable:hover { background: var(--neutral-100); }
.num { text-align: right; font-family: var(--font-mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.best { font-weight: 700; color: var(--blue-700); }
.muted { color: var(--neutral-500); }
.kind { color: var(--neutral-500); font-size: var(--text-xs); font-weight: 400; font-family: var(--font-body); }

.heatmap th { font-size: var(--text-xs); color: var(--neutral-600); font-weight: 600; padding: 6px var(--space-1);
              vertical-align: bottom; min-width: 72px; max-width: 120px; }
.heatmap td.heat { text-align: center; font-family: var(--font-mono); font-size: 0.8125rem; padding: var(--space-3) var(--space-1);
                   border: 2px solid var(--neutral-0); border-radius: var(--radius-sm); cursor: pointer; }
.heatmap td.heat:hover { outline: 2px solid var(--blue-700); outline-offset: -2px; }
.heatmap td.best-cell { outline: 3px solid var(--blue-500); outline-offset: -3px; font-weight: 700; }
.heatmap td.row-label { padding: var(--space-2) var(--space-3); white-space: nowrap; }

/* ─── Controls ──────────────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.card > label, .toolbar label { color: var(--neutral-600); font-size: var(--text-sm); display: inline-flex; align-items: center;
                                gap: var(--space-2); margin-right: var(--space-4); }
select, input[type=search], button { font-family: var(--font-body); font-size: var(--text-sm); height: 40px;
  padding: 0 var(--space-3); border: 1.5px solid var(--neutral-300); border-radius: var(--radius-md);
  background: var(--neutral-0); color: var(--neutral-800);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
select:hover, input[type=search]:hover { border-color: var(--neutral-400); }
select:focus, input[type=search]:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--shadow-focus); }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--blue-700); color: var(--blue-700); }
button:disabled { opacity: .45; cursor: default; }
#show-more { background: var(--blue-700); color: var(--neutral-0); border-color: var(--blue-700); padding: 0 var(--space-5); }
#show-more:hover { background: var(--blue-800); border-color: var(--blue-800); color: var(--neutral-0); transform: translateY(-1px); }
.breadcrumb { font-size: var(--text-sm); color: var(--neutral-500); }
.breadcrumb a:hover { color: var(--blue-800); }

/* ─── Pareto chart ──────────────────────────────────────────────────────── */
svg.pareto { width: 100%; min-width: 720px; height: auto; display: block; font-family: var(--font-body); }
.pareto .grid { stroke: var(--neutral-200); stroke-width: 1; }
.pareto .tick { fill: var(--neutral-500); font-size: 12px; font-family: var(--font-mono); }
.pareto .axis-label { fill: var(--neutral-600); font-size: 13px; }
.pareto .frontier-line { fill: none; stroke: var(--blue-700); stroke-width: 2; stroke-dasharray: 6 4; }
.pareto .point { fill: var(--blue-200); stroke: var(--neutral-0); stroke-width: 1.5; cursor: pointer;
                 transition: fill var(--duration-fast) var(--ease-out); }
.pareto .point.frontier { fill: var(--blue-700); }
.pareto .point:hover { fill: var(--blue-500); }
.pareto .point-label { fill: var(--neutral-800); font-size: 12px; font-weight: 600; paint-order: stroke;
                       stroke: var(--neutral-0); stroke-width: 3px; }
.pareto .point-label.minor { fill: var(--neutral-600); font-size: 11px; font-weight: 400; }
.pareto .label-leader { stroke: var(--neutral-400); stroke-width: 1; }
.frontier-table { margin-top: var(--space-2); }

/* ─── Score badges (per page / per element) ────────────────────────────── */
.score { display: inline-block; min-width: 64px; padding: 2px var(--space-2); border-radius: var(--radius-sm);
         font-family: var(--font-mono); font-weight: 600; font-size: 0.8125rem; text-align: center; }
.score-good { background: var(--success-bg); color: var(--success); }
.score-mid { background: var(--warning-bg); color: var(--warning); }
.score-bad { background: var(--error-bg); color: var(--error); }
.score-none { background: transparent; color: var(--neutral-400); font-weight: 400; }
.page-name { font-family: var(--font-mono); font-size: var(--text-xs); word-break: break-all; }

/* ─── Sample view ───────────────────────────────────────────────────────── */
.sample-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--space-6); margin-top: var(--space-6); }
.sample-layout .card { margin: 0; }
.image-card { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; }
.page-image { position: relative; }
.page-image img { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }
.page-image svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.page-image polygon { fill: transparent; stroke: var(--blue-500); stroke-width: 3; vector-effect: non-scaling-stroke; }
.page-image polygon.ignored { stroke: var(--neutral-400); stroke-dasharray: 4 4; }
.page-image polygon.active { fill: rgba(41, 169, 223, 0.25); stroke: var(--blue-700); stroke-width: 4; }
.page-image.hide-boxes svg { display: none; }
.score-chips { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 6px 0 var(--space-1);
               font-size: var(--text-sm); color: var(--neutral-600); }
.score-chips span.score { margin-left: 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); border-bottom: 1px solid var(--neutral-200); margin-bottom: var(--space-4); }
.tab { height: auto; border: none; border-radius: var(--radius-md) var(--radius-md) 0 0; padding: var(--space-2) var(--space-4);
       background: transparent; color: var(--neutral-500); font-weight: 600; margin-bottom: -1px;
       border-bottom: 2px solid transparent; }
.tab:hover:not(:disabled) { color: var(--blue-700); background: var(--blue-50); }
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-700); }
.match { border: 1px solid var(--neutral-200); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4);
         margin-bottom: var(--space-3); transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.match.active { border-color: var(--blue-500); box-shadow: var(--shadow-focus); }
.match-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: var(--text-xs);
              color: var(--neutral-500); margin-bottom: var(--space-2); }
.match-side { display: grid; grid-template-columns: 64px 1fr; gap: var(--space-2); margin-top: 6px; }
.match-side-label { font-size: var(--text-xs); color: var(--neutral-500); padding-top: 2px; }
.match-text { white-space: pre-wrap; word-break: break-word; line-height: var(--leading-relaxed); font-size: 15px; }
.match-text.code { font-family: var(--font-mono); font-size: 13px; }
.diff-deleted { background: var(--error-bg); text-decoration: underline wavy var(--error); }
.diff-inserted { background: var(--warning-bg); text-decoration: underline wavy var(--warning); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--text-xs); color: var(--neutral-500);
          margin-bottom: var(--space-3); }
.table-frame { width: 100%; min-height: 80px; border: 1px solid var(--neutral-200); border-radius: var(--radius-md); background: var(--neutral-0); }
details summary { cursor: pointer; color: var(--neutral-600); font-size: var(--text-sm); margin-top: var(--space-3); }
pre.source { white-space: pre-wrap; word-break: break-word; background: var(--neutral-50); border: 1px solid var(--neutral-200);
             border-radius: var(--radius-md); padding: var(--space-3); font-size: 13px; max-height: 70vh; overflow: auto; }
.order-seq { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 6px 0 var(--space-3); }
.order-seq span { min-width: 30px; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--neutral-100); text-align: center;
                  font-family: var(--font-mono); font-size: var(--text-xs); }
.order-seq span.moved { background: var(--warning-bg); color: var(--warning); font-weight: 700; }
.empty-state { color: var(--neutral-500); padding: var(--space-5) 0; }
.error { margin-top: var(--space-6); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md);
         background: var(--error-bg); color: var(--neutral-800); border: 1px solid var(--error-bg); }

/* ─── Responsive: sidebar becomes an overlay drawer ────────────────────── */
@media (max-width: 1100px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  .icon-button { display: inline-flex; }
  .topbar { padding: var(--space-3) var(--space-4); }
  main { padding: var(--space-4) var(--space-4) var(--space-12); }
  .card { padding: var(--space-5) var(--space-4); }
  .sample-layout { grid-template-columns: 1fr; }
  .image-card { position: static; max-height: none; }
  .bar-row { grid-template-columns: 120px 1fr; }
}

/* Dataset EDA */
.eda-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-6); }
.eda-columns h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-2); }
.eda-bar-cell { min-width: 200px; }
.heatmap td.eda-run-label { white-space: normal; min-width: 180px; max-width: 240px; }

.pareto-metrics { display: flex; flex-wrap: wrap; gap: 8px 20px; border: 1px solid var(--neutral-200);
  border-radius: 8px; padding: 8px 14px 10px; margin: 0 0 12px; }
.pareto-metrics legend { font-size: var(--text-sm); color: var(--neutral-600); padding: 0 6px; }
.pareto-metric { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--text-sm); }
.pareto-metric input { width: 16px; height: 16px; accent-color: var(--blue-500); cursor: pointer; }

/* Summary table page */
.summary-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.summary-header h2 { margin-bottom: 0; }
a.button { display: inline-flex; align-items: center; height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  background: var(--blue-700); color: var(--neutral-0); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
a.button:hover { background: var(--blue-500); }
.summary-scroll { max-height: 75vh; overflow: auto; }
.summary-table { font-size: var(--text-xs); }
.summary-table th, .summary-table td { white-space: nowrap; }
.summary-table thead th { position: sticky; top: 0; background: var(--neutral-0); z-index: 2; cursor: pointer; user-select: none; }
.summary-table thead th:hover { color: var(--blue-700); }
.summary-table td.summary-label, .summary-table th[data-column="label"] { position: sticky; left: 0; background: var(--neutral-0); z-index: 1; }
.summary-table th[data-column="label"] { z-index: 3; }
.summary-table td.summary-wide { white-space: normal; min-width: 260px; }

/* Show/hide runs panel (visibility.js) */
.visibility-panel summary { cursor: pointer; }
.visibility-actions { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.visibility-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; }
.visibility-item { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: start; cursor: pointer;
  padding: 4px 0; }
.visibility-item input { margin-top: 3px; }
.visibility-item .kind { display: block; overflow-wrap: anywhere; }

/* Navigation sub-items and the combined / handwriting pages */
.nav-item.nav-sub { padding-left: var(--space-6); font-size: var(--text-xs); }
.nav-item.nav-sub svg { width: 16px; height: 16px; }
.axis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.axis-card { display: block; padding: var(--space-4); border: 1px solid var(--neutral-200); border-radius: var(--radius-lg);
             color: var(--neutral-700); font-size: var(--text-sm); line-height: var(--leading-normal); background: var(--blue-50); }
.axis-card:hover { border-color: var(--blue-500); text-decoration: none; }
.axis-card b { color: var(--blue-700); font-size: var(--text-base); }
.tile-link { display: block; color: inherit; }
.tile-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.combined-table th.axis-head { text-align: center; color: var(--blue-700); }
.combined-table .axis-start { border-left: 2px solid var(--neutral-200); }
.status-warn { color: var(--warning); font-weight: 600; }
.bar-row-static { cursor: default; }
.hw-legend { margin: 0 0 var(--space-4); padding-left: var(--space-6); color: var(--neutral-600); font-size: var(--text-sm);
             line-height: var(--leading-normal); }
.scorecard td.model-cell { min-width: 240px; }
.scorecard td.nowrap { white-space: nowrap; }
#section-research a { overflow-wrap: anywhere; }
.combined-table td.combined-model { min-width: 170px; max-width: 220px; }
.combined-table th, .combined-table td { padding-left: var(--space-2); padding-right: var(--space-2); }
.summary-table td.summary-run { font-family: var(--font-mono); }
/* Tree3 internal OCR page */
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }
.product-card { border: 1px solid var(--neutral-200); border-radius: var(--radius-lg); padding: var(--space-5); background: var(--neutral-0); }
.product-name { font-size: var(--text-xl); font-weight: 700; color: var(--blue-700); }
.product-engine { color: var(--neutral-600); font-size: var(--text-sm); margin-bottom: var(--space-2); }
.product-summary { color: var(--neutral-700); font-size: var(--text-sm); line-height: var(--leading-normal); margin: 0 0 var(--space-3); }
.kpi-list { margin: 0; }
.kpi-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--neutral-100); }
.kpi-row dt { color: var(--neutral-600); font-size: var(--text-sm); }
.kpi-row dd { margin: 0; text-align: right; }
.kpi-row dd .kind { display: block; }
.product-caveats { margin: var(--space-3) 0 0; padding-left: var(--space-5); color: var(--warning); font-size: var(--text-xs); }
.lang-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; margin-right: 6px; white-space: nowrap; }
.lang-measured { background: var(--blue-700); color: var(--neutral-0); }
.lang-vocabulary { background: var(--blue-50); color: var(--blue-700); }
.lang-missing { background: var(--neutral-100); color: var(--neutral-600); }
.lang-table tr.lang-thai td, .lang-line.lang-thai { background: var(--blue-50); }
.lang-score { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--text-xs); margin-right: 6px; }
.lang-bar { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--neutral-100); overflow: hidden; }
.lang-bar span { display: block; height: 100%; background: var(--blue-500); border-radius: 4px; }
.lang-details { margin-top: var(--space-4); }
.lang-details summary { cursor: pointer; font-weight: 600; color: var(--blue-700); }
.lang-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px var(--space-5); margin-top: var(--space-3); }
.lang-line { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; border-bottom: 1px solid var(--neutral-100); font-size: var(--text-sm); }
.internal-table td.internal-run { font-family: var(--font-mono); font-size: var(--text-xs); min-width: 280px; max-width: 360px;
                                  white-space: normal; overflow-wrap: anywhere; }
.internal-table td:first-child { min-width: 170px; white-space: normal; }
.internal-table td:last-child { min-width: 150px; white-space: normal; overflow-wrap: anywhere; }
.internal-table td.internal-run .kind, .internal-table td.internal-run .status-warn { font-family: var(--font-body); }
.internal-table tr.row-invalid td { opacity: 0.6; }
/* Internal OCR comparison charts: two validated categorical series + neutral context (white card surface) */
.viz-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: var(--space-6); }
.viz-layout.single { grid-template-columns: 1fr; margin-top: var(--space-6); }
@media (max-width: 720px) { .viz-layout { grid-template-columns: 1fr; } }
.viz-panel h3 { margin: 0 0 var(--space-1); font-size: var(--text-base); color: var(--neutral-800); }
.viz-panel { --series-fast: #2a78d6; --series-balance: #eb6834; --series-context: #C2CBD3; min-width: 0; }
svg.viz { width: 100%; min-width: 520px; height: auto; display: block; font-family: var(--font-body); }
.viz .viz-grid { stroke: var(--neutral-200); stroke-width: 1; }
.viz .viz-tick { fill: var(--neutral-500); font-size: 11px; font-family: var(--font-mono); }
.viz .viz-label { fill: var(--neutral-700); font-size: 12px; }
.viz .viz-label.strong, .viz .viz-value.strong { font-weight: 700; fill: var(--neutral-800); }
.viz .viz-value { fill: var(--neutral-700); font-size: 11px; font-family: var(--font-mono); }
.viz .viz-value.muted { fill: var(--neutral-500); }
.viz .viz-bar { stroke: var(--neutral-0); stroke-width: 1; }
.viz .viz-bar:hover, .viz .viz-dot:hover { opacity: 0.8; }
.viz .s-fast { fill: var(--series-fast); }
.viz .s-balance { fill: var(--series-balance); }
.viz .s-context { fill: var(--series-context); }
.viz .s-invalid { fill: var(--series-context); fill-opacity: 0.5; }
.viz .viz-best { stroke: var(--neutral-800); stroke-width: 2; }
.viz .viz-connector { stroke: var(--neutral-300); stroke-width: 2; }
.viz .viz-dot { stroke: var(--neutral-0); stroke-width: 2; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--neutral-700); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.viz-swatch.s-fast { background: #2a78d6; }
.viz-swatch.s-balance { background: #eb6834; }
.viz-swatch.s-context { background: #C2CBD3; }
.viz-swatch.s-invalid { background: #C2CBD3; opacity: 0.5; }
.viz-swatch.s-best { width: 3px; height: 14px; border-radius: 0; background: var(--neutral-800); }
svg.viz { max-width: 860px; }
.viz .viz-key.s-fast { fill: #2a78d6; }
.viz .viz-key.s-balance { fill: #eb6834; }
