/* WB Studio foundations. Local styles; no UI framework is required. */
:root {
    color-scheme: light;
    --primary: #007aff;
    --primary-hover: #0063d1;
    --primary-soft: #eaf3ff;
    --text-main: #1c1c1e;
    --text-sub: #7c7c84;
    --bg-body: #f5f5f7;
    --surface: rgba(255, 255, 255, .92);
    --line: #e9e9ee;
    --muted-surface: #f5f5f8;
    --green: #248a3d;
    --green-soft: #eef9f0;
    --orange: #ff9500;
    --radius: 22px;
    --sidebar-w: 264px;
    --gutter: clamp(20px, 2.2vw, 44px);
    --tabbar-h: 68px;
    --shell-gap: 30px;
    --shadow: 0 4px 24px rgba(28, 28, 30, .035), 0 1px 3px rgba(28, 28, 30, .02);
    --shadow-hover: 0 10px 32px rgba(28, 28, 30, .08);
    --ease: cubic-bezier(.25, .46, .45, .94);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--tabbar-h) + 12px); }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--text-main);
    background: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, p { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; line-height: 1.35; }
h4 { font-size: 20px; } h5 { font-size: 17px; } h6 { font-size: 14px; }
p + p { margin-top: 12px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled, input:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
img, canvas, svg { vertical-align: middle; }
button, a, input, select, textarea, summary, [tabindex], [role="button"] { outline-offset: 4px; }
:focus-visible { outline: 3px solid #8bc2ff; }
::selection { color: #004a9c; background: #dcecff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
small, .small { font-size: 12px; }
.font-monospace { font-family: "SF Mono", Menlo, Consolas, monospace; }
.wb-skip-link { position: fixed; top: -60px; left: 16px; z-index: 15000; background: #1c1c1e; color: #fff; border-radius: 10px; padding: 10px 18px; }
.wb-skip-link:focus { top: 12px; }

/* A single navigation is shared between desktop and mobile; the workbench has
   no top bar, so its context and storage status live in the project drawer. */
.wb-status { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; white-space: nowrap; }
.wb-status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px #34c75912; }
.wb-status[data-mode="warning"] { color: #b86b00; }
.wb-status[data-mode="warning"] .wb-status-dot { background: #ff9500; box-shadow: 0 0 0 3px #ff950014; }
.wb-status[data-mode="loading"] { color: #8e8e93; }
.wb-status[data-mode="loading"] .wb-status-dot { background: #b8b8be; box-shadow: none; }
.wb-sidebar-status { display: flex; gap: 7px; margin-top: 10px; padding: 9px 10px; background: #f7f7fa; border-radius: 10px; font-size: 10px; }
.wb-project-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; background: #ffffffe6; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 22px #1c1c1e1a; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); align-items: start; gap: var(--shell-gap); width: 100%; padding: 16px var(--gutter) 36px; margin: 0 auto; }
.wb-rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: calc(var(--tabbar-h) + 20px); min-width: 0; max-height: calc(100dvh - var(--tabbar-h) - 42px); }
/* Navigation: small cards across the top, each naming one workbench view. The bar
   stays translucent so the page reads as one surface. It must remain a body-level
   element: an ancestor with backdrop-filter would capture the fixed mobile nav. */
/* The bar itself has no surface of its own: only the cards are visible, and they share
   the full width evenly. It must remain a body-level element: an ancestor with
   backdrop-filter would capture the fixed mobile navigation. */
.top-tool-nav { position: sticky; top: 0; z-index: 220; display: flex; align-items: center; height: var(--tabbar-h); padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; background: none; border: 0; }
.top-tool-nav::-webkit-scrollbar { display: none; }
/* At rest the bar is invisible; once the page scrolls under it the cards would otherwise
   show page content through the gaps, so a scrim fades in only while stuck. */
.top-tool-nav::before { content: ''; position: absolute; inset: 0; z-index: -1; background: rgba(250, 250, 251, .92); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); border-bottom: 1px solid #1c1c1e10; opacity: 0; transition: opacity .2s var(--ease); pointer-events: none; }
.top-tool-nav.is-scrolled::before { opacity: 1; }
.wb-nav-track { display: flex; flex: 1 1 auto; align-items: stretch; gap: 8px; min-width: 0; padding: 10px 0; }
.nav-item { display: flex; flex: 1 1 0; align-items: center; gap: 9px; min-width: 0; padding: 7px 12px; border: 1px solid #1c1c1e12; border-radius: 12px; background: #fff; color: #1d1d1f; text-align: left; box-shadow: 0 1px 2px #1c1c1e08; transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease); }
.nav-item > i { flex: 0 0 auto; font-size: 16px; line-height: 1; color: #a1a1aa; transition: color .18s var(--ease); }
.wb-nav-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wb-nav-copy strong, .wb-nav-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-nav-copy strong { font-size: 12.5px; font-weight: 600; letter-spacing: .01em; }
.wb-nav-copy small { font-size: 9.5px; color: #8a8a93; }
.nav-item:hover { border-color: #1c1c1e2b; box-shadow: 0 4px 12px #1c1c1e12; transform: translateY(-1px); }
.nav-item:hover > i { color: #71717a; }
.nav-item.active { border-color: #007aff4d; box-shadow: 0 2px 10px #007aff1f; }
.nav-item.active > i, .nav-item.active .wb-nav-copy strong { color: #0063d1; }
.nav-item.active::after { display: none; }
.wb-nav-divider { display: none; }
.wb-guide-nav { color: #1d1d1f; }
.wb-guide-nav > i { color: #a1a1aa; }

/* Project tree and backup actions. */
#sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sidebar-top { display: flex; align-items: center; gap: 8px; padding: 18px 16px 12px; flex: 0 0 auto; }
.sidebar-heading { flex: 1; min-width: 0; }
.sidebar-heading-title { display: block; font-size: 12px; font-weight: 650; }
.sidebar-heading-desc { display: block; font-size: 10px; color: #a0a0a8; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-toggle { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; padding: 0; background: #f5f5f8; color: #8e8e93; border: 0; border-radius: 9px; }
.sidebar-toggle:hover { color: #1c1c1e; background: #eaeaf0; }
.workspace-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; padding: 0 12px 12px; }
.workspace-panel-head { flex-shrink: 0; }
.workspace-actions, .workspace-footer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.workspace-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 31px; padding: 7px 5px; background: #f5f5f8; color: #74747c; border: 1px solid transparent; border-radius: 9px; font-size: 10px; white-space: nowrap; }
.workspace-icon-btn:hover { color: #1c1c1e; background: #eaeaf0; }
.workspace-scope-note { font-size: 9px; color: #ababB2; margin: 10px 3px 8px; }
.workspace-tree { min-height: 50px; overflow: auto; scrollbar-width: thin; scrollbar-color: #dedee5 transparent; padding-bottom: 8px; flex: 1 1 auto; }
.workspace-folder-row, .workspace-analysis-row { display: flex; align-items: center; gap: 4px; border-radius: 9px; color: #77777f; min-width: 0; }
.workspace-folder-row { min-height: 32px; padding: 5px 4px; font-size: 11px; }
.workspace-folder-row > i { color: #da9f42; }
.workspace-folder-row.is-selected { background: #f5f5f8; color: #414149; }
.workspace-folder-row:hover { background: #eeeef3; }
.workspace-folder-toggle { display: grid; place-items: center; width: 16px; height: 22px; padding: 0; flex: 0 0 16px; border: 0; background: none; color: #a5a5ad; font-size: 9px; }
.workspace-folder-name, .workspace-analysis-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.workspace-row-action { display: inline-grid; place-items: center; width: 22px; height: 24px; padding: 0; flex: 0 0 22px; border: 0; background: transparent; color: #aaaab1; border-radius: 6px; font-size: 10px; opacity: 0; }
.workspace-row-action:hover { color: #c23a32; background: #fff0ee; }
.workspace-folder-row:hover .workspace-row-action, .workspace-analysis-row:hover .workspace-row-action, .workspace-folder-row:focus-within .workspace-row-action, .workspace-analysis-row:focus-within .workspace-row-action { opacity: 1; }
.workspace-analysis-list { padding-left: 14px; }
.workspace-analysis-row { min-height: 30px; padding: 5px 6px; margin: 3px 0; font-size: 10px; border: 1px solid transparent; cursor: pointer; }
.workspace-analysis-row:hover { background: #f6f6f9; }
.workspace-analysis-row.is-active { color: #007aff; background: #eff5ff; border-color: #e4eeff; }
.workspace-local-badge { font-size: 8px; color: #9c9ca5; white-space: nowrap; }
.workspace-analysis-row.is-active .workspace-local-badge { color: #7ca9dd; }
.workspace-empty { color: #a0a0a8; padding: 14px 5px; text-align: center; font-size: 11px; }
.workspace-footer-actions { border-top: 1px solid #efeff3; padding-top: 10px; margin-top: 3px; flex: 0 0 auto; }
.workspace-footer-actions .workspace-icon-btn { background: transparent; min-height: 28px; justify-content: flex-start; padding-left: 6px; }
.workspace-footer-actions .workspace-icon-btn:hover { background: #f5f5f8; }
.workspace-storage-note { display: flex; align-items: flex-start; gap: 7px; font-size: 9px; line-height: 1.65; color: #9999a1; background: #f7f7fa; border-radius: 10px; padding: 10px; margin-top: 10px; flex: 0 0 auto; }
.workspace-storage-note > i { color: #919199; font-size: 13px; }
.workspace-storage-alert { font-weight: 500; color: #7f7f88; }
.sidebar-clear-btn { display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; color: #b0b0b8; font-size: 9px; padding: 10px 0 0; width: 100%; flex: 0 0 auto; }
.sidebar-clear-btn:hover { color: #d04b43; }
body.sidebar-collapsed #sidebar > :not(.sidebar-top) { display: none; }
body.sidebar-collapsed .sidebar-heading-desc { display: none; }
body.sidebar-collapsed .sidebar-top { padding-bottom: 18px; }
.wb-drawer-backdrop { display: none; }
#main { min-width: 0; outline: 0; }
.view-section { display: none; min-width: 0; width: 100%; padding-bottom: 20px; animation: slide-in .3s var(--ease); }
.view-section.active { display: block; }
@keyframes slide-in { from { transform: translateY(7px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Legacy quantification, spreadsheet, and plotting surfaces. */
.glass-card { min-width: 0; background: var(--surface); border: 1px solid #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header-clean { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px 24px 16px; }
.card-title { font-size: 14px; font-weight: 650; }
.card-body-clean { padding: 0 24px 24px; }
.label-xs { display: block; color: #77777f; font-size: 11px; font-weight: 500; margin-bottom: 7px; }
.modern-input { width: 100%; min-width: 0; border: 1px solid #eaeaef; border-radius: 11px; padding: 10px 12px; background: #f8f8fa; font-size: 12px; color: #34343b; transition: border-color .2s, box-shadow .2s; }
.modern-input:focus { outline: 0; background: #fff; border-color: #a1caff; box-shadow: 0 0 0 3px #007aff0a; }
textarea.modern-input { resize: vertical; }
.field-hint, .form-text { display: block; font-size: 10px; color: #97979f; line-height: 1.65; margin-top: 6px; }
.context-guide { display: flex; align-items: flex-start; gap: 8px; padding: 11px 13px; margin-bottom: 16px; background: #f7f7fa; color: #888890; font-size: 10px; line-height: 1.8; border-radius: 12px; }
.context-guide > i { color: #9a9aa2; flex: 0 0 auto; margin-top: 1px; }
.context-guide strong { color: #66666e; font-weight: 600; }
.live-status { padding: 9px 12px; background: #f5f5f8; color: #898991; border-radius: 10px; font-size: 10px; }
.live-status.is-valid { background: #f0f9f2; color: #40814d; }
.live-status.is-warning, .norm-hint.is-warning { background: #fff8eb; color: #ad7b26; }
.norm-hint { margin-top: 6px; color: #9999a1; font-size: 10px; }
.btn-modern, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; padding: 9px 15px; border: 1px solid transparent; border-radius: 12px; font-size: 11px; font-weight: 500; background: #f3f3f7; color: #55555d; transition: transform .2s var(--ease), box-shadow .2s, background .2s; }
.btn-primary-m { background: #1c1c1e; color: #fff; }
.btn-light-m { background: #f7f7fa; border-color: #e9e9ef; }
.btn-modern:hover { transform: translateY(-1px); box-shadow: 0 5px 14px #1c1c1e0a; }
.btn-primary-m:hover { background: #363638; }
.btn-light-m:hover { background: #eeeef3; }
.btn-check { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn-check:checked + .btn { color: #fff; background: #1c1c1e; }
.btn-check:focus-visible + .btn { outline: 3px solid #8bc2ff; outline-offset: 3px; }
.btn-group { display: inline-flex; gap: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; min-height: 27px; }
.form-check-input { margin: 0; accent-color: #34c759; flex: 0 0 auto; }
.form-switch .form-check-input { appearance: none; -webkit-appearance: none; width: 32px; height: 19px; border: 0; border-radius: 999px; background: #dedee5; position: relative; transition: background .2s; cursor: pointer; }
.form-switch .form-check-input::before { content: ''; display: block; width: 15px; height: 15px; border-radius: 50%; background: #fff; position: absolute; top: 2px; left: 2px; box-shadow: 0 1px 3px #0002; transition: transform .2s; }
.form-switch .form-check-input:checked { background: #34c759; }
.form-switch .form-check-input:checked::before { transform: translateX(13px); }
.form-check-label { color: #7e7e86; }
input[type="range"] { accent-color: #007aff; height: 18px; min-width: 0; cursor: pointer; }
input[type="color"] { padding: 3px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #fafafb; cursor: pointer; }
.wb-wrapper { position: relative; display: flex; align-items: flex-start; justify-content: flex-start; height: 430px; min-height: 280px; overflow: auto; border: 1px solid #e5e5eb; border-radius: 15px; background: #262628; cursor: crosshair; overscroll-behavior: contain; }
#wbCanvas { display: block; flex: 0 0 auto; margin: auto; touch-action: none; }
#empty-tip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 28px; font-size: 12px; pointer-events: none; }
#empty-tip small { font-size: 10px; opacity: .6; }
.wb-storage-note { display: flex; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 10px; background: #f2f8ff; color: #708297; font-size: 11px; }
.wb-storage-note.is-warning { color: #a17625; background: #fff8ec; }
#result-scope { width: auto; max-width: 100%; font-size: 10px; }
.result-actions { flex-wrap: wrap; }
.table-responsive, .table-scroll-container { width: 100%; max-width: 100%; overflow: auto; scrollbar-width: thin; scrollbar-color: #d9d9e0 transparent; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-weight: 500; color: #92929a; background: #f8f8fa; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: #f9f9fc; }
.table-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; margin-bottom: 24px; }
.table-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; background: #fafafc; border-bottom: 1px solid var(--line); }
.sci-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.sci-table th, .sci-table td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.sci-table thead th { position: sticky; top: 0; z-index: 20; background: #f7f7fa; font-weight: 500; color: #85858d; }
.sci-table :is(td,th):first-child { position: sticky; left: 0; background: #fff; border-right: 1px solid var(--line); z-index: 10; }
.sci-table thead th:first-child { z-index: 30; background: #f7f7fa; }
.sci-table tbody tr:hover td { background: #fafafc; }
.num-cell { font-family: "SF Mono", Menlo, monospace; color: #66666e; }
.row-header { color: #4a4a52; font-weight: 500; }
.btn-copy-sm { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: #fff; color: #8a8a92; font-size: 10px; }
.preview-area { display: flex; align-items: center; flex-direction: column; min-height: 550px; padding: 24px; border: 1px solid #fff; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; min-width: 0; }
.hm-preview-toolbar { display: flex; justify-content: flex-end; width: 100%; margin-bottom: 18px; }
#hm-preview { width: 100%; max-width: 100%; overflow-x: auto; }
#hm-preview svg { display: block; max-width: none; margin: 0 auto; }
.hm-sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hm-sheet-action-btn, .hm-sheet-expand-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 9px; border: 1px solid #eeeef3; border-radius: 9px; background: #f8f8fa; color: #7d7d85; font-size: 10px; }
.hm-sheet-action-btn:hover, .hm-sheet-expand-btn:hover { background: #eeeef3; color: #1c1c1e; }
.hm-sheet-action-btn.is-danger { color: #c9756f; background: #fff7f6; border-color: #fbece9; }
.hm-sheet-shell { border: 1px solid #e6e6ec; border-radius: 12px; overflow: hidden; }
.hm-sheet-scroll { max-height: 240px; overflow: auto; scrollbar-width: thin; }
.hm-sheet-shell.is-expanded .hm-sheet-scroll { max-height: none; }
.hm-sheet-expand-row { display: flex; justify-content: center; margin-top: 10px; }
.hm-sheet-expand-btn { border-color: transparent; background: transparent; }
.hm-sheet-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; table-layout: fixed; }
.hm-sheet-table th, .hm-sheet-table td { min-width: 115px; width: 115px; height: 39px; position: relative; padding: 0; border-right: 1px solid #eeeef3; border-bottom: 1px solid #eeeef3; background: #fff; }
.hm-sheet-table th { position: sticky; top: 0; z-index: 3; background: #f7f7fa; }
.hm-sheet-table :is(th,td):first-child { min-width: 165px; width: 165px; position: sticky; left: 0; z-index: 4; background: #fafafc; }
.hm-sheet-table thead th:first-child { z-index: 6; }
.hm-sheet-table tr > :last-child { border-right: 0; }
.hm-sheet-table tbody tr:last-child > * { border-bottom: 0; }
.hm-sheet-corner { display: flex; align-items: center; gap: 6px; padding: 9px 12px; font-size: 10px; font-weight: 500; color: #8a8a92; white-space: nowrap; }
.hm-sheet-input { width: 100%; height: 100%; border: 0; border-radius: 0; padding: 10px 24px 10px 12px; background: transparent; color: #686870; font-size: 11px; outline: none; }
.hm-sheet-input:focus { box-shadow: inset 0 0 0 2px #8dc1ff; background: #f4f9ff; }
.hm-sheet-cell-selected { background: #eef5ff !important; }
.hm-sheet-cell-active { box-shadow: inset 0 0 0 2px #67acff; }
.hm-sheet-shell.is-range-selecting .hm-sheet-input { cursor: cell; }
.hm-sheet-name-input { font-weight: 550; }
.hm-sheet-input.is-invalid { color: #c44940; background: #fff2ef; }
.hm-sheet-delete { position: absolute; top: 9px; right: 3px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: #f1f1f5; color: #a3a3ab; font-size: 8px; opacity: 0; }
.hm-sheet-table :is(th,td):hover .hm-sheet-delete, .hm-sheet-table :is(th,td):focus-within .hm-sheet-delete { opacity: 1; }
.hm-sheet-delete:hover { color: #cf554a; background: #fff0ed; }
.hm-sheet-help { display: flex; align-items: flex-start; gap: 7px; color: #a0a0a8; font-size: 10px; line-height: 1.7; margin-top: 12px; }
.hm-sheet-help > i { color: #92929a; margin-top: 2px; }
#trend-charts-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 18px; }
.trend-chart { min-width: 0; border: 1px solid var(--line); padding: 14px; border-radius: 14px; background: #fff; }
.trend-chart-scroll { width: 100%; overflow: auto; }
.trend-chart svg { display: block; min-width: 100%; cursor: context-menu; }

/* Select popovers, notifications, and confirmations share the card language. */
.custom-select { width: 100%; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 42px; padding: 10px 12px; text-align: left; border: 1px solid #eaeaef; border-radius: 11px; background: #f8f8fa; color: #55555d; font-size: 11px; }
.custom-select-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-label.is-placeholder { color: #b0b0b8; }
.custom-select-chevron { flex: 0 0 auto; font-size: 9px; color: #a6a6ae; transition: transform .2s; }
.custom-select.is-open .custom-select-chevron { transform: rotate(180deg); }
.custom-select-menu { position: fixed; z-index: 10000; display: none; padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #eeeef3; border-radius: 14px; background: #fffffffa; box-shadow: 0 10px 40px #1c1c1e1a; scrollbar-width: thin; backdrop-filter: blur(20px); }
.custom-select-menu.is-open { display: block; }
.custom-select-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 37px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: #7c7c84; font-size: 11px; text-align: left; }
.custom-select-option:hover, .custom-select-option.is-active { background: #f5f5f8; }
.custom-select-option.is-selected { color: #007aff; background: #edf5ff; }
.wb-toast-stack { position: fixed; top: 20px; right: 26px; z-index: 11010; display: flex; flex-direction: column; gap: 10px; max-width: min(390px, calc(100vw - 32px)); pointer-events: none; }
.wb-toast { display: flex; align-items: flex-start; gap: 11px; padding: 15px 18px; border: 1px solid #eaeaef; border-radius: 18px; background: #fffffff5; color: #72727a; box-shadow: 0 8px 32px #1c1c1e12; font-size: 12px; pointer-events: auto; opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; backdrop-filter: blur(20px); }
.wb-toast.is-visible { opacity: 1; transform: translateY(0); }
.wb-toast-icon { color: #007aff; flex: 0 0 auto; font-size: 16px; }
.wb-toast-text { white-space: pre-line; word-break: break-word; }
.wb-toast.is-success .wb-toast-icon { color: #34a853; }
.wb-toast.is-warning .wb-toast-icon { color: #f0a327; }
.wb-toast.is-error .wb-toast-icon { color: #e65e52; }
.wb-dialog-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 11000; padding: 20px; background: #1c1c1e38; opacity: 0; transition: opacity .16s; backdrop-filter: blur(6px); }
.wb-dialog-overlay.is-visible { opacity: 1; }
.wb-dialog { width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px; border: 1px solid #fff; border-radius: 25px; background: #fff; box-shadow: 0 22px 80px #1c1c1e20; transform: translateY(8px) scale(.98); transition: transform .16s; }
.wb-dialog-overlay.is-visible .wb-dialog { transform: none; }
.wb-dialog-title { font-size: 18px; font-weight: 650; margin-bottom: 12px; }
.wb-dialog-body { color: #8a8a92; font-size: 12px; line-height: 1.9; white-space: pre-line; word-break: break-word; }
.wb-dialog-input { display: block; width: 100%; padding: 11px 13px; background: #f7f7fa; border: 1px solid var(--line); border-radius: 12px; margin-top: 18px; }
.wb-dialog-options { display: grid; gap: 7px; margin-top: 16px; }
.wb-dialog-option { display: flex; align-items: center; gap: 10px; padding: 12px; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fafafc; font-size: 12px; text-align: left; }
.wb-dialog-option:hover:not(:disabled) { background: #edf5ff; border-color: #cce3ff; }
.wb-dialog-option-tag { margin-left: auto; color: #aaaab2; font-size: 10px; }
.wb-dialog-option.is-new { color: #007aff; }
.wb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.wb-dialog-btn { padding: 10px 15px; border: 1px solid transparent; border-radius: 12px; background: #f5f5f8; font-size: 12px; font-weight: 500; }
.wb-dialog-btn-primary { color: #fff; background: #1c1c1e; }
.wb-dialog-btn-primary:hover { background: #3c3c3e; }
.wb-dialog-btn-ghost { border-color: var(--line); color: #8b8b93; background: #fff; }
.wb-dialog-btn-danger { color: #fff; background: #df584e; }

/* Small local utilities used by the established quantitative modules. */
.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.row > * { min-width: 0; grid-column: span 12; }
.row > .col-6 { grid-column: span 6; }
.g-3 { gap: 12px; } .g-4 { gap: 20px; }
.d-flex { display: flex; } .d-block { display: block; }
.flex-column { flex-direction: column; } .flex-grow-1 { flex-grow: 1; }
.align-items-center { align-items: center; } .align-items-start { align-items: flex-start; } .align-items-end { align-items: flex-end; } .align-items-stretch { align-items: stretch; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 20px; }
.w-100 { width: 100%; } .h-100 { height: 100%; } .min-h-0 { min-height: 0; }
.p-2 { padding: 8px; } .p-3 { padding: 18px; } .p-4 { padding: 24px; }
.px-0 { padding-left: 0; padding-right: 0; } .px-3 { padding-left: 12px; padding-right: 12px; }
.py-1 { padding-top: 5px; padding-bottom: 5px; } .py-2 { padding-top: 8px; padding-bottom: 8px; } .py-3 { padding-top: 12px; padding-bottom: 12px; }
.pt-3 { padding-top: 12px; } .pt-4 { padding-top: 24px; } .pb-1 { padding-bottom: 4px; }
.ps-3 { padding-left: 12px; } .ps-4 { padding-left: 20px; } .pe-3 { padding-right: 12px; }
.m-0 { margin: 0; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; } .mb-5 { margin-bottom: 32px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 24px; } .mt-5 { margin-top: 32px; }
.me-1 { margin-right: 4px; } .me-2 { margin-right: 6px; } .me-3 { margin-right: 12px; } .ms-1 { margin-left: 4px; } .ms-4 { margin-left: 20px; }
.my-5 { margin-top: 32px; margin-bottom: 32px; } .mx-auto { margin-left: auto; margin-right: auto; }
.text-muted { color: #96969e; } .text-secondary { color: #85858d; } .text-primary { color: #007aff; } .text-dark { color: #35353d; } .text-success { color: #3a9650; } .text-danger { color: #d3635a; } .text-white-50 { color: #ffffff80; } .text-center { text-align: center; }
.bg-light, .bg-body { background: #f7f7fa; } .bg-white { background: #fff; } .bg-primary { background: #007aff; } .bg-success { background: #eef9f0; color: #3a9650; } .bg-warning { background: #fff5e5; } .bg-danger { background: #fff1ee; color: #ca665b; }
.fw-bold { font-weight: 650; } .fs-1 { font-size: 38px; } .fs-5 { font-size: 20px; } .fs-6 { font-size: 14px; } .lead { font-size: 16px; }
.border { border: 1px solid var(--line); } .border-top { border-top: 1px solid var(--line); } .border-end { border-right: 1px solid var(--line); } .border-start { border-left: 1px solid var(--line); } .border-0 { border: 0; } .border-bottom-0 { border-bottom: 0; }
.rounded { border-radius: 10px; } .rounded-3 { border-radius: 12px; } .rounded-pill { border-radius: 999px; }
.badge { display: inline-flex; align-items: center; border-radius: 7px; padding: 3px 7px; font-size: 10px; font-weight: 550; white-space: nowrap; }
.position-absolute { position: absolute; } .opacity-25 { opacity: .25; }
.list-unstyled { list-style: none; padding-left: 0; }

@media (min-width: 768px) { .col-md-6 { grid-column: span 6; } .col-md-3 { grid-column: span 3; } }
@media (min-width: 992px) { .col-lg-4 { grid-column: span 4; } .col-lg-6 { grid-column: span 6; } .col-lg-8 { grid-column: span 8; } }
@media (min-width: 1200px) { .col-xl-3 { grid-column: span 3; } .col-xl-9 { grid-column: span 9; } }
@media (max-width: 1100px) {
    /* Narrow desktops: drop the captions so seven equal cards keep readable titles. */
    .wb-nav-track { gap: 6px; }
    .nav-item { gap: 7px; padding: 7px 10px; }
    .wb-nav-copy small { display: none; }
}
@media (max-width: 1220px) {
    :root { --sidebar-w: 236px; --shell-gap: 22px; }
    .app-shell { gap: var(--shell-gap); padding: 24px; }
    .wb-rail { top: calc(var(--tabbar-h) + 18px); max-height: calc(100dvh - var(--tabbar-h) - 40px); }
}
@media (max-width: 859px) {
    html { scroll-padding-top: 16px; }
    .top-tool-nav { display: block; top: auto; height: auto; padding: 0; overflow: visible; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .top-tool-nav::before { display: none; }
    .wb-nav-track { display: contents; }
    .wb-project-toggle { display: inline-flex; position: fixed; right: 14px; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 280; }
    .app-shell { display: block; padding: 20px 20px calc(100px + env(safe-area-inset-bottom)); }
    .wb-rail { display: contents; }
    .wb-mobile-nav { position: fixed; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 240; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; padding: 7px 4px; background: rgba(255, 255, 255, .94); border: 1px solid #ffffffe0; border-radius: 20px; box-shadow: 0 4px 28px #1c1c1e14; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
    .wb-nav-label, .wb-nav-divider { display: none; }
    .nav-item { flex-direction: column; justify-content: center; gap: 5px; min-width: 0; min-height: 51px; padding: 7px 0; border: 0; border-radius: 13px; background: transparent; box-shadow: none; }
    .nav-item > i { display: inline-block; font-size: 18px; width: auto; }
    .wb-nav-copy { align-items: center; gap: 0; }
    .wb-nav-copy strong { font-size: 9px; font-weight: 500; }
    .wb-nav-copy small { display: none; }
    .nav-item.active::after { display: none; }
    .nav-item.active { border: 0; background: #eef4ff; box-shadow: none; transform: none; }
    .nav-item:hover { transform: none; box-shadow: none; }
    .nav-item > i { color: inherit; }
    #sidebar, body.sidebar-collapsed #sidebar { position: fixed; left: 16px; top: 14px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 270; width: min(340px, calc(100vw - 32px)); max-height: 700px; opacity: 0; visibility: hidden; transform: translateX(-20px); transition: transform .22s var(--ease), opacity .22s, visibility .22s; }
    body.projects-open #sidebar { visibility: visible; opacity: 1; transform: translateX(0); }
    body.sidebar-collapsed #sidebar > :not(.sidebar-top) { display: flex; }
    body.sidebar-collapsed .sidebar-heading-desc { display: block; }
    .sidebar-top, body.sidebar-collapsed .sidebar-top { padding: 20px 18px 15px; }
    .sidebar-heading-title { font-size: 15px; }
    .sidebar-heading-desc { font-size: 11px; }
    .sidebar-toggle { width: 36px; height: 36px; flex-basis: 36px; }
    .workspace-panel { padding: 0 14px 14px; }
    .workspace-icon-btn { font-size: 11px; min-height: 38px; }
    .workspace-folder-row { min-height: 40px; font-size: 12px; }
    .workspace-analysis-row { min-height: 38px; font-size: 11px; }
    .workspace-row-action { width: 26px; height: 32px; flex-basis: 26px; opacity: 1; font-size: 11px; }
    .workspace-folder-toggle { width: 26px; height: 32px; flex-basis: 26px; }
    .workspace-storage-note { font-size: 10px; }
    .sidebar-clear-btn { min-height: 38px; font-size: 10px; padding-top: 8px; }
    .wb-drawer-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 260; border: 0; background: #1c1c1e26; backdrop-filter: blur(3px); }
    body.projects-open { overflow: hidden; }
    .wb-toast-stack { top: 14px; right: 16px; }
    .wb-wrapper { height: min(58vh, 400px); }
    .image-controls { width: 100%; flex-wrap: wrap; }
    .image-control { display: grid; grid-template-columns: 70px minmax(0, 1fr) 42px; width: 100%; border: 0; padding: 0; }
    .image-control input[type="range"] { width: 100% !important; }
    .card-header-clean { padding: 20px 18px 14px; }
    .card-body-clean { padding: 0 18px 20px; }
    .modern-input, .hm-sheet-input { font-size: 16px; }
    #trend-area > .d-flex { flex-direction: column; gap: 12px; align-items: flex-start; }
}
@media (max-width: 479px) {
    .app-shell { padding: 18px 16px 105px; }
    .wb-mobile-nav { left: 8px; right: 8px; }
    .glass-card { border-radius: 19px; }
    .result-actions { width: 100%; }
    #result-scope { width: 100%; }
    .result-actions .btn-modern { flex: 1 1 calc(50% - 8px); padding: 9px 8px; }
    .hm-sheet-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .hm-sheet-actions .form-check-label { font-size: 11px; }
    .hm-sheet-action-btn { min-height: 36px; }
    .preview-area { padding: 16px 12px; min-height: 400px; }
    .table-header-row { flex-wrap: wrap; }
    .p-3 { padding: 16px; }
    .wb-dialog { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
