:root {
  --chrome: #161a1f;
  --chrome-2: #1e242b;
  --paper: #f4f1ea;
  --grid: #fffdf8;
  --line: #d9d3c6;
  --head: #ece6d8;
  --ink: #1c2128;
  --muted: #6d7580;
  --gold: #e2b33b;
  --green: #2f6f56;
  --green-2: #1e4d3c;
  --sel: #d9ead3;
  --sel-head: #b7d4b0;
  --coral: #c45c4e;
  --computed: #1f6f8a;
  --shadow: 0 16px 40px rgba(20, 24, 28, 0.18);
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, Segoe UI, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--chrome);
  color: var(--ink);
  font: 13px/1.4 var(--sans);
}

body {
  min-width: 1100px;
  display: grid;
  grid-template-rows: 50px auto 1fr 26px;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
kbd {
  background: #eef1f4;
  border: 1px solid #cfd6de;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
}

.hidden { display: none !important; }
.logo { width: 32px; height: 32px; display: block; }
.logo.sm { width: 26px; height: 26px; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(1000px 500px at 50% -8%, #2a3340, var(--chrome));
  color: #e8eef4;
  display: grid;
  place-items: center;
}
.boot-card { width: 340px; text-align: center; }
.boot-card .logo { margin: 0 auto; }
.boot-card h1 { font-size: 22px; margin: 12px 0 6px; }
.boot-card p { color: #9aa6b2; margin: 0 0 14px; }
.boot-bar { height: 3px; background: #2c3642; border-radius: 99px; overflow: hidden; }
.boot-bar span {
  display: block;
  height: 100%;
  width: 18%;
  background: linear-gradient(90deg, var(--gold), #7dcf8a);
  animation: load 1.2s ease-in-out infinite;
}
@keyframes load {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(520%); }
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: linear-gradient(180deg, #1c2229, var(--chrome));
  color: #e8eef4;
  border-bottom: 1px solid #0d1013;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
a.brand:hover { opacity: 0.92; }
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub { color: #93a0ad; font-size: 11px; margin-top: -1px; }
.title-actions { display: flex; align-items: center; gap: 7px; flex: 1; }
.mode-switch {
  display: flex;
  background: #14191f;
  border: 1px solid #3a4450;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.mode-btn {
  background: transparent;
  border: 0;
  color: #9aa6b2;
  padding: 5px 10px;
  font-weight: 600;
}
.mode-btn:hover { color: #e8eef4; background: #262d36; }
.mode-btn.on {
  background: #2a3340;
  color: #e8eef4;
}
.find-wrap {
  display: flex;
  align-items: stretch;
  background: #262d36;
  border: 1px solid #3a4450;
  border-radius: 6px;
  overflow: hidden;
}
.find-wrap:focus-within { border-color: #6d8f7c; }
.find {
  width: 132px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 5px 10px;
  color: #e8eef4;
  outline: none;
}
.find-opt {
  background: transparent;
  border: 0;
  border-left: 1px solid #3a4450;
  color: #9aa6b2;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}
.find-opt:hover { color: #e8eef4; background: #303844; }
.find-opt.on { color: var(--gold); background: #2a3340; }
.find-n {
  border-left: 1px solid #3a4450;
  color: #9aa6b2;
  font-size: 10px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  min-width: 2.2em;
  font-variant-numeric: tabular-nums;
}
.brand-sub { color: #93a0ad; font-size: 11px; margin-top: -1px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  background: #262d36;
  border: 1px solid #3a4450;
  color: #e8eef4;
  border-radius: 6px;
  padding: 5px 10px;
}
.btn:hover:not(:disabled) { background: #303844; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-gold {
  background: var(--gold);
  color: #1a1403;
  border-color: #c49a2e;
  font-weight: 600;
}
.btn-gold:hover:not(:disabled) { background: #f0c45a; }
.btn-apply {
  background: var(--green);
  border-color: #245a46;
  color: #f3fff8;
  font-weight: 600;
}
.btn-apply:hover:not(:disabled) { background: #358564; }
.btn.ghost { background: transparent; }
.text-btn {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
}
.text-btn:hover { color: var(--ink); }

.pill {
  font-size: 11px;
  border: 1px solid #3a4450;
  border-radius: 99px;
  padding: 3px 10px;
  color: #9aa6b2;
  white-space: nowrap;
  background: transparent;
}
button.pill { font: inherit; }
button.pill:hover { color: #d5dde4; }
.pill.ok { color: #8fdfb0; border-color: #2d5a38; }

.sql-stack {
  display: flex;
  flex-direction: column;
  background: #1c2128;
  border-bottom: 1px solid #0d1013;
}
.sql-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 0;
  min-height: 34px;
}
.sql-tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  flex: 1;
}
.sql-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #262d36;
  border: 1px solid #3a4450;
  color: #c5d0da;
  border-radius: 6px 6px 0 0;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
  max-width: 180px;
  white-space: nowrap;
}
.sql-tab.on {
  background: #141a20;
  border-bottom-color: #141a20;
  color: #e8eef4;
}
.sql-tab .nm {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sql-tab.dirty .nm::after {
  content: " ·";
  color: var(--gold);
}
.sql-tab .x {
  background: none;
  border: 0;
  color: #9aa6b2;
  padding: 0 4px;
  border-radius: 4px;
}
.sql-tab .x:hover { color: #ffb4ab; background: #3a2a28; }
.sql-tab-add {
  background: #262d36;
  border: 1px solid #3a4450;
  color: #e8eef4;
  border-radius: 6px;
  width: 28px;
  height: 24px;
  flex-shrink: 0;
}
.sql-tab-add:hover { background: #303844; }
.sql-tab-status {
  color: #9aa6b2;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
#sql-editor {
  width: 100%;
  min-height: 140px;
  max-height: 42vh;
  resize: vertical;
  border: 0;
  border-top: 1px solid #3a4450;
  background: #141a20;
  color: #d7e3ee;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  padding: 10px 12px;
  outline: none;
}
.sql-stack .btn-apply { margin-left: auto; }
.sql-stack .text-btn { color: #9aa6b2; }
.sql-stack .text-btn:hover { color: #e8eef4; }

.formula-stack {
  display: flex;
  flex-direction: column;
  background: #e7e2d6;
  border-bottom: 1px solid #c9c2b3;
}
.formula-bar {
  display: grid;
  grid-template-columns: 160px 72px 36px 1fr auto auto;
  gap: 0;
  background: #e7e2d6;
  border-bottom: 0;
  align-items: stretch;
}
.name-box, .fx-input {
  border: 0;
  background: #fffdf8;
  padding: 0 10px;
  outline: none;
  font-family: var(--mono);
  font-size: 13px;
}
.name-box { border-right: 1px solid var(--line); }
.fx-label {
  display: grid;
  place-items: center;
  background: #ddd6c8;
  color: var(--green-2);
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
}
.fx-label:hover { background: #d4ccb8; }
.fx-label.active {
  background: var(--green);
  color: #f3fff8;
}
.fx-kind {
  display: grid;
  place-items: center;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #ddd6c8;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.formula-bar.derived .fx-kind { color: var(--computed); background: #dce8ec; }
.formula-bar.source .fx-kind { color: var(--green-2); }
.formula-bar.source .fx-input {
  color: var(--muted);
  font-style: italic;
  cursor: pointer;
}

.step-strip .quiet { margin: 0 4px 0 0; }
.chip-f {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 4px 3px 10px;
  font-size: 12px;
  max-width: min(420px, 100%);
}
.chip-f .k {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green);
  flex-shrink: 0;
}
.chip-f .lab {
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-f .x {
  background: none;
  border: 0;
  color: var(--muted);
  border-radius: 99px;
  padding: 0 7px;
  font-size: 14px;
  line-height: 1.4;
}
.chip-f .x:hover { color: var(--coral); background: #f8e6e3; }
.chip-f.can-edit { cursor: pointer; }
.chip-f.can-edit:hover { border-color: #b7d4b0; background: #f4faf2; }

.fx-name-lab {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
  max-width: 280px;
}
.fx-name-lab input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: white;
  font-family: var(--mono);
}
.fx-insert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 6px;
}
.fx-insert select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: white;
  font-size: 12px;
}
.fx-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.fx-chip {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
}
.fx-chip:hover { border-color: var(--green); color: var(--green-2); }
.fx-chip.col { font-family: var(--mono); }
#fx-big {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}
.formula-bar .btn {
  margin: 5px 6px 5px 0;
  align-self: center;
}
.formula-bar .btn-apply { margin-left: 8px; }

.workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 0;
  background: var(--paper);
}

.inspector {
  background: #ebe6db;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--ink);
}
.insp-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.insp-tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 9px 8px;
  border-bottom: 2px solid transparent;
}
.insp-tab.active {
  color: var(--ink);
  border-bottom-color: var(--green);
}
.insp-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.side-head-actions {
  display: flex;
  gap: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.source-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.source-card.empty { color: var(--muted); }
.source-card .name { font-weight: 600; font-family: var(--mono); }
.source-card .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }

.steps { overflow: auto; flex: 1; }
.step {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  margin-bottom: 6px;
  width: 100%;
  text-align: left;
}
.step .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--green); }
.step .v { font-family: var(--mono); font-size: 12px; }
.step .x {
  background: #f4eee3;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 12px;
  flex-shrink: 0;
}
.step .x:hover { color: #fffdf8; background: var(--coral); border-color: var(--coral); }
.empty-hint p, .sql-note { color: var(--muted); margin: 0; line-height: 1.45; }

.sql-sec { border-top: 1px solid var(--line); }
.sql {
  width: 100%;
  flex: 1;
  min-height: 160px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1c2128;
  color: #d7e3ee;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px;
  outline: none;
}
.sql:not([readonly]) { box-shadow: inset 0 0 0 2px var(--gold); }
.sql-actions { display: flex; gap: 6px; margin-top: 6px; }
.sql-note { margin-top: 6px; font-size: 11px; }

.grid-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--grid);
}
.grid-empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
  color: #3b424c;
  padding: 24px;
}
.grid-empty h2 { font-size: 22px; margin: 0 0 8px; }
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.empty-actions .btn { color: #e8eef4; }
.empty-actions .btn-gold { color: #1a1403; }
.col-pulse .cname { font-family: var(--mono); font-weight: 600; margin: 0 0 2px; font-size: 14px; }
.pulse-type { color: var(--muted); font-size: 11px; margin: 0 0 8px; }
.pulse-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.kpi {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 64px;
}
.kpi b { display: block; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.kpi span { color: var(--muted); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.hist {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 92px;
  padding: 8px 6px 0;
  margin: 0 0 4px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.hist-bin {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 3px 3px 0 0;
  background: var(--green);
  opacity: 0.82;
  align-self: flex-end;
}
.hist-bin:hover { opacity: 1; background: #358564; }
.hist-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 12px;
}
.pulse-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  width: 100%;
  background: none;
  border: 0;
  padding: 4px 0;
  text-align: left;
  color: inherit;
}
.pulse-bar .lab {
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pulse-bar .n { color: var(--muted); font-size: 11px; }
.pulse-track {
  grid-column: 1 / -1;
  height: 7px;
  background: #ddd6c8;
  border-radius: 99px;
  overflow: hidden;
}
.pulse-track > span { display: block; height: 100%; background: var(--green); }
.pulse-bar:hover .lab { color: var(--green-2); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.insp-actions .btn { color: #e8eef4; font-size: 12px; }
.grid-scroller { flex: 1; overflow: auto; user-select: none; }
.grid-inner { position: relative; min-width: 100%; }
table.sheet.virt {
  position: absolute;
  left: 0;
  top: 0;
}

table.sheet {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 12.5px;
}
table.sheet th, table.sheet td {
  border: 1px solid var(--line);
  padding: 0;
  white-space: nowrap;
}
table.sheet tbody tr {
  height: 26px;
}
table.sheet .virt-pad td,
table.sheet .virt-pad th {
  border: 0;
  padding: 0;
  background: transparent;
}
table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--head);
  font-weight: 500;
}
table.sheet thead th.col-h { overflow: hidden; }
table.sheet .row-n {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--head);
  color: var(--muted);
  text-align: right;
  width: 42px;
  min-width: 42px;
  padding: 4px 6px;
  font-size: 11px;
}
table.sheet tbody .row-n {
  cursor: pointer;
  user-select: none;
}
table.sheet tbody .row-n:hover { background: #e3dccb; color: var(--ink); }
table.sheet tbody .row-n.sel {
  background: var(--sel-head);
  color: var(--ink);
}
table.sheet thead .row-n { z-index: 3; cursor: pointer; }
table.sheet thead .row-n:hover { background: #e3dccb; }
.col-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 5px 14px 5px 8px;
  text-align: left;
  color: var(--ink);
  min-width: 92px;
}
.col-btn .nm-wrap { display: flex; flex-direction: column; min-width: 0; }
.col-btn .nm { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.col-btn .ty { font-size: 10px; color: var(--muted); line-height: 1.2; }
.col-btn.computed .nm { color: var(--computed); }
.col-btn .chev {
  color: var(--muted);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
.col-btn .chev:hover { background: #cfc6b4; color: var(--ink); }
.col-btn.filtered { background: #e4f0dd; }
.col-btn.active { background: var(--sel-head); }
.col-btn:hover { background: #e3dccb; }
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}
.col-resizer:hover { background: rgba(47, 111, 86, 0.25); }

td .cell {
  display: block;
  padding: 4px 8px;
  height: 26px;
  line-height: 18px;
  box-sizing: border-box;
  min-width: 72px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 12px;
}
td.num .cell { text-align: right; }
td.null .cell { color: #9aa19a; font-style: italic; }
td.sel { background: var(--sel); }
td.sel-anchor { outline: 2px solid var(--green); outline-offset: -2px; }
td.hit { box-shadow: inset 0 -2px 0 var(--gold); }
td.hit .cell { background: #fff4cc; }

.menu-wrap { position: relative; }
.copy-split { display: flex; align-items: stretch; }
.copy-split #btn-copy {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.copy-split .copy-more {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
  padding-left: 7px;
  padding-right: 7px;
}
.menu {
  position: absolute;
  z-index: 20;
  min-width: 220px;
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
}
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 5px;
  padding: 7px 10px;
}
.menu button:hover { background: #eef6ea; }
.menu .sep { height: 1px; background: var(--line); margin: 4px 6px; }

#col-menu.menu {
  position: fixed;
}
.menu-wrap .menu {
  top: calc(100% + 4px);
  left: 0;
}

.filter-pop {
  position: fixed;
  z-index: 21;
  width: 280px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px;
  color: var(--ink);
}
.filter-row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; }
.filter-pop select, .filter-pop input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: white;
}
.f-vals { max-height: 180px; overflow: auto; margin: 8px 0; font-size: 12px; }
.f-vals button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  padding: 4px 2px;
  font-family: var(--mono);
}
.f-vals button:hover { background: #eef6ea; }
.filter-actions { display: flex; gap: 6px; }
.filter-actions .btn { color: #e8eef4; }

.statusbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1.2fr);
  gap: 16px;
  align-items: center;
  padding: 0 12px;
  background: #1b4a38;
  color: #dcefe6;
  font-size: 12px;
}
.statusbar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.statusbar #status-left, .statusbar #status-right { color: #b7d4c6; }
.statusbar #status-right { text-align: right; }

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(22, 26, 31, 0.72);
  color: #f4f1ea;
  display: grid;
  place-items: center;
  border: 2px dashed var(--gold);
}
.drop-veil p { color: #b7c0c8; }

.toast {
  position: fixed;
  bottom: 40px;
  right: 16px;
  z-index: 35;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 340px;
}

.modal {
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  width: min(520px, 90vw);
  box-shadow: var(--shadow);
}
.modal.about-modal {
  width: min(680px, 94vw);
}
.modal.about-modal .quiet { margin: 0 0 12px; color: var(--muted); }
#about-text {
  display: block;
  width: 100%;
  min-height: 280px;
  height: min(52vh, 440px);
  resize: vertical;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f3ea;
  color: var(--ink);
  font: 12px/1.45 var(--mono);
  white-space: pre;
  overflow: auto;
}
.about-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.about-actions form { margin: 0; }
.modal.fx-modal {
  width: min(560px, 94vw);
  padding: 20px 22px 16px;
}
.modal.extract-modal {
  width: min(460px, 94vw);
  padding: 20px 22px 16px;
}
.modal.fx-modal .quiet,
.modal.extract-modal .quiet { margin: 0 0 12px; }
.modal.fx-modal .btn-apply,
.modal.extract-modal .btn-apply {
  background: var(--green);
  border-color: #245a46;
  color: #f3fff8;
}
.modal.fx-modal .btn-apply:hover:not(:disabled),
.modal.extract-modal .btn-apply:hover:not(:disabled) { background: #358564; }
.extract-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 4px 0 12px;
}
.extract-fields .wide { grid-column: 1 / -1; }
.extract-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.extract-fields input,
.extract-fields select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: white;
  font-family: var(--sans);
  color: var(--ink);
}
.extract-fields input { font-family: var(--mono); }
.ex-keep {
  display: flex;
  gap: 18px;
  align-items: center;
}
.ex-check {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--ink) !important;
  font-size: 13px !important;
}
.ex-check input {
  width: auto;
  margin: 0;
  accent-color: var(--green);
}
.ex-preview {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.4;
  background: #141a20;
  color: #c5d4c8;
  padding: 8px 10px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.fx-panel-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.agg-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 4px 0 12px;
}
.agg-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.agg-measure-head { margin-top: 4px; }
.agg-measures { display: grid; gap: 6px; margin: 6px 0 4px; }
.agg-measure {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.agg-measure select,
.agg-measure input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  background: #fff;
  min-width: 0;
}
.modal::backdrop { background: rgba(20, 24, 28, 0.45); }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p, .modal li { color: #3b424c; }
.modal form { margin-top: 16px; text-align: right; }
.modal .btn-gold, .modal .btn { color: #1a1403; }
.modal .btn { background: #e7e2d6; border-color: var(--line); color: var(--ink); }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys td:last-child { color: var(--muted); }

.error-box {
  margin: 12px;
  padding: 12px 14px;
  border: 1px solid #e3b6af;
  background: #fff1ee;
  color: #7a3129;
  border-radius: 8px;
  font-family: var(--mono);
  white-space: pre-wrap;
}

.file-warn {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #3a1f1c;
  border: 1px solid #7a3b34;
  color: #ffd4cf;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}

.quiet { color: var(--muted); font-size: 12px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9c2b3; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
