:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #172338;
  --muted: #69788d;
  --line: #dfe6ef;
  --primary: #3156d3;
  --primary-dark: #223fa8;
  --primary-soft: #edf1ff;
  --success: #16825b;
  --success-soft: #e9f7f1;
  --warning: #b46b06;
  --warning-soft: #fff4df;
  --danger: #c43e50;
  --danger-soft: #ffedf0;
  --shadow: 0 14px 38px rgba(31, 50, 80, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1320;
  --surface: #151f30;
  --surface-soft: #101927;
  --ink: #edf3ff;
  --muted: #9baabe;
  --line: #2a394e;
  --primary: #7897ff;
  --primary-dark: #6384f2;
  --primary-soft: #202f57;
  --success: #55c79a;
  --success-soft: #173a31;
  --warning: #efad4d;
  --warning-soft: #392c18;
  --danger: #ff7c8d;
  --danger-soft: #3b2029;
  --shadow: 0 16px 42px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--bg); }
button, input { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(49, 86, 211, .2); outline-offset: 2px; }
.hidden { display: none !important; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; }
.eyebrow { display: block; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.muted { color: var(--muted); font-size: 12px; }
.primary-text { color: var(--primary) !important; }
.success-text { color: var(--success) !important; }
.danger-text { color: var(--danger) !important; }

.primary-button, .outline-button, .nav-button, .icon-button, .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  border: 0; border-radius: 11px; font-weight: 750; cursor: pointer; transition: .18s ease;
}
.primary-button { padding: 0 20px; color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(49, 86, 211, .2); }
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.outline-button { padding: 0 15px; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.outline-button:hover { border-color: #bec9d8; background: var(--surface-soft); }
.text-button { min-height: 34px; padding: 0 9px; color: var(--primary); border: 0; border-radius: 8px; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.text-button:hover { background: var(--primary-soft); }
.theme-toggle { width: 36px; min-height: 36px; padding: 0; color: var(--muted); border: 1px solid var(--line); background: var(--surface-soft); }
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.login-theme-toggle { position: fixed; top: 22px; right: 22px; z-index: 5; color: #e8efff; border-color: rgba(255,255,255,.2); background: rgba(16,24,42,.68); backdrop-filter: blur(10px); }

/* Login */
.login-page { display: grid; place-items: center; padding: 36px; background: #10182a; }
.login-page::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32; background: radial-gradient(circle at 15% 20%, #365dc8 0, transparent 30%), radial-gradient(circle at 85% 80%, #173d91 0, transparent 34%); }
.login-shell { position: relative; width: min(1080px, 100%); min-height: 650px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 28px; background: #172238; box-shadow: 0 35px 90px rgba(0,0,0,.42); }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; padding: 58px; color: #fff; background: linear-gradient(145deg, #182440, #213c82); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; color: #fff; background: linear-gradient(135deg, #5477ed, #274abf); box-shadow: 0 12px 26px rgba(11, 25, 68, .28); font-size: 17px; font-weight: 900; letter-spacing: -.06em; }
.login-brand .eyebrow { color: #9eb5ff; }
.login-brand h1 { margin: 15px 0 18px; font-size: clamp(37px, 4.4vw, 59px); line-height: 1.05; letter-spacing: -.04em; }
.login-brand h1 span { color: #88a5ff; }
.login-brand > div > p { max-width: 540px; margin: 0; color: #bdc9df; font-size: 15px; line-height: 1.8; }
.login-security { display: flex; align-items: center; gap: 14px; padding-top: 28px; border-top: 1px solid rgba(255,255,255,.12); }
.login-security > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #8ce0bd; background: rgba(93, 216, 167, .12); font-weight: 900; }
.login-security p { display: flex; flex-direction: column; gap: 3px; margin: 0; color: #aebbd1; font-size: 12px; }
.login-security strong { color: #fff; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 55px; background: var(--surface); }
.login-card { width: min(390px, 100%); }
.login-card-head { display: flex; align-items: center; gap: 15px; margin-bottom: 32px; }
.lock-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); font-size: 23px; font-weight: 800; }
.login-card h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.025em; }
.field { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.field > span { font-size: 12px; font-weight: 750; }
.field input { width: 100%; height: 50px; padding: 0 15px; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); transition: .15s ease; }
.field input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); outline: none; }
.login-button { width: 100%; min-height: 50px; margin-top: 25px; }
.login-button span { margin-left: auto; font-size: 18px; }
.login-card > small { display: block; margin-top: 16px; color: var(--muted); text-align: center; }

/* Application shell */
.app-shell { min-height: 100vh; }
.app-header { position: sticky; top: 0; z-index: 20; height: 74px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 max(24px, calc((100vw - 1500px) / 2)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; justify-self: start; }
.brand-mark.small { width: 39px; height: 39px; border-radius: 11px; font-size: 12px; }
.brand > div { display: flex; flex-direction: column; }
.brand strong { font-size: 14px; letter-spacing: .07em; }
.brand small { color: var(--muted); font-size: 9px; }
.app-header nav { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.nav-button { min-height: 36px; padding: 0 15px; color: var(--muted); background: transparent; font-size: 12px; }
.nav-button.active { color: var(--primary); background: var(--surface); box-shadow: 0 3px 12px rgba(30, 48, 77, .08); }
.logout-form { display: flex; align-items: center; justify-self: end; gap: 9px; }
.user-chip { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 850; }
.user-name { font-size: 12px; font-weight: 750; }
.icon-button { width: 34px; min-height: 34px; padding: 0; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--danger); background: var(--danger-soft); }
.workspace { width: min(1500px, calc(100% - 48px)); min-height: calc(100vh - 130px); margin: 0 auto; padding: 52px 0 68px; }
footer { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 0 max(24px, calc((100vw - 1500px) / 2)); color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); font-size: 10px; }

/* Analysis */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .72fr); align-items: stretch; gap: 34px; }
.hero-copy { padding: 20px 0; }
.status-label, .live-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.status-label i, .live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.hero-copy h1, .settings-heading h1 { margin: 18px 0 15px; font-size: clamp(33px, 4.1vw, 58px); line-height: 1.07; letter-spacing: -.045em; }
.hero-copy h1 span { color: var(--primary); }
.hero-copy > p { max-width: 740px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.library-inline { display: inline-flex; margin-top: 23px; padding: 9px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 10px; }
.library-inline b { margin-right: 3px; color: var(--ink); }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; padding: 34px; text-align: center; border: 2px dashed #7788a1; border-radius: 21px; background: var(--surface); box-shadow: var(--shadow); transition: .18s ease; }
.drop-zone.dragging { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.drop-zone.processing { pointer-events: none; opacity: .7; }
.upload-icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 15px; color: var(--primary); background: var(--primary-soft); font-size: 25px; font-weight: 800; }
.drop-zone strong { font-size: 16px; }
.drop-zone > span { margin: 7px 0 18px; color: var(--muted); font-size: 11px; }
.drop-zone small { min-height: 14px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.empty-workflow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.empty-workflow article { display: flex; align-items: center; gap: 15px; min-height: 126px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 25px rgba(31, 50, 80, .04); }
.empty-workflow article > span, .step { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 850; }
.empty-workflow strong { font-size: 12px; }
.empty-workflow p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 27px; }
.stat-grid article { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat-grid article > span { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.stat-grid strong { margin: 7px 0 2px; font-size: 28px; line-height: 1; }
.stat-grid small { overflow: hidden; color: var(--muted); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.analysis-card { margin-top: 18px; overflow: hidden; }
.sample-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.sample-strip > div:first-child, .table-title, .card-heading { display: flex; align-items: center; gap: 12px; }
.sample-strip h2, .table-title h2, .card-heading h2, .records-toolbar h2 { margin: 0; font-size: 14px; }
.sample-strip p, .table-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.selection-title { min-width: 275px; }
.selection-title em { display: inline-flex; margin-left: 5px; padding: 3px 6px; color: var(--primary); border-radius: 99px; background: var(--primary-soft); font-size: 8px; font-style: normal; vertical-align: middle; }
.selection-tools { display: flex; gap: 2px; }
.sample-list { display: flex; gap: 9px; overflow-x: auto; padding: 3px; }
.sample-button { min-width: 205px; display: flex; align-items: center; gap: 10px; padding: 10px 11px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.sample-button:not(.selected) { opacity: .55; filter: saturate(.55); }
.sample-button.selected { border-color: #9cadde; background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(49, 86, 211, .08); }
.sample-button > i { width: 7px; height: 31px; flex: 0 0 auto; border-radius: 99px; background: var(--muted); }
.sample-button > i.has-error { background: var(--warning); }
.sample-button > i.is-ok { background: var(--success); }
.sample-button > span { min-width: 0; display: flex; flex-direction: column; }
.sample-button > .selection-check { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 9px; font-weight: 900; }
.sample-button.selected > .selection-check { color: #fff; border-color: var(--primary); background: var(--primary); }
.sample-button strong, .sample-button small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sample-button strong { font-size: 10px; }
.sample-button small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.sample-button b { margin-left: auto; padding: 6px 8px; border-radius: 8px; background: var(--surface-soft); font-size: 9px; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 25px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.segmented button { min-height: 32px; padding: 0 10px; color: var(--muted); border: 0; border-radius: 7px; background: transparent; font-size: 9px; font-weight: 800; cursor: pointer; }
.segmented button.active { color: var(--primary); background: var(--surface); box-shadow: 0 3px 10px rgba(31, 50, 80, .08); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
.result-table { min-width: 1320px; }
.common-result-table { min-width: 1480px; }
th { padding: 12px 16px; color: var(--muted); border-block: 1px solid var(--line); background: var(--surface-soft); text-align: left; font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #edf1f6; font-size: 10px; vertical-align: middle; }
tbody tr:hover { background: var(--surface-soft); }
.element-cell { display: flex; align-items: center; gap: 9px; }
.element-cell > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 850; }
.element-cell > div, .impact, .recommendation { display: flex; flex-direction: column; gap: 3px; }
.element-cell small, .unit, .impact small { display: block; color: var(--muted); font-size: 8px; }
.coefficient { display: inline-flex; padding: 5px 7px; border-radius: 7px; background: var(--surface-soft); }
.recommendation small { width: max-content; padding: 3px 6px; border-radius: 99px; font-size: 8px; font-weight: 850; }
.recommendation .up { color: var(--success); background: var(--success-soft); }
.recommendation .down { color: var(--warning); background: var(--warning-soft); }
.recommendation .danger { color: var(--danger); background: var(--danger-soft); }
.status-chip { display: inline-flex; padding: 6px 8px; border-radius: 99px; font-size: 8px; font-weight: 850; white-space: nowrap; }
.status-chip.danger { color: var(--danger); background: var(--danger-soft); }
.status-chip.warning { color: var(--warning); background: var(--warning-soft); }
.status-chip.success { color: var(--success); background: var(--success-soft); }
.status-chip.action { color: var(--primary); background: var(--primary-soft); }
.status-chip.neutral { color: var(--muted); background: var(--surface-soft); }
.warning-text { color: var(--warning) !important; }
.a1-editor { width: 112px; display: flex; flex-direction: column; gap: 4px; }
.a1-editor input { width: 112px; height: 35px; padding: 0 9px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 10px; font-weight: 800; }
.a1-editor input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.a1-editor input.invalid { border-color: var(--danger); background: var(--danger-soft); }
.a1-editor small, .fit-count small { color: var(--muted); font-size: 8px; }
.fit-count { display: flex; flex-direction: column; gap: 3px; }
.fit-count strong { font-size: 12px; }
.no-intersection { color: var(--danger); font-size: 9px; font-weight: 850; }
.common-detail-row > td { padding: 0 16px 12px; background: var(--surface-soft); }
.common-detail-row:hover { background: transparent; }
.common-detail-row details { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.common-detail-row summary { padding: 9px 12px; color: var(--primary); font-size: 9px; font-weight: 800; cursor: pointer; }
.detail-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.detail-table { min-width: 760px; }
.detail-table td { padding-block: 10px; }
.detail-table td:first-child { display: flex; flex-direction: column; gap: 3px; }
.detail-table td:first-child small { color: var(--muted); font-size: 8px; }
.validation-note { display: flex; align-items: center; gap: 13px; margin: 18px 24px 24px; padding: 15px; border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--line)); border-radius: 12px; background: var(--warning-soft); }
.validation-note > b { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--warning); background: var(--warning-soft); }
.validation-note strong { font-size: 10px; }
.validation-note p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.missing-state { display: flex; flex-direction: column; align-items: center; padding: 55px 25px; text-align: center; }
.missing-state > span { width: 47px; height: 47px; display: grid; place-items: center; border-radius: 14px; color: var(--warning); background: var(--warning-soft); font-size: 20px; font-weight: 850; }
.missing-state h2 { margin: 14px 0 6px; font-size: 17px; }
.missing-state p { max-width: 600px; margin: 0 0 17px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.all-good-state { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 50px 25px; }
.all-good-state > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--success); background: var(--success-soft); font-size: 18px; font-weight: 900; }
.all-good-state h2 { margin: 0; font-size: 15px; }
.all-good-state p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 11px; margin-top: 18px; padding: 14px 16px; border: 1px solid; border-radius: 12px; }
.alert > b { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; }
.alert strong { display: block; font-size: 11px; }
.alert p { margin: 3px 0 0; font-size: 10px; line-height: 1.45; }
.login-card .alert { margin: 0 0 18px; }
.login-card .alert > span { align-self: center; font-size: 11px; }
.error-alert { color: var(--danger); border-color: #f1bec6; background: var(--danger-soft); }
.error-alert > b { background: rgba(196, 62, 80, .1); }
.success-alert { color: var(--success); border-color: #a9dfca; background: var(--success-soft); }
.success-alert > b { background: rgba(22, 130, 91, .1); }
.warning-alert { color: var(--warning); border-color: #efd69d; background: var(--warning-soft); }
.warning-alert > b { background: rgba(180, 107, 6, .1); }

/* Settings */
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.settings-heading h1 { margin: 9px 0 10px; font-size: clamp(28px, 3vw, 42px); }
.settings-heading p { max-width: 820px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.settings-grid .card { padding: 25px; }
.card-heading { position: relative; }
.card-heading > div { min-width: 0; }
.card-heading h2 { max-width: 420px; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 18px; font-weight: 800; }
.live-badge { margin-left: auto; padding: 7px 9px; border-radius: 99px; background: var(--success-soft); letter-spacing: 0; }
.library-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 23px 0; }
.library-kpis > div { display: flex; flex-direction: column; padding: 15px; border-radius: 11px; background: var(--surface-soft); }
.library-kpis strong { font-size: 23px; }
.library-kpis span { margin-top: 3px; color: var(--muted); font-size: 9px; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; gap: 25px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 10px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; text-align: right; }
.update-card > p { min-height: 62px; margin: 23px 0 17px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.update-card > small { display: block; margin-top: 13px; color: var(--muted); font-size: 9px; }
.records-card { margin-top: 18px; overflow: hidden; }
.records-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 22px 25px; }
.records-toolbar h2 { margin-top: 5px; }
.search-box { width: min(330px, 100%); height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.search-box span { color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 10px; }
.method-tag { display: inline-flex; padding: 5px 7px; border-radius: 7px; color: var(--primary); background: var(--primary-soft); font-weight: 750; }
.standard-link { padding: 0; color: var(--primary); border: 0; border-bottom: 1px dashed currentColor; background: transparent; font-size: 10px; font-weight: 850; cursor: pointer; }
.standard-link:hover { color: var(--primary-dark); }
.table-caption { padding: 13px 25px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface-soft); font-size: 9px; }
.empty-cell { padding: 28px; color: var(--muted); text-align: center; }

/* Limit detail dialog */
.limit-dialog { width: min(780px, calc(100% - 28px)); max-height: min(760px, calc(100vh - 38px)); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 19px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.limit-dialog::backdrop { background: rgba(5, 10, 19, .66); backdrop-filter: blur(5px); }
.dialog-panel { overflow: hidden; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; padding: 24px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 5px 0 4px; font-size: 21px; }
.dialog-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.dialog-close { color: var(--muted); border: 1px solid var(--line); background: var(--surface-soft); font-size: 20px; }
.limit-detail-table { min-width: 520px; }
.limit-detail-table tbody tr:last-child td { border-bottom: 0; }

:root[data-theme="dark"] .login-panel { background: var(--surface); }
:root[data-theme="dark"] .login-shell { border-color: var(--line); }
:root[data-theme="dark"] .login-brand { background: linear-gradient(145deg, #10192c, #192d60); }
:root[data-theme="dark"] .primary-button { color: #fff; }

@media (max-width: 1050px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 360px; padding: 38px; }
  .login-security { margin-top: 35px; }
  .hero-grid { grid-template-columns: 1fr; }
  .drop-zone { min-height: 250px; }
  .sample-strip, .results-toolbar { align-items: flex-start; flex-direction: column; }
  .sample-list { width: 100%; }
  .selection-tools { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .login-brand { min-height: 320px; padding: 28px; }
  .login-brand > .brand-mark { width: 48px; height: 48px; }
  .login-panel { padding: 34px 24px; }
  .app-header { height: auto; min-height: 68px; grid-template-columns: 1fr auto; padding: 10px 16px; }
  .app-header nav { grid-column: 1 / -1; grid-row: 2; width: 100%; margin-top: 9px; }
  .nav-button { flex: 1; }
  .user-name { display: none; }
  .workspace { width: min(100% - 28px, 1500px); padding: 32px 0 50px; }
  .hero-copy h1 { font-size: 36px; }
  .empty-workflow, .stat-grid { grid-template-columns: 1fr 1fr; }
  .toolbar-actions, .settings-heading, .records-toolbar { width: 100%; align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .search-box { width: 100%; }
  footer { flex-direction: column; align-items: flex-start; padding: 18px; }
}

@media (max-width: 480px) {
  .empty-workflow, .stat-grid, .library-kpis { grid-template-columns: 1fr; }
  .drop-zone { padding: 25px 17px; }
  .settings-grid .card { padding: 20px; }
}
