/* CEF Automation (web) - a port of Don's Qt stylesheet (ui_main.APP_STYLE).
   Every colour below is copied from that stylesheet.  All sizes derive from ONE
   base (--pt, px per point) so A- / A+ moves everything together and a window
   resize never changes a font size (UI rule #3). */
/* RMS Trade Desk look: tan light theme (default) and charcoal dark theme with gold accents.
   One base (--pt, px per point) so A- / A+ moves everything together (UI rule #3). */
:root, :root[data-theme="light"] {
  --pt: 1.38px;
  --page: #e9dcc0; --pane: #f1e6cb; --pane-border: #c4ad7c;
  --tab: #e4d5b2; --tab-ink: #5a4a2f; --tab-border: #c4ad7c; --tab-hover: #d9c8a0; --tab-on: #d9a21f; --tab-on-ink: #2a1c02;
  --group-bg: #f7efdb; --group-border: #c9b27f; --group-ink: #7a520a;
  --navy: #e0cf9f; --navy-line: #c4ad7c; --head-ink: #3b2a08;
  --ink: #2a2115; --field-ink: #2a2115; --field-bg: #fbf5e4; --field-border: #b39a63;
  --btn: #eadbb4; --btn-hover: #dfcb99; --btn-press: #d2bb80;
  --alt: #f6eed8; --grid: #dccaa0; --row: #fbf5e4; --sel: #f4d77a; --hover: #f8e8b4;
  --pos: #17692f; --neg: #a8231b; --alert: #a8231b;
  --ok: #17692f; --blue: #1b559b; --gold: #8a5f0a; --gold-line: #d9a21f;
  --amber-bg: #f6e2a8; --amber-line: #c9930c; --amber-ink: #7a4a00;
  --red-bg: #f3d2c8; --green-bg: #d3e8c6; --blue-bg: #d6e2ee;
  --bar: #e4d5b2; --bar-ink: #2a2115; --shadow: 0 1px 6px rgba(70,45,5,.14);
  --font: -apple-system, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
}
:root[data-theme="dark"] {
  --page: #2a2c31; --pane: #31343b; --pane-border: #5c616d;
  --tab: #3f434c; --tab-ink: #cfc7b2; --tab-border: #5c616d; --tab-hover: #4a4f59; --tab-on: #e0b24a; --tab-on-ink: #241b05;
  --group-bg: #383c44; --group-border: #5c616d; --group-ink: #e6b84e;
  --navy: #454a55; --navy-line: #5c616d; --head-ink: #f0e3bd;
  --ink: #f0e9d8; --field-ink: #f4eedd; --field-bg: #2a2c31; --field-border: #6a7080;
  --btn: #454a55; --btn-hover: #525865; --btn-press: #5d6472;
  --alt: #3a3e47; --grid: #4a4f59; --row: #343740; --sel: #5a4a1a; --hover: #484532;
  --pos: #6fd58b; --neg: #ff9488; --alert: #ff9488;
  --ok: #3f9f5a; --blue: #86b9f5; --gold: #e6b84e; --gold-line: #e0b24a;
  --amber-bg: #53431f; --amber-line: #d4a437; --amber-ink: #f2bd57;
  --red-bg: #573532; --green-bg: #2f4a38; --blue-bg: #2f4258;
  --bar: #3a3e47; --bar-ink: #f0e9d8; --shadow: 0 1px 8px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: calc(var(--pt) * 10); }
body { display: flex; flex-direction: column; min-width: 900px; overflow: auto; }
button, input, select, textarea { font-family: inherit; }
.mono { font-family: Consolas, 'SF Mono', Menlo, monospace; }

/* ---- header ---- */
#topbar { display: flex; align-items: center; gap: 14px; padding: 9px 18px; background: var(--bar); border-bottom: 3px solid var(--gold-line); flex: none; }
#topbar .logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; color: var(--gold); letter-spacing: .2px; white-space: nowrap; }
#topbar .logo svg { width: 30px; height: 30px; flex: none; }
.hpill { display: inline-block; padding: 4px 13px; border-radius: 999px; font-weight: 700; font-size: 14.5px; border: 1px solid; white-space: nowrap; }
.hpill.practice { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.hpill.info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
#topbar .sp { flex: 1; }
#topbar button { padding: 7px 16px; font-size: 15px; }
#topbar .kill { background: #b3261e; color: #fff; border-color: #8e1c16; letter-spacing: .4px; cursor: default; }
:root[data-theme="dark"] #topbar .kill { background: #c9473d; border-color: #e0685e; }
#topbar .kill:hover { background: #b3261e; }

/* ---- tabs: rounded, tan, active tab gold with dark text ---- */
.tabbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 18px 0; margin: 0; user-select: none; background: var(--page); border-bottom: 1px solid var(--pane-border); }
.tab { padding: 9px 17px; background: var(--tab); color: var(--tab-ink); border: 1px solid var(--tab-border);
  border-bottom: none; border-top-left-radius: 8px; border-top-right-radius: 8px;
  font-size: calc(var(--pt) * 11); font-weight: 700; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tab:hover { background: var(--tab-hover); color: var(--ink); }
.tab.on { background: var(--tab-on); color: var(--tab-on-ink); border-color: var(--tab-on); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.tab.dragging { opacity: .5; }
.tab .ico { display: none; }
.tab .dotmark { color: var(--ok); font-size: 12px; }
.tab.on .dotmark { color: var(--tab-on-ink); }
.subwrap .subwrap > .tabbar { background: var(--pane); padding: 8px 14px 0; gap: 3px; }
.subwrap .subwrap > .tabbar .tab { padding: 6px 14px; font-size: calc(var(--pt) * 10.2); border-top-left-radius: 7px; border-top-right-radius: 7px; }
.pane { border: none; background: var(--pane); flex: 1; min-height: 0; display: none; position: relative; overflow: auto; }
.pane.on { display: flex; flex-direction: column; }
.pane > .inner { padding: 12px 18px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.subwrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scrollpage { overflow: auto; flex: 1; min-height: 0; }

/* ---- labels, boxes ---- */
label, .lbl { font-size: calc(var(--pt) * 11); font-weight: 700; color: var(--ink); }
.groupbox { position: relative; border: 1px solid var(--group-border); border-top: 3px solid var(--gold-line); border-radius: 8px; margin-top: 16px;
  background: var(--group-bg); padding: 22px 14px 12px; box-shadow: var(--shadow); }
.groupbox > .gtitle { position: absolute; top: 0; left: 0; right: 0; padding: 3px 14px; background: transparent;
  color: var(--group-ink); font-weight: 800; font-size: calc(var(--pt) * 11.5); letter-spacing: .15px; }
.groupbox .groupbox { background: var(--field-bg); border-color: var(--pane-border); box-shadow: none; }
.groupbox .groupbox > .gtitle { background: transparent; }
.form { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; align-items: center; }
.form > .full { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 6px; }
.flow { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; }
.stretch { flex: 1; }
.hint { color: var(--tab-ink); font-style: italic; font-size: calc(var(--pt) * 10); }

/* ---- fields ---- */
input[type=text], input[type=number], input[type=password], input.field, select, textarea.field {
  background: var(--field-bg); color: var(--field-ink); border: 1px solid var(--field-border); border-radius: 8px;
  padding: 4px 9px; font-size: calc(var(--pt) * 11); font-weight: 600; min-height: calc(var(--pt) * 22); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-line); box-shadow: 0 0 0 2px rgba(217,162,31,.35); }
input:disabled, select:disabled { background: var(--alt); color: var(--tab-ink); border-color: var(--grid); opacity: .8; }
input[readonly] { background: var(--alt); }
select { appearance: none; padding-right: 24px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--tab-ink) 50%), linear-gradient(135deg, var(--tab-ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
select option { background: var(--field-bg); color: var(--field-ink); }
.spin { position: relative; display: inline-block; }
.spin input { padding-right: 30px; width: 100%; }
.spin .ud { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 24px; display: flex; flex-direction: column; }
.spin .ud b { flex: 1; background: var(--btn); border-left: 1px solid var(--field-border); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink); font-size: 13px; line-height: 1; user-select: none; }
.spin .ud b:first-child { border-bottom: 1px solid var(--field-border); border-top-right-radius: 6px; }
.spin .ud b:last-child { border-bottom-right-radius: 6px; }
.spin .ud b:hover { background: var(--btn-hover); }
.spin .ud b:active { background: var(--btn-press); }
.spin.fill { display: block; width: 100%; }
input[type=number]::-webkit-inner-spin-button { display: none; }
input[type=number] { -moz-appearance: textfield; }

/* check boxes: white box + dark border; checked = solid dark green with a bold white tick */
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; flex: none;
  border: 2px solid var(--field-border); border-radius: 5px; background: var(--field-bg); margin: 0; cursor: pointer; position: relative; vertical-align: middle; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--gold-line); }
input[type=checkbox]:checked { background: var(--gold-line); border-color: var(--gold-line); }
input[type=checkbox]:checked::after { content: ''; position: absolute; left: 4px; top: 0px; width: 4px; height: 9px; border: solid var(--tab-on-ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }
input[type=checkbox].partial { background: #f9a825; border-color: #f9a825; }
input[type=checkbox].partial::after { content: ''; position: absolute; left: 2px; top: 6px; width: 10px; height: 3px; background: #fff; border-radius: 1px; }
input[type=radio]:checked { background: var(--gold-line); border-color: var(--gold-line); }
input[type=radio]:checked::after { content: ''; position: absolute; left: 3px; top: 3px; width: 8px; height: 8px; background: var(--tab-on-ink); border-radius: 50%; }
input[type=checkbox]:disabled, input[type=radio]:disabled { border-color: var(--grid); background: var(--alt); }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---- buttons ---- */
button, .btn { background: var(--btn); border: 1px solid var(--pane-border); border-radius: 8px; padding: 7px 15px;
  font-size: calc(var(--pt) * 11); font-weight: 700; color: var(--ink); cursor: pointer; }
button:hover { background: var(--btn-hover); }
button:active { background: var(--btn-press); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible { outline: 2px solid var(--gold-line); outline-offset: 2px; }
button.solid { color: #fff; border-color: transparent; }
.b-blue { background: #1b559b; color: #fff; } .b-blue:hover { background: #2a68b3; }
.b-green { background: #2e7d32; color: #fff; } .b-green:hover { background: #3d9142; }
.b-amber { background: #e0a91f; color: #2a1c02; } .b-amber:hover { background: #ecb835; }
.b-red { background: #c62828; color: #fff; } .b-red:hover { background: #d33535; }
.b-gold { background: var(--tab-on); color: var(--tab-on-ink); } .b-gold:hover { filter: brightness(1.08); }
.b-edit { background: #0d47a1; color: #fff; } .b-edit:hover { background: #1565c0; }
.b-prev { background: #00695c; color: #fff; } .b-prev:hover { background: #00796b; }
.b-place { background: #1b5e20; color: #fff; } .b-place:hover { background: #2e7d32; }
.b-cancel { background: #b71c1c; color: #fff; } .b-cancel:hover { background: #c62828; }
.b-uncancel { background: #4a148c; color: #fff; } .b-uncancel:hover { background: #6a1b9a; }
.b-delete { background: #5a4a2f; color: #fff; } .b-delete:hover { background: #6e5b3a; }
.b-reset { padding: 0; width: 34px; font-family: 'Segoe UI Symbol', system-ui; font-size: calc(var(--pt) * 12); }
.b-tiny { width: 18px; height: 18px; padding: 0; font-size: 11px; line-height: 1; }

/* ---- collapsible criteria boxes ---- */
.cbox { border: 1px solid var(--group-border); border-radius: 8px; background: var(--group-bg); padding: 5px 12px 7px; box-shadow: var(--shadow); }
.cbox.amber { background: var(--amber-bg); border-color: var(--amber-line); }
.cbox > .chead { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.cbox .ctog { width: 30px; height: 24px; padding: 0; border: 1px solid var(--field-border); border-radius: 6px; background: var(--btn); color: var(--gold); font-size: 12px; }
.cbox .ctog:hover { background: var(--btn-hover); }
.cbox.amber .ctog { color: var(--amber-ink); border-color: var(--amber-line); background: transparent; }
.cbox .ctitle { color: var(--group-ink); font-weight: 800; font-size: calc(var(--pt) * 11.5); }
.cbox.amber .ctitle { color: var(--amber-ink); }
.cbox .chint { margin-left: auto; color: var(--tab-ink); font-style: italic; font-size: calc(var(--pt) * 10.5); }
.cbox.amber .chint { color: var(--amber-ink); } .cbox.amber .chint.legacy { color: var(--neg); font-weight: bold; font-style: normal; }
.cbox > .cbody { padding-top: 4px; }
.cbox.closed > .cbody { display: none; }
.tag-or { color: var(--neg); font-weight: bold; } .tag-row { color: var(--amber-ink); font-weight: bold; }
.preview { border: 1px dashed var(--amber-line); border-radius: 8px; background: var(--field-bg); color: var(--amber-ink); padding: 3px 8px; font-weight: bold; margin-top: 4px; }
.fp-off { opacity: .45; pointer-events: none; }

/* ---- progress / banners ---- */
.pbar { height: 16px; border: 1px solid var(--field-border); border-radius: 8px; position: relative; overflow: hidden; background: var(--field-bg); }
.pbar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); opacity: .75; }
.pbar > span { position: relative; z-index: 1; display: block; text-align: center; font-size: 11px; font-weight: bold; line-height: 14px; }
.banner { background: var(--red-bg); color: var(--neg); font-weight: 700; padding: 10px 14px 10px 18px; border-radius: 8px; border: 1px solid var(--neg); border-left: 6px solid var(--neg); flex: 1; font-size: calc(var(--pt) * 11); box-shadow: var(--shadow); }

/* ---- grids (Tabulator): cream header, subtle zebra, hover tint ---- */
.grid { flex: 1; min-height: 120px; }
.tabulator { background: var(--row); border: 1px solid var(--group-border); border-radius: 8px; overflow: hidden; font-size: calc(var(--pt) * 11); font-weight: 600; font-family: var(--font); box-shadow: var(--shadow); }
.tabulator .tabulator-header { background: var(--navy); color: var(--head-ink); border-bottom: 2px solid var(--gold-line); }
.tabulator .tabulator-header .tabulator-col { background: var(--navy); color: var(--head-ink); border-right: 1px solid var(--navy-line); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 8px 10px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { text-align: center; font-weight: 800; white-space: nowrap; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--tab-hover); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--gold); border-top-color: var(--gold); }
.tabulator-row { background: var(--row); min-height: 30px; border-bottom: 1px solid var(--grid); color: var(--field-ink); }
.tabulator-row.tabulator-row-even { background: var(--alt); }
.tabulator-row .tabulator-cell { border-right: 1px solid var(--grid); padding: 5px 10px; font-variant-numeric: tabular-nums; }
.tabulator-row:hover { background: var(--hover) !important; }
.tabulator-row.tabulator-selected { background: var(--sel) !important; color: var(--field-ink); }
.tabulator-row.qual, .tabulator-row.qual.tabulator-row-even { background: var(--green-bg); }
.tabulator-row.qual:hover { background: var(--hover) !important; }
.tabulator-row.qual.tabulator-selected { background: var(--sel) !important; }
/* Don's 2026-08-15 ruling (ui_main APP_STYLE): ONE bright-yellow selected row on every table, and it beats every per-cell tint (ticketed blue, status colors, raise/cut) */
.tabulator-row.tabulator-selected, .tabulator-row.tabulator-selected.tabulator-row-even, .tabulator-row.tabulator-selected .tabulator-cell { background: #FFEB3B !important; color: #101418 !important; }
.tabulator-row.tabulator-selected a.tk { color: #0b3d91; }
body.working, body.working * { cursor: progress !important; }
button.working { opacity: .75; }
.tabulator-row .tabulator-cell.r { text-align: right; }
.tabulator-row .tabulator-cell.pos { color: var(--pos); font-weight: 700; } .tabulator-row .tabulator-cell.neg { color: var(--neg); font-weight: 700; }
.tabulator-row .tabulator-cell.alert { color: var(--alert); }
.tabulator-row .tabulator-cell.ticketed { background: var(--blue-bg); color: var(--field-ink); }
.tabulator-row .tabulator-cell.cut { background: #e8857c; color: #2a0e0a; }
.tabulator-row .tabulator-cell.raise { background: var(--green-bg); color: var(--field-ink); }
.tabulator-row .tabulator-cell.st-PENDING { background: var(--amber-bg); color: var(--amber-ink); } .tabulator-row .tabulator-cell.st-PREVIEWED { background: var(--blue-bg); color: var(--blue); }
.tabulator-row .tabulator-cell.st-PLACED { background: var(--green-bg); color: var(--pos); } .tabulator-row .tabulator-cell.st-FILLED { background: var(--ok); color: #fff; }
.tabulator-row .tabulator-cell.st-CANCELED { background: var(--grid); color: var(--tab-ink); } .tabulator-row .tabulator-cell.st-ERROR { background: var(--red-bg); color: var(--neg); }
.tabulator-row .tabulator-cell.side-buy { color: var(--blue); }
.tabulator-row .tabulator-cell.b { font-weight: 800; }
.tabulator .tabulator-tableholder .tabulator-placeholder span { color: var(--tab-ink); font-weight: 700; }
.tkcell { display: flex; align-items: center; gap: 6px; }
.tkcell a, a.tk { color: var(--blue); font-weight: 800; text-decoration: underline; cursor: pointer; }

/* ---- status bar ---- */
#statusbar { background: var(--bar); color: var(--bar-ink); border-top: 3px solid var(--gold-line); display: flex; align-items: center; gap: 8px; padding: 7px 14px; min-height: 50px; flex: none; }
#statusbar label, #statusbar .lbl { color: var(--bar-ink); }
#statusbar select { background: var(--field-bg); color: var(--field-ink); border: 1px solid var(--field-border); min-width: 120px; }
#statusbar select.m1 { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); } #statusbar select.m2 { background: var(--red-bg); color: var(--neg); border-color: var(--neg); }
#statusbar select option { background: var(--field-bg); color: var(--field-ink); }
#statusbar .asv { display: inline-flex; align-items: center; gap: 6px; color: var(--bar-ink); font-weight: 700; cursor: pointer; }
#statusbar input.time { width: 168px; }
#statusbar .zoom { width: 44px; padding: 6px 0; }
#conn { color: var(--neg); font-weight: 800; } #conn.ok { color: var(--pos); } #conn.warn { color: var(--amber-ink); }
#countdown { color: var(--bar-ink); font-weight: 700; }
#toasts { position: fixed; right: 16px; bottom: 64px; display: flex; flex-direction: column; gap: 8px; z-index: 9000; }
.toast { background: var(--bar); color: var(--ink); border: 1px solid var(--gold-line); border-left: 6px solid var(--gold-line); border-radius: 8px; padding: 10px 14px; max-width: 380px; box-shadow: 0 3px 12px #0004; }
.toast b { display: block; margin-bottom: 2px; color: var(--gold); }

/* ---- totals bar / index bar ---- */
.totals { background: var(--group-bg); border: 1px solid var(--group-border); border-radius: 8px; display: flex; align-items: center; flex: none; box-shadow: var(--shadow); }
.totals .tl { white-space: nowrap; color: var(--ink); font-weight: 700; padding: 8px 14px; font-size: calc(var(--pt) * 11); }
.totals .ix { color: var(--tab-ink); font-weight: 700; padding: 8px 10px; font-size: calc(var(--pt) * 11); white-space: nowrap; }
.totals .ix.up { color: var(--pos); } .totals .ix.dn { color: var(--neg); }
.totals .clock { color: var(--gold); font-weight: 800; font-size: calc(var(--pt) * 16); padding: 2px 16px 2px 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- debug panels ---- */
.dbg { background: #2b2d31; color: #dfe6d4; font-family: Consolas, 'SF Mono', Menlo, monospace; font-size: calc(var(--pt) * 9.5); border: 1px solid var(--group-border); border-radius: 8px;
  padding: 8px; overflow: auto; white-space: pre-wrap; flex: none; }
.dbg.big { background: #2b2d31; color: #cde8cd; flex: 1; min-height: 200px; }
.dbgrow { display: flex; align-items: center; gap: 8px; flex: none; }
.dbgrow .st { color: var(--tab-ink); font-weight: bold; }
.hide { display: none !important; }

/* ---- tooltip ---- */
/* QToolTip of Don's stylesheet (ui_main.py APP_STYLE): bold, #1a1a1a on #fffbd9, 1px #d4b84a, padding 6px 8px, square corners, table font size.
   Plain text does not wrap (Qt wraps rich text only); both themes use the same bubble because the desktop has one. */
#tip { position: fixed; z-index: 10000; max-width: calc(100vw - 4px); overflow: hidden; background: #fffbd9; color: #1a1a1a; border: 1px solid #d4b84a; border-radius: 0; padding: 6px 8px;
  font-size: calc(var(--pt) * 11); font-weight: 700; white-space: pre; pointer-events: none; display: none; box-shadow: none; }
#tip.rich { white-space: normal; max-width: min(560px, calc(100vw - 4px)); }

/* ---- dialogs ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,14,4,.5); z-index: 8000; display: flex; align-items: center; justify-content: center; }
.dlg { background: var(--pane); border: 2px solid var(--gold-line); border-radius: 12px; box-shadow: 0 8px 28px #0006; min-width: 380px; max-width: 680px; padding: 18px 20px; color: var(--ink); }
.dlg h3 { margin: 0 0 10px; font-size: calc(var(--pt) * 13); color: var(--gold); border-bottom: 1px solid var(--group-border); padding-bottom: 6px; }
.dlg .btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.dlg .kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; }
.dlg .kv span.v { color: var(--blue); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- misc pages ---- */
.stepcard { display: grid; grid-template-columns: 1fr 140px 270px 1fr; gap: 8px; align-items: stretch; margin-bottom: 4px; }
.stepcard > div { background: var(--row); border: 1px solid var(--grid); border-radius: 8px; padding: 5px 9px; display: flex; flex-direction: column; justify-content: center; }
.stepnum { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.section-head { background: var(--navy); border-left: 4px solid var(--gold-line); border-radius: 8px; padding: 6px 12px; font-weight: 800; cursor: pointer; display: flex; gap: 8px; color: var(--head-ink); }
.section-head.warn { color: var(--amber-ink); background: var(--amber-bg); }
.chiplbl { border: 1px solid var(--field-border); background: var(--field-bg); border-radius: 8px; text-align: center; font-weight: 700; padding: 5px; }
.btn-chip { background: var(--btn); border: 1px solid var(--pane-border); border-radius: 8px; text-align: center; font-weight: 700; padding: 11px 4px; font-size: calc(var(--pt) * 11); }
.status-chip { padding: 1px 8px; font-weight: 700; border-radius: 6px; }
.tree { background: var(--row); border: 1px solid var(--grid); border-radius: 8px; overflow: auto; font-size: calc(var(--pt) * 11); font-weight: 600; }
.tree .node { padding: 4px 8px; cursor: pointer; white-space: nowrap; }
.tree .node:hover { background: var(--hover); } .tree .node.sel { background: var(--sel); }
.editor { background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 8px; flex: 1; min-height: 200px; padding: 12px; overflow: auto; font-size: calc(var(--pt) * 11); font-weight: normal; color: var(--field-ink); outline: none; }
.tb { min-width: 30px; padding: 5px 9px; }
.tb.on { background: var(--tab-on); color: var(--tab-on-ink); }
.splitter { display: flex; gap: 8px; flex: 1; min-height: 0; }
.dict-sec { background: var(--navy); color: var(--group-ink); border-left: 4px solid var(--gold-line); border-radius: 8px; font-weight: 800; padding: 7px 12px; font-size: calc(var(--pt) * 13); }
table.plain { border-collapse: collapse; width: 100%; font-weight: 600; }
table.plain th { background: var(--navy); color: var(--head-ink); padding: 7px 10px; border-right: 1px solid var(--navy-line); border-bottom: 2px solid var(--gold-line); }
table.plain td { border-bottom: 1px solid var(--grid); padding: 5px 10px; background: var(--row); }
table.plain tr:nth-child(even) td { background: var(--alt); }
table.plain td input { width: 100%; }
.upload-note { color: var(--amber-ink); font-weight: normal; }
.notice { color: var(--neg); font-weight: 700; }

.grid.wrap .tabulator-row .tabulator-cell { white-space: normal; word-break: break-word; font-weight: 600; }
.tabulator-row.tabulator-group, .tabulator .tabulator-row.tabulator-group, .tabulator-row.dd-head { background: var(--navy) !important; color: var(--group-ink); font-size: calc(var(--pt) * 12); font-weight: 800; padding: 7px 10px; border-bottom: 2px solid var(--gold-line); border-left: 4px solid var(--gold-line); }
.tabulator-row.dd-head .tabulator-cell { border-right: none; }
.tabulator-row.tabulator-group span { color: var(--group-ink); }
.tabulator-row.tabulator-group .tabulator-arrow { border-left-color: transparent; }

.tabulator-row .tabulator-cell.sc1 { background: var(--green-bg); } .tabulator-row .tabulator-cell.sc2 { background: #e0ecc0; }
.tabulator-row .tabulator-cell.sc3 { background: var(--amber-bg); } .tabulator-row .tabulator-cell.sc4 { background: #f0c08a; }
.tabulator-row .tabulator-cell.sc5 { background: var(--red-bg); }
td.st-PENDING { background: var(--amber-bg) !important; } td.st-FILLED { background: var(--green-bg) !important; }

.pane > .inner, .grid, .subwrap, .splitter > div { min-width: 0; }
.grid { width: 100%; }
.totals { flex-wrap: wrap; } .totals .clock { margin-left: auto; }

.tabulator .tabulator-col.rn, .tabulator-row .tabulator-cell.rn { background: var(--navy) !important; color: var(--head-ink) !important; font-weight: 800; border-right: 1px solid var(--navy-line); text-align: center; }
.tabulator-row.notifyrow { background: var(--amber-bg) !important; }
.tabulator-row .tabulator-cell.dim { color: var(--tab-ink); }
.tabulator-row .tabulator-cell.cutdecl { background: #e8857c; color: #2a0e0a; } .tabulator-row .tabulator-cell.cutrisk { background: var(--red-bg); color: var(--field-ink); }
.tabulator-row .tabulator-cell.sc1, .tabulator-row .tabulator-cell.sc2, .tabulator-row .tabulator-cell.sc3, .tabulator-row .tabulator-cell.sc4, .tabulator-row .tabulator-cell.sc5 { color: #2a2115; }

.cbox.flat { background: transparent; border: none; padding: 0; box-shadow: none; }
.cbox.flat .ctog { border: none; background: transparent; width: 18px; color: var(--gold); }
.cbox.flat .ctitle { color: var(--group-ink); }

/* ---- Phase 5 / Troubleshooting / broker choice ---- */
.choice { border: 2px solid var(--pane-border); border-radius: 8px; padding: 10px 12px; background: var(--row); }
.choice.on { border-color: var(--gold-line); background: var(--hover); }
.plain-text { font-size: calc(var(--pt) * 11); line-height: 1.5; color: var(--ink); margin: 4px 0; white-space: pre-wrap; }
.notice-amber { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-ink); font-weight: 700; padding: 6px 11px; border-radius: 8px; font-size: calc(var(--pt) * 11); }
.st-line { font-weight: 700; } .st-line.ok { color: var(--ok); } .st-line.warn { color: var(--amber-ink); } .st-line.bad { color: var(--alert); }
.flowbox { background: var(--row); margin-top: 16px; }
.hlist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.hrow { display: flex; align-items: center; gap: 12px; background: var(--row); border: 1px solid var(--pane-border); border-left-width: 8px; border-radius: 8px; padding: 10px 12px; }
.hrow.green { border-left-color: var(--ok); } .hrow.amber { border-left-color: var(--amber-line); } .hrow.red { border-left-color: var(--neg); background: var(--red-bg); }
.hbody { flex: 1; } .htitle { font-weight: 800; font-size: calc(var(--pt) * 12); } .hdetail { font-size: calc(var(--pt) * 11); color: var(--tab-ink); line-height: 1.4; }
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.dot.green { background: var(--ok); } .dot.amber { background: var(--amber-line); } .dot.red { background: var(--neg); }
.chip { padding: 4px 13px; border-radius: 12px; font-weight: 700; color: #fff; font-size: calc(var(--pt) * 11); }
.chip.green { background: var(--ok); } .chip.amber { background: #b98300; } .chip.red { background: #b3261e; }
.warn-line { color: var(--neg); font-weight: 700; margin-top: 6px; }
tr.dim td { color: var(--tab-ink); }

/* ---- the few inline colors the scripts set, mapped to the themes ---- */
[style*="rgb(0, 110, 0)"], [style*="#0a7d32"] { color: var(--pos) !important; }
[style*="rgb(185, 15, 15)"], [style*="rgb(198, 20, 20)"] { color: var(--neg) !important; }
[style*="rgb(31, 111, 178)"] { color: var(--blue) !important; }
[style*="rgb(179, 45, 0)"] { color: var(--neg) !important; }
[style*="rgb(232, 240, 248)"] { background: var(--blue-bg) !important; color: var(--ink) !important; }
[style*="rgb(27, 43, 58)"], [style*="rgb(65, 80, 95)"], [style*="rgb(85, 85, 85)"], [style*="rgb(68, 68, 68)"] { color: var(--ink) !important; }
[style*="rgb(138, 97, 0)"] { background: var(--amber-bg) !important; color: var(--amber-ink) !important; }
[style*="rgb(27, 94, 32)"] { background: var(--green-bg) !important; color: var(--pos) !important; }

/* status bar fits one row at 1440 */
#statusbar > *, #statusbar label, #statusbar button { white-space: nowrap; flex: none; }
#statusbar .stretch { flex: 1; min-width: 0; }
#statusbar button { padding: 7px 12px; font-size: 14.5px; }
#statusbar select { min-width: 0; width: 150px; }
#statusbar input.time { width: 130px; }
#statusbar { gap: 7px; padding: 7px 14px; flex-wrap: wrap; row-gap: 6px; }   /* one row at 1440; wraps to two rows at 1024 instead of scrolling the page */
#statusbar #countdown, #statusbar #conn { font-size: 14.5px; }
.tabulator-row .tabulator-cell.rn { padding: 5px 2px !important; overflow: visible; text-overflow: clip; }
.groupbox { padding-top: 30px; }
.groupbox > .gtitle { padding-top: 6px; }

.license-box { max-height: 52vh; overflow: auto; min-width: 560px; max-width: 640px; white-space: pre-wrap; background: var(--pane); border: 1px solid var(--group-border); border-radius: 6px; padding: 8px 12px; }
.license-box p { margin: 0 0 10px; }
.license-declined { padding: 60px 24px; text-align: center; font-weight: bold; font-size: calc(var(--pt) * 14); color: var(--ink); }
:root[data-theme="dark"] .tabulator-row .tabulator-cell.sc1, :root[data-theme="dark"] .tabulator-row .tabulator-cell.sc5 { color: var(--ink); }   /* dark theme: these two scores sit on dark tints, so the dark ink above was unreadable */

/* ---- Buy Scan / Fund Facts cell tints: the exact QColor values of buy_ui._scan_ready_impl (readable in both themes: dark ink on the light tint) ---- */
.tabulator-row .tabulator-cell.b { font-weight: 700; }
.tabulator-row .tabulator-cell.tf-dark { color: #101418; }
.tabulator-row .tabulator-cell.tb-red { background: #ffb7b2; }      /* 255,183,178 */
.tabulator-row .tabulator-cell.tb-amber { background: #ffe082; }    /* 255,224,130 */
.tabulator-row .tabulator-cell.tb-cream { background: #ffecb3; }    /* 255,236,179 */
.tabulator-row .tabulator-cell.tb-green { background: #c6efc6; }    /* 198,239,198 */
.tabulator-row .tabulator-cell.tb-blue { background: #ddebf7; }     /* 221,235,247 */
.tabulator-row .tabulator-cell.tb-worse { background: #ff8a80; }    /* 255,138,128 */
.tabulator-row .tabulator-cell.cutdecl { background: #ff6961; color: #101418; }   /* 255,105,97 */
.tabulator-row .tabulator-cell.cutrisk { background: #ffb7b2; color: #101418; }
.tabulator-row .tabulator-cell.raise { background: #c6efce; color: #101418; }     /* 198,239,206 */
.tabulator-row .tabulator-cell.hycaut { color: #9b1e1e; font-weight: 700; }       /* 155,30,30 */
.tabulator-row .tabulator-cell.exred { color: #c80000; font-weight: 700; }        /* 200,0,0 */

/* Qt-style popup menu (right-click menus: Notepad tree, same look as the header menu) */
.qmenu { display: flex; flex-direction: column; gap: 0; border-radius: 4px; }
.qmenu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 0; padding: 6px 14px; box-shadow: none; font-weight: 600; }
.qmenu button:hover:not(:disabled) { background: var(--gold); color: #1a1a1a; }
.qmenu hr { border: 0; border-top: 1px solid var(--group-border); margin: 3px 0; }

/* ---- Get Ready to Scan (simulated Refresh): Don's step rows, status chips, bars, banner, verdict ---- */
.gstep { display: grid; grid-template-columns: 34px minmax(230px, 1.3fr) 200px minmax(240px, 1.2fr) minmax(230px, 1.6fr); gap: 8px; align-items: center; margin-bottom: 6px; }
.gstep > div, .gstep > .pbar { min-width: 0; }
.gr-what { font-weight: 600; opacity: .85; }
.gr-chipcell { display: flex; justify-content: center; }
.gchip { display: inline-block; font-weight: 800; padding: 3px 10px; border-radius: 10px; border: 1px solid transparent; text-align: center; min-width: 150px; }
.pbar.gr-bar { height: 22px; border: 2px solid #333; border-radius: 4px; background: #fff; }
.pbar.gr-bar > i { opacity: 1; width: 0; transition: width .5s linear; }
.pbar.gr-bar > span { color: #111; line-height: 18px; font-size: calc(var(--pt) * 10.5); display: block; width: max-content; max-width: 96%; margin: 0 auto; padding: 0 6px; background: rgba(255,255,255,.88); border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-det { font-weight: 600; word-break: break-word; }
.gr-upd { display: grid; grid-template-columns: minmax(200px, 1fr) 3fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.gfinal { white-space: pre-wrap; font-weight: 800; font-size: calc(var(--pt) * 13); padding: 8px; border-radius: 6px; border: 2px solid; margin: 4px 0; }
.gverdict { font-weight: 800; font-size: calc(var(--pt) * 14); padding: 4px 8px; border-radius: 4px; display: inline-block; margin: 2px 0 6px; }
.gr-reasons { white-space: pre-wrap; margin-bottom: 4px; }
.gr-secchip { font-weight: 800; }
.gr-demo { margin-bottom: 6px; }
table.gr-b tr.gr-busy td { outline: 2px solid #1e5aa8; outline-offset: -2px; }

/* ---- Don's Zoom, 24 Nov 2026: action bar under the sub-tabs, status chips, Trade at <broker> ---- */
.actbar { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--group-border); border-top: 3px solid var(--gold-line); border-radius: 8px;
  background: var(--group-bg); padding: 7px 10px; box-shadow: var(--shadow); }
.actbar:not(:has(> .row)) { flex-direction: row; flex-wrap: wrap; align-items: center; }
.actbar > .row { flex-wrap: wrap; }
.selinfo { font-size: calc(var(--pt) * 11); color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.selinfo b { color: var(--blue); font-weight: 800; }
.cbox .chextra { display: inline-flex; align-items: center; gap: 8px; margin-left: 14px; cursor: default; }
.cbox .chextra button { padding: 4px 12px; }
.stchip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 10px; border: 1px solid currentColor; font-weight: 800;
  font-size: calc(var(--pt) * 9.5); letter-spacing: .02em; line-height: 1.5; white-space: nowrap; }
.stchip.st-PENDING { background: #fff5c8; color: #7a4a00; } .stchip.st-PREVIEWED { background: #d2e6ff; color: #12457f; }
.stchip.st-PLACED { background: #c8f0c8; color: #11592a; } .stchip.st-FILLED { background: #17692f; color: #fff; border-color: #17692f; }
.stchip.st-CANCELED { background: #e6e6e6; color: #4a4a4a; } .stchip.st-ERROR { background: #ffc8c8; color: #8e1b14; }
.stchip .qmark { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: #12457f; color: #fff;
  font-size: 10px; line-height: 1; cursor: help; }
.qmark.qhelp { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #12457f; color: #fff;
  font-weight: 800; font-size: 12px; line-height: 1; cursor: help; margin-left: -2px; flex: none; }
.tabulator-row .tabulator-cell.stcell { background: transparent !important; }
.stlegend { gap: 6px; }
.tradebar { display: inline-flex; align-items: center; gap: 6px; }
a.tradebtn { display: inline-block; padding: 5px 12px; border-radius: 8px; font-weight: 800; text-decoration: none; color: #fff; border: 1px solid transparent;
  font-size: calc(var(--pt) * 10.5); cursor: pointer; }
a.tradebtn::after { content: ' \2197'; }
a.tradebtn:hover { filter: brightness(1.1); }
a.tb-schwab { background: #00a0df; color: #08263a; } a.tb-etrade { background: #4b2c7a; } a.tb-fidelity { background: #3a8a2e; }
.dlg-trade { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--group-border); }
.scanbar { margin: 0; height: 18px; }
.scanbar > i { background: #2e7d32; opacity: 1; transition: width .25s linear; }
.scanbar > span { line-height: 16px; }
