:root {
  color-scheme: light;
  --bg: #eef2ee;
  --surface: #ffffff;
  --surface-2: #f5f8f5;
  --surface-3: #e8eee9;
  --text: #152019;
  --muted: #657168;
  --line: #d4ddd6;
  --line-strong: #a8b7ab;
  --accent: #267a47;
  --accent-2: #185b34;
  --accent-soft: #dff2e5;
  --terminal: #17241b;
  --terminal-text: #d6f5df;
  --warning: #a65b00;
  --danger: #b53030;
  --shadow: 0 18px 45px rgba(26, 44, 31, .12);
  --shadow-soft: 0 8px 24px rgba(26, 44, 31, .08);
  --radius: 16px;
  --topbar-h: 72px;
  --footer-h: 82px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1310;
  --surface: #151c17;
  --surface-2: #1b241e;
  --surface-3: #243027;
  --text: #edf5ef;
  --muted: #9cad9f;
  --line: #2d3b31;
  --line-strong: #445748;
  --accent: #65d38b;
  --accent-2: #3eb86b;
  --accent-soft: #203b29;
  --terminal: #080b09;
  --terminal-text: #aef1c3;
  --warning: #f0ae52;
  --danger: #ff7e7e;
  --shadow: 0 18px 50px rgba(0, 0, 0, .4);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(100, 130, 108, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 130, 108, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.brand span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linux-mark, .about-logo {
  display: grid;
  place-items: center;
  background: var(--terminal);
  color: var(--terminal-text);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
  letter-spacing: .08em;
}
.linux-mark { width: 42px; height: 42px; border-radius: 11px; font-size: 13px; flex: 0 0 auto; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.ghost-btn, .theme-toggle, .icon-btn, .text-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.ghost-btn { padding: 9px 12px; border-radius: 9px; color: var(--muted); }
.ghost-btn:hover, .ghost-btn.active { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 98px;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.main-area { width: min(1380px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 calc(var(--footer-h) + 34px); }
.hero-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-soft);
}
.eyebrow { color: var(--accent); font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.hero-strip h1 { margin: 5px 0 6px; font-size: clamp(25px, 3vw, 38px); line-height: 1.14; letter-spacing: -.035em; }
.hero-strip p { margin: 0; color: var(--muted); max-width: 820px; }
.server-pill { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 15%, transparent); }
.status-dot.online { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }

.steps-card { margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); overflow-x: auto; }
.step-track { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; min-width: 980px; }
.step-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: .18s ease;
}
.step-item:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.step-item.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.step-item.done { color: var(--text); }
.step-number { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-family: "Cascadia Code", Consolas, monospace; font-weight: 800; flex: 0 0 auto; }
.step-item.active .step-number, .step-item.done .step-number { border-color: var(--accent); background: var(--accent); color: #07150c; }
html[data-theme="light"] .step-item.active .step-number, html[data-theme="light"] .step-item.done .step-number { color: white; }
.step-copy strong { display: block; font-size: 13px; }
.step-copy small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }

.workspace-card { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.workspace-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--line); background: var(--terminal); color: var(--terminal-text); }
.workspace-head h2 { margin: 5px 0 2px; font-size: 23px; color: #f1fff5; }
.workspace-head p { margin: 0; color: color-mix(in srgb, var(--terminal-text) 68%, transparent); }
.terminal-path { font-family: "Cascadia Code", Consolas, monospace; color: var(--accent); font-size: 12px; }
.step-badge { padding: 7px 10px; border: 1px solid rgba(174, 241, 195, .25); border-radius: 8px; background: rgba(174, 241, 195, .07); font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.step-panel { display: none; padding: 26px; min-height: 520px; }
.step-panel.active { display: block; animation: panelIn .2s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateX(7px); } to { opacity: 1; transform: none; } }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.compact-top { margin-top: 18px; }
.panel-box { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--surface-2); }
.panel-box h3 { margin: 0 0 10px; }
.panel-title { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.panel-title > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; background: var(--terminal); color: var(--terminal-text); font: 800 12px "Cascadia Code", Consolas, monospace; }
.panel-title h3 { margin: 0; font-size: 17px; }
.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text); }
input, select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.sensor-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.sensor-input { min-width: 0; font-family: "Cascadia Code", Consolas, monospace; text-align: center; }
.primary-btn, .secondary-btn, .run-btn, .nav-btn {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  transition: .17s ease;
}
.primary-btn { padding: 11px 15px; border-radius: 10px; background: var(--accent); color: #07150c; }
html[data-theme="light"] .primary-btn { color: white; }
.primary-btn:hover, .run-btn:hover, .nav-btn.next:hover { transform: translateY(-1px); filter: brightness(1.05); }
.secondary-btn { padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.secondary-btn:hover { border-color: var(--accent); }
.text-btn { padding: 9px 11px; color: var(--muted); }
.text-btn:hover { color: var(--text); }
.info-box, .privacy-note { margin-top: 18px; padding: 13px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 9px 9px 0; color: var(--muted); font-size: 13px; }
.info-box code { display: block; margin-top: 7px; color: var(--text); font-family: "Cascadia Code", Consolas, monospace; }

.switch-row, .radio-row { display: flex; align-items: center; gap: 12px; margin: 13px 0 8px; cursor: pointer; }
.switch-row input, .radio-row input, .mode-tabs input, .feature-check input { width: auto; min-height: 0; }
.switch-row > span { position: relative; width: 42px; height: 23px; border-radius: 999px; background: var(--line-strong); flex: 0 0 auto; }
.switch-row > span::after { content: ""; position: absolute; width: 17px; height: 17px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: .18s; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row input:checked + span { background: var(--accent); }
.switch-row input:checked + span::after { transform: translateX(19px); }
.switch-row strong, .radio-row strong { display: block; }
.switch-row small, .radio-row small { display: block; color: var(--muted); font-weight: 500; }

.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.mode-tabs label { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.mode-tabs label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-tabs strong, .mode-tabs small { display: block; }
.mode-tabs small { color: var(--muted); font-weight: 500; }
.folder-list { display: grid; gap: 10px; margin-top: 16px; }
.folder-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.folder-row .folder-info { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-btn { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--danger); cursor: pointer; }
.drop-box { min-height: 300px; display: grid; place-items: center; align-content: center; text-align: center; border-style: dashed; }
.drop-box h3, .drop-box p { margin: 5px 0; }
.drop-icon, .empty-icon { font: 800 50px "Cascadia Code", Consolas, monospace; color: var(--accent); }
.selection-summary { margin-top: 14px; color: var(--muted); font-size: 13px; }

.phase-layout { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 14px; }
.phase-box { position: relative; overflow: hidden; }
.phase-box::after { content: ""; position: absolute; inset: auto -25px -50px auto; width: 120px; height: 120px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.phase-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-family: "Cascadia Code", Consolas, monospace; font-weight: 900; }
.phase-box h3 { margin: 11px 0 3px; }
.phase-box p { min-height: 62px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.important-field input { font-size: 22px; font-family: "Cascadia Code", Consolas, monospace; border-color: var(--accent); }
.sample-conversion { display: grid; gap: 7px; margin-top: 15px; font: 12px "Cascadia Code", Consolas, monospace; color: var(--muted); }
.sample-conversion span { display: flex; justify-content: space-between; padding-bottom: 5px; border-bottom: 1px dashed var(--line); }

.feature-toolbar, .result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.feature-toolbar h3, .feature-toolbar p, .result-head h3, .result-head p { margin: 0; }
.feature-toolbar p, .result-head p { color: var(--muted); }
.feature-actions, .button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.domain-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.domain-card { position: relative; min-height: 190px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; text-align: left; overflow: hidden; }
.domain-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-soft); }
.domain-card::after { content: ""; position: absolute; width: 105px; height: 105px; border-radius: 50%; right: -32px; bottom: -32px; background: var(--accent-soft); }
.domain-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 11px; background: var(--terminal); color: var(--terminal-text); font: 800 13px "Cascadia Code", Consolas, monospace; }
.domain-card h3 { margin: 17px 0 5px; }
.domain-card p { margin: 0; color: var(--muted); font-size: 13px; }
.domain-count { position: absolute; left: 19px; bottom: 16px; font: 700 12px "Cascadia Code", Consolas, monospace; color: var(--accent); }
.selected-feature-strip { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.selected-feature-strip > strong { display: block; margin-bottom: 9px; }
#selectedFeatureChips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 104px; overflow: auto; }
.feature-chip { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; }

.review-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.review-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.review-card span { display: block; color: var(--muted); font-size: 11px; font-family: "Cascadia Code", Consolas, monospace; text-transform: uppercase; }
.review-card strong { display: block; margin-top: 7px; font-size: 17px; overflow-wrap: anywhere; }
.review-card small { display: block; color: var(--muted); margin-top: 4px; }
.run-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 18px; padding: 25px; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 14px; background: linear-gradient(125deg, var(--accent-soft), var(--surface-2)); }
.run-card h3 { margin: 5px 0; font-size: 22px; }
.run-card p { margin: 0; color: var(--muted); }
.run-btn { min-width: 220px; padding: 16px 20px; border-radius: 12px; background: var(--accent); color: #06130a; font-size: 15px; }
html[data-theme="light"] .run-btn { color: white; }
.progress-area { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.progress-area p { margin: 2px 0 0; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-result { min-height: 390px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-result h3, .empty-result p { margin: 4px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-item { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.summary-item span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-family: "Cascadia Code", Consolas, monospace; }
.summary-item strong { display: block; margin-top: 6px; font-size: 21px; }
.result-box, .boxplot-box, .pca-box { margin-bottom: 16px; }
.table-wrap { margin-top: 15px; max-height: 500px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
th { position: sticky; top: 0; z-index: 2; background: var(--terminal); color: var(--terminal-text); font-family: "Cascadia Code", Consolas, monospace; font-weight: 700; }
th:last-child, td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.pagination button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
.pca-placeholder { margin-top: 15px; min-height: 300px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 11px; color: var(--muted); background: var(--surface); }
.pca-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0 12px; }
.pca-meta span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 12px "Cascadia Code", Consolas, monospace; }
.pca-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; }
.pca-canvas-wrap { min-height: 430px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); overflow: hidden; }
.pca-canvas-wrap svg { display: block; width: 100%; height: auto; min-height: 430px; }
.pca-legend { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.legend-row:last-child { border-bottom: 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.class-summary { margin-top: 13px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.class-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.class-card strong, .class-card small { display: block; }
.class-card small { color: var(--muted); margin-top: 3px; }
.message-box { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.message-box.error { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); }
.message-box.warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--line)); color: var(--warning); }

.floating-nav {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(850px, calc(100% - 24px));
  min-height: 64px;
  display: grid;
  grid-template-columns: 170px minmax(150px, 1fr) 170px;
  align-items: center;
  gap: 14px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
}
.nav-btn { min-height: 45px; border-radius: 10px; font-size: 13px; }
.nav-btn.prev { border: 1px solid var(--line); background: var(--surface-2); }
.nav-btn.next { background: var(--accent); color: #06130a; }
html[data-theme="light"] .nav-btn.next { color: white; }
.nav-btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.nav-progress { text-align: center; color: var(--muted); font-size: 11px; font-family: "Cascadia Code", Consolas, monospace; }
.nav-progress > div { height: 4px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.nav-progress i { display: block; width: 16.66%; height: 100%; background: var(--accent); transition: width .25s ease; }

.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 10, 7, .72); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(700px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.modal-card.large { width: min(980px, calc(100% - 28px)); }
.modal-card.guide-card { width: min(1120px, calc(100% - 28px)); height: min(760px, calc(100vh - 40px)); }
.modal-card.about-card { width: min(900px, calc(100% - 28px)); overflow-y: auto; }
.modal-card > header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--terminal); color: var(--terminal-text); }
.modal-card > header h2 { margin: 3px 0 0; color: #f4fff7; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--terminal-text); font-size: 26px; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.modal-tools { display: grid; grid-template-columns: 1fr auto auto; gap: 9px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.feature-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 16px 18px; overflow-y: auto; }
.feature-check { display: grid; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.feature-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.feature-check strong { display: block; font-size: 13px; }
.feature-check code { display: block; margin-top: 4px; color: var(--muted); font-family: "Cascadia Code", Consolas, monospace; font-size: 11px; white-space: normal; }
.modal-card > footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

.guide-layout { display: grid; grid-template-columns: 320px 1fr; min-height: 0; flex: 1; }
.guide-layout aside { display: flex; flex-direction: column; gap: 9px; padding: 14px; border-right: 1px solid var(--line); background: var(--surface-2); min-height: 0; }
.guide-list { min-height: 0; overflow-y: auto; display: grid; gap: 6px; }
.guide-item { padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.guide-item:hover, .guide-item.active { border-color: var(--accent); background: var(--accent-soft); }
.guide-item strong { display: block; font-size: 12px; }
.guide-item small { color: var(--muted); }
.guide-detail { padding: 28px; overflow-y: auto; }
.empty-guide { min-height: 360px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.guide-detail h3 { margin: 4px 0 7px; font-size: 25px; }
.guide-domain { color: var(--accent); font: 800 11px "Cascadia Code", Consolas, monospace; text-transform: uppercase; letter-spacing: .12em; }
.formula-box { margin: 20px 0; padding: 20px; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: 11px; background: var(--terminal); color: var(--terminal-text); font: 600 17px "Cascadia Code", Consolas, monospace; overflow-x: auto; }
.guide-note { padding: 15px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 9px 9px 0; }
.guide-note h4 { margin: 0 0 6px; }
.guide-note p { margin: 0; color: var(--muted); }

.about-hero { display: grid; grid-template-columns: 100px 1fr; gap: 18px; align-items: center; padding: 24px; }
.about-logo { width: 100px; height: 100px; border-radius: 18px; font-size: 25px; }
.about-hero h3 { margin: 0 0 6px; font-size: 23px; }
.about-hero p { margin: 0; color: var(--muted); }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 24px 24px; }
.about-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.about-grid article span { color: var(--accent); font: 800 11px "Cascadia Code", Consolas, monospace; }
.about-grid h4 { margin: 8px 0 4px; }
.about-grid p { margin: 0; color: var(--muted); font-size: 13px; }
.about-card .privacy-note { margin: 0 24px 24px; }

.toast-container { position: fixed; right: 18px; top: 86px; z-index: 150; display: grid; gap: 9px; width: min(380px, calc(100% - 36px)); }
.toast { padding: 13px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); animation: toastIn .2s ease; }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--accent); }
.toast.warning { border-left: 4px solid var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(15px); } to { opacity: 1; transform: none; } }

@media (max-width: 1050px) {
  .phase-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .domain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pca-layout { grid-template-columns: 1fr; }
  .pca-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  :root { --topbar-h: auto; }
  .topbar { position: relative; padding: 14px 16px; align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; overflow-x: auto; }
  .main-area { width: min(100% - 20px, 1380px); padding-top: 12px; }
  .hero-strip, .workspace-head, .run-card, .feature-toolbar, .result-head { flex-direction: column; }
  .server-pill { align-self: flex-start; }
  .two-column, .phase-layout, .mode-tabs, .summary-grid, .about-grid { grid-template-columns: 1fr; }
  .sensor-list { grid-template-columns: repeat(3, 1fr); }
  .domain-grid, .review-grid { grid-template-columns: 1fr; }
  .step-panel { padding: 17px; }
  .workspace-head { padding: 18px; }
  .folder-row { grid-template-columns: 1fr auto; }
  .folder-row .folder-info { grid-column: 1 / -1; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-layout aside { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .feature-checklist { grid-template-columns: 1fr; }
  .modal-tools { grid-template-columns: 1fr 1fr; }
  .modal-tools input { grid-column: 1 / -1; }
  .floating-nav { grid-template-columns: 1fr 1fr; }
  .nav-progress { display: none; }
  .about-hero { grid-template-columns: 1fr; }
  .run-btn { min-width: 100%; }
}

@media (max-width: 460px) {
  .sensor-list { grid-template-columns: repeat(2, 1fr); }
  .floating-nav { width: calc(100% - 12px); bottom: 6px; padding: 6px; gap: 7px; }
  .nav-btn { font-size: 12px; }
  .top-actions .ghost-btn { padding-inline: 8px; }
  .theme-toggle { min-width: auto; }
  #themeText { display: none; }
}


/* v5.1 — single-feature boxplot */
.boxplot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; margin-top: 15px; align-items: stretch; }
.boxplot-visual { min-width: 0; }
.boxplot-canvas-wrap { min-height: 430px; display: grid; place-items: center; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); }
.boxplot-canvas-wrap svg { display: block; width: 100%; height: auto; min-height: 430px; }
.boxplot-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; min-height: 24px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.boxplot-legend .legend-inline { display: inline-flex; align-items: center; gap: 6px; }
.boxplot-legend .legend-inline i { width: 9px; height: 9px; border-radius: 50%; }
.boxplot-selector { min-height: 430px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.boxplot-selector > label { display: block; margin-bottom: 8px; font-weight: 700; }
.boxplot-selector input[type="search"] { width: 100%; margin-bottom: 10px; }
.boxplot-feature-list { max-height: 345px; overflow: auto; padding-right: 3px; }
.boxplot-feature-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; align-items: start; padding: 9px 7px; border-bottom: 1px solid var(--line); cursor: pointer; }
.boxplot-feature-option:last-child { border-bottom: 0; }
.boxplot-feature-option:hover, .boxplot-feature-option.active { background: var(--accent-soft); }
.boxplot-feature-option input { margin-top: 2px; accent-color: var(--accent); }
.boxplot-feature-option strong, .boxplot-feature-option small { display: block; }
.boxplot-feature-option strong { font-size: 12px; }
.boxplot-feature-option small { margin-top: 2px; color: var(--muted); font: 10px "Cascadia Code", Consolas, monospace; }
@media (max-width: 820px) {
  .boxplot-layout { grid-template-columns: 1fr; }
  .boxplot-selector { min-height: 0; }
  .boxplot-feature-list { max-height: 230px; }
}

/* v5.2 — PCA & machine learning */
.step-track { grid-template-columns: repeat(7, minmax(145px, 1fr)); min-width: 1120px; }
.result-box, .boxplot-box, .pca-box, .ml-box { margin-bottom: 16px; }
.analysis-note { margin: 14px 0; padding: 11px 13px; border-left: 3px solid var(--accent); border-radius: 0 9px 9px 0; background: var(--accent-soft); color: var(--muted); font-size: 13px; }
.analysis-note strong { color: var(--text); }
.ml-control-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.run-btn.compact { min-width: 180px; padding: 11px 16px; font-size: 13px; }
.ml-summary { margin: 16px 0; }
.evaluation-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.analysis-panel { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.analysis-panel h4 { margin: 0 0 4px; }
.analysis-panel > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.confusion-wrap { overflow: auto; }
.confusion-table { width: 100%; min-width: 440px; border-collapse: separate; border-spacing: 4px; }
.confusion-table th, .confusion-table td { padding: 10px; border: 1px solid var(--line); border-radius: 7px; text-align: center; }
.confusion-table th { background: var(--surface-2); color: var(--muted); font-size: 11px; }
.confusion-table td { position: relative; background: var(--surface); }
.confusion-table td.diagonal { border-color: var(--accent); }
.confusion-table td strong { position: relative; z-index: 1; }
.roc-chart { min-height: 340px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.roc-chart svg { display: block; width: 100%; height: auto; }
.class-metrics { margin-top: 14px; }
.cluster-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cluster-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cluster-card i { width: 12px; height: 36px; border-radius: 999px; flex: 0 0 auto; }
.cluster-card strong, .cluster-card small { display: block; }
.cluster-card small { margin-top: 2px; color: var(--muted); }
.boxplot-canvas-wrap { justify-content: start; justify-items: start; }
.boxplot-canvas-wrap svg { flex: 0 0 auto; min-height: 0; }
.pca-canvas-wrap { min-height: 500px; }
.pca-canvas-wrap svg { min-height: 500px; }

@media (max-width: 1050px) {
  .evaluation-grid { grid-template-columns: 1fr; }
  .ml-control-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .ml-control-grid { grid-template-columns: 1fr; }
  .run-btn.compact { min-width: 100%; }
}

/* v5.3 — PCA loading, feature selectors, and train/test CV report */
.analysis-control-grid {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  gap: 14px;
  margin: 14px 0;
}
.analysis-control-grid label,
.ml-control-grid label {
  min-width: 0;
}
.analysis-control-grid small,
.ml-control-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.ml-control-grid.expanded {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.pca-score-panel,
.loading-panel,
.fold-panel {
  margin-top: 16px;
}
.compact-head {
  margin-bottom: 8px;
}
.loading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
  gap: 16px;
  align-items: start;
}
.loading-table {
  min-width: 0;
  overflow: hidden;
}
.loading-table > strong {
  display: block;
  margin-bottom: 10px;
}
.fold-metrics .table-wrap,
.loading-table .table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.fold-metrics table,
.loading-table table {
  min-width: 760px;
}
.summary-row th,
.summary-row td {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  font-weight: 700;
}
.pca-score-panel > h4,
.loading-panel h4,
.fold-panel h4 {
  margin: 0 0 5px;
}
.pca-score-panel > p,
.loading-panel p,
.fold-panel p {
  margin: 0 0 12px;
  color: var(--muted);
}
@media (max-width: 900px) {
  .loading-layout {
    grid-template-columns: 1fr;
  }
}

/* v5.4 — corrected PCA input handling, white analytical plots, ML metric guide */
.analysis-selection-info {
  margin: 10px 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  overflow-wrap: anywhere;
}
.analysis-selection-info small {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
}
.pca-canvas-wrap,
.roc-chart {
  background: #ffffff !important;
  color-scheme: light;
}
.pca-canvas-wrap svg,
.roc-chart svg {
  background: #ffffff;
}
.pca-legend .legend-row {
  grid-template-columns: 18px minmax(0, 1fr) auto;
}
.pca-marker-icon {
  --marker-color: var(--accent);
  display: inline-block;
  width: 11px;
  height: 11px;
  background: var(--marker-color);
  border: 1px solid color-mix(in srgb, var(--marker-color) 70%, #000);
}
.pca-marker-icon.marker-circle { border-radius: 50%; }
.pca-marker-icon.marker-square { border-radius: 1px; }
.pca-marker-icon.marker-diamond { transform: rotate(45deg) scale(.82); }
.pca-marker-icon.marker-triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid var(--marker-color);
  border-top: 0;
}
.pca-marker-icon.marker-triangle-down {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 11px solid var(--marker-color);
  border-bottom: 0;
}
.pca-marker-icon.marker-hexagon {
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
}
.guide-ml-item {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
}
.metric-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.metric-guide-grid article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.metric-guide-grid h4 {
  margin: 0 0 6px;
  color: var(--text);
}
.metric-guide-grid p {
  margin: 0;
  color: var(--muted);
}
@media (max-width: 720px) {
  .metric-guide-grid { grid-template-columns: 1fr; }
}


/* v5.5 — selected sensors, multiclass PCA collision layout, ML metric guide */
.sensor-action-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px; }
.sensor-bulk-actions { display:flex; gap:6px; flex-wrap:wrap; }
.sensor-selection-status { margin-top:12px; padding:9px 12px; border:1px solid var(--line); border-radius:9px; background:var(--surface-2); color:var(--muted); font-size:.86rem; }
.sensor-selection-status.warning { border-color:#c97b2a; color:#c97b2a; }
.sensor-row { display:grid; grid-template-columns:36px minmax(0,1fr); gap:7px; align-items:center; padding:6px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2); transition:.18s ease; }
.sensor-row.enabled { border-color:color-mix(in srgb,var(--accent) 54%,var(--line)); background:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.sensor-row.disabled { opacity:.55; }
.sensor-row.disabled .sensor-input { text-decoration:line-through; }
.sensor-check { display:grid; place-items:center; cursor:pointer; margin:0; }
.sensor-check input { position:absolute; opacity:0; pointer-events:none; }
.sensor-check span { display:grid; place-items:center; width:30px; height:34px; border:1px solid var(--line); border-radius:8px; font-family:"Cascadia Code",Consolas,monospace; font-size:.75rem; color:var(--muted); background:var(--surface); }
.sensor-check input:checked + span { background:var(--accent); color:var(--sensor-accent-text); border-color:var(--accent); font-weight:800; }
.sensor-row .sensor-input { width:100%; text-align:left; }
.sensor-info { margin-top:12px; }
.guide-section-button { width:100%; text-align:left; border:1px solid color-mix(in srgb,var(--accent) 50%,var(--line)); background:color-mix(in srgb,var(--accent) 9%,var(--surface)); color:var(--text); border-radius:10px; padding:12px; cursor:pointer; display:grid; gap:4px; }
.guide-section-button:hover,.guide-section-button.active { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 18%,var(--surface)); }
.guide-section-button small { color:var(--muted); line-height:1.35; }
.guide-divider { display:flex; align-items:center; gap:8px; margin:14px 0 9px; color:var(--muted); font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; }
.guide-divider::before,.guide-divider::after { content:""; height:1px; background:var(--line); flex:1; }
.metric-guide-grid article code { display:block; margin-top:9px; padding:8px 9px; border-radius:7px; background:var(--surface-2); color:var(--accent-2); white-space:normal; line-height:1.4; }
.confusion-guide { display:grid; grid-template-columns:minmax(110px,1.15fr) repeat(2,minmax(100px,1fr)); border:1px solid var(--line); border-radius:10px; overflow:hidden; margin:15px 0; }
.confusion-guide > * { padding:10px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); text-align:center; }
.confusion-guide > :nth-child(3n) { border-right:0; }
.confusion-guide > :nth-last-child(-n+3) { border-bottom:0; }
.confusion-guide strong { background:var(--surface-2); }
.metric-good { background:color-mix(in srgb,#2f9e5b 18%,var(--surface)); font-weight:800; }
.metric-bad { background:color-mix(in srgb,#cf4e5c 15%,var(--surface)); font-weight:800; }
.pca-legend { max-height:560px; overflow:auto; }
@media (max-width:700px) {
  .sensor-action-row { align-items:flex-start; flex-direction:column; }
  .confusion-guide { grid-template-columns:minmax(85px,1fr) repeat(2,minmax(80px,1fr)); font-size:.78rem; }
}

:root { --sensor-accent-text: #ffffff; }
html[data-theme="dark"] { --sensor-accent-text: #102116; }


/* v5.6 PCA exact-score and eigenvalue report */
.pca-eigen-summary{margin:14px 0}.eigen-panel{background:var(--panel-2);border:1px solid var(--line);border-radius:14px;padding:14px}.eigen-panel table{min-width:760px}.eigen-foot{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}.eigen-foot span{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:7px 10px;font-size:.78rem}.pca-score-panel .pca-canvas-wrap svg{background:#fff;border-radius:10px}.pca-box .button-row{align-items:center}.pca-box #downloadPcaReport{white-space:nowrap}@media(max-width:720px){.pca-box .result-head{align-items:stretch}.pca-box .button-row{width:100%;display:grid;grid-template-columns:1fr 1fr}.pca-box .button-row button{width:100%}}

/* v5.7 - Origin-inspired PCA presentation */
#pcaChart,
.pca-chart,
.pca-stage,
.analysis-chart,
.origin-pca-svg {
  background: #ffffff !important;
}
#pcaChart {
  border: 1px solid #b8b8b8;
  border-radius: 2px;
  padding: 12px;
  box-shadow: none;
}
#pcaChart .origin-pca-svg {
  display: block;
  width: 100%;
  height: auto;
}
#pcaLegend {
  background: #ffffff;
  color: #111111;
  border: 1px solid #b8b8b8;
  border-radius: 2px;
  padding: 10px 12px;
}
#downloadMlReport::before {
  content: "PDF";
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 20px;
  margin-right: 7px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
}

/* v5.8 — archive source, strict PCA, and LDA */
.source-type-box{margin-bottom:16px}
.source-type-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.source-type-tabs label{display:block;cursor:pointer}
.source-type-tabs input{position:absolute;opacity:0;pointer-events:none}
.source-type-tabs span{display:flex;min-height:78px;flex-direction:column;justify-content:center;gap:5px;border:1px solid var(--line);border-radius:12px;padding:14px 16px;background:var(--surface-2);transition:.18s ease}
.source-type-tabs small{color:var(--muted)}
.source-type-tabs input:checked+span{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 22%,transparent);background:var(--accent-soft)}
.lda-box{margin-top:18px}
.three-controls{grid-template-columns:repeat(3,minmax(0,1fr))}
.switch-field{display:flex;flex-direction:column;gap:8px}
.switch-inline{display:flex;align-items:center;gap:9px;min-height:43px;border:1px solid var(--line);border-radius:9px;padding:8px 11px;background:var(--input-bg)}
.switch-inline input{width:18px;height:18px;accent-color:var(--accent)}
.origin-pca-svg{display:block;width:100%;height:auto;background:#fff;color:#111}
@media(max-width:780px){.source-type-tabs,.three-controls{grid-template-columns:1fr}}


/* v5.9 — score plots: raw coordinates only, no bubble aggregation or perspective distortion */
.component-pair-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.component-pair-grid > section { background: #fff; border: 1px solid #cfd8d2; border-radius: 10px; padding: 10px; overflow: hidden; }
.component-pair-grid h5 { margin: 0 0 8px; color: #111; font-family: "Times New Roman", Times, serif; font-size: 16px; text-align: center; }
.component-pair-grid .origin-pca-svg { display: block; width: 100%; height: auto; background: #fff; }
@media (min-width: 1450px) { .component-pair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .component-pair-grid > section:first-child { grid-column: 1 / -1; } }


/* v5.10 — scientific boxplot and final report */
.boxplot-mode-field { display:block; margin: 2px 0 10px; padding:10px; border:1px solid var(--line); border-radius:9px; background:var(--surface); font-size:12px; font-weight:700; }
.boxplot-mode-field select { width:100%; margin:6px 0 3px; }
.boxplot-mode-field small { display:block; color:var(--muted); font-weight:400; line-height:1.35; }
.boxplot-canvas-wrap { background:#fff; }
.boxplot-canvas-wrap svg { background:#fff; }
.box-stat-legend { display:inline-flex; gap:5px; align-items:center; color:var(--text); }
.feature-importance-panel { margin-top:16px; }
.feature-importance-layout { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(220px,.8fr); gap:14px; align-items:start; }
.feature-importance-chart { border:1px solid var(--line); border-radius:11px; background:#fff; overflow:hidden; }
.feature-importance-chart svg { display:block; width:100%; height:auto; }
.feature-importance-summary { display:grid; gap:8px; }
.feature-importance-summary .summary-item { min-height:72px; }
.feature-importance-table { margin-top:14px; }
.final-report-note { margin-top:14px; }
@media (max-width:900px){.feature-importance-layout{grid-template-columns:1fr}}

/* v5.13 process monitor */
.process-monitor{
  position:fixed;right:22px;bottom:88px;z-index:1400;width:min(430px,calc(100vw - 28px));
  padding:16px;border:1px solid var(--border-strong,#4c6458);border-radius:14px;
  background:var(--panel,#111b17);color:var(--text,#eaf2ed);box-shadow:0 18px 50px rgba(0,0,0,.28);
}
.process-monitor.hidden{display:none!important}
.process-monitor-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.process-monitor-head strong{display:block;font-size:15px;line-height:1.35}
.process-kicker{display:block;margin-bottom:3px;font:700 10px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.13em;color:var(--accent,#43c878)}
.process-percent{font:700 18px/1 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--accent,#43c878)}
.process-track{height:12px;margin:14px 0 11px;overflow:hidden;border:1px solid var(--border,#365047);border-radius:999px;background:var(--input,#09110e)}
.process-track i{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--accent,#43c878),#88e5ad);transition:width .22s ease}
.process-stage{font-weight:700;font-size:13px}.process-detail{margin:4px 0 10px;color:var(--muted,#a9b8b0);font-size:12px;line-height:1.45}
.process-meta{display:flex;justify-content:space-between;gap:12px;padding-top:9px;border-top:1px solid var(--border,#32483f);font:600 11px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--muted,#9eb0a6)}
.process-wait-note{margin-top:10px;padding:9px 10px;border-left:3px solid #d8a33a;background:rgba(216,163,58,.10);font-size:11px;line-height:1.45;color:var(--text,#eaf2ed)}
.process-cancel{margin-top:11px;width:100%;padding:9px 12px;border:1px solid #c75b5b;border-radius:9px;background:transparent;color:#e08080;font-weight:700;cursor:pointer}
.process-cancel:hover{background:rgba(199,91,91,.12)}
.progress-area[aria-hidden="true"]{display:none!important}
@media(max-width:640px){.process-monitor{right:14px;bottom:76px;width:calc(100vw - 28px)}.process-meta{flex-direction:column;gap:4px}}

/* ===== v5.15 Model save, load, and raw-data prediction ===== */
.model-menu-btn {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
}

.model-loader-card {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(900px, calc(100vh - 34px));
  overflow: auto;
}

.model-workflow {
  display: grid;
  gap: 16px;
  padding: 18px 22px 4px;
}

.model-stage {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  transition: opacity .2s ease, border-color .2s ease;
}

.model-stage:not(.disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.model-stage.disabled {
  opacity: .48;
  pointer-events: none;
  filter: saturate(.55);
}

.model-stage-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "Cascadia Code", Consolas, monospace;
  font-weight: 800;
}

.model-stage-content {
  min-width: 0;
}

.model-stage-content > h3 {
  margin: 0 0 5px;
}

.model-stage-content > p {
  margin: 0 0 14px;
  color: var(--muted);
}

.model-action-row,
.prediction-pickers,
.model-modal-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.model-file-state {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.model-file-state strong {
  color: var(--text);
}

.model-file-state small,
.prediction-path {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-top: 3px;
}

.model-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 9px;
  margin-top: 13px;
}

.prediction-source-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 13px;
}

.prediction-source-tabs label {
  cursor: pointer;
}

.prediction-source-tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.prediction-source-tabs span {
  display: flex;
  flex-direction: column;
  min-height: 76px;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.prediction-source-tabs input:checked + span {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}

.prediction-source-tabs small {
  color: var(--muted);
}

.prediction-confidence-note {
  margin: 13px 0;
  padding: 11px 13px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-size: .88rem;
}

.prediction-table-wrap {
  max-height: 430px;
}

.prediction-table-wrap table {
  min-width: 900px;
}

.prediction-label {
  display: inline-flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 750;
  white-space: nowrap;
}

.confidence-mini {
  width: 92px;
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.confidence-mini i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.model-modal-footer {
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 920px) {
  .model-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prediction-source-tabs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .model-loader-card {
    width: calc(100vw - 14px);
  }
  .model-workflow {
    padding-inline: 10px;
  }
  .model-stage {
    grid-template-columns: 1fr;
    padding: 13px;
  }
  .model-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* v5.18 — Phase column auto-detection */
.phase-detection-card {
  margin-bottom: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.phase-detection-card[data-status="detected"] {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.phase-detection-card[data-status="checking"] { border-style: dashed; }
.phase-detection-card[data-status="error"] { border-color: #c97b2a; }
.phase-detection-head {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
}
.phase-detect-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
  color: var(--accent);
  font: 700 20px "Cascadia Code", Consolas, monospace;
}
.phase-detection-copy h3 { margin: 0 0 4px; }
.phase-detection-copy p { margin: 0; color: var(--muted); line-height: 1.45; }
.phase-detection-badge {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: 700 11px "Cascadia Code", Consolas, monospace;
  white-space: nowrap;
}
.phase-detection-card[data-status="detected"] .phase-detection-badge {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  color: var(--accent);
}
.phase-detection-details { margin-top: 13px; }
.phase-detect-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.phase-detect-grid > span {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.phase-detect-grid b {
  color: var(--muted);
  font: 700 10px "Cascadia Code", Consolas, monospace;
  letter-spacing: .07em;
}
.phase-detect-grid strong { color: var(--text); }
.phase-detect-grid small { color: var(--accent); }
.phase-detect-meta,
.phase-detect-warning,
.phase-detect-skeleton {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.phase-detect-warning {
  padding: 8px 10px;
  border-left: 3px solid #c97b2a;
  background: color-mix(in srgb, #c97b2a 8%, var(--surface-2));
  color: var(--text);
}
.phase-detection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 11px;
}
.phase-auto-input[readonly] {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
  color: var(--text);
  cursor: default;
}
.phase-auto-input[readonly]:focus { box-shadow: none; }
@media (max-width: 720px) {
  .phase-detection-head { grid-template-columns: 38px minmax(0,1fr); }
  .phase-detection-badge { grid-column: 1 / -1; justify-self: start; }
  .phase-detect-grid { grid-template-columns: 1fr; }
}

/* v5.19 — automatic environmental-column detection and environmental analysis */
.environment-detection-card { position: relative; }
.environment-detection-card[data-status="detected"] { border-color: color-mix(in srgb, var(--accent) 62%, var(--line)); }
.environment-detection-card[data-status="checking"] { border-style: dashed; }
.environment-detection-card[data-status="error"] { border-color: #b86b2a; }
.environment-detection-head {
  display: grid;
  grid-template-columns: 54px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.environment-detect-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.environment-detection-copy { min-width: 0; }
.environment-detection-copy strong { display: block; color: var(--text); margin-bottom: 4px; line-height: 1.35; }
.environment-detection-copy small { display: block; color: var(--muted); line-height: 1.4; }
.environment-detection-badge {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}
.environment-detection-card[data-status="detected"] .environment-detection-badge {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.environment-detection-details { margin-top: 12px; }
.environment-detect-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.environment-detect-grid > span {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.environment-detect-grid > span.detected { border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); }
.environment-detect-grid b { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.environment-detect-grid strong { color: var(--text); }
.environment-detect-grid small { color: var(--muted); font-size: 10px; }
.environment-detect-grid .detected small { color: var(--accent); }
.environment-detect-meta,
.environment-detect-warning,
.environment-detect-skeleton {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  line-height: 1.45;
  font-size: 12px;
}
.environment-detect-warning { border-color: #b86b2a; color: #b86b2a; }
.environment-redetect-btn { margin-top: 11px; }

.environment-analysis-box { margin-top: 16px; }
.environment-analysis-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.environment-variable-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: var(--surface);
}
.environment-variable-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.environment-variable-head span { color: var(--accent); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; }
.environment-variable-head h4 { margin: 4px 0 0; color: var(--text); font-size: 16px; }
.environment-variable-head > strong { color: var(--text); font-family: "Times New Roman", Georgia, serif; font-size: 15px; text-align: right; }
.environment-chart-wrap {
  overflow-x: auto;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  background: #fff;
}
.environment-boxplot-svg { display: block; min-width: 640px; }
.environment-stat-table { margin-top: 10px; max-height: 280px; overflow: auto; }
.environment-stat-table table { min-width: 600px; }
.environment-stat-table th { white-space: nowrap; }

@media (max-width: 980px) {
  .environment-analysis-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .environment-detection-head { grid-template-columns: 44px minmax(0,1fr); }
  .environment-detection-badge { grid-column: 1 / -1; justify-self: start; }
  .environment-detect-grid { grid-template-columns: 1fr; }
}

/* v5.20 — data-first column detection */
.column-detection-layout { align-items: start; }
.sensor-detection-card[data-status="detected"] { border-color: color-mix(in srgb,var(--accent) 62%,var(--line)); }
.sensor-detection-card[data-status="checking"] { border-style: dashed; }
.sensor-detection-card[data-status="error"] { border-color:#b86b2a; }
.structure-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:14px 0 4px; }
.sensor-row { grid-template-columns:36px minmax(0,1fr) 30px; }
.sensor-remove { width:30px; height:30px; border:1px solid var(--line); border-radius:8px; background:transparent; color:var(--muted); cursor:pointer; font-size:18px; line-height:1; }
.sensor-remove:hover { color:#d85d68; border-color:#d85d68; background:color-mix(in srgb,#d85d68 8%,transparent); }
.sensor-empty { grid-column:1/-1; }
.manual-column-box,.other-columns-box { margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); }
.manual-column-box > div:first-child,.other-columns-head { display:flex; flex-direction:column; gap:3px; margin-bottom:10px; }
.manual-column-box small,.other-columns-head small { color:var(--muted); }
.manual-column-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.other-column-list { display:flex; flex-wrap:wrap; gap:7px; }
.other-column-chip { display:inline-flex; align-items:center; gap:9px; border:1px solid var(--line); border-radius:999px; padding:7px 10px 7px 12px; background:var(--surface); color:var(--text); cursor:pointer; }
.other-column-chip:hover { border-color:var(--accent); }
.other-column-chip b { color:var(--accent); font-size:16px; }
@media (max-width:720px) {
  .manual-column-row { grid-template-columns:1fr; }
  .manual-column-row .secondary-btn { width:100%; }
}

/* v5.21 — vertical sensor mapping */
.sensor-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px;
  margin-top: 15px;
}
.sensor-row {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) 118px 78px !important;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  min-height: 66px;
  border-radius: 12px;
}
.sensor-order {
  display: grid;
  place-items: center;
  width: 48px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--accent);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .88rem;
  font-weight: 900;
  letter-spacing: .03em;
}
.sensor-column-field { min-width: 0; display: grid; gap: 5px; }
.sensor-column-field > span {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sensor-column-field .sensor-input { min-height: 38px; text-align: left; font-size: .9rem; }
.sensor-switch {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
}
.sensor-switch input { position: absolute; opacity: 0; pointer-events: none; }
.sensor-switch-track {
  position: relative;
  width: 42px;
  height: 23px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  transition: .18s ease;
}
.sensor-switch-track i {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  transition: .18s ease;
}
.sensor-switch input:checked + .sensor-switch-track { background: color-mix(in srgb,var(--accent) 28%,var(--surface)); border-color: var(--accent); }
.sensor-switch input:checked + .sensor-switch-track i { left: 22px; background: var(--accent); }
.sensor-switch b { font-size: .76rem; color: var(--muted); }
.sensor-row.enabled .sensor-switch b { color: var(--accent); }
.sensor-row.disabled { opacity: .62; }
.sensor-row.disabled .sensor-input { text-decoration: none; color: var(--muted); }
.sensor-remove {
  width: 72px;
  height: 34px;
  font-size: .74rem;
  font-weight: 800;
  line-height: 1;
}
@media (max-width: 720px) {
  .sensor-row { grid-template-columns: 52px minmax(0,1fr) !important; }
  .sensor-switch { grid-column: 2; grid-row: 2; width: max-content; }
  .sensor-remove { grid-column: 2; grid-row: 2; justify-self: end; }
}

/* v5.22 — analysis direction & regression workflow */
.analysis-direction-box{margin-bottom:16px}
.analysis-mode-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.analysis-mode-tabs label{cursor:pointer}
.analysis-mode-tabs input{position:absolute;opacity:0;pointer-events:none}
.analysis-mode-tabs span{display:flex;min-height:102px;flex-direction:column;gap:5px;padding:16px;border:1px solid var(--border);background:var(--surface-2);border-radius:10px;transition:.18s ease}
.analysis-mode-tabs strong{font-size:1rem;color:var(--text)}
.analysis-mode-tabs small{color:var(--muted);line-height:1.45}
.analysis-mode-tabs input:checked+span{border-color:var(--accent);box-shadow:inset 4px 0 0 var(--accent);background:var(--accent-soft)}
.regression-target-source{margin-top:16px}
.regression-target-actions{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}
.regression-target-selector{margin-top:18px}
.regression-target-selector select{max-width:520px}
#regressionTargetMatchInfo.good{border-color:#48a868;background:rgba(72,168,104,.08)}
#regressionTargetMatchInfo.warn{border-color:#d79a38;background:rgba(215,154,56,.08)}
.regression-metric-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:12px 0}
.regression-metric-card{border:1px solid var(--border);background:var(--surface-2);border-radius:8px;padding:12px}
.regression-metric-card span{display:block;color:var(--muted);font-size:.78rem;margin-bottom:4px}
.regression-metric-card strong{font-size:1.08rem}
.regression-chart-svg{display:block;width:100%;height:auto;background:#fff;border:1px solid #b9c2bc}
.regression-target-chip{display:inline-flex;align-items:center;gap:6px;margin:4px 6px 4px 0;padding:5px 8px;border:1px solid var(--border);border-radius:999px;background:var(--surface-2);font-size:.78rem}
@media (max-width:900px){.analysis-mode-tabs{grid-template-columns:1fr}.regression-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v5.23 bilingual switch */
.language-switch{display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2, var(--surface));}
.language-switch button{border:0;background:transparent;color:var(--muted);font:inherit;font-size:12px;font-weight:700;letter-spacing:.04em;padding:6px 8px;border-radius:6px;cursor:pointer;min-width:34px;}
.language-switch button.active{background:var(--accent);color:var(--accent-contrast,#07110b);}
.language-switch button:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
@media(max-width:760px){.top-actions .language-switch{order:8}.language-switch button{padding:6px 7px}}

/* v5.29 About contact */
.about-contact { margin: 0 24px 24px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); display: grid; gap: 5px; }
.about-contact span { color: var(--accent); font: 800 11px "Cascadia Code", Consolas, monospace; letter-spacing: .08em; }
.about-contact strong { font-size: 14px; }
.about-contact a { color: var(--accent); text-decoration: none; word-break: break-all; }
.about-contact a:hover { text-decoration: underline; }
