/* Excel2SQLite — single stylesheet. Tokens first; light and dark are both
   designed (dark is not an automatic inversion). */

:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --surface-3: #eae9e3;
  --sidebar: #efeee9;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #6f6d68;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-ink: #ffffff;
  --accent-weak: #e6f0fb;
  --accent-text: #1c5cab;
  --good: #0ca30c;
  --good-text: #006300;
  --good-weak: #e7f5e7;
  --warning: #fab219;
  --warn-text: #7a5000;
  --warn-weak: #fdf3dc;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-text: #b42c2c;
  --critical-weak: #fbeaea;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --s-other: #a8a69f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.16);
  --radius: 10px;
  --radius-sm: 7px;
  --row-h: 30px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --surface-3: #2c2c2a;
    --sidebar: #131312;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #a5a49b;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --accent-ink: #ffffff;
    --accent-weak: #172a40;
    --accent-text: #86b6ef;
    --good-text: #0ca30c;
    --good-weak: #12280f;
    --warn-text: #fab219;
    --warn-weak: #2d2410;
    --critical-text: #e66767;
    --critical-weak: #2e1515;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --s-other: #6c6b65;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2c2c2a;
  --sidebar: #131312;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #a5a49b;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --accent-ink: #ffffff;
  --accent-weak: #172a40;
  --accent-text: #86b6ef;
  --good-text: #0ca30c;
  --good-weak: #12280f;
  --warn-text: #fab219;
  --warn-weak: #2d2410;
  --critical-text: #e66767;
  --critical-weak: #2e1515;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --s-other: #6c6b65;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.icon { display: inline-flex; flex: none; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a.active .icon { color: var(--accent); }
