:root {
  color: #172928;
  background: #f4f7f6;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  font-synthesis: none;
  --navy: #102b2d;
  --navy-2: #17383a;
  --teal: #147d72;
  --teal-dark: #0d685f;
  --mint: #e5f4f1;
  --line: #dfe8e6;
  --muted: #71817f;
  --surface: #fff;
  --amber: #a76819;
  --amber-bg: #fff5df;
  --shadow: 0 8px 28px rgba(18, 48, 48, 0.07);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f4f7f6; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(20, 125, 114, 0.25); outline-offset: 2px; }
.icon { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: 244px; padding: 0 16px 20px;
  background: var(--navy); color: #fff; display: flex; flex-direction: column;
}
.brand { height: 84px; display: flex; align-items: center; gap: 12px; padding: 0 12px; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.brand-mark { width: 31px; height: 31px; padding: 6px; border-radius: 8px; background: #2b9388; display: flex; gap: 3px; align-items: flex-end; }
.brand-mark span { display: block; flex: 1; border-radius: 2px 2px 0 0; background: white; }
.brand-mark span:nth-child(1) { height: 45%; opacity: .7; }
.brand-mark span:nth-child(2) { height: 75%; }
.brand-mark span:nth-child(3) { height: 100%; opacity: .84; }
.workspace-label { padding: 14px 14px 9px; color: #769092; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #a9bdbd; min-height: 48px; border-radius: 8px; padding: 0 13px; cursor: pointer; display: grid; grid-template-columns: 22px 1fr 18px; align-items: center; gap: 11px; text-align: left; font-size: 14px; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.055); color: white; }
.nav-item.active { color: white; background: #1b4948; box-shadow: inset 3px 0 #53c1b1; }
.nav-item .icon:last-child { width: 16px; height: 16px; justify-self: end; }
.sidebar-spacer { flex: 1; }
.validation-card { display: grid; grid-template-columns: 34px 1fr 8px; gap: 10px; align-items: center; padding: 13px; margin: 0 2px 14px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.07); border-radius: 9px; }
.validation-card .validation-icon { color: #60c8b8; }
.validation-card strong, .sidebar-footer strong { display: block; font-size: 12px; }
.validation-card span, .sidebar-footer span { display: block; margin-top: 3px; color: #8ea6a7; font-size: 10px; }
.online-dot { width: 7px; height: 7px; background: #56d09b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(86,208,155,.1); }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: 17px 10px 0; display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #173b3a; background: #b8dfd8; font-size: 11px; font-weight: 700; }
.sidebar-close { display: none; margin-left: auto; color: white; }
.sidebar-scrim { display: none; }

.main-panel { margin-left: 244px; min-height: 100vh; }
.topbar { height: 84px; padding: 0 32px; background: white; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar-title { display: flex; gap: 12px; align-items: center; }
.topbar h1 { font-size: 20px; line-height: 1.35; margin: 0 0 4px; letter-spacing: -.45px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.system-health { color: #58706e; font-size: 12px; display: flex; align-items: center; gap: 7px; }
.system-health span, .updated-label > span, .analysis-fresh > span { width: 7px; height: 7px; border-radius: 50%; background: #2bac7f; box-shadow: 0 0 0 4px rgba(43,172,127,.1); }
.primary-button, .secondary-button {
  min-height: 40px; border-radius: 7px; padding: 0 15px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.primary-button { background: var(--teal); color: white; box-shadow: 0 4px 12px rgba(20,125,114,.16); }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button { background: white; border-color: #cfddda; color: #344e4c; }
.secondary-button:hover { border-color: #83b4ac; background: #f8fbfa; }
.secondary-button.small { min-height: 34px; padding: 0 11px; }
.text-button { border: 0; background: transparent; color: var(--teal); cursor: pointer; display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.text-button .icon { width: 15px; height: 15px; }
.icon-button { width: 36px; height: 36px; padding: 8px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; }
.icon-button svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mobile-menu { display: none; }

.content { max-width: 1500px; padding: 27px 32px 45px; margin: auto; }
.overview-hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.overview-hero h2 { margin: 5px 0 0; font-size: 19px; letter-spacing: -.5px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 27px; }
.kpi-card { min-height: 127px; padding: 20px; background: white; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: flex-start; justify-content: space-between; box-shadow: 0 2px 8px rgba(20,40,40,.025); }
.kpi-label { color: #687a78; font-size: 12px; font-weight: 500; }
.kpi-number { margin: 7px 0 2px; color: #172c2b; font-size: 29px; line-height: 1; font-weight: 700; letter-spacing: -1px; }
.kpi-number small { margin-left: 4px; color: #596b69; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.delta { color: #26896e; font-size: 10px; }
.delta.attention { color: var(--amber); }
.kpi-icon { width: 42px; height: 42px; padding: 10px; border-radius: 9px; }
.kpi-icon.mint { color: #177c70; background: #e5f4f1; }
.kpi-icon.blue { color: #4978ad; background: #edf4fb; }
.kpi-icon.amber { color: #b27225; background: #fff3de; }
.kpi-icon.violet { color: #7867a9; background: #f3f0fa; }
.section-block { margin-bottom: 24px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading { margin-bottom: 12px; }
.section-heading h3, .panel-heading h3 { margin: 0 0 3px; font-size: 14px; letter-spacing: -.25px; }
.section-heading p, .panel-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.updated-label { color: #758684; font-size: 10px; display: flex; gap: 8px; align-items: center; }
.quality-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quality-card { padding: 17px 18px 15px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.quality-card-top { display: flex; justify-content: space-between; align-items: start; margin-bottom: 13px; }
.quality-icon { width: 31px; height: 31px; border-radius: 7px; display: grid; place-items: center; color: #227f74; background: #e7f4f1; font-size: 12px; font-weight: 700; }
.quality-icon.handwriting { font-family: serif; font-style: italic; font-size: 17px; }
.quality-icon .icon { width: 16px; }
.pass-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 20px; color: #21775f; background: #eaf7f1; font-size: 9px; font-weight: 600; }
.pass-badge.failed { color: #955e16; background: #fff1d5; }
.pass-badge .icon { width: 11px; height: 11px; }
.metric-label { color: #647572; font-size: 11px; }
.metric-value { margin: 4px 0 12px; font-size: 23px; font-weight: 700; letter-spacing: -.5px; }
.target-row { display: flex; justify-content: space-between; color: #8a9896; font-size: 9px; }
.target-row .good { color: #338872; }
.target-row .bad { color: #b06430; }
.metric-track { height: 3px; border-radius: 4px; margin-top: 8px; background: #edf2f1; overflow: hidden; }
.metric-track span { display: block; height: 100%; border-radius: inherit; background: #3aa08f; }

.panel { background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 2px 8px rgba(20,40,40,.025); }
.split-grid { display: grid; grid-template-columns: 1.58fr 1fr; gap: 14px; margin-bottom: 14px; }
.pipeline-panel, .composition-panel { padding: 20px; min-height: 275px; }
.pipeline-file { margin-top: 18px; padding: 11px 12px; background: #f7faf9; border: 1px solid #e8efed; border-radius: 7px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; }
.file-tile, .small-file { color: #267f74; background: #e5f4f1; border-radius: 6px; display: grid; place-items: center; }
.file-tile { width: 34px; height: 38px; }
.file-tile .icon { width: 18px; }
.pipeline-file strong { display: block; font-size: 11px; }
.pipeline-file span { display: block; margin-top: 2px; color: #8a9997; font-size: 9px; }
.batch-chip, .zoom-chip, .unit-chip { padding: 5px 7px; border-radius: 5px; background: #edf4f2; color: #5b716e !important; font: 500 9px monospace !important; }
.pipeline-steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 26px; }
.pipeline-step { position: relative; text-align: center; }
.pipeline-step:not(:last-child)::after { content: ""; position: absolute; top: 12px; left: calc(50% + 16px); width: calc(100% - 32px); height: 1px; background: #9bcfc5; }
.step-node { position: relative; z-index: 1; width: 25px; height: 25px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; color: white; background: #258d80; font-size: 10px; }
.step-node svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.pipeline-step.review .step-node { background: #f3b754; color: #5b3b0b; }
.pipeline-step strong { display: block; font-size: 10px; }
.pipeline-step span:last-child { display: block; margin-top: 3px; color: #83918f; font-size: 9px; }
.composition-content { display: flex; align-items: center; justify-content: center; gap: 28px; margin-top: 30px; }
.donut { width: 125px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#147d72 0 33.3%, #49aa98 33.3% 66.6%, #87cfc1 66.6% 83.3%, #c7e8e2 83.3%); display: grid; place-items: center; position: relative; }
.donut::after { content: ""; position: absolute; width: 72%; height: 72%; border-radius: 50%; background: white; }
.donut div { z-index: 1; text-align: center; }
.donut strong { display: block; font-size: 22px; }
.donut span { color: #80908e; font-size: 9px; }
.legend-list { min-width: 155px; display: grid; gap: 11px; }
.legend-row { display: grid; grid-template-columns: 8px 1fr 25px 37px; gap: 7px; align-items: center; font-size: 10px; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; }
.legend-row strong { text-align: right; }
.legend-row small { color: #8a9896; text-align: right; }
.recent-panel { padding: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 11px; }
th { padding: 9px 12px; border-bottom: 1px solid #e2e9e7; background: #f8faf9; color: #71817f; text-align: left; font-size: 9px; font-weight: 600; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #edf1f0; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.file-cell { display: flex; align-items: center; gap: 9px; }
.small-file { width: 26px; height: 29px; }
.small-file .icon { width: 14px; }
.mono { color: #697b79; font: 9px monospace; }
.muted { color: #859492; }
.status-pill { display: inline-flex; gap: 5px; align-items: center; padding: 4px 8px; border-radius: 12px; font-size: 9px; font-weight: 600; }
.status-pill span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.complete { color: #27745f; background: #eaf6f1; }
.status-pill.review { color: #9a641c; background: #fff2d9; }
.status-pill.processing { color: #4077a1; background: #edf5fa; }
.row-menu { color: #869593; }

.workbench-toolbar, .analysis-toolbar { min-height: 68px; margin-bottom: 15px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.upload-compact { flex: 1; display: flex; align-items: center; gap: 10px; padding: 7px; border: 1px dashed transparent; border-radius: 7px; }
.upload-compact.dragging { border-color: var(--teal); background: #edf8f5; }
.upload-icon { width: 34px; height: 34px; padding: 8px; display: grid; place-items: center; color: var(--teal); background: var(--mint); border-radius: 7px; }
.upload-compact strong, .upload-compact span { display: block; font-size: 10px; }
.upload-compact span { margin-top: 2px; color: #849391; font-size: 9px; }
.file-picker { margin-left: auto; min-height: 32px; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pipeline-message { min-width: 290px; display: flex; align-items: center; gap: 8px; color: #617472; font-size: 10px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #879895; }
.pipeline-message.processing .pulse-dot { background: #3b89ae; animation: pulse 1s infinite; }
.pipeline-message.complete .pulse-dot { background: #2bac7f; }
.pipeline-message.unsupported .pulse-dot { background: #d19238; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(59,137,174,.14); } }
.workbench-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(400px, .8fr); gap: 15px; align-items: start; }
.document-panel, .field-panel { overflow: hidden; }
.panel-heading.compact { min-height: 66px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.document-stage { min-height: 680px; padding: 28px; display: flex; justify-content: center; background: #edf1f0; overflow: auto; }
.scan-page { position: relative; flex: 0 0 auto; width: min(100%, 570px); aspect-ratio: 760 / 980; background: white; box-shadow: 0 8px 28px rgba(26,48,47,.14); overflow: hidden; }
.scan-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.scan-page.placeholder { padding: 7.9% 9.8%; color: #304342; font-size: clamp(8px, .85vw, 12px); }
.paper-header { display: flex; justify-content: space-between; align-items: center; color: #173d3a; font-size: 1.65em; font-weight: 700; }
.paper-header small { color: #82918f; font-size: .55em; letter-spacing: .5px; }
.paper-rule { height: 3px; margin: 2.3% 0 3%; background: #1b8579; }
.paper-intro { color: #6f807e; font-size: .84em; line-height: 1.65; }
.paper-row { position: absolute; left: 10%; right: 10%; height: 5.1%; display: grid; grid-template-columns: 8% 35% 1fr; align-items: center; }
.paper-row.name { top: 14.9%; }
.paper-row.age { top: 22.5%; }
.paper-row b { height: 100%; display: grid; place-items: center; color: #167d72; background: #e9f5f2; font-size: .85em; }
.paper-row span { padding-left: 14%; font-weight: 600; }
.paper-row em { height: 100%; padding-left: 8%; display: flex; align-items: center; border: 1px solid #dce6e3; font-family: serif; font-size: 1.5em; }
.paper-question { position: absolute; left: 10%; right: 10%; height: 10.7%; border-bottom: 1px solid #e1e8e6; }
.paper-question.region { top: 33%; }
.paper-question.score { top: 44%; }
.paper-question.comment { top: 55%; height: 13%; }
.paper-question.contact { top: 69%; }
.paper-question b { margin-right: 4%; color: var(--teal); }
.paper-question span { font-weight: 600; }
.paper-question > div { margin: 4% 0 0 16%; font-size: 1.15em; }
.paper-question .handwritten { color: #273e5d; font: italic 1.6em serif; }
.paper-bottom { position: absolute; left: 10%; right: 10%; bottom: 6%; color: #8b9997; text-align: center; font-size: .8em; }
.overlay-box { position: absolute; padding: 0; border: 2px solid rgba(29,144,128,.78); background: rgba(43,177,158,.06); cursor: pointer; }
.overlay-box:hover, .overlay-box.selected { border-width: 3px; background: rgba(43,177,158,.13); }
.overlay-box.needs-review { border-color: #df9a2e; background: rgba(240,176,71,.1); }
.overlay-box span { position: absolute; left: -2px; top: -19px; padding: 3px 5px; color: white; background: #167d72; font-size: 8px; line-height: 1; white-space: nowrap; }
.overlay-box.needs-review span { background: #b67518; }
.document-footer { min-height: 43px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: #82918f; border-top: 1px solid var(--line); font-size: 9px; }
.document-footer > span { display: flex; gap: 6px; align-items: center; }
.document-footer .icon { width: 14px; height: 14px; color: #4c8b80; }
.coordinate { font-family: monospace; }
.field-controls { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filter-tabs { display: flex; gap: 5px; }
.filter-tabs button, .analysis-tabs button { min-height: 30px; padding: 0 11px; color: #71817f; background: #f4f7f6; border: 0; border-radius: 6px; cursor: pointer; font-size: 10px; }
.filter-tabs button.active { color: white; background: #2a6f69; }
.threshold-control { display: block; margin-top: 13px; }
.threshold-control > span { display: flex; justify-content: space-between; color: #768683; font-size: 9px; }
.threshold-control strong { color: #2e5a55; font-family: monospace; }
.threshold-control input { width: 100%; height: 3px; accent-color: var(--teal); }
.field-list { height: 495px; padding: 10px; overflow-y: auto; }
.field-card { position: relative; width: 100%; min-height: 78px; padding: 11px; border: 1px solid transparent; border-bottom-color: #edf1f0; background: white; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; cursor: pointer; }
.field-card:hover, .field-card.selected { background: #f7fbfa; border-color: #cfe4df; border-radius: 7px; }
.field-card.review { background: #fffbf2; }
.field-type { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: #277d72; background: #e8f4f2; font-size: 11px; font-weight: 700; }
.field-type.handwriting { font: italic 17px serif; }
.field-type svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.field-main { min-width: 0; }
.field-main strong, .field-main small, .field-main em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-main strong { font-size: 11px; }
.field-main small { margin: 2px 0 6px; color: #8a9896; font: 8px monospace; }
.field-main em { color: #425553; font: 500 11px inherit; }
.confidence { min-width: 39px; padding: 4px 5px; border-radius: 4px; color: #24735f; background: #eaf6f1; font: 600 9px monospace; text-align: center; }
.confidence.low { color: #9b6417; background: #fff0d3; }
.review-flag { position: absolute; right: 11px; bottom: 7px; display: flex; align-items: center; gap: 3px; color: #a76a16; font-size: 8px; }
.review-flag .icon { width: 10px; height: 10px; }
.export-row { min-height: 65px; padding: 11px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.empty-state { padding: 40px; color: #82918f; text-align: center; font-size: 11px; }

.review-dialog { width: min(92vw, 480px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 25px 80px rgba(15,40,39,.28); }
.review-dialog::backdrop { background: rgba(10,28,28,.5); }
.review-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.dialog-heading h3 { margin: 5px 0 0; font-size: 20px; }
.review-context { display: flex; gap: 7px; margin: 17px 0; }
.review-context span { padding: 4px 7px; background: #edf4f2; border-radius: 4px; color: #5f7471; font-size: 9px; }
.review-dialog label { display: grid; gap: 6px; margin-top: 12px; color: #657774; font-size: 10px; font-weight: 600; }
.review-dialog input { height: 42px; padding: 0 12px; border: 1px solid #cedbd8; border-radius: 6px; color: #253d3b; background: white; }
.review-dialog input:disabled { background: #f4f7f6; color: #82918f; }
.dialog-note { padding: 10px; border-radius: 6px; color: #8b5a18; background: #fff5df; display: flex; gap: 7px; align-items: center; font-size: 10px; }
.dialog-note .icon { width: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.dataset-select { min-width: 325px; display: flex; align-items: center; gap: 10px; }
.dataset-icon { width: 36px; height: 36px; padding: 8px; color: var(--teal); background: var(--mint); border-radius: 7px; }
.dataset-select > div { flex: 1; }
.dataset-select span, .dataset-select strong { display: block; }
.dataset-select div span { color: #7e8f8c; font-size: 9px; }
.dataset-select strong { margin-top: 2px; font-size: 11px; }
.dataset-select > .icon { width: 14px; transform: rotate(90deg); color: #7c8b89; }
.policy-note { flex: 1; color: #667a77; display: flex; gap: 6px; align-items: center; font-size: 10px; }
.policy-note .icon { width: 15px; color: #308378; }
.policy-note span { color: #b6c0be; }
.analysis-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.analysis-kpis article { padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.analysis-kpis article > span { color: #6e807d; font-size: 11px; }
.analysis-kpis article > div { margin: 7px 0 8px; font-size: 27px; font-weight: 700; }
.analysis-kpis small { margin-left: 3px; color: #61726f; font-size: 10px; font-weight: 500; }
.analysis-kpis p { margin: 0; color: #38806d; display: flex; align-items: center; gap: 4px; font-size: 9px; }
.analysis-kpis p .icon { width: 11px; height: 11px; }
.analysis-tabs { height: 44px; margin-bottom: 14px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: white; display: flex; gap: 4px; align-items: center; }
.analysis-tabs button { min-width: 95px; }
.analysis-tabs button.active { color: white; background: #2b716a; }
.analysis-fresh { margin-left: auto; margin-right: 10px; display: flex; align-items: center; gap: 7px; color: #788986; font-size: 9px; }
.analysis-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 14px; }
.mean-chart-panel, .group-panel, .stats-table-panel { padding: 20px; }
.horizontal-chart { display: grid; gap: 23px; margin: 31px 4px 13px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 40px; gap: 13px; align-items: center; }
.bar-row > div:first-child strong, .bar-row > div:first-child span { display: block; }
.bar-row > div:first-child strong { font-size: 10px; }
.bar-row > div:first-child span { margin-top: 3px; color: #899693; font-size: 8px; }
.bar-row > strong { font-size: 12px; text-align: right; }
.bar-track { height: 10px; border-radius: 5px; background: #edf2f1; overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: #258e81; }
.mini-bars { height: 190px; padding: 23px 15px 0; display: flex; align-items: end; justify-content: center; gap: 50px; border-bottom: 1px solid #dfe7e5; }
.mini-bars > div { height: 100%; width: 70px; display: flex; flex-direction: column; align-items: center; justify-content: end; }
.mini-bars > div > span { order: 2; width: 38px; height: 110px; display: flex; align-items: end; }
.mini-bars i { display: block; width: 100%; min-height: 20%; border-radius: 5px 5px 0 0; }
.mini-bars strong { order: 1; margin-bottom: 5px; font-size: 12px; }
.mini-bars small { order: 3; margin-top: 8px; white-space: nowrap; color: #788986; font-size: 9px; }
.variable-key { display: inline-block; margin-left: 7px; color: #8d9a98; font: 8px monospace; }
.test-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.test-card { padding: 20px; }
.test-heading { display: flex; gap: 11px; align-items: center; }
.test-number { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 6px; color: #277d72; background: #e8f4f2; font: 600 9px monospace; }
.test-heading h3 { margin: 0 0 2px; font-size: 12px; }
.test-heading p { margin: 0; color: #80908d; font-size: 9px; }
.test-result { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0 10px; padding: 13px 0; border-block: 1px solid #e4ebe9; }
.test-result div { text-align: center; border-right: 1px solid #e4ebe9; }
.test-result div:last-child { border: 0; }
.test-result span, .test-result strong { display: block; }
.test-result span { color: #83918f; font-size: 8px; }
.test-result strong { margin-top: 4px; font: 600 13px monospace; }
.test-meta { display: flex; justify-content: space-between; color: #8a9896; font-size: 8px; }
.conclusion { margin-top: 16px; padding: 11px; border-radius: 7px; color: #26765f; background: #eaf6f1; display: flex; gap: 8px; align-items: center; }
.conclusion.significant { color: #96601b; background: #fff3dc; }
.conclusion .icon { width: 17px; }
.conclusion strong, .conclusion span { display: block; }
.conclusion strong { font-size: 10px; }
.conclusion span { margin-top: 2px; font-size: 8px; opacity: .8; }
.test-detail { grid-column: 1 / -1; padding: 20px; }
.test-detail dl { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 22px 0 0; }
.test-detail dl div { padding: 0 15px; border-right: 1px solid var(--line); }
.test-detail dl div:first-child { padding-left: 0; }
.test-detail dl div:last-child { border: 0; }
.test-detail dt { color: #82918f; font-size: 9px; }
.test-detail dd { margin: 6px 0 0; font-size: 10px; font-weight: 600; line-height: 1.5; }

.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 8px; color: white; background: #193c39; box-shadow: 0 12px 36px rgba(14,37,36,.22); display: flex; gap: 9px; align-items: center; font-size: 11px; opacity: 0; transform: translateY(12px); transition: .2s ease; pointer-events: none; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.warning { background: #81551b; }
.toast .icon { width: 17px; }

@media (max-width: 1180px) {
  .kpi-grid, .quality-grid, .analysis-kpis { grid-template-columns: repeat(2, 1fr); }
  .workbench-grid { grid-template-columns: 1fr; }
  .field-list { height: 460px; }
  .pipeline-message { display: none; }
  .test-card-grid { grid-template-columns: 1fr 1fr; }
  .test-card:last-of-type { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-visible .sidebar { transform: translateX(0); }
  .sidebar-visible .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(10,29,28,.45); }
  .sidebar-close, .mobile-menu { display: block; }
  .main-panel { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .content { padding: 22px 20px 40px; }
  .split-grid, .analysis-grid { grid-template-columns: 1fr; }
  .test-detail dl { grid-template-columns: 1fr 1fr; gap: 18px 0; }
  .test-detail dl div { border: 0; padding: 0; }
}

@media (max-width: 650px) {
  .topbar { height: 72px; padding: 0 14px; }
  .topbar h1 { font-size: 17px; }
  .topbar p, .system-health { display: none; }
  .header-actions { gap: 7px; }
  .header-actions .primary-button { width: 40px; padding: 0; font-size: 0; }
  .content { padding: 17px 13px 35px; }
  .overview-hero { align-items: start; }
  .overview-hero h2 { font-size: 16px; line-height: 1.4; }
  .overview-hero .secondary-button { display: none; }
  .kpi-grid, .quality-grid, .analysis-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi-card { min-height: 112px; padding: 15px; }
  .kpi-number { font-size: 24px; }
  .quality-card { padding: 14px; }
  .metric-value { font-size: 20px; }
  .split-grid { gap: 10px; }
  .pipeline-panel, .composition-panel { padding: 15px; }
  .pipeline-file { grid-template-columns: 32px 1fr; }
  .batch-chip { display: none !important; }
  .pipeline-step strong { font-size: 8px; }
  .pipeline-step span:last-child { font-size: 7px; }
  .composition-content { gap: 18px; }
  .recent-panel { padding: 14px; }
  .workbench-toolbar, .analysis-toolbar { align-items: stretch; flex-wrap: wrap; }
  .upload-compact { flex-basis: 100%; }
  .workbench-toolbar > .primary-button { width: 100%; }
  .document-stage { min-height: 420px; padding: 14px; }
  .scan-page.placeholder { font-size: 7px; }
  .workbench-grid { grid-template-columns: minmax(0, 1fr); }
  .field-panel { min-width: 0; }
  .export-row .primary-button { flex: 1; }
  .dataset-select { min-width: 100%; }
  .analysis-toolbar .policy-note { flex-basis: 100%; }
  .analysis-toolbar > .secondary-button { width: 100%; }
  .analysis-tabs { overflow-x: auto; }
  .analysis-fresh { display: none; }
  .bar-row { grid-template-columns: 92px 1fr 35px; gap: 8px; }
  .test-card-grid { grid-template-columns: 1fr; }
  .test-card:last-of-type { grid-column: auto; }
  .test-detail dl { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .kpi-grid, .quality-grid, .analysis-kpis { grid-template-columns: 1fr; }
}
