/* HUBTEX Translation Hub — design tokens and components from the Translation Lab (lab/app.css), which follows the HUBTEX Advisor. */

@font-face { font-family: 'Franklin Gothic'; src: local('Franklin Gothic Book'), local('FranklinGothic-Book'), url('/fonts/FRABK.TTF') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Franklin Gothic'; src: local('Franklin Gothic Demi'), local('FranklinGothic-Demi'), url('/fonts/FRADM.TTF') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Franklin Gothic'; src: local('Franklin Gothic Demi'), local('FranklinGothic-Demi'), url('/fonts/FRADM.TTF') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Franklin Gothic'; src: local('Franklin Gothic Heavy'), local('FranklinGothic-Heavy'), url('/fonts/FRAHV.TTF') format('truetype'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Franklin Gothic Condensed'; src: local('Franklin Gothic Demi Cond'), local('FranklinGothic-DemiCond'), url('/fonts/FRADMCN.TTF') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --hx-orange: #ff661b;
  --hx-orange-hover: #e55a15;
  --hx-orange-press: #c64c10;
  --hx-orange-tint: #fff1e8;
  --hx-orange-soft: #fff8f4;
  --hx-ring: rgba(255, 102, 27, .28);
  --hx-dark: #2f3339;
  --hx-dark-raised: #3c4047;
  --hx-text-2: #4d5058;
  --hx-muted: #6b6e76;
  --hx-subtle: #8d8f96;
  --hx-on-dark: #bcbcc1;
  --hx-on-dark-2: #d9d9dc;
  --hx-border: #d9d9dc;
  --hx-border-input: #bcbcc1;
  --hx-surface: #f6f6f7;
  --hx-track: #ececee;
  --hx-row: #ededee;
  --hx-head: #f8f8f9;
  --hx-success: #2f8a3a;
  --hx-success-bg: #eff7f0;
  --hx-success-line: #c5ddc9;
  --hx-success-text: #286535;
  --hx-warn-bg: #fff6ec;
  --hx-warn-line: #e2cdbb;
  --hx-warn-text: #8b4d10;
  --hx-danger: #c8322c;
  --hx-danger-text: #8a1f1a;
  --hx-danger-bg: #fbeceb;
  --hx-danger-line: #eac4bd;
  --hx-ease: cubic-bezier(.2, .7, .2, 1);
  --hx-font: 'Franklin Gothic', 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
  --hx-font-cond: 'Franklin Gothic Condensed', 'Franklin Gothic', 'Libre Franklin', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #fff; color: var(--hx-dark); font-family: var(--hx-font); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--hx-orange-press); text-decoration: none; }
a:hover { color: var(--hx-orange-hover); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--hx-ring); }
[hidden] { display: none !important; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: square; stroke-linejoin: miter; }

/* ---------- type roles ---------- */
.hx-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); }
.hx-accent { color: var(--hx-orange); }
.hx-h1 { font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: -.01em; text-transform: uppercase; margin-top: 6px; }
.hx-h2 { font-weight: 900; font-size: 22px; line-height: 1.1; text-transform: uppercase; }
.hx-cond { font-family: var(--hx-font-cond); font-weight: 700; }
.hx-lead { font-size: 14px; color: var(--hx-muted); max-width: 760px; margin-top: 12px; }
.hx-rule { height: 2px; background: var(--hx-orange); margin: 18px 0 24px; }
.hx-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); }

/* ---------- buttons ---------- */
.hx-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 22px; border-radius: 4px;
  background: var(--hx-orange); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; transition: background 120ms;
}
.hx-btn-primary:hover { background: var(--hx-orange-hover); }
.hx-btn-primary:active { background: var(--hx-orange-press); }
.hx-btn-primary:disabled { opacity: .6; cursor: default; }
.hx-btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 18px; border-radius: 4px; border: 1px solid var(--hx-dark);
  background: transparent; font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; transition: background 120ms;
}
.hx-btn-outline:hover { background: var(--hx-surface); }
.hx-btn-small {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--hx-border);
  background: #fff; font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-text-2); white-space: nowrap;
}
.hx-btn-small:hover { border-color: var(--hx-dark); color: var(--hx-dark); }
.hx-btn-small .i { width: 13px; height: 13px; }
.hx-text-btn { font-size: 13px; font-weight: 600; color: var(--hx-muted); padding: 6px 8px; transition: color 120ms; }
.hx-text-btn:hover { color: var(--hx-dark); }