.nav a.adv-hint { margin-top: 10px; color: var(--text-3); font-size: 12px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.jobtray { display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: 40vh; }
.job-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12.5px; cursor: pointer;
}
.job-title { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; margin-bottom: 6px; }
.job-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.exit-btn { justify-content: flex-start; color: var(--text-2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 18px; flex: none;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.db-pill {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 5px 12px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; font-size: 13px;
}
.db-pill .db-name { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-pill:hover { border-color: var(--accent); }
.db-menu { width: min(400px, calc(100vw - 16px)); max-height: 72vh; overflow: auto; }
.db-menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.db-menu-head .mono { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.db-menu-empty { padding: 4px 10px 8px; }
.db-choice { display: flex; align-items: center; gap: 4px; border-radius: var(--radius-sm); }
.db-choice .menu-item { flex: 1; min-width: 0; }
.db-choice.on .menu-item:disabled { opacity: 1; background: var(--surface-2); }
.db-choice-text { display: flex; flex-direction: column; min-width: 0; }
.db-choice-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-choice .icon-btn.sm { flex: none; width: 28px; height: 28px; color: var(--text-3); }
.db-choice .icon-btn.danger:hover { color: var(--critical-text); }
.top-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn.menu-toggle { display: none; }
.view { flex: 1; overflow: auto; padding: 20px 24px 32px; min-height: 0; }
.view.full { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .brand span, .nav a span, .exit-btn span { display: none; }
  .nav a { justify-content: center; padding: 10px; }
  .exit-btn { justify-content: center; }
  .jobtray { display: none; }
  .view { padding: 16px; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 220px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .sidebar.open .brand span, .sidebar.open .nav a span, .sidebar.open .exit-btn span { display: inline; }
  .sidebar.open .nav a { justify-content: flex-start; }
  .icon-btn.menu-toggle { display: inline-flex; }
  .hide-sm { display: none; }
  .view { padding: 12px; }
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--critical-text); }
.btn.danger.solid { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.big { height: 42px; padding: 0 22px; font-size: 15px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { background: none; border: none; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 550; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input, .select {
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); min-width: 0;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input.sm, .select.sm { height: 28px; font-size: 13px; padding: 0 8px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.empty {
  text-align: center; padding: 48px 20px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty .icon { color: var(--muted); }

/* ---------- badges, notes ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--good-weak); color: var(--good-text); }
.badge.warn { background: var(--warn-weak); color: var(--warn-text); }
.badge.err { background: var(--critical-weak); color: var(--critical-text); }
.badge.info { background: var(--accent-weak); color: var(--accent-text); }
.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--surface-2); color: var(--text-2);
}
.note.info { background: var(--accent-weak); color: var(--accent-text); }
.note.warn { background: var(--warn-weak); color: var(--warn-text); }
.note.err { background: var(--critical-weak); color: var(--critical-text); }
.note.ok { background: var(--good-weak); color: var(--good-text); }
.note + .note { margin-top: 8px; }
.banner { display: flex; gap: 8px; align-items: center; padding: 8px 18px; font-weight: 550; }
.banner.error { background: var(--critical-weak); color: var(--critical-text); }

/* ---------- progress ---------- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress.small { height: 5px; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.progress .bar.indeterminate { width: 30% !important; position: absolute; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { left: -30%; } 100% { left: 100%; } }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none;
  border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; color: var(--text-2); z-index: 1; white-space: nowrap; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .samples { color: var(--text-3); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.stat .label { font-size: 12.5px; color: var(--text-2); }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 4px 2px; }
.kpi .label { font-size: 12.5px; color: var(--text-2); }
.kpi .value { font-size: 26px; font-weight: 650; line-height: 1.2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value.hero { font-size: 34px; }
.kpi .sub { font-size: 12px; color: var(--text-3); }

/* ---------- toasts & modal & menus ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(460px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); animation: pop .18s ease-out;
}
.toast .toast-msg { flex: 1; padding-top: 1px; white-space: pre-line; }
.toast.error .icon:first-child { color: var(--critical); }
.toast.warn .icon:first-child { color: var(--warn-text); }
.toast.ok .icon:first-child { color: var(--good); }
.toast.info .icon:first-child { color: var(--accent); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop);
  width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 18px 8px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 8px 18px 16px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.menu-pop {
  position: fixed; z-index: 950; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item:disabled { opacity: 0.45; cursor: default; }
.menu-item.danger { color: var(--critical-text); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.goodbye { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }

/* ---------- import ---------- */
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .import-grid { grid-template-columns: minmax(0, 1fr); } }
.path-row { display: flex; gap: 8px; }
.path-row .input { flex: 1; }
.col-table select, .col-table input[type=checkbox] { vertical-align: middle; }
.col-table td { padding: 5px 8px; }
.col-table .colname { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-table .note-cell { font-size: 12px; color: var(--text-3); max-width: 240px; }
.progress-hero { display: flex; flex-direction: column; gap: 10px; }
.progress-hero .progress { height: 14px; }
.progress-hero .phase { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.log-list { max-height: 260px; overflow: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.log-line { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.log-line .t { color: var(--muted); font-family: var(--mono); font-size: 11.5px; padding-top: 1px; }
.log-line.warn .m { color: var(--warn-text); }
.log-line.error .m { color: var(--critical-text); }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--text-2); padding: 4px 0; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 12px; }

/* ---------- data grid ---------- */
.data-screen { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.filterbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 200px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px;
  border-radius: 999px; background: var(--accent-weak); color: var(--accent-text); font-size: 13px; font-weight: 550;
  max-width: 340px; cursor: pointer;
}
.chip .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon-btn { width: 22px; height: 22px; color: inherit; }
.chip.slow { background: var(--warn-weak); color: var(--warn-text); }
.countbox { font-size: 13px; color: var(--text-2); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.countbox b { color: var(--text); }
.grid-host { flex: 1; min-height: 0; position: relative; display: flex; background: var(--surface); }
.vgrid { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; outline: none; }
.vgrid-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; position: relative; }
.vgrid-inner { position: relative; min-height: 100%; }
.vgrid-head { position: sticky; top: 0; z-index: 3; display: flex; background: var(--surface-2); border-bottom: 1px solid var(--border-strong); height: 34px; }
.vgrid-body { position: relative; overflow: hidden; }
.vrow { position: absolute; left: 0; display: flex; height: var(--row-h); border-bottom: 1px solid var(--border); }
.vrow:hover .vcell { background-color: var(--surface-2); }
.vrow.sel .vcell { background-color: var(--accent-weak); }
.vcell {
  flex: none; padding: 0 10px; line-height: calc(var(--row-h) - 1px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--border); font-size: 13px; background: var(--surface);
}
.vcell.num { text-align: right; font-variant-numeric: tabular-nums; }
.vcell.null { color: var(--muted); }
.vcell.rownum { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; background: var(--surface-2); }
.vcell.frozen, .vhead.frozen { position: sticky; z-index: 2; }
.vcell.cellsel { box-shadow: inset 0 0 0 2px var(--accent); }
.vhead {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 0 6px 0 10px; position: relative;
  font-weight: 600; font-size: 12.5px; color: var(--text-2); border-right: 1px solid var(--border); background: var(--surface-2);
  user-select: none;
}
.vhead .hname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vhead.sortable { cursor: pointer; }
.vhead.sortable:hover { color: var(--text); }
.vhead .sorticon { color: var(--accent); }
.vhead .idx { color: var(--accent); opacity: 0.8; }
.vhead .resizer { position: absolute; right: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 4; }
.vrow.loading .vcell:not(.rownum) { color: transparent; }
.vrow.loading .vcell:not(.rownum)::after {
  content: ""; display: block; height: 8px; margin-top: 10px; border-radius: 4px; background: var(--surface-3);
}
.vscroll { width: 14px; flex: none; position: relative; background: var(--surface-2); border-left: 1px solid var(--border); }
.vscroll .thumb {
  position: absolute; left: 2px; right: 2px; min-height: 28px; border-radius: 6px; background: var(--axis); cursor: grab;
}
.vscroll .thumb:hover, .vscroll .thumb.drag { background: var(--muted); }
.vgrid-status { display: flex; gap: 14px; align-items: center; padding: 6px 16px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.vgrid-overlay { position: absolute; inset: 34px 14px 0 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.vgrid-overlay .note { pointer-events: auto; box-shadow: var(--shadow); }
.popover {
  position: fixed; z-index: 940; width: 340px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 10px;
}
.checklist { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.checklist label:hover { background: var(--surface-2); }
.checklist .cnt { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.widget.wide { grid-column: 1 / -1; }
.widget.dragging { opacity: 0.4; }
.widget.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.widget-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 4px 16px; }
.widget-head h3 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.widget-head .drag-handle { cursor: grab; color: var(--muted); }
.widget-body { padding: 4px 16px 14px; min-height: 0; position: relative; }
.widget-foot { padding: 0 16px 12px; font-size: 12px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-box { width: 100%; height: 300px; }
.widget.wide .chart-box { height: 320px; }
.chart-wrap { position: relative; }
.chart-wrap.busy .chart-box { opacity: 0.45; transition: opacity .2s; }

/* ---------- chart builder ---------- */
.builder { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .builder { grid-template-columns: minmax(0, 1fr); } }
.builder-form { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; font-size: 11.5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; color: var(--text-2);
}
.type-btn:hover { background: var(--surface-2); }
.type-btn.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-weak); }
.builder-canvas { min-width: 0; }
.builder-canvas .chart-box { height: min(62vh, 560px); }
.plan-box { display: flex; flex-direction: column; gap: 10px; }
.pivot-wrap { max-height: min(62vh, 560px); overflow: auto; }
.legend-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1100px; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: none; background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--accent-weak); color: var(--accent-text); font-weight: 600; }
.builder-canvas.busy .chart-box { opacity: 0.45; transition: opacity .2s; }
.widget-body .kpis { padding-top: 4px; }
.kpi .value.text { font-size: 19px; padding-top: 6px; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  background: var(--surface-2); color: var(--text-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-text); }
.dropzone .icon { color: var(--accent); }
.upload-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; }
.upload-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.upload-item:hover { background: var(--surface-2); }
.upload-item span.grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- grid header filter button ---------- */
.vhead .hfilter {
  flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); opacity: 0.6;
}
.vhead:hover .hfilter, .vhead .hfilter:focus-visible { opacity: 1; }
.vhead .hfilter:hover { background: var(--surface-3); color: var(--text); }
.vhead .hfilter.on { opacity: 1; color: var(--accent); background: var(--accent-weak); }

/* ---------- SQL query screen ---------- */
.sql-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.sql-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sql-editor {
  display: block; width: 100%; min-height: 170px; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: 13.5px/1.55 var(--mono); tab-size: 2;
}
.sql-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.sql-status { display: inline-flex; align-items: center; gap: 6px; }
.sql-side { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow: auto; padding: 14px; }
.sql-kind { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin: 14px 0 4px; }
.sql-kind:first-of-type { margin-top: 0; }
.sql-table { display: flex; align-items: center; gap: 2px; }
.sql-table .icon-btn { width: 22px; height: 22px; flex: none; }
.sql-tname, .sql-col { border: 0; background: none; color: var(--text); cursor: pointer; text-align: left; font: inherit; padding: 3px 6px; border-radius: 5px; }
.sql-tname { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sql-tname:hover, .sql-col:hover { background: var(--surface-2); }
.sql-note { font-size: 11.5px; margin: 0 0 4px 30px; }
.sql-cols { display: flex; flex-direction: column; margin: 0 0 6px 24px; }
.sql-col { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.sql-col span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sql-col .muted { font-size: 11px; flex: none; }
.sql-table-wrap { max-height: 62vh; background: var(--surface); }
.sql-grid td { white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.sql-grid td.null { color: var(--muted); font-style: italic; }
.sql-grid .rn { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; width: 1%; }
@media (max-width: 900px) {
  .sql-layout { grid-template-columns: 1fr; }
  .sql-side { position: static; max-height: 320px; }
}

/* ---------- table tabs (bureau databases) ---------- */
.dataset-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; overflow-x: auto; }
.dataset-tabs:empty { display: none; }
.ds-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px;
  background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.ds-tab:hover { color: var(--text); background: var(--surface-3); }
.ds-tab.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.ds-tab .ds-count { font-size: 11.5px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .db-pill .db-name { max-width: 120px; } }

/* ---------- bureau import ---------- */
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.steps-list b { color: var(--text); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }

/* ---------- customer screen ---------- */
.big-search { flex: 1; height: 42px; font-size: 15px; }
.recent-row { margin-top: 10px; gap: 6px; }
.recent-row:empty { display: none; }
.chip-btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px;
  padding: 2px 10px; font: inherit; font-size: 12.5px; cursor: pointer; font-family: var(--mono);
}
.chip-btn:hover { color: var(--text); background: var(--surface-2); }
.customer-out { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.customer-out .card + .card { margin-top: 0; }
.customer-ref { font-size: 26px; font-weight: 700; font-family: var(--mono); letter-spacing: 0.01em; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.fact { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0; }
.fact .label { font-size: 12px; color: var(--text-3); }
.fact .value { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-grid { display: grid; grid-template-columns: minmax(140px, max-content) 1fr minmax(140px, max-content) 1fr; gap: 6px 16px; font-size: 13px; }
.kv-grid .k { color: var(--text-3); }
.kv-grid .v { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) { .kv-grid { grid-template-columns: minmax(120px, max-content) 1fr; } }
.customer-table { max-height: 420px; }
.customer-table td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.tbl.clickable tbody tr { cursor: pointer; }
a.btn { text-decoration: none; color: inherit; }

/* ---------- ⓘ explanations ---------- */
.info-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0;
  margin-left: 2px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; vertical-align: middle;
}
.info-btn:hover, .info-btn:focus-visible { color: var(--accent); background: var(--accent-weak); }
.vhead .info-btn { opacity: 0.75; }
.vhead:hover .info-btn { opacity: 1; }
.info-pop {
  position: fixed; z-index: 960; max-width: 360px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px;
}
.info-pop .info-title { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--text); }
.info-pop .info-title .icon { color: var(--accent); }
.info-pop .info-en { color: var(--text); }
.info-pop .info-hi { color: var(--text-3); border-top: 1px solid var(--border); padding-top: 6px; }
.table-help {
  display: flex; align-items: center; gap: 10px; padding: 7px 16px; font-size: 13px; color: var(--text-2);
  background: var(--accent-weak); border-bottom: 1px solid var(--border);
}
.table-help > .icon { color: var(--accent-text); flex: none; }
.table-help > span { flex: 1; min-width: 0; }
.table-help .link { flex: none; white-space: nowrap; }
.chip-btn.on { background: var(--accent-weak); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.fact .label, .kv-grid .k { display: flex; align-items: center; gap: 2px; }

/* ---------- Overview ---------- */
.ov-body { display: flex; flex-direction: column; gap: 16px; }
.ov-body .card + .card { margin-top: 0; }
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.ov-tile { min-width: 0; }
.ov-tile .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.ov-tile .label { display: flex; align-items: center; gap: 2px; }
.ov-tile .value { font-size: 28px; }
.ov-lead { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }
.ov-map { display: grid; grid-template-columns: 1fr 96px 1fr 96px 1fr; align-items: center; gap: 8px; }
.ov-col { display: flex; flex-direction: column; gap: 10px; }
.ov-table {
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; background: var(--surface);
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.ov-table.center { border: 2px solid var(--accent); background: var(--accent-weak); }
.ov-table-head { display: flex; align-items: center; gap: 2px; font-size: 15px; }
.ov-table-count { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-table .btn { margin-top: 6px; }
.ov-link { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.ov-arrow { width: 100%; height: 2px; background: var(--axis); position: relative; }
.ov-arrow::before, .ov-arrow::after { content: ""; position: absolute; top: -4px; border: 5px solid transparent; }
.ov-arrow::before { left: -2px; border-right-color: var(--axis); border-left-width: 0; }
.ov-arrow::after { right: -2px; border-left-color: var(--axis); border-right-width: 0; }
@media (max-width: 1000px) {
  .ov-map { grid-template-columns: 1fr; }
  .ov-link { flex-direction: row; justify-content: center; }
  .ov-arrow { width: 2px; height: 18px; }
  .ov-arrow::before, .ov-arrow::after { display: none; }
}
.ov-story { font-size: 15px; line-height: 1.6; margin: 0; color: var(--text); }
.ov-rowchips { margin-top: 10px; gap: 6px; }
.ov-section { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 -4px; font-size: 18px; }
.ov-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 700px) { .ov-groups { grid-template-columns: 1fr; } }
.ov-group .card-head { margin-bottom: 6px; }
.ov-group .card-head h3 { flex: none; }
.ov-group .card-head .muted { margin-left: auto; }
.ov-bars { display: flex; flex-direction: column; gap: 2px; }
.ov-bar {
  display: grid; grid-template-columns: 170px minmax(60px, 1fr) 76px 48px; align-items: center; gap: 10px;
  width: 100%; padding: 5px 6px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left;
}
button.ov-bar { cursor: pointer; }
button.ov-bar:hover { background: var(--surface-2); }
button.ov-bar:hover .ov-bar-label { color: var(--accent-text); text-decoration: underline; }
.ov-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bar-track { height: 10px; border-radius: 0 4px 4px 0; background: var(--surface-3); overflow: hidden; }
.ov-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.ov-bar-count { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.ov-bar-pct { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-3); }
.ov-dict td { vertical-align: top; }
.ov-colname { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; font-weight: 600; }

/* Overview downloads */
.ov-bar-row { display: flex; align-items: center; gap: 4px; }
.ov-bar-row .ov-bar { flex: 1; min-width: 0; }
.ov-dl {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px;
  color: var(--text-3); text-decoration: none;
}
.ov-dl:hover, .ov-dl:focus-visible { background: var(--accent-weak); color: var(--accent-text); }
.ov-group .card-head .ov-dl-all { margin-left: 8px; }

/* Overview selection */
.ov-tick { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 30px; cursor: pointer; }
.ov-tick input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.ov-bar-row.picked { background: var(--accent-weak); border-radius: 6px; }
.ov-selbar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 4px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.ov-selhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ov-selcount { font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.ov-selchips { gap: 6px; }
a.btn.disabled { opacity: 0.5; pointer-events: none; }

/* version in the sidebar, banner while a database is updated */
.brand .ver { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.banner.info { background: var(--accent-weak); color: var(--accent-text); }

/* Overview: what one row contains */
.ov-anatomy { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; margin: 6px 0 12px; }
.ov-seg { display: block; min-width: 6px; }
.ov-anatomy-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 18px; }
.ov-leg { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.ov-swatch { flex: none; width: 12px; height: 12px; border-radius: 3px; margin-top: 3px; }
.ov-seg.s1, .ov-swatch.s1 { background: var(--s1); }
.ov-seg.s2, .ov-swatch.s2 { background: var(--s2); }
.ov-seg.s3, .ov-swatch.s3 { background: var(--s3); }
.ov-seg.s4, .ov-swatch.s4 { background: var(--s4); }
.ov-seg.s5, .ov-swatch.s5 { background: var(--s7); }

/* Data screen: page view */
.seg.sm button { padding: 4px 10px; font-size: 13px; }
.invisible { visibility: hidden; }
.paged-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.paged-table { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.paged-table.stale { opacity: 0.55; }
table.tbl.paged th { white-space: nowrap; }
table.tbl.paged th .th-in { display: inline-flex; align-items: center; gap: 4px; }
table.tbl.paged th.sortable { cursor: pointer; }
table.tbl.paged th .idx { color: var(--accent); }
table.tbl.paged td { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.tbl.paged .rn { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; position: sticky; left: 0; background: var(--surface-2); z-index: 1; }
table.tbl.paged th.rn { z-index: 3; }
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.pager-page { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
th .hfilter { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
th .hfilter:hover { background: var(--surface-3); color: var(--text); }
th .hfilter.on { color: var(--accent); background: var(--accent-weak); }

/* Overview: customer product propensity */
.prop { display: flex; flex-direction: column; gap: 16px; }
.prop .ov-section { margin-bottom: 0; }
.prop-headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.prop-facts { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.prop-facts > span { display: inline-flex; align-items: center; gap: 4px; }
.prop-disclaimer { margin-top: 12px; font-size: 13px; }
.prop-progress .row { gap: 10px; }
.prop-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; }
.prop-block .card-head { margin-bottom: 8px; }
.prop-block .card-head h3 { flex: none; }
.prop-product + .prop-product { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.prop-pname { font-weight: 650; margin-bottom: 6px; }
.prop-big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.prop-big > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.prop-num { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.prop-block .ov-bar { grid-template-columns: 140px minmax(50px, 1fr) 70px 48px; }
.prop-cat { font-size: 12px; }
.prop-fill-muted { background: var(--s-other) !important; }
.prop-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.prop-chip { font-size: 12px; }
.prop-facts-list { margin: 8px 0 0; padding-left: 18px; }
.prop-details { margin-top: 8px; }
.prop-details summary { cursor: pointer; color: var(--accent-text); }
.prop-details-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; margin-top: 6px; }
.prop-details-body ul { margin: 4px 0 0; padding-left: 18px; }
.prop-controls, .prop-actions { margin-bottom: 10px; gap: 8px; }
.prop-spacer { flex: 1; }
.prop-table { max-height: 560px; }
.prop-table td { vertical-align: top; }
.prop-key { max-width: 460px; color: var(--text-2); font-size: 13px; }
.prop-ref { font-family: var(--mono); font-size: 13px; }
.prop-score { display: inline-flex; align-items: center; gap: 6px; }
.prop-scorebar { display: inline-block; width: 44px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prop-scorebar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.prop-pager { border-top: 0; padding: 10px 0 0; background: none; }
.prop-why { display: flex; flex-direction: column; gap: 10px; }
.prop-result { padding: 10px 14px; }
.prop-result + .prop-result { margin-top: 0; }
.prop-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.prop-result-score { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.prop-result-body { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.prop-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
.prop-lists ul { margin: 4px 0 0; padding-left: 18px; }
.prop-pos li::marker { content: "✓  "; color: var(--good-text); }
.prop-neg li::marker { content: "!  "; color: var(--critical-text); }
.prop-settings { display: flex; flex-direction: column; gap: 10px; }
.prop-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 16px; }
.prop-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.prop-field > span { display: inline-flex; align-items: center; gap: 2px; }
.prop-numin { width: 110px; text-align: right; }
@media (max-width: 700px) {
  .prop-big { grid-template-columns: 1fr 1fr; }
  .prop-block .ov-bar { grid-template-columns: 110px minmax(40px, 1fr) 60px 44px; }
}

/* Settings: databases */
.db-list { display: flex; flex-direction: column; gap: 8px; }
.db-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.db-item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.db-item-main b { word-break: break-all; }
.prop-page { display: flex; flex-direction: column; gap: 16px; }
.prop-lead { margin: 0; }
.prop .card + .card { margin-top: 0; }

/* Excel2SQLite Importer (lite edition): no sidebar */
.app.lite { grid-template-columns: minmax(0, 1fr); }
.lite-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; margin-right: auto; }
.lite-brand .ver { margin-left: 6px; }

/* ---------- Sales Intelligence (#/propensity, web/js/sales/) ---------- */
.badge.proxy { background: color-mix(in srgb, var(--s7) 16%, transparent); color: var(--s7); }
.badge.serious { background: color-mix(in srgb, var(--serious) 18%, transparent); color: var(--serious); }
.si-page { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.si-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.si-head h1 { margin: 0 0 2px; font-size: 22px; }
.si-disclaimer { font-size: 12.5px; }
.si-progress { max-width: 760px; }
.si-running { margin: 10px 0; padding: 12px 14px; }
.si-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 24px 4px; }
.si-empty, .si-hint { display: flex; gap: 8px; align-items: center; color: var(--text-2); padding: 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* question box */
.si-ask { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.si-ask-row { display: flex; gap: 8px; align-items: center; }
.si-ask-input { flex: 1; min-width: 160px; font-size: 14px; }
.si-ask-note { margin-top: 4px; }
.si-ask-result { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.si-tag { background: var(--accent-weak); color: var(--accent-text); border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.si-sql { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; font: 12px/1.5 var(--mono); white-space: pre-wrap; margin: 6px 0 0; }
.si-examples { display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.si-examples .link { text-align: left; }

/* filter bar */
.si-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.si-product { min-width: 190px; }
.si-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.si-chip:hover { border-color: var(--accent); color: var(--text); }
.si-chip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-text); }
.si-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.si-pop { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 10px 12px; min-width: 220px; max-width: 360px; }
.si-pop-title { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.si-checks { display: flex; flex-direction: column; gap: 4px; }
.si-checks.scroll { max-height: 260px; overflow: auto; margin-top: 6px; }
.si-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.si-check .muted { margin-left: auto; }
.si-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.si-presets { display: flex; flex-direction: column; gap: 4px; }

/* tabs */
.si-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.si-tab-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; background: none; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; font-size: 13.5px; white-space: nowrap; }
.si-tab-btn:hover { color: var(--text); }
.si-tab-btn.on { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.si-tab { display: flex; flex-direction: column; gap: 12px; }

/* KPI cards */
.si-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.si-kpis.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.si-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); border-top: 3px solid var(--border-strong); }
.si-kpi.click { cursor: pointer; }
.si-kpi.click:hover { border-color: var(--accent); }
.si-kpi.accent { border-top-color: var(--accent); }
.si-kpi.good { border-top-color: var(--good); }
.si-kpi.warn { border-top-color: var(--warning); }
.si-kpi.proxy { border-top-color: var(--s7); }
.si-kpi.bad { border-top-color: var(--critical); }
.si-kpi-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.si-kpi-value { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.si-kpis.small .si-kpi-value { font-size: 16px; }
.si-kpi-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* panels and charts */
.si-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.si-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.si-panel.wide { grid-column: 1 / -1; }
.si-panel-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 0; }
.si-panel-head h3 { margin: 0; font-size: 14px; }
.si-panel-body { padding: 8px 12px 12px; }
.si-chart { width: 100%; overflow: auto; }
/* Light charts (plain HTML, see web/js/sales/common.js) */
.si-bars .si-legend { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.si-bars-rows { display: flex; flex-direction: column; gap: 5px; }
.si-bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.si-bars.click .si-bar-row { cursor: pointer; }
.si-bars.click .si-bar-row:hover .si-bar-label { color: var(--accent-text); }
.si-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.si-bar-value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 48px; text-align: right; }
.si-bar-track { display: flex; flex-direction: column; gap: 2px; height: 16px; justify-content: center; }
.si-bar-track > i { display: block; height: 100%; min-height: 4px; border-radius: 0 3px 3px 0; flex: 1 1 0; }
.si-bar-track.stacked { flex-direction: row; justify-content: flex-start; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.si-bar-track.stacked > i { flex: none; border-radius: 0; }
.si-bars.vt .si-bars-rows { flex-direction: row; align-items: stretch; gap: 4px; height: 180px; }
.si-bars.vt .si-bar-row { display: flex; flex-direction: column-reverse; align-items: stretch; flex: 1 1 0; min-width: 0; gap: 4px; }
.si-bars.vt .si-bar-label { font-size: 11px; text-align: center; color: var(--muted); }
.si-bars.vt .si-bar-value { min-width: 0; text-align: center; font-size: 11px; }
.si-bars.vt .si-bar-track { flex: 1; height: auto; flex-direction: row; align-items: flex-end; gap: 2px; background: none; }
.si-bars.vt .si-bar-track > i { width: 100%; flex: 1 1 0; min-height: 0; border-radius: 3px 3px 0 0; }
.si-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.si-donut-ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.si-donut-hole { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.si-donut-hole b { font-size: 18px; }
.si-donut-hole span { font-size: 11px; color: var(--muted); }
.si-donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; min-width: 200px; flex: 1; }
.si-donut-legend > div { display: grid; grid-template-columns: 10px 1fr auto 48px; gap: 8px; align-items: center; }
.si-donut-legend > div.click { cursor: pointer; }
.si-donut-legend i { width: 10px; height: 10px; border-radius: 2px; }
.si-donut-legend .muted { text-align: right; }
.si-heat-scroll { overflow: auto; }
.si-heat table { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
.si-heat th { font-weight: 500; color: var(--muted); padding: 3px 6px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.si-heat thead th { text-align: center; }
.si-heat tbody th { text-align: left; }
.si-heat th.click { cursor: pointer; color: var(--text); }
.si-heat td { min-width: 44px; padding: 4px 6px; text-align: center; border-radius: 3px; font-variant-numeric: tabular-nums; }
.si-heat td.none { background: var(--surface-2); }
.si-heat td.click { cursor: pointer; }
.si-line { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 120px auto; gap: 2px 8px; }
.si-line svg { width: 100%; height: 120px; display: block; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.si-line-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); text-align: right; }
.si-line-foot { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.si-foot { margin-top: 2px; align-items: center; gap: 8px; }
.si-inline-pop { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.si-bars { display: flex; flex-direction: column; gap: 6px; }
.si-barrow { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 48px; gap: 8px; align-items: center; font-size: 12.5px; }
.si-barlabel { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.si-bartrack { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.si-barfill { height: 100%; background: var(--accent); border-radius: 4px; }
.si-barval { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* product cards */
.si-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.si-pcard { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 10px; cursor: pointer; color: var(--text); }
.si-pcard:hover { border-color: var(--accent); }
.si-pcard.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.si-pcard-head { display: flex; justify-content: space-between; gap: 6px; align-items: center; font-size: 13px; }
.si-pcard-nums { display: flex; gap: 10px; font-size: 12px; color: var(--text-2); margin: 4px 0; }
.si-pcard-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.si-pcard-note { margin-top: 4px; }
.si-inactive-head { margin-top: -4px; }
.si-inactive { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.si-inactive-row { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.si-inactive-row .badge { align-self: flex-start; }
.si-product-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.si-product-head h2 { margin: 0 0 4px; font-size: 18px; }
.si-compare th { white-space: nowrap; vertical-align: top; }
.si-compare td { vertical-align: top; }

/* product scoring & ranking guide */
.si-guide { margin: 12px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.si-guide-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.si-guide-title-block { display: flex; flex-direction: column; gap: 3px; }
.si-guide-title-block .row { gap: 6px; font-size: 14px; color: var(--text); }
.si-guide-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.si-guide-tabs { display: inline-flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.si-guide-tab { background: transparent; border: none; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 5px; color: var(--text-2); cursor: pointer; transition: all 0.15s ease; }
.si-guide-tab:hover { color: var(--text); background: var(--surface-3); }
.si-guide-tab.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.si-guide-body { margin-top: 14px; }
.si-guide-split { display: grid; grid-template-columns: minmax(0, 58%) minmax(0, 42%); gap: 14px; }
@media (max-width: 1024px) { .si-guide-split { grid-template-columns: 1fr; } }
.si-guide-col-left, .si-guide-col-right { display: flex; flex-direction: column; gap: 14px; }
.si-guide-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.si-guide-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.si-guide-card-head h3 { margin: 0; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.si-guide-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.si-guide-tbl th { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border-strong); color: var(--text-2); font-weight: 650; background: var(--surface-2); }
.si-guide-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; line-height: 1.4; }
.si-guide-tbl tbody tr:hover td { background: var(--surface-2); }
.si-guide-tbl tbody tr:last-child td { border-bottom: none; }
.si-guide-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.si-guide-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.si-guide-sort-list { display: flex; flex-direction: column; gap: 8px; }
.si-guide-sort-row { display: flex; align-items: flex-start; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.si-guide-sort-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; flex-shrink: 0; margin-top: 1px; }

/* tables */
.si-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.si-table-wrap { max-height: 70vh; overflow: auto; }
.si-table td, .si-table th { vertical-align: top; }
.si-table tbody tr { cursor: pointer; }
.si-table tbody tr:hover td { background: var(--surface-2); }
.si-table td.num, .si-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.si-table .small div { line-height: 1.35; }
.si-neg { color: var(--critical-text); }
.si-verify { color: var(--accent-text); }
.si-moved { background: var(--warn-weak); }
.si-closed td { color: var(--text-3); }
.si-table tfoot th { position: sticky; bottom: 0; background: var(--surface-2); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.si-qtable td:first-child { white-space: nowrap; }
/* opportunities: two lines per result (the facts, then why / checks / next step) */
.si-opp td { white-space: nowrap; }
.si-opp td:last-child { white-space: normal; min-width: 130px; }
.si-opp .si-chk { width: 30px; }
.si-opp > tbody.si-opp-row { cursor: pointer; }
.si-opp > tbody.si-opp-row > tr:first-child > td { border-bottom: 0; padding-bottom: 3px; }
.si-opp > tbody.si-opp-row:hover td { background: var(--surface-2); }
.si-opp > tbody.si-opp-row.on td { background: var(--accent-weak); }
.si-opp-why > td { white-space: normal; padding-top: 0; }
.si-why { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 12.5px; color: var(--text-2); }
.si-why-neg { color: var(--critical-text); }
.si-why-verify { color: var(--accent-text); }
.si-why-next { color: var(--text); font-weight: 600; }
/* loans of a customer */
.si-loans td, .si-loans th { white-space: nowrap; padding-left: 7px; padding-right: 7px; }
.si-loans td.si-wrap { white-space: normal; min-width: 110px; }
.si-loans .si-dpd { gap: 1px; }
.si-loans .si-dpd-m { width: 4px; height: 12px; border-radius: 1px; }
/* a line of coloured squares naming values */
.si-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.si-legend span { display: inline-flex; align-items: center; gap: 5px; }
.si-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.si-cards-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.si-pager { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 6px; }
.si-score { display: flex; align-items: center; gap: 6px; min-width: 90px; }
.si-score-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; min-width: 50px; }
.si-score-fill { height: 100%; border-radius: 3px; }
.si-sim { margin-top: 10px; }
.si-sim h4 { margin: 0 0 6px; }

/* customer 360 drawer */
.si-drawer-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.28); z-index: 50; display: flex; justify-content: flex-end; }
.si-drawer { width: min(980px, 96vw); height: 100%; background: var(--bg); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.si-drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.si-drawer-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.si-drawer-body { flex: 1; overflow: auto; padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 12px; }
.si-c-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.si-convo { display: flex; gap: 8px; background: var(--good-weak); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.si-c-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.si-c-sec h3 { margin: 0 0 8px; font-size: 14px; }
.si-c-sec h4 { margin: 10px 0 4px; font-size: 12.5px; color: var(--text-2); }
.si-dpd { display: flex; gap: 2px; flex-wrap: nowrap; }
.si-dpd-m { display: inline-block; width: 9px; height: 16px; border-radius: 2px; background: var(--surface-3); flex: none; }
.si-dpd-m.ok { background: var(--good); }
.si-dpd-m.late { background: var(--warning); }
.si-dpd-m.bad { background: var(--serious); }
.si-dpd-m.worst { background: var(--critical); }
.si-dpd-legend { display: flex; align-items: center; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.si-dpd-legend .si-dpd-m { height: 10px; }
.si-c-products { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.si-c-product { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.si-c-prow { width: 100%; display: grid; grid-template-columns: minmax(150px, 1.3fr) 120px auto auto auto 90px 18px; gap: 8px; align-items: center;
  background: none; border: 0; padding: 7px 9px; cursor: pointer; color: var(--text); text-align: left; }
.si-c-prow:hover { background: var(--surface-2); }
.si-c-pname { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; }
.si-c-pdetail { padding: 6px 10px 10px; border-top: 1px solid var(--border); font-size: 13px; }
.si-c-action { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 6px; }
.si-c-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 6px 0; }
.si-c-list ul { margin: 4px 0 0; padding-left: 18px; }
.si-c-details { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: 13px; }
.si-c-details dt { color: var(--text-2); }
.si-c-details dd { margin: 0; }

/* forms */
.si-form { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 80vw); }
.si-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.si-num { width: 100px; }
.si-notes { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow: auto; margin-top: 4px; }
.si-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 12.5px; }
.si-facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

@media (max-width: 900px) {
  .si-grid { grid-template-columns: minmax(0, 1fr); }
  .si-c-prow { grid-template-columns: 1fr auto; }
  .si-c-prow > :nth-child(n+3):not(:last-child) { display: none; }
}

/* copying a database for another laptop / importing a ready one */
.share-box { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.share-box p { margin: 0; }
.share-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }

/* ---------- server mode: sign in, account, Load data, Users, Audit log ---------- */
.server-mode [hidden], .auth-screen [hidden] { display: none !important; }
.signed-out #app { display: none; }
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; margin-bottom: 20px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card > p { margin: 0 0 18px; }
.auth-form, .form-col { display: flex; flex-direction: column; gap: 12px; }
.auth-form p, .form-col p { margin: 0; }
.auth-form .input, .form-col .input { width: 100%; }
.auth-btn { justify-content: center; height: 38px; margin-top: 4px; }
.db-pill.static { cursor: default; }
.db-pill.static:hover { border-color: var(--border); }
.server-mode .exit-btn { width: 100%; }
.server-mode .exit-btn .account-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

.ws-page { max-width: 1280px; }
.ws-sub { margin: 4px 0 0; }
.ws-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ws-ingest-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .ws-ingest-grid { grid-template-columns: 1fr; } }
.ws-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; }
.ws-chosen { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ws-chosen .upload-item { display: flex; align-items: center; gap: 6px; }
.ws-chosen .upload-item .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ws-progress { display: flex; flex-direction: column; gap: 8px; }
.ws-progress .row .grow { min-width: 0; }
.err-text { color: var(--critical-text); max-width: 320px; }
.ws-report { display: flex; flex-direction: column; gap: 12px; }
.ws-report h3 { margin-top: 6px; }
.ws-report .stat.warn { background: var(--warn-weak); }
.ws-report .stat.warn .value { color: var(--warn-text); }
.ws-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ws-chips b { margin-right: 4px; }
.ws-scroll { max-height: 300px; }
.ws-scroll-tall { max-height: calc(100vh - 290px); }
.ws-sample td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ws-details summary { cursor: pointer; font-size: 13px; }
.ws-details .log-list { margin-top: 6px; max-height: 180px; overflow: auto; }
.ws-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .ws-form-2 { grid-template-columns: 1fr; } }
.ws-perm { align-items: flex-start; }
.ws-perm input { margin-top: 2px; flex: none; }
.ws-secret { margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; user-select: all; white-space: pre-wrap; }
.ws-detail { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-page > .card + .card { margin-top: 16px; }
.ws-page > .card .ws-filters { margin-bottom: 12px; }
.ws-map { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.ws-map h3 { margin: 0; }
.ws-map > p { margin: 0; }
.ws-maptbl td { vertical-align: top; }
.ws-maptbl select { max-width: 230px; }
.ws-maptbl tr.ws-missing td { background: var(--critical-weak); }
.ws-vals { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 180px; overflow: auto; }
.ws-map-fold > summary { font-size: 13px; padding: 6px 0; }
.ws-asof input { width: auto; }

/* A client's logo (server mode, /brand/logo): on a white card above the menu, and on the sign-in page; DataSprint stays below it, smaller. */
.client-logo[hidden], .auth-client-logo[hidden] { display: none; }
.client-logo {
  display: flex; align-items: center; justify-content: center;
  margin: 0 2px 12px; padding: 12px 14px; min-height: 64px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.client-logo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 46px; object-fit: contain; }
.has-client-logo .sidebar .brand { font-size: 13px; font-weight: 650; padding: 0 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.has-client-logo .sidebar .brand img { width: 18px; height: 18px; }
.auth-client-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-client-logo img { max-width: 240px; max-height: 88px; object-fit: contain; }
.auth-client-logo + .auth-brand { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.auth-client-logo + .auth-brand img { width: 18px; height: 18px; }
/* On the dark theme the sign-in logo sits on a white plate too. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-client-logo img { background: #fff; border-radius: 8px; padding: 8px 10px; }
}
:root[data-theme="dark"] .auth-client-logo img { background: #fff; border-radius: 8px; padding: 8px 10px; }
/* The narrow menu (icons only) has no room for it; the phone menu, when open, has. */
@media (max-width: 1100px) { .client-logo { display: none; } }
@media (max-width: 700px) { .sidebar.open .client-logo:not([hidden]) { display: flex; } }
