:root {
  --bg: #0b0b0d;
  --panel: #141416;
  --panel-2: #1a1a1d;
  --border: #2a2a2f;
  --border-soft: #222226;
  --text: #ececf0;
  --muted: #9a9aa3;
  --dim: #6b6b74;
  --green: #22c08a;
  --green-soft: rgba(34, 192, 138, 0.14);
  --red: #f0455a;
  --red-soft: rgba(240, 69, 90, 0.14);
  --blue: #1f5eff;
  --blue-hover: #3a72ff;
  --amber: #f5a524;
  --radius: 12px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---- top bar --------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: 0.2px; }
.brand-logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--green)); display: grid; place-items: center; color: #fff; }
.tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab {
  background: none; border: 0; padding: 7px 16px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.tab .run-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.tab[data-tab='live'].active { color: #fff; }
.chain-status { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.pill b { color: var(--text); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }

/* ---- layout ---------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; padding: 14px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---- sidebar --------------------------------------------------------------- */
.sidebar { padding: 18px; display: flex; flex-direction: column; min-height: calc(100vh - 90px); position: sticky; top: 14px; }
.sidebar h2 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sidebar .sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.sidebar hr { border: 0; border-top: 1px solid var(--border); margin: 0 0 16px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; align-items: end; }
.field-row > * { min-width: 0; }
/* Two fields side by side share their label row, so the inputs line up even when one label wraps. */
.field-row > .field { display: grid; grid-template-columns: minmax(0, 1fr); grid-row: span 2; grid-template-rows: subgrid; }
.field-row > .field > .label { align-self: end; }
.label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px; line-height: 15px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.help {
  width: 14px; height: 14px; border-radius: 50%; border: 1.3px solid var(--dim); color: var(--dim); font-size: 9.5px;
  display: inline-grid; place-items: center; cursor: help; text-transform: none; font-weight: 700; flex: none;
}
/* The "?" stays with the label's last word, also when the label wraps. */
.label .nw { white-space: nowrap; }
.label .help { margin-left: 2px; vertical-align: top; }
.input {
  display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 0 12px; height: 40px; transition: border-color 0.15s;
}
.input:focus-within { border-color: #4a4a55; }
.input input, .input select {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 100%; font-size: 15px;
}
.input select { appearance: none; cursor: pointer; }
.input select option { background: var(--panel); }
.input .affix { color: var(--muted); font-size: 14px; }
.input.mono input, .input.mono textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.input.area { height: auto; min-height: 40px; padding: 9px 12px; }
.input textarea { flex: 1; min-width: 0; background: none; border: 0; outline: none; resize: vertical; line-height: 1.6; color: inherit; }
.input textarea:disabled { opacity: 0.6; }
.chev { color: var(--muted); pointer-events: none; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #2a2a2f; border-radius: 10px; padding: 3px; }
.segmented button {
  border: 0; background: none; padding: 8px 6px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.segmented button.active { background: var(--bg); color: var(--text); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #2f2f35; border-radius: 22px; transition: 0.15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::before { transform: translateX(16px); }
.sidebar .spacer { flex: 1; min-height: 12px; }
.primary {
  width: 100%; height: 44px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 600; font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.15s;
}
.primary:hover { background: var(--blue-hover); }
.primary:disabled { opacity: 0.55; cursor: progress; }
.primary.stop { background: #2b2b31; box-shadow: inset 0 0 0 1px var(--border); }
.primary.stop:hover { background: #34343b; }
.primary.danger { background: #d92d44; }
.primary.danger:hover { background: #e8435a; }
.secondary-actions { display: flex; gap: 8px; margin-top: 8px; }
.ghost {
  flex: 1; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px;
}
.ghost:hover { color: var(--text); border-color: #3a3a42; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 10px; }
.note.warn { color: var(--amber); }
.note.err { color: var(--red); }

/* ---- date range picker -------------------------------------------------------- */
.drp { position: relative; }
.drp-trigger { width: fit-content; min-width: 160px; max-width: 100%; cursor: pointer; background: var(--bg); text-align: left; }
.drp-trigger .drp-label { flex: 1; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drp-trigger[aria-expanded='true'] { border-color: #4a4a55; }
.drp-trigger[aria-expanded='true'] .chev { transform: rotate(180deg); }
.drp-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: min(304px, calc(100vw - 32px));
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.drp-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 3px; background: var(--bg); border-radius: 9px; margin-bottom: 10px; }
.drp-chip { border: 0; background: none; color: var(--muted); padding: 6px 0; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.drp-chip:hover { color: var(--text); background: #1f1f24; }
.drp-chip.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.drp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drp-month { font-weight: 600; font-size: 13.5px; }
.drp-nav { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: none; color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; }
.drp-nav:hover:not(:disabled) { background: #24242a; }
.drp-nav:disabled { opacity: 0.3; cursor: default; }
.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.drp-weekdays span { text-align: center; font-size: 11px; color: var(--dim); font-weight: 600; padding: 4px 0; }
.drp-day {
  height: 34px; border: 0; background: none; color: var(--text); font-size: 13px; cursor: pointer; border-radius: 0;
  font-variant-numeric: tabular-nums; position: relative;
}
.drp-day:hover:not(:disabled):not(.start):not(.end) { background: #2a2a31; border-radius: 8px; }
.drp-day.out { color: var(--dim); }
.drp-day.today::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--green); }
.drp-day.in { background: rgba(31, 94, 255, 0.18); }
.drp-day.start, .drp-day.end { background: var(--blue); color: #fff; font-weight: 700; }
.drp-day.start { border-radius: 8px 0 0 8px; }
.drp-day.end { border-radius: 0 8px 8px 0; }
.drp-day.start.end { border-radius: 8px; }
.drp-day:disabled { color: #45454d; cursor: not-allowed; }
.drp-day:focus-visible, .drp-chip:focus-visible, .drp-nav:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.drp-pop.up { top: auto; bottom: calc(100% + 6px); }
.drp-summary { font-size: 12.5px; color: var(--muted); margin: 10px 2px 10px; min-height: 17px; }
.drp-summary.picking { color: var(--amber); }
.drp-actions { display: flex; gap: 8px; }
.drp-actions .ghost { height: 34px; }
.drp-apply { flex: 1; height: 34px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; }
.drp-apply:hover:not(:disabled) { background: var(--blue-hover); }
.drp-apply:disabled { opacity: 0.45; cursor: default; }

/* ---- results --------------------------------------------------------------- */
.results { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.results-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.results-head h1 { font-size: 16px; margin: 0; font-weight: 700; }
.badge {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #2a2a30; color: #cfcfd6; white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: rgba(245, 165, 36, 0.14); color: var(--amber); }
.badge.btn { cursor: pointer; border: 1px solid transparent; }
.badge.btn.active { border-color: #55555f; color: #fff; }
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.outline-btn {
  border: 1px solid var(--border); background: var(--panel-2); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.outline-btn:hover { border-color: #44444c; }

.wallets { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; margin-bottom: 14px; }
.wallets table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.wallets th { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); }
.wallets td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); }
.wallets tr:last-child td { border-bottom: 0; }
.wallets .l { text-align: left; }
.wallets .o { font-size: 11.5px; color: var(--dim); }
.wallets .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.wallet-row { cursor: pointer; }
.wallet-row:hover td { background: rgba(255, 255, 255, 0.025); }
.wallet-row.active td { background: rgba(255, 255, 255, 0.06); }
.wallet-row.active td:first-child { box-shadow: inset 3px 0 0 var(--text); }
.wallet-row.paused td { opacity: 0.75; }
/* The cell stays a table cell (flex on a <td> breaks the row's borders and highlight). */
.wallets .acts { white-space: nowrap; }
.wallets .acts-in { display: flex; gap: 12px; justify-content: flex-end; align-items: center; }
.wallets .acts .link-btn { margin-left: 0; }
.slip { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.slip input { width: 52px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; text-align: right; color: var(--text); font: inherit; }
.slip input::placeholder { color: var(--dim); }
.slip.set input { border-color: #4a4a55; }
.add-row td { padding: 10px 12px; }
.add-row .input.add { display: inline-flex; width: min(420px, 100%); height: 34px; vertical-align: middle; margin-right: 8px; }
.add-row .outline-btn { vertical-align: middle; margin-right: 10px; }
.wallet-link { display: inline-flex; flex-direction: column; vertical-align: middle; color: inherit; text-decoration: none; line-height: 1.3; }
.wallet-link:hover .wname, .wallet-link:hover > .mono { text-decoration: underline; text-underline-offset: 3px; }
.wallet-link .wname { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.wallet-link .waddr { font-size: 11.5px; color: var(--dim); }
.wallets .ncol { text-align: center; }
.notify { display: inline-flex; padding: 4px; cursor: pointer; }
.notify input { width: 16px; height: 16px; accent-color: #3ecf8e; cursor: pointer; margin: 0; }
.notify input:disabled { cursor: not-allowed; opacity: 0.4; }
.addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.waited { font-size: 11px; font-weight: 700; color: #6aa9ff; white-space: nowrap; }
.maker { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; color: #e0a43a; border: 1px solid #e0a43a66; border-radius: 4px; padding: 1px 4px; vertical-align: middle; }
.forced { font-size: 11px; font-weight: 700; color: #e0a43a; white-space: nowrap; }
.wdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ecf8e; margin-right: 8px; vertical-align: middle; }
.wdot.off { background: #e0a43a; }
.wdot.all { background: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); min-width: 0; }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 21px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 11.5px; color: var(--dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s + .s { margin-top: 1px; }
.stat .v small { font-size: 13px; font-weight: 600; opacity: 0.85; }
/* Two figures side by side, each with its label above. */
.stat .s .split { display: flex; gap: 16px; }
.stat .s .split > span { display: flex; flex-direction: column; min-width: 0; }
.stat .s .split i { font-style: normal; }
.stat .s .split b { font-size: 12.5px; }
.stat .s b.pos { color: var(--green); }
.stat .s b.neg { color: var(--red); }
.pos { color: var(--green); }
.neg { color: var(--red); }

.chart-card { padding: 14px 16px 10px; border: 1px solid var(--border); border-radius: 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chart-head .k { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); }
.chart-head .r { font-size: 12.5px; font-weight: 600; }
.chart { position: relative; height: 230px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: #2c2c33; stroke-dasharray: 3 4; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .watermark { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, 0.13); font-weight: 700; font-size: 16px; pointer-events: none; }
.chart .watermark i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.13); display: inline-block; }
.chart-tip {
  position: absolute; pointer-events: none; background: #1f1f24; border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px;
  font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%);
}
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 13px; }

.table-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-head h3 { margin: 0 6px 0 0; font-size: 15px; }
.table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table-scroll { overflow: auto; max-height: 520px; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th {
  position: sticky; top: 0; background: var(--panel); z-index: 1; text-align: right; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); padding: 12px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
th.l, td.l { text-align: left; }
td { padding: 12px; border-bottom: 1px solid var(--border-soft); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.row:hover td { background: #17171a; }
.expand {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; font-size: 15px; line-height: 1;
}
/* The market column takes all width the numeric columns don't need:
   width:100% claims the slack, max-width:0 stops long titles from widening
   the table (they ellipsize instead), min-width keeps it readable when narrow. */
th.mcol, td.mcol { width: 100%; max-width: 0; min-width: 240px; }
.market { display: flex; align-items: center; gap: 10px; min-width: 0; }
.market img, .market .ph { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; background: #2a2a30; }
/* Up to two lines before truncating: rows are already two lines tall (sublines
   under time / P&L / fee), so the full question usually fits at no height cost. */
.market .t {
  min-width: 0; font-weight: 500; white-space: normal; overflow: hidden; line-height: 1.3;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere;
}
.market .o { color: var(--muted); font-size: 12px; }
.market a.ext { color: var(--muted); text-decoration: none; flex: none; }
.market a.ext:hover { color: var(--text); }
table.positions { min-width: 960px; }
td .sub { font-size: 11.5px; margin-top: 2px; }
/* P&L % sits under the amount in a softer shade of the same color. */
td .sub.pos { color: rgba(34, 192, 138, 0.62); }
td .sub.neg { color: rgba(240, 69, 90, 0.62); }
td .sub:not(.pos):not(.neg) { color: var(--dim); }

/* Outcome held: Yes / No / named outcome */
.outcome {
  flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.5; white-space: nowrap;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent;
}
.outcome.yes { color: #3ddc9c; background: rgba(34, 192, 138, 0.14); border-color: rgba(34, 192, 138, 0.35); }
.outcome.no { color: #ff6b7d; background: rgba(240, 69, 90, 0.14); border-color: rgba(240, 69, 90, 0.35); }
.outcome.other { color: #9db7ff; background: rgba(31, 94, 255, 0.14); border-color: rgba(31, 94, 255, 0.3); display: inline-block; }
.outcome.yes::before { content: '✓'; font-size: 10px; }
.outcome.no::before { content: '✕'; font-size: 9.5px; }
table.positions > thead > tr > th, table.positions > tbody > tr.row > td { padding-left: 9px; padding-right: 9px; }
tr.pos-row { cursor: pointer; }
tr.pos-row.open td { background: #17171a; border-bottom-color: transparent; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
.sort { vertical-align: -1px; margin-left: 3px; fill: currentColor; }
.sort.on { color: var(--text); }
td .o { font-size: 11.5px; color: var(--dim); margin-top: 2px; font-weight: 400; }

/* expanded position: leader vs copy-trader breakdown */
tr.detail > td { background: #0f0f11; padding: 0; border-bottom: 1px solid var(--border); }
.events-scroll { box-sizing: border-box; position: sticky; left: 0; width: var(--visible-w, 100%); max-height: 300px; overflow: auto; border-top: 1px solid var(--border); box-shadow: inset 0 6px 8px -8px rgba(0, 0, 0, 0.8); }
table.events { width: 100%; min-width: 780px; }
table.events td:last-child { white-space: normal; min-width: 130px; }
table.events th, table.events td { position: static; padding: 10px 10px; font-size: 12.5px; background: none; border-bottom: 1px solid #1d1d21; }
table.events thead th { position: sticky; top: 0; background: #0f0f11; z-index: 1; }
table.events thead tr.group th { top: 0; padding: 10px 12px 2px; border-bottom: 0; color: var(--muted); }
table.events thead tr:not(.group) th { top: 30px; }
table.events th.c { text-align: center; }
table.events .lead { background: #131318; }
table.events thead .lead { background: #131318; }
table.events .lead-end { border-right: 1px solid var(--border); }
table.events tbody tr:hover td { background: #18181c; }
table.events tbody tr:hover td.lead { background: #1b1b21; }
tr.ev-muted td { color: var(--muted); }
.ev-ok { color: var(--muted); }
.ev-skipped { color: var(--amber); font-weight: 600; }
.ev-failed { color: var(--red); font-weight: 600; }
.ev-skipped, .ev-failed { display: inline-block; line-height: 1.35; }
.side { font-weight: 700; font-size: 11.5px; }
.side.BUY { color: var(--green); }
.side.SELL { color: var(--red); }
.src { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; letter-spacing: 0.3px; }
.src.mempool { background: rgba(31, 94, 255, 0.18); color: #7ea2ff; }
.src.block { background: #26262c; color: var(--muted); }
.status { font-weight: 600; font-size: 12px; }
.status.copied { color: var(--green); }
.status.skipped { color: var(--muted); }
.status.failed { color: var(--red); }
.reason { color: var(--dim); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.table-foot { padding: 14px 18px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border-soft); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.empty { padding: 40px; text-align: center; color: var(--dim); }

.live-banner {
  border: 1px solid rgba(240, 69, 90, 0.4); background: var(--red-soft); color: #ffb3bd; border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5;
}
.live-banner.ok { border-color: rgba(34, 192, 138, 0.35); background: var(--green-soft); color: #9fe8cd; }
.live-banner code { background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px; }

/* ---- modal / toast ----------------------------------------------------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { max-width: 440px; width: 100%; padding: 20px; }
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--muted); line-height: 1.55; margin: 0 0 12px; font-size: 13.5px; }
.modal ul { color: var(--text); font-size: 13px; padding-left: 18px; line-height: 1.7; margin: 0 0 16px; }
.modal .row { display: flex; gap: 8px; }
.toast {
  position: fixed; bottom: 18px; right: 18px; background: #1f1f24; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; z-index: 60;
  max-width: 360px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.err { border-color: rgba(240, 69, 90, 0.6); }
.spin { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.spin.small { width: 11px; height: 11px; border-width: 2px; display: inline-block; vertical-align: -1px; border-color: rgba(255, 255, 255, 0.25); border-top-color: var(--text); }
.sim-progress { display: flex; flex-direction: column; gap: 8px; }
.sim-progress-bar { height: 4px; border-radius: 4px; background: #24242a; overflow: hidden; }
.sim-progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 4px; transition: width 0.4s ease; }
.sim-progress-text { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 12.5px; color: var(--muted); }
.sim-progress-text b { color: var(--text); font-weight: 600; }
.sim-progress-text.err { color: var(--red); }
.link-btn { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.more-row { padding: 12px; text-align: center; color: var(--dim); font-size: 12.5px; cursor: pointer; }
.more-row:hover { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flash { from { background: rgba(31, 94, 255, 0.18); } to { background: transparent; } }
tr.flash td { animation: flash 1.6s ease-out; }

/* ---- weather bot (Weather Paper / Weather Live) --------------------------------- */
.tab[data-tab='weather-live'].active { color: #fff; }
.group-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--dim);
  margin: 2px 0 12px; padding-top: 12px; border-top: 1px dashed var(--border-soft);
}
.group-title:first-child { padding-top: 0; border-top: 0; }
/* The weather form is long: the sidebar scrolls on its own while the action button stays in view. */
body.wx .sidebar { max-height: calc(100vh - 28px); overflow-y: auto; padding-bottom: 0; scrollbar-width: thin; scrollbar-color: #3a3a42 transparent; }
body.wx .sidebar-actions { position: sticky; bottom: 0; background: var(--panel); padding: 10px 0 18px; box-shadow: 0 -14px 12px -12px rgba(0, 0, 0, 0.7); }
.note .warn-text { color: var(--amber); font-weight: 600; }
.wx-mode-only .note { margin-bottom: 16px; }
.stats-sub { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.stats-sub b { color: var(--text); font-weight: 600; }
/* Phase of an event's local day: pre → day → late → post. */
.phase {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  background: #26262c; color: var(--muted); line-height: 1.5; white-space: nowrap;
}
.phase.pre { background: rgba(31, 94, 255, 0.16); color: #7ea2ff; }
.phase.fresh { background: rgba(31, 94, 255, 0.16); color: #7ea2ff; }
.phase.day { background: var(--green-soft); color: var(--green); }
.phase.late { background: rgba(245, 165, 36, 0.16); color: var(--amber); }
.phase.post { background: #26262c; color: var(--muted); }
.wflag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #26262c; color: var(--dim); }
.wflag.on { background: var(--green-soft); color: var(--green); }
.status.bought { color: var(--green); }
.status.sold { color: #7ea2ff; }
table.wx-events { min-width: 1080px; }
table.wx-signals { min-width: 1080px; }
table.wx-events > tbody > tr.row > td, table.wx-signals > tbody > tr.row > td, table.wx-activity > tbody > tr.row > td { padding-left: 9px; padding-right: 9px; }
table.wx-events > thead > tr > th, table.wx-signals > thead > tr > th, table.wx-activity > thead > tr > th { padding-left: 9px; padding-right: 9px; }
table.wx-fills thead tr:not(.group) th { top: 0; }
/* Expanded event: model inputs + the bucket strip (scrolls sideways inside the visible width). */
.wx-detail { max-height: none; }
.wx-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 10px 12px 2px; font-size: 12px; color: var(--muted); }
.wx-meta b { color: var(--text); font-weight: 600; }
.wx-meta .wx-note { color: var(--amber); }
.wx-meta .legend { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--dim); }
.wx-meta .legend i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.wx-meta .legend i.top { border-color: var(--blue); background: rgba(31, 94, 255, 0.25); }
.wx-meta .legend i.obs { border-color: var(--amber); background: rgba(245, 165, 36, 0.25); margin-left: 8px; }
.buckets { display: flex; gap: 6px; padding: 10px 12px 12px; width: max-content; min-width: 100%; }
.bucket { width: 118px; flex: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px; background: var(--panel); min-width: 0; }
.bucket.top { border-color: var(--blue); background: rgba(31, 94, 255, 0.08); }
.bucket.obs { border-color: var(--amber); background: rgba(245, 165, 36, 0.07); }
.bucket.top.obs { box-shadow: inset 0 0 0 1px var(--blue); }
.bucket .bt { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bucket .bp { font-size: 15px; font-weight: 600; margin: 3px 0 4px; font-variant-numeric: tabular-nums; }
.bucket.top .bp { color: #7ea2ff; }
.pbar { height: 5px; border-radius: 3px; background: #26262c; overflow: hidden; }
.pbar span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.bucket.obs .pbar span { background: var(--amber); }
.bucket .bq { font-size: 10.5px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bucket .bh { font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bucket .bh .y { color: var(--green); font-weight: 600; }
.bucket .bh .n { color: var(--red); font-weight: 600; }
.bucket .bh .o { color: var(--dim); }

/* ---- responsive ------------------------------------------------------------- */
/* Narrower screens: the market column gets less width, so allow a third line. */
@media (max-width: 1400px) {
  .market .t { -webkit-line-clamp: 3; line-clamp: 3; }
}
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 10px 16px; }
  .sidebar { position: static; min-height: 0; }
  body.wx .sidebar { max-height: none; overflow: visible; padding-bottom: 18px; }
  body.wx .sidebar-actions { position: static; padding: 0; box-shadow: none; }
  /* Five tabs no longer fit on one row at phone width. */
  .tabs { flex-wrap: wrap; }
  .tab { white-space: nowrap; padding: 7px 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain-status { margin-left: 0; }
}

/* ---- accounts ---------------------------------------------------------------- */
.user-menu { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
.user-email { color: var(--muted); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-bg { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 60; padding: 16px; }
.auth { width: 100%; max-width: 380px; padding: 24px; }
.auth .brand { margin-bottom: 18px; }
.auth-switch { margin-bottom: 18px; }
.auth .primary { width: 100%; margin-top: 4px; }
.auth .note { margin-top: 12px; }
.modal.account { max-width: 520px; }
.modal.account p { margin-bottom: 4px; }
.modal.account .field { margin-bottom: 12px; }
.modal.account .input select { width: 100%; background: transparent; border: 0; color: var(--text); font: inherit; padding: 0; height: 100%; outline: none; }
.modal.account .input select option { background: var(--panel-2); }
.wallet-status { font-size: 13px; line-height: 1.55; margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.wallet-status.ok { border-color: rgba(34, 192, 138, 0.35); background: var(--green-soft); }
.wallet-status.warn { border-color: rgba(240, 180, 41, 0.35); }
.wallet-status code { background: rgba(0, 0, 0, 0.3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.wallet-actions { margin: 12px 0 16px; flex-wrap: wrap; }
.wallet-actions .primary { flex: 1; }
.admin-users { font-size: 12.5px; margin-bottom: 14px; }
.admin-users table { width: 100%; border-collapse: collapse; }
.admin-users th, .admin-users td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.admin-users th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.live-banner a { color: inherit; font-weight: 600; }