/* ---------- header ---------- */
.hx-app { min-height: 100vh; display: flex; flex-direction: column; }
.hx-header { border-bottom: 1px solid var(--hx-border); background: #fff; position: sticky; top: 0; z-index: 20; }
.hx-header-inner { max-width: 1360px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hx-header-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hx-logo { height: 18px; width: auto; display: block; }
.hx-header-divider { width: 1px; height: 20px; background: var(--hx-border); flex-shrink: 0; }
.hx-header-title { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hx-build { font-size: 12px; color: var(--hx-subtle); white-space: nowrap; }
.hx-chip-btn {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--hx-border);
  background: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.hx-chip-btn .i { width: 14px; height: 14px; color: var(--hx-muted); }
.hx-lang-src { color: var(--hx-muted); }
.hx-lang { position: relative; display: block; }
.hx-lang select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.hx-lang:focus-within .hx-chip-btn { box-shadow: 0 0 0 3px var(--hx-ring); }
.hx-lang:hover .hx-chip-btn { border-color: var(--hx-dark); }

/* ---------- body + dark rail ---------- */
.hx-body { flex: 1; max-width: 1360px; width: 100%; margin: 0 auto; display: flex; align-items: stretch; }
.hx-sidebar { flex: 0 0 260px; background: var(--hx-dark); color: #fff; display: flex; flex-direction: column; position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; }
.hx-rail { padding: 16px 24px 8px; display: flex; flex-direction: column; }
.hx-rail-row {
  display: grid; grid-template-columns: 28px 1fr; column-gap: 14px; align-items: start; padding: 9px 0;
  border-bottom: 1px solid var(--hx-dark-raised); color: #fff; opacity: .55; transition: opacity 120ms;
}
.hx-rail-row.is-current, .hx-rail-row:hover { opacity: 1; }
.hx-mark {
  width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-family: var(--hx-font-cond); font-weight: 700; font-size: 15px; border: 1px solid var(--hx-muted); color: var(--hx-on-dark);
}
.hx-rail-row.is-current .hx-mark { background: var(--hx-orange); color: #fff; border: 0; }
.hx-rail-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hx-rail-title { font-weight: 600; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; line-height: 28px; white-space: nowrap; }
.hx-rail-summary { font-size: 12px; color: var(--hx-on-dark); line-height: 1.35; }
.hx-match { margin-top: auto; padding: 20px 24px; }
.hx-match-count { font-family: var(--hx-font-cond); font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: .01em; }
.hx-match-count b { font-weight: inherit; color: var(--hx-orange); }
.hx-match-second { margin-top: 12px; }
.hx-match-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-on-dark); margin-top: 4px; }
.hx-match-note { font-size: 12px; color: var(--hx-subtle); margin-top: 18px; line-height: 1.4; }

.hx-main { flex: 1 1 560px; min-width: 0; padding: 32px 40px 64px; }
.hx-view { animation: hx-fade 200ms var(--hx-ease); }
@keyframes hx-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- form fields ---------- */
.hx-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-text-2); }
.hx-field > span em { font-style: normal; color: var(--hx-subtle); letter-spacing: .04em; margin-left: 6px; }
.hx-input, .hx-textarea {
  height: 44px; border-radius: 4px; border: 1px solid var(--hx-border-input); padding: 0 12px; font-size: 15px; outline: none;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--hx-dark); background: #fff; width: 100%;
}
.hx-textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.hx-input:focus, .hx-textarea:focus { border-color: var(--hx-orange); box-shadow: 0 0 0 3px var(--hx-ring); }
.hx-select { appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f3339' stroke-width='2.25' stroke-linecap='square'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; cursor: pointer; }

.hx-input-panel { border: 1px solid var(--hx-border); border-top: 4px solid var(--hx-dark); border-radius: 6px; padding: 20px; background: #fff; }
.hx-field-wide { width: 100%; }
.hx-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin-top: 16px; }
.hx-controls > label.hx-field { width: 150px; }
.hx-controls > label.hx-field:has(#doc-type) { width: 210px; }
.hx-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hx-switch-row { display: flex; align-items: center; gap: 10px; height: 44px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--hx-dark); }
.hx-switch-row:disabled { cursor: not-allowed; color: var(--hx-subtle); }
.hx-switch { width: 36px; height: 20px; border-radius: 999px; background: var(--hx-border-input); padding: 2px; flex: none; transition: background 120ms; }
.hx-switch i { display: block; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: transform 120ms var(--hx-ease); }
.hx-switch-row[aria-checked="true"] .hx-switch { background: var(--hx-orange); }
.hx-switch-row[aria-checked="true"] .hx-switch i { transform: translateX(16px); }
.hx-ai-note { margin-top: 14px; font-size: 13px; color: var(--hx-muted); border-left: 3px solid var(--hx-orange); padding: 8px 12px; background: var(--hx-surface); }
.hx-ai-note code { font-size: 12px; background: #fff; border: 1px solid var(--hx-border); border-radius: 3px; padding: 0 4px; }

/* ---------- toolbar / filters ---------- */
.hx-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hx-search { position: relative; flex: 1 1 320px; display: block; }
.hx-search .i { position: absolute; left: 12px; top: 14px; color: var(--hx-muted); }
.hx-search .hx-input { padding-left: 36px; }
.hx-segments { display: inline-flex; border: 1px solid var(--hx-dark); border-radius: 4px; overflow: hidden; height: 44px; }
.hx-segments button { border-right: 1px solid var(--hx-border); padding: 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: #fff; }
.hx-segments button:last-child { border-right: 0; }
.hx-segments button.is-active { background: var(--hx-dark); color: #fff; }
.hx-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 20px; }
.hx-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--hx-border);
  background: #fff; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-text-2);
}
.hx-filter b { font-family: var(--hx-font-cond); font-weight: 700; font-size: 12px; letter-spacing: 0; color: var(--hx-subtle); }
.hx-filter:hover { border-color: var(--hx-dark); }
.hx-filter[aria-pressed="true"] { background: var(--hx-dark); border-color: var(--hx-dark); color: #fff; }
.hx-filter[aria-pressed="true"] b { color: var(--hx-on-dark); }

/* ---------- pills (evidence levels, term statuses, draft origins) ---------- */
.hx-pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 3px; border: 1px solid var(--hx-border); background: var(--hx-surface); color: var(--hx-text-2);
  padding: 2px 8px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; line-height: 1.5;
}
.hx-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hx-pill.is-approved { background: var(--hx-success-bg); border-color: var(--hx-success-line); color: var(--hx-success-text); }
.hx-pill.is-established { background: var(--hx-dark); border-color: var(--hx-dark); color: #fff; }
.hx-pill.is-supported { background: var(--hx-orange-tint); border-color: #f6c7ab; color: var(--hx-orange-press); }
.hx-pill.is-conflict, .hx-pill.is-disputed { background: var(--hx-warn-bg); border-color: var(--hx-warn-line); color: var(--hx-warn-text); }
.hx-pill.is-candidate, .hx-pill.is-single, .hx-pill.is-minority { background: var(--hx-surface); border-color: var(--hx-border); color: var(--hx-text-2); }
.hx-pill.is-proposed { background: #fff; border-style: dashed; border-color: var(--hx-border-input); color: var(--hx-muted); }
.hx-pill.is-none { background: #fff; color: var(--hx-subtle); }
.hx-pill.is-weak, .hx-pill.is-rejected { background: var(--hx-danger-bg); border-color: var(--hx-danger-line); color: var(--hx-danger-text); }
.hx-pill.is-origin-memory { background: var(--hx-orange); border-color: var(--hx-orange); color: #fff; }
.hx-pill.is-origin-fuzzy { background: var(--hx-orange-tint); border-color: #f6c7ab; color: var(--hx-orange-press); }
.hx-pill.is-origin-ai { background: var(--hx-dark); border-color: var(--hx-dark); color: #fff; }
.hx-pill.is-origin-none { background: #fff; color: var(--hx-subtle); }

/* ---------- summary stats ---------- */
.hx-stats { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); border: 1px solid var(--hx-border); border-radius: 4px; margin: 28px 0 8px; background: #fff; }
.hx-stat { padding: 14px 16px; border-right: 1px solid var(--hx-border); min-width: 0; }
.hx-stat:last-child { border-right: 0; }
.hx-stat dt { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); line-height: 1.3; }
.hx-stat dd { margin: 4px 0 0; font-family: var(--hx-font-cond); font-weight: 700; font-size: 30px; line-height: 1.1; }
.hx-stat.is-accent dd { color: var(--hx-orange); }
.hx-stat.is-bad dd { color: var(--hx-danger); }
.hx-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 32px 0 14px; flex-wrap: wrap; }
.hx-results-meta { font-size: 13px; color: var(--hx-muted); }
.hx-error { padding: 12px 16px; background: var(--hx-danger-bg); color: var(--hx-danger-text); font-size: 14px; border-radius: 4px; margin-top: 20px; border-left: 3px solid var(--hx-danger); }
.hx-notice { padding: 12px 16px; background: var(--hx-surface); color: var(--hx-text-2); font-size: 14px; border-radius: 4px; margin-top: 20px; border-left: 3px solid var(--hx-orange); }

/* ---------- segment cards ---------- */
.hx-seg { border: 1px solid var(--hx-border); border-top: 4px solid var(--hx-dark); border-radius: 6px; margin-bottom: 16px; background: #fff; }
.hx-seg.is-memory { border-top-color: var(--hx-orange); }
.hx-seg.is-none { border-top-color: var(--hx-border-input); }
.hx-seg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hx-seg-col { padding: 14px 16px 16px; min-width: 0; }
.hx-seg-col + .hx-seg-col { border-left: 1px solid var(--hx-border); }
.hx-seg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; margin-bottom: 8px; }
.hx-seg-num { font-family: var(--hx-font-cond); font-weight: 700; font-size: 15px; color: var(--hx-subtle); margin-right: 8px; }
.hx-seg-source { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.hx-term {
  background: linear-gradient(transparent 62%, var(--hx-orange-tint) 62%); border-bottom: 2px solid var(--hx-orange); cursor: help; padding: 0 1px;
}
.hx-term.is-weak { border-bottom: 2px dotted var(--hx-subtle); background: none; }
.hx-term.is-hot { background: var(--hx-orange-tint); }
.hx-draft { min-height: 76px; font-size: 15px; }
.hx-draft[dir="rtl"] { text-align: right; }
.hx-draft-empty { font-size: 14px; color: var(--hx-subtle); padding: 10px 0; }
.hx-clarify { margin-top: 8px; font-size: 13px; color: var(--hx-warn-text); background: var(--hx-warn-bg); border-left: 3px solid #e7a96d; padding: 6px 10px; }
.hx-checks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hx-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; }
.hx-check small { color: var(--hx-muted); font-size: 12px; overflow-wrap: anywhere; }
.hx-dot { flex-shrink: 0; margin-top: 2px; width: 14px; height: 14px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--hx-border); color: #fff; }
.hx-dot .i { width: 9px; height: 9px; stroke-width: 3.5; }
.hx-dot.is-ok { background: var(--hx-success); }
.hx-dot.is-bad { background: var(--hx-danger); }
.hx-dot.is-warn { background: #d98a2b; }

.hx-seg-tabs { display: flex; gap: 4px; border-top: 1px solid var(--hx-border); padding: 0 12px; background: var(--hx-head); border-radius: 0 0 6px 6px; }
.hx-seg-tabs button { display: flex; align-items: center; gap: 6px; padding: 10px 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--hx-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.hx-seg-tabs button:hover { color: var(--hx-dark); }
.hx-seg-tabs button[aria-expanded="true"] { color: var(--hx-dark); border-bottom-color: var(--hx-orange); }
.hx-seg-tabs b { font-family: var(--hx-font-cond); font-weight: 700; font-size: 12px; background: #fff; border: 1px solid var(--hx-border); border-radius: 999px; padding: 0 6px; letter-spacing: 0; }
.hx-seg-tabs button[aria-expanded="true"] b { background: var(--hx-orange-tint); border-color: #f6c7ab; color: var(--hx-orange-press); }
.hx-seg-panel { border-top: 1px solid var(--hx-border); padding: 4px 16px 12px; }
.hx-seg-panel:empty { display: none; }

/* memory matches */
.hx-matchrow { display: grid; grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hx-row); }
.hx-matchrow:last-child { border-bottom: 0; }
.hx-score { display: flex; flex-direction: column; gap: 6px; }
.hx-score-num { font-family: var(--hx-font-cond); font-weight: 700; font-size: 26px; line-height: 1; }
.hx-score-num small { font-size: 14px; color: var(--hx-muted); margin-left: 1px; }
.hx-score.is-exact .hx-score-num { color: var(--hx-orange); }
.hx-bar { height: 4px; background: var(--hx-track); }
.hx-bar > span { display: block; height: 100%; background: var(--hx-dark); }
.hx-score.is-exact .hx-bar > span { background: var(--hx-orange); }
.hx-ctx { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-orange-press); }
.hx-matchtext { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.hx-matchmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 12px; color: var(--hx-muted); }
.hx-matchmeta .hx-flag { color: var(--hx-warn-text); }
del.hx-del { color: var(--hx-danger-text); background: var(--hx-danger-bg); text-decoration: line-through; text-decoration-thickness: 1px; }
ins.hx-ins { color: var(--hx-orange-press); background: var(--hx-orange-tint); text-decoration: none; border-bottom: 1px solid var(--hx-orange); }
.hx-alts { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.hx-alt { font-size: 13px; color: var(--hx-text-2); padding-left: 10px; border-left: 2px solid var(--hx-border); }
.hx-use { margin-top: 8px; }

/* tables */
.hx-table-wrap { overflow-x: auto; }
.hx-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.hx-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); background: var(--hx-head); border-bottom: 1px solid var(--hx-border); white-space: nowrap; }
.hx-table td { padding: 12px; border-bottom: 1px solid var(--hx-row); vertical-align: top; overflow-wrap: break-word; }
.hx-table tr:last-child td { border-bottom: 0; }
.hx-table .num { font-family: var(--hx-font-cond); font-weight: 700; font-size: 15px; text-align: right; white-space: nowrap; }
.hx-table th.num { font-family: var(--hx-font); font-size: 11px; }
.hx-table tbody tr.is-clickable { cursor: pointer; }
.hx-table tbody tr.is-clickable:hover td { background: var(--hx-orange-soft); }
.hx-table tbody tr.is-open td { background: var(--hx-orange-soft); border-bottom-color: transparent; }
.hx-table tr.hx-detail td { background: var(--hx-orange-soft); padding-top: 0; }
.hx-panel { border: 1px solid var(--hx-border); border-radius: 4px; overflow: hidden; background: #fff; }
.hx-panel .hx-table td:first-child, .hx-panel .hx-table th:first-child { padding-left: 18px; }
.hx-term-de { font-weight: 600; }
.hx-term-forms { font-size: 12px; color: var(--hx-muted); margin-top: 2px; }
.hx-term-target { font-weight: 600; }
.hx-term-target.is-missing { color: var(--hx-subtle); font-weight: 400; }
.hx-evidence { font-size: 12px; color: var(--hx-muted); }
.hx-evidence span + span::before { content: " · "; }
.hx-mark-q { background: var(--hx-orange-tint); color: inherit; padding: 0 1px; border-bottom: 1px solid var(--hx-orange); }

.hx-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px; padding: 8px 0 6px; font-size: 13px; }
.hx-detail-grid h3 { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hx-muted); margin-bottom: 6px; }
.hx-detail-grid ul { margin: 0; padding-left: 16px; }
.hx-detail-grid li { margin-bottom: 3px; }
.hx-langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.hx-langs div { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.hx-langs code { font-family: var(--hx-font-cond); font-weight: 700; font-size: 12px; color: var(--hx-muted); width: 40px; flex: none; }
.hx-langs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-langs .is-dim { color: var(--hx-subtle); }
.hx-more { display: flex; justify-content: center; padding: 16px; border-top: 1px solid var(--hx-border); }
.hx-empty { padding: 36px 20px; text-align: center; color: var(--hx-muted); font-size: 14px; }

/* loading + toast */
.hx-loading { display: flex; align-items: center; gap: 14px; padding: 28px 0; color: var(--hx-muted); font-size: 14px; }
.hx-spinner { width: 28px; height: 28px; border: 3px solid var(--hx-orange); border-top-color: transparent; border-radius: 999px; animation: hx-spin 1s linear infinite; }
@keyframes hx-spin { to { transform: rotate(360deg); } }
.hx-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--hx-dark); color: #fff; padding: 10px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; box-shadow: 0 12px 28px rgba(47, 51, 57, .24); z-index: 50; }

/* ---------- lab extensions ---------- */
.hx-lead code, .hx-notice code { font-size: 13px; background: var(--hx-surface); border: 1px solid var(--hx-border); border-radius: 3px; padding: 0 4px; }
.hx-btn-small.is-primary { background: var(--hx-orange); border-color: var(--hx-orange); color: #fff; }
.hx-btn-small.is-primary:hover { background: var(--hx-orange-hover); color: #fff; }
.hx-btn-small:disabled { opacity: .45; cursor: not-allowed; }
.hx-btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hx-btn-row .hx-use { margin-top: 0; }
.hx-icon-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--hx-muted); border: 1px solid transparent; }
.hx-icon-btn:hover { color: var(--hx-dark); border-color: var(--hx-border); background: #fff; }
.hx-icon-btn .i { width: 14px; height: 14px; }
.hx-results-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.hx-row-actions { white-space: nowrap; text-align: right; }
.hx-row-actions > * + * { margin-left: 6px; }
.hx-seg-tools { display: inline-flex; align-items: center; gap: 4px; }
.hx-seg-context { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--hx-muted); margin: -2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-export { margin: 14px 0; border-top: 3px solid var(--hx-success); }
.hx-doc-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; background: var(--hx-orange-soft); border-left: 3px solid var(--hx-orange); }
.hx-doc-chip strong { font-size: 15px; }
.hx-doc-chip .hx-text-btn { margin-left: auto; }

/* review level and route */
.hx-review { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hx-lvl { font-family: var(--hx-font-cond); font-weight: 700; font-size: 13px; line-height: 1; padding: 4px 6px; border-radius: 3px; cursor: help; }
.hx-lvl.is-1 { background: var(--hx-success-bg); color: var(--hx-success-text); border: 1px solid var(--hx-success-line); }
.hx-lvl.is-2 { background: var(--hx-surface); color: var(--hx-text-2); border: 1px solid var(--hx-border); }
.hx-lvl.is-3 { background: var(--hx-dark); color: #fff; border: 1px solid var(--hx-dark); }
.hx-review-class { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-muted); cursor: help; }
.hx-route { font-size: 11px; color: var(--hx-muted); cursor: help; }
.hx-route.is-person { color: var(--hx-warn-text); }
.hx-fixes { margin-top: 6px; font-size: 12px; color: var(--hx-success-text); background: var(--hx-success-bg); border-left: 3px solid var(--hx-success); padding: 4px 8px; }
.hx-consistency-note small { color: var(--hx-muted); }

/* analysis */
.hx-details { border: 1px solid var(--hx-border); border-radius: 4px; background: #fff; margin: 14px 0; }
.hx-details > summary { cursor: pointer; padding: 12px 16px; font-size: 14px; color: var(--hx-text-2); list-style-position: inside; }
.hx-details > summary .hx-label { margin-right: 6px; }
.hx-details[open] > summary { border-bottom: 1px solid var(--hx-border); }
.hx-details > :not(summary) { margin: 12px 16px; }
.hx-cost { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.hx-cost > div { display: flex; flex-direction: column; gap: 2px; }
.hx-cost b { font-size: 22px; line-height: 1.1; }
.hx-cost b.is-accent { color: var(--hx-orange); }
.hx-bands tr.is-dim td { color: var(--hx-subtle); }
.hx-bands tr.is-total td { font-weight: 600; border-top: 1px solid var(--hx-border); }
.hx-band { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; background: var(--hx-track); }
.hx-band.is-context, .hx-band.is-exact { background: var(--hx-orange); }
.hx-band.is-repetition { background: #c64c10; }
.hx-band.is-95-99 { background: #ff8a4f; }
.hx-band.is-85-94 { background: #ffa36e; }
.hx-band.is-75-84 { background: #ffc6a3; }
.hx-band.is-50-74 { background: #e2e3e6; }
.hx-band.is-none { background: #fff; border: 1px solid var(--hx-border-input); }
.hx-pad { padding: 18px 20px; }
.hx-pad .hx-table-wrap { margin-top: 14px; }
.hx-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.hx-two .hx-cost { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hx-doc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; }

/* consistency + comparison */
.hx-consistency { border: 1px solid var(--hx-warn-line); background: var(--hx-warn-bg); border-radius: 4px; padding: 12px 16px; margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.hx-consistency .hx-label { color: var(--hx-warn-text); }
.hx-consistency-row { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; align-items: baseline; }
.hx-variant.is-preferred { color: var(--hx-success-text); }
.hx-compare { margin: 14px 0; }
.hx-panel-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--hx-border); background: var(--hx-head); }
.hx-table td.is-bad, .hx-table td.num.is-bad { color: var(--hx-danger); }
.hx-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; padding: 10px 0; }
.hx-provider { border: 1px solid var(--hx-border); border-top: 3px solid var(--hx-dark); border-radius: 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }

/* dialogs */
.hx-overlay { position: fixed; inset: 0; background: rgba(47, 51, 57, .6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; animation: hx-fade 160ms var(--hx-ease); }
.hx-dialog { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 6px; box-shadow: 0 12px 28px rgba(47, 51, 57, .24); }
.hx-dialog-head { background: var(--hx-dark); color: #fff; padding: 18px 22px; border-radius: 6px 6px 0 0; }
.hx-dialog-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.hx-dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 0 22px 18px; }
.hx-checks-field { border: 0; padding: 0; margin: 0; }
.hx-checks-field legend { padding: 0; margin-bottom: 6px; }
.hx-check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--hx-dark); cursor: pointer; }
.hx-check-row input { margin-top: 3px; accent-color: var(--hx-orange); width: 16px; height: 16px; }
.hx-check-row > span { display: flex; flex-direction: column; }
.hx-check-row small { color: var(--hx-muted); font-size: 12px; }
.hx-check-row.is-disabled { color: var(--hx-subtle); cursor: not-allowed; }

/* document upload */
.hx-dropzone { border: 2px dashed var(--hx-border-input); border-radius: 6px; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; background: #fff; transition: border-color 120ms, background 120ms; }
.hx-dropzone .i { width: 28px; height: 28px; color: var(--hx-orange); }
.hx-dropzone:hover, .hx-dropzone.is-over { border-color: var(--hx-orange); background: var(--hx-orange-soft); }
.hx-dropzone.is-disabled { cursor: not-allowed; opacity: .55; }

/* charts (growth) */
.hx-chart-card { border: 1px solid var(--hx-border); border-radius: 4px; background: #fff; padding: 16px 18px 10px; margin-top: 16px; }
.hx-chart-title { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hx-text-2); margin: 0 0 6px; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--hx-text-2); margin-bottom: 6px; }
.hx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hx-legend i, .hx-tip-row i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.hx-chart { position: relative; }
.hx-chart-svg { width: 100%; height: auto; display: block; }
.hx-chart-svg .hx-grid { stroke: var(--hx-row); stroke-width: 1; }
.hx-chart-svg .hx-axis { stroke: var(--hx-border-input); stroke-width: 1; }
.hx-chart-svg .hx-tick { font-family: var(--hx-font-cond); font-size: 12px; fill: var(--hx-muted); }
.hx-chart-svg .hx-col { transition: opacity 120ms; }
.hx-chart-svg:hover .hx-col { opacity: .55; }
.hx-chart-svg .hx-col.is-hot { opacity: 1; }
.hx-tip { position: absolute; min-width: 190px; background: #fff; border: 1px solid var(--hx-border); border-radius: 4px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 18px rgba(47, 51, 57, .14); pointer-events: none; z-index: 5; }
.hx-tip strong { display: block; margin-bottom: 4px; font-size: 12px; }
.hx-tip-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.hx-tip-row b { font-family: var(--hx-font-cond); font-weight: 700; }

/* evaluation */
.hx-table tr.is-bad-row td { background: var(--hx-danger-bg); }
.hx-confusion td.is-diag { color: var(--hx-success-text); font-weight: 700; }
.hx-flag { color: var(--hx-warn-text); }

/* ---------- narrow screens (advisor switches at 820 px) ---------- */
@media (max-width: 1100px) {
  .hx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hx-stat:nth-child(3) { border-right: 0; }
  .hx-stat:nth-child(-n+3) { border-bottom: 1px solid var(--hx-border); }
}
@media (max-width: 960px) {
  .hx-seg-grid { grid-template-columns: 1fr; }
  .hx-seg-col + .hx-seg-col { border-left: 0; border-top: 1px solid var(--hx-border); }
  .hx-matchrow { grid-template-columns: 64px minmax(0, 1fr); }
  .hx-matchrow > :last-child { grid-column: 2; }
}
@media (max-width: 819px) {
  .hx-header-inner { padding: 12px 16px; }
  .hx-header-divider, .hx-header-title, .hx-build { display: none; }
  .hx-logo { height: 15px; }
  .hx-body { flex-direction: column; }
  .hx-sidebar { position: static; height: auto; flex: none; }
  .hx-rail { flex-direction: row; padding: 10px 16px; gap: 8px; overflow-x: auto; }
  .hx-rail-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--hx-dark-raised); border-radius: 999px; flex: none; }
  .hx-rail-row .hx-mark { width: 24px; height: 24px; font-size: 13px; }
  .hx-rail-title { font-size: 11px; line-height: 1.2; }
  .hx-rail-summary, .hx-match { display: none; }
  .hx-main { padding: 24px 16px 48px; }
  .hx-h1 { font-size: 34px; }
  .hx-controls > label.hx-field, .hx-controls > label.hx-field:has(#doc-type) { width: 100%; }
  .hx-two { grid-template-columns: 1fr; }
  .hx-cost, .hx-two .hx-cost { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-results-actions { width: 100%; }
  .hx-actions { margin-left: 0; width: 100%; }
  .hx-actions .hx-btn-primary { flex: 1; }
  .hx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-stat { border-bottom: 1px solid var(--hx-border); }
  .hx-stat:nth-child(odd) { border-right: 1px solid var(--hx-border); }
  .hx-stat:nth-child(even) { border-right: 0; }
  .hx-segments { width: 100%; }
  .hx-segments button { flex: 1; }
  .hx-table .hide-sm { display: none; }
}
