/* CopyBot dashboard layout.
   Colours, type, buttons, badges, alerts, tables and form controls come from private-console.css (the one
   PolyTraderBot console theme, loaded first). This file only lays out CopyBot's own components on the shared
   tokens (--bg, --panel, --panel2, --inset, --line, --text, --muted, --faint, --accent, --good, --bad, --warn,
   --info and their -tint variants). No palette, gradients, glows or shadows here. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: 0; }
.caption { font-size: 0.82rem; color: var(--muted); }
.label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.brand-logo { width: 32px; height: 32px; flex-shrink: 0; }

/* CARDS */
.card { border: 1px solid var(--line); padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding: 0 0 0.75rem; border-bottom: 1px solid var(--line); }
.card-header h3 { font-size: 0.95rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 0.75rem; }
.stat-card { border: 1px solid var(--line); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: 0.3rem; }
.stat-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.stat-value { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; color: var(--text); }
.stat-value.positive { color: var(--good); }
.stat-value.negative { color: var(--bad); }
.delta { font-size: 0.8rem; margin-top: 0.15rem; }
.delta.positive, .delta-positive { color: var(--good); }
.delta.negative, .delta-negative { color: var(--bad); }
.delta-warning { color: var(--warn); }
.row-buy { background: color-mix(in srgb, var(--good) 6%, transparent); }
.row-sell { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.explain-box { padding: 0.5rem; margin-top: 0.25rem; font-size: 0.82rem; color: var(--accent); background: var(--accent-tint); border-radius: var(--radius-sm); }
.positive { color: var(--good); }
.negative { color: var(--bad); }

/* METRIC CARDS */
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.metric-card { position: relative; min-width: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.metric-card .label { display: block; margin-bottom: 0.25rem; }
.metric-card .value { font-family: var(--mono); font-size: 1.25rem; line-height: 1.2; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.metric-card .caption { display: block; margin-top: 0.35rem; line-height: 1.45; }
.metric-card .delta { display: block; margin-top: 0.3rem; }
.metric-card.loading-card { min-height: 105px; }
.metric-card.loading-card .value { color: var(--muted); }

/* OVERVIEW COMMAND CENTER */
.overview-command { display: flex; align-items: stretch; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.overview-title-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.overview-command-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.overview-command h1 { font-size: 1.6rem; line-height: 1.15; margin: 0; }
.overview-command p { margin: 0.35rem 0 0; max-width: 680px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.first-screen-command { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 220px) auto; align-items: center; gap: 1.1rem; margin-bottom: 1rem; padding: 1.15rem 1.2rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--panel); }
.first-screen-command[data-state="attention"] { border-left-color: var(--warn); }
.first-screen-command[data-state="blocked"] { border-left-color: var(--bad); }
.first-screen-mode { display: inline-block; margin-bottom: 0.25rem; color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.first-screen-command[data-state="attention"] .first-screen-mode { color: var(--warn); }
.first-screen-command[data-state="blocked"] .first-screen-mode { color: var(--bad); }
.first-screen-command h2 { margin: 0; font-size: 1.2rem; line-height: 1.2; }
.first-screen-command p { max-width: 690px; margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.first-screen-money { min-width: 0; padding-left: 1rem; border-left: 1px solid var(--line); }
.first-screen-money span,
.first-screen-money small { display: block; color: var(--muted); font-size: 0.8rem; }
.first-screen-money strong { display: block; margin: 0.08rem 0; font-family: var(--mono); font-size: 1.35rem; line-height: 1.2; }
.first-screen-action { min-height: 42px; white-space: nowrap; }
.first-screen-loading { opacity: 0.82; }
.system-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0.24rem 0.65rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.system-pill-ok { color: var(--good); background: var(--good-tint); border-color: var(--good); }
.system-pill-warn { color: var(--warn); background: var(--warn-tint); border-color: var(--warn); }
.eyebrow { color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.overview-command-actions { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 0.35rem; min-width: 190px; }
.share-privacy-note { color: var(--faint); font-size: 0.8rem; line-height: 1.35; text-align: right; }
.overview-support-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.overview-full-log { margin-top: 1rem; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 390px); gap: 1rem; align-items: start; }
.overview-primary,
.overview-rail { min-width: 0; }
.overview-rail { display: flex; flex-direction: column; gap: 1rem; }
.copy-status-shell .section-title { display: flex; align-items: center; gap: 0.55rem; }
.copy-status-shell .section-title::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.copy-status-metrics { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.copy-status-metrics + .copy-status-metrics { margin-top: 0.85rem; }
.copy-status-trust { grid-template-columns: repeat(4, minmax(170px, 1fr)); margin-top: 0.85rem; }
.safety-command-shell { display: flex; flex-direction: column; gap: 1rem; }
.safety-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.safety-kpi-card,
.safety-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.safety-kpi-card { padding: 1.05rem 1.15rem; }
.safety-kpi-card.loading-card { min-height: 112px; }
.safety-kpi-card .label { display: block; margin-bottom: 0.45rem; }
.safety-kpi-card .value { font-family: var(--mono); font-size: 1.7rem; line-height: 1.05; font-weight: 600; color: var(--text); }
.safety-kpi-card .value span { color: var(--faint); font-size: 0.92rem; font-weight: 600; }
.safety-kpi-card .caption { display: block; margin-top: 0.5rem; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.safety-score-meter { height: 7px; margin-top: 0.75rem; border-radius: 999px; background: var(--inset); overflow: hidden; }
.safety-score-meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.safety-command-grid,
.safety-lower-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, 0.85fr); gap: 1rem; align-items: stretch; }
.safety-card { padding: 1.15rem; }
.safety-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.safety-card-header.compact { margin-bottom: 0.8rem; }
.safety-card h2,
.safety-card h3 { margin: 0; color: var(--text); }
.safety-card h2 { font-size: 1.25rem; }
.safety-card h3 { font-size: 1rem; }
.safety-card p { margin: 0.28rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.market-coverage-card { position: relative; overflow: hidden; border-color: var(--line); background: var(--panel); }
.market-coverage-header { align-items: center; }
.market-coverage-eyebrow { margin-bottom: 0.35rem; color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.market-scope-pill { display: inline-flex; align-items: center; flex: 0 0 auto; max-width: 320px; padding: 0.42rem 0.72rem; border: 1px solid transparent; border-radius: 999px; font-size: 0.8rem; font-weight: 600; line-height: 1.2; text-align: center; }
.market-scope-pill.scope-open { color: var(--good); background: var(--good-tint); border-color: var(--good); }
.market-scope-pill.scope-filtered { color: var(--warn); background: var(--warn-tint); border-color: var(--warn); }
.market-scope-pill.scope-raw { color: var(--info); background: var(--info-tint); border-color: var(--info); }
.market-coverage-layout { display: grid; grid-template-columns: minmax(190px, 0.65fr) minmax(260px, 1fr) minmax(300px, 1.2fr); gap: 1rem; align-items: stretch; }
.market-coverage-stat,
.market-coverage-chart,
.market-coverage-explanation { min-width: 0; padding: 0.9rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--inset); }
.market-coverage-stat { display: flex; flex-direction: column; justify-content: center; }
.market-coverage-stat > strong { margin: 0.38rem 0 0.18rem; color: var(--text); font-family: var(--mono); font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.1; }
.market-coverage-bar { display: flex; width: 100%; height: 12px; margin: 0.22rem 0 0.8rem; overflow: hidden; border-radius: 999px; background: var(--panel2); }
.market-coverage-segment { display: block; min-width: 2px; background: var(--accent); }
.market-coverage-segment:nth-child(2) { background: var(--info); }
.market-coverage-segment:nth-child(3) { background: var(--good); }
.market-coverage-segment:nth-child(4) { background: var(--warn); }
.market-coverage-segment:nth-child(5) { background: var(--bad); }
.market-coverage-segment:nth-child(6) { background: var(--faint); }
.market-coverage-segment.coverage-empty { background: var(--line); }
.market-coverage-chips { display: flex; flex-wrap: wrap; gap: 0.42rem; }
.market-coverage-chip { padding: 0.3rem 0.52rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.8rem; line-height: 1.2; background: var(--panel); }
.market-coverage-chip b { color: var(--text); }
.market-coverage-chip.muted { color: var(--faint); }
.market-coverage-explanation > strong { color: var(--text); font-size: 0.85rem; }
.market-coverage-explanation p { min-height: 2.8em; }
.market-coverage-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.market-scope-action .alert { margin: 0.65rem 0 0; }
.market-scope-footnote { margin-top: 0.75rem; color: var(--faint); font-size: 0.8rem; }
.market-scope-footnote strong { color: var(--muted); }
.safety-check-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.safety-check-list.compact { border-color: transparent; gap: 0.2rem; overflow: visible; }
.safety-check-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.82rem 0.9rem; border-bottom: 1px solid var(--line); }
.safety-check-list.compact .safety-check-row { border: 0; border-bottom: 1px solid var(--line); padding: 0.74rem 0; }
.safety-check-row:last-child { border-bottom: 0; }
.safety-check-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.safety-check-good .safety-check-dot { background: var(--good); }
.safety-check-warn .safety-check-dot { background: var(--warn); }
.safety-check-bad .safety-check-dot { background: var(--bad); }
.safety-check-copy { display: flex; flex-direction: column; min-width: 0; }
.safety-check-copy strong { color: var(--text); font-size: 0.88rem; }
.safety-check-copy span,
.safety-check-state { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.safety-check-state { font-weight: 600; white-space: nowrap; }
.go-live-callout { display: flex; align-items: center; justify-content: space-between; gap: 0.85rem; margin-top: 1rem; padding: 0.85rem 0.95rem; border: 1px solid var(--warn); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--warn-tint); }
.go-live-callout div { display: flex; flex-direction: column; gap: 0.15rem; }
.go-live-callout strong { color: var(--warn); }
.go-live-callout span { color: var(--muted); font-size: 0.82rem; }
.copy-timeline { display: flex; flex-direction: column; gap: 0.2rem; }
.copy-timeline-row { display: grid; grid-template-columns: 12px 58px minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.copy-timeline-row:last-child { border-bottom: 0; }
.copy-timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.copy-timeline-copied .copy-timeline-dot { background: var(--good); }
.copy-timeline-paper .copy-timeline-dot { background: var(--info); }
.copy-timeline-skipped .copy-timeline-dot { background: var(--warn); }
.copy-timeline-time,
.copy-timeline-main small { color: var(--faint); font-size: 0.8rem; }
.copy-timeline-main { display: flex; flex-direction: column; min-width: 0; gap: 0.14rem; }
.copy-timeline-main strong { color: var(--text); font-size: 0.85rem; }
.copy-timeline-main span,
.copy-timeline-main a { color: var(--muted); font-size: 0.82rem; line-height: 1.35; overflow-wrap: anywhere; }
.decision-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0.18rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.decision-copied { color: var(--good); background: var(--good-tint); border-color: var(--good); }
.decision-paper { color: var(--info); background: var(--info-tint); border-color: var(--info); }
.decision-skipped { color: var(--warn); background: var(--warn-tint); border-color: var(--warn); }
.text-link { color: var(--accent); font-size: 0.82rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.safety-leader-table { min-width: 640px; }
.safety-leader-table td,
.safety-leader-table th { vertical-align: middle; }
.advanced-connection-details { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.advanced-connection-details summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.command-detail-card .metrics-row { margin-bottom: 0; }
.copy-status-details { padding-top: 0.25rem; }
.readiness-details { padding: 0; overflow: hidden; }
.readiness-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; min-height: 54px; padding: 0.85rem 1rem; cursor: pointer; list-style: none; }
.readiness-details > summary::-webkit-details-marker { display: none; }
.readiness-details > summary::after { content: 'Review checks'; color: var(--accent); font-size: 0.82rem; font-weight: 600; }
.readiness-details[open] > summary { border-bottom: 1px solid var(--line); }
.readiness-details-body { padding: 1rem; }
.empty-state { color: var(--muted); }
.empty-state.compact { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.85rem; font-size: 0.85rem; line-height: 1.4; }
.empty-state.compact strong { color: var(--text); }
/* Neutral "nothing here yet" line (replaces the old blue info boxes). */
.empty-note { margin-bottom: 1rem; padding: 0.8rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 0.88rem; }
/* Paper run summary: a neutral card with the shared Paper badge, not a coloured bar. */
.paper-mode-banner { margin-bottom: 1rem; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); font-size: 0.88rem; font-weight: 600; }
.paper-run-details summary { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; cursor: pointer; list-style: none; }
.paper-run-details summary::-webkit-details-marker { display: none; }
.paper-run-details summary::after { content: 'Run details'; color: var(--accent); font-size: 0.82rem; white-space: nowrap; }
.paper-run-details[open] summary { margin-bottom: 0.7rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line-soft); }
.paper-mode-stats { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; min-width: 0; }
.paper-mode-stats span { white-space: nowrap; }
.paper-reset-form { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; }
.paper-reset-form label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }

/* COPY HEALTH */
.copy-health-panel { padding: 1rem; }
.copy-health-panel .card-header { margin-bottom: 0.75rem; padding-bottom: 0; border-bottom: 0; }
.health-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.85rem; margin-bottom: 0.8rem; }
.health-title { font-size: 1.25rem; font-weight: 600; line-height: 1.15; color: var(--text); }
/* The score ring is a chart: conic fill = score, inner disc = card surface. */
.health-score { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at center, var(--panel) 56%, transparent 57%), conic-gradient(var(--health-color, var(--good)) calc(var(--health-score, 0) * 1%), var(--panel2) 0); border: 1px solid var(--line); flex: 0 0 auto; }
.health-score-value { font-family: var(--mono); font-size: 0.95rem; font-weight: 600; }
.health-meter { height: 7px; background: var(--inset); border-radius: 999px; overflow: hidden; border: 1px solid var(--line-soft); }
.health-meter span { display: block; height: 100%; width: calc(var(--health-score, 0) * 1%); background: var(--health-color, var(--good)); }
.health-stream-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.85rem; }
.health-stream { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; gap: 0.55rem; align-items: start; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.health-stream:last-child { border-bottom: 0; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 0.38rem; background: var(--faint); }
.status-dot.ok { background: var(--good); }
.status-dot.warn { background: var(--warn); }
.status-dot.bad { background: var(--bad); }
.health-stream-title { font-size: 0.86rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.health-stream-detail { margin-top: 0.1rem; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.health-pill { border: 1px solid var(--line); border-radius: 999px; padding: 0.18rem 0.48rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.health-pill.ok { color: var(--good); background: var(--good-tint); border-color: var(--good); }
.health-pill.warn { color: var(--warn); background: var(--warn-tint); border-color: var(--warn); }
.health-pill.bad { color: var(--bad); background: var(--bad-tint); border-color: var(--bad); }
.health-detail-line { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; line-height: 1.45; }

/* BUTTONS: shape and colour come from the console (.btn, .btn-primary, .btn-secondary, .btn-danger).
   .btn-sm is still in the markup but every button has the one console size. */
.btn-full { width: 100%; text-align: center; justify-content: center; }
.btn-sell-all { background: var(--bad-tint) !important; border-color: var(--bad) !important; color: var(--bad) !important; }
.btn-sell { background: var(--bad-tint); border: 1px solid var(--bad); color: var(--bad); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.btn-emergency { background: var(--warn-tint) !important; border-color: var(--warn) !important; color: var(--warn) !important; }
.btn-withdraw { background: var(--accent-tint) !important; border-color: var(--accent) !important; color: var(--accent) !important; }
.btn-update { display: block; width: 100%; margin-top: 0.4rem; }

/* FORMS: colours, borders and focus come from the console; radios and checkboxes keep their natural size. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { width: 100%; padding: 0.6rem 0.85rem; font-size: 0.85rem; }
input[type="password"] { font-family: var(--mono); letter-spacing: 0.15em; }
input[type="number"] { font-family: var(--mono); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
.form-group .hint { font-size: 0.82rem; color: var(--muted); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio-list { display: grid; gap: 0.5rem; }
.radio-list label { display: flex; align-items: center; gap: 0.55rem; min-height: 32px; font-weight: 400; color: var(--text); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; padding: 0.45rem 0; }
.toggle-wrap .toggle-label { font-size: 0.85rem; color: var(--muted); }
.toggle { display: inline-block; position: relative; width: 36px; height: 20px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: var(--line); border-radius: 10px; transition: 0.2s; }
.toggle .slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: var(--muted); border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(16px); background: var(--on-accent); }

/* TABLES: header type comes from the console (12px, sentence case). */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 0.2rem; }
.table-wrap > table { min-width: 100%; }
.table-wrap > table.data-table { min-width: max-content; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sortable-th { position: relative; }
.table-sort-btn { display: inline-flex; align-items: center; gap: 0.35rem; width: 100%; min-height: 0; padding: 0; margin: 0; border: none; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.table-sort-btn:hover,
.table-sort-btn:focus-visible { color: var(--text); }
.table-sort-btn .sort-indicator { font-size: 0.8rem; color: var(--faint); flex-shrink: 0; }
.sortable-th[aria-sort="ascending"] .sort-indicator,
.sortable-th[aria-sort="descending"] .sort-indicator { color: var(--accent); }
tbody td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 0.85rem; vertical-align: top; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--panel-hover); }
tbody tr:last-child td { border-bottom: none; }
/* Sticky action column: same surface as the row, separated by a rule instead of a shadow band. */
.sticky-action-table th:last-child,
.sticky-action-table td:last-child { position: sticky; right: 0; z-index: 2; background: var(--panel); border-left: 1px solid var(--line-soft); }
.sticky-action-table thead th:last-child { z-index: 3; }
.sticky-action-table tbody tr:hover td:last-child { background: var(--panel-hover); }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.4rem; white-space: nowrap; }
.table-wrap > table.copy-task-table { min-width: 0; }
.copy-task-table { width: 100%; table-layout: fixed; }
.copy-task-table th:nth-child(1),
.copy-task-table td:nth-child(1) { width: 18%; }
.copy-task-table th:nth-child(2),
.copy-task-table td:nth-child(2) { width: 16%; }
.copy-task-table th:nth-child(3),
.copy-task-table td:nth-child(3) { width: 20%; }
.copy-task-table th:nth-child(4),
.copy-task-table td:nth-child(4) { width: 20%; }
.copy-task-table th:nth-child(5),
.copy-task-table td:nth-child(5) { width: 14%; }
.copy-task-table th:nth-child(6),
.copy-task-table td:nth-child(6) { width: 12%; }
.copy-task-table td { overflow-wrap: anywhere; }
.copy-task-input,
.copy-task-select { min-height: 36px; font-size: 0.85rem; padding: 0.45rem 0.65rem; }
.copy-task-size-edit { display: grid; grid-template-columns: 112px minmax(72px, 1fr); gap: 0.35rem; min-width: 190px; }
.copy-task-select:not(.mini) { min-width: 13rem; }
.copy-task-size-edit .mini { min-width: 0; }
.copy-task-card .table-actions { justify-content: flex-start; }
.position-action { min-width: 190px; }
.leader-recommendation-table .recommendation-notes { min-width: 260px; max-width: 380px; white-space: normal; line-height: 1.45; }
.leader-recommendation-table .recommendation-notes b { color: var(--text); }

/* PILLS: base shape is the console badge; the colour variants need the compound selector to win. */
.pill { font-size: 0.8rem; }
.pill.pill-green { background: var(--good-tint); border-color: var(--good); color: var(--good); }
.pill.pill-red { background: var(--bad-tint); border-color: var(--bad); color: var(--bad); }
.pill.pill-yellow { background: var(--warn-tint); border-color: var(--warn); color: var(--warn); }
.pill.pill-blue { background: var(--info-tint); border-color: var(--info); color: var(--info); }
.pill.pill-neutral { background: var(--panel2); color: var(--muted); }
.pill.pill-live { background: var(--good-tint); border-color: var(--good); color: var(--good); }

/* Kickoff countdown */
.kickoff-countdown { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.55rem; border: 1px solid var(--warn); border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--warn-tint); color: var(--warn); white-space: nowrap; }
.kickoff-na { opacity: 0.4; font-size: 0.8rem; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; }

/* TABS: colours and the active state come from the console (.tab-bar button). */
.tab-bar { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tab-btn { padding: 0.65rem 1.1rem; border: none; border-bottom: 2px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; white-space: nowrap; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ALERTS: colours come from the console (.alert-info/-success/-warning/-error/-danger). */
.alert { margin-bottom: 1rem; font-size: 0.88rem; }
.alert-warning strong { color: var(--text); }

/* DASHBOARD LAYOUT */
.dashboard-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; position: relative; z-index: 1; }
.sidebar { border-right: 1px solid var(--line); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.65rem; overflow-y: auto; height: 100vh; position: sticky; top: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); margin-bottom: 0.15rem; }
.sidebar-brand h2 { font-size: 1rem; font-weight: 600; }
.sidebar-brand .version { font-size: 0.8rem; color: var(--faint); font-family: var(--mono); }
/* The mode badge (console .mode-paper / .mode-live / .mode-stopped) carries the colour; the card stays neutral. */
.sidebar-mode-card { padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.sidebar-mode-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.sidebar-mode-caption { margin-top: 0.25rem; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.sidebar-mode-link { margin-top: 0.65rem; padding: 0; min-height: 0; border: 0; background: transparent; color: var(--accent); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.sidebar-mode-link:hover { text-decoration: underline; }
.licence-line { margin-top: 0.55rem; white-space: normal; }
.licence-line .badge { white-space: normal; line-height: 1.35; padding-top: 3px; padding-bottom: 3px; }
.licence-note { margin-top: 0.3rem; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

.bot-status-area { padding: 0.55rem 0.65rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.82rem; }
.bot-running { color: var(--good); font-weight: 600; }
.bot-paused { color: var(--bad); font-weight: 600; }

.config-section { margin-top: 0.15rem; }
.config-section-header { font-size: 0.85rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); margin-bottom: 0.4rem; padding-top: 0.5rem; }
.config-section-header.collapsible { cursor: pointer; display: flex; justify-content: space-between; align-items: center; -webkit-user-select: none; user-select: none; }
.config-section-header.collapsible:hover { color: var(--muted); }
.collapse-arrow { font-size: 0.8rem; transition: transform 0.15s ease; }
.config-section.collapsed .collapse-arrow { transform: rotate(0deg); }
.config-section:not(.collapsed) .collapse-arrow { transform: rotate(90deg); }
.config-section.collapsed .config-section-body { display: none; }
.dashboard-collapse-header { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.dashboard-collapse-block.collapsed [data-collapsible-body] { display: none; }
.config-field { margin-bottom: 0.45rem; }
.config-field label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.15rem; }
.config-field input[type="number"],
.config-field input[type="text"] { padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.config-field select.config-select { width: 100%; padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.field-help { font-size: 0.8rem; color: var(--faint); margin-top: 0.1rem; line-height: 1.35; }

.sidebar-footer { margin-top: auto; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.sidebar-version-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 4px 0; }
.sidebar-version { font-size: 0.8rem; color: var(--faint); }

.main-content { padding: 1.5rem 2rem; overflow-y: auto; max-width: 1400px; }

/* CENTERED PAGES (login, setup done) */
.centered-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; position: relative; z-index: 1; }
.centered-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 440px; }
.brand-mark { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.5rem; }
.brand-mark h1 { font-size: 1.4rem; color: var(--text); }
.setup-done-lead { margin-bottom: 1.5rem; }
.setup-done-command { margin-top: 0.5rem; padding: 0.6rem; border-radius: var(--radius-sm); background: var(--inset); color: var(--accent); font-family: var(--mono); font-size: 0.85rem; }

/* SETUP WIZARD */
.setup-container { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 3rem 1.5rem; position: relative; z-index: 1; }
.setup-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 640px; overflow: hidden; }
.setup-header { padding: 2rem 2.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.setup-header h1 { font-size: 1.45rem; margin-bottom: 0.3rem; }
.setup-header p { color: var(--muted); font-size: 0.9rem; }
.wizard-progress { display: flex; padding: 0 2.25rem; background: var(--inset); border-bottom: 1px solid var(--line); }
.wizard-step-indicator { flex: 1; padding: 0.7rem 0.25rem; text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--faint); border-bottom: 2px solid transparent; }
.wizard-step-indicator.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-step-indicator.completed { color: var(--muted); }
.wizard-body { padding: 2rem 2.25rem; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-nav { display: flex; justify-content: space-between; padding: 1.2rem 2.25rem; border-top: 1px solid var(--line); background: var(--inset); }

/* Reference boxes */
.ref-box { background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin: 0.75rem 0; font-size: 0.85rem; }
.ref-box .ref-title { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); margin-bottom: 0.3rem; font-size: 0.9rem; }
.ref-box ol, .ref-box ul { padding-left: 1.15rem; color: var(--muted); line-height: 1.7; }
.ref-box code { background: var(--panel); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.82rem; color: var(--accent); }

/* WALLET LIST */
.wallet-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.65rem; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 0.35rem; font-family: var(--mono); font-size: 0.82rem; }

/* CURRENCY TOGGLE */
.money-currency-control { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.4rem; color: var(--muted); font-size: 14px; }
.money-currency-control select { min-height: 36px; width: auto; padding: 0.35rem 1.8rem 0.35rem 0.55rem; font-size: 14px; }

/* LOG VIEWER */
.log-viewer { background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; max-height: 500px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; color: var(--muted); }

/* ================================================================
   SETTINGS TAB
   ================================================================ */
.settings-header { margin-bottom: 1.25rem; }
.settings-header h2 { font-size: 1.25rem; margin-bottom: 0.2rem; }
.settings-level-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.settings-level-btn.active { background: var(--accent) !important; color: var(--on-accent) !important; border-color: var(--accent) !important; }
[data-settings-complexity-root][data-settings-complexity-mode="basic"] [data-settings-level="advanced"] { display: none !important; }
.polymarket-connector-card { border-color: var(--line); }
.connector-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.9rem; }
.connector-status-item { min-width: 0; padding: 0.75rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--inset); }
.connector-status-item .value { margin-top: 0.24rem; font-family: var(--mono); font-size: 0.85rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.connector-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--line); }
.settings-tabs { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; background: var(--panel); }
.settings-tab-btn { flex: 1; min-height: 44px; padding: 0.6rem 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); background: transparent; border: none; border-right: 1px solid var(--line); border-radius: 0; cursor: pointer; white-space: nowrap; }
.settings-tab-btn:last-child { border-right: none; }
.settings-tab-btn:hover { color: var(--text); background: var(--panel-hover); }
.settings-tab-btn.active { color: var(--accent); background: var(--accent-tint); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.settings-section-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.15rem; }
.settings-section-desc { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; line-height: 1.5; }
.settings-grid { display: flex; flex-direction: column; gap: 0; }
.setting-item { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
.setting-item:last-child { border-bottom: none; }
.setting-info { flex: 1; margin-right: 1rem; }
.setting-name { font-size: 0.9rem; font-weight: 500; }
.setting-desc { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.5; }
.settings-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.settings-save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; padding: 1rem 0; margin-top: 0.5rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--bg); z-index: 5; }

/* Currency grid (Settings > Display) */
.currency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.currency-card { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; min-height: 0; padding: 0.75rem 0.5rem; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); }
.currency-card:hover { background: var(--panel-hover); }
.currency-card.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.currency-symbol { font-size: 1.1rem; font-weight: 600; font-family: var(--mono); }
.currency-code { font-size: 0.8rem; font-weight: 600; }
.currency-name { font-size: 0.8rem; color: var(--muted); text-align: center; }
.currency-card.active .currency-name { color: var(--accent); }

/* ================================================================
   HELP TAB
   ================================================================ */
.help-container { max-width: 800px; }
.help-hero { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.help-hero h2 { font-size: 1.25rem; margin-bottom: 0.2rem; }
.help-hero p { color: var(--muted); font-size: 0.9rem; }
.help-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.25rem; }
.help-nav-btn { min-height: 36px; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.help-nav-btn:hover { background: var(--panel-hover); color: var(--text); }
.help-nav-btn.active { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.help-section { display: none; }
.help-section.active { display: block; }
.help-content { font-size: 0.92rem; line-height: 1.75; color: var(--muted); }
.help-content h4 { color: var(--text); font-size: 0.95rem; margin-bottom: 0.5rem; }
.help-content p { margin-bottom: 0.75rem; }
.help-content ol, .help-content ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.help-content li { margin-bottom: 0.3rem; }
.help-content table { margin: 0.75rem 0; }
.help-content code { background: var(--inset); padding: 0.12rem 0.4rem; border-radius: 3px; font-size: 0.85rem; color: var(--accent); }

/* Help steps */
.help-step { display: flex; gap: 0.85rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.help-step:last-child { border-bottom: none; }
.help-step-num { width: 28px; height: 28px; background: var(--accent); color: var(--on-accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 600; flex-shrink: 0; margin-top: 0.1rem; }
.help-step h4 { margin-bottom: 0.25rem; }

/* Help diagram */
.help-diagram { display: flex; align-items: flex-start; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.diagram-step { flex: 1; min-width: 120px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem; text-align: center; }
.diagram-icon { display: grid; place-items: center; width: 28px; height: 28px; margin: 0 auto 0.45rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-tint); color: var(--accent); font: 600 13px/1 var(--mono); }
.diagram-label { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }
.diagram-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.diagram-arrow { display: flex; align-items: center; color: var(--accent); font-size: 1.2rem; font-weight: 600; padding-top: 1.5rem; }

/* Risk layers */
.risk-layer { padding: 0.85rem 0 0.85rem 0.85rem; border-bottom: 1px solid var(--line); border-left: 2px solid var(--accent-tint); }
.risk-layer:last-child { border-bottom: none; }
.risk-layer h4 { font-size: 0.9rem; margin-bottom: 0.25rem; }
.risk-layer p { font-size: 0.88rem; line-height: 1.6; }

/* FAQ / Troubleshooting items */
.faq-item, .trouble-item { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.faq-item:last-child, .trouble-item:last-child { border-bottom: none; }
.faq-item h4, .trouble-item h4 { font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--text); }
.faq-item p { font-size: 0.9rem; line-height: 1.6; }
.trouble-item ul { padding-left: 1.15rem; font-size: 0.9rem; line-height: 1.6; }
.trouble-item li { margin-bottom: 0.2rem; }

/* SIDEBAR DISCLOSURES */
.quick-actions { padding: 0.75rem 1rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.4rem; }
.quick-actions .config-section-header { margin-bottom: 0.15rem; }
.bot-control-disclosure,
.sidebar-control-disclosure,
.emergency-actions-disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.bot-control-disclosure > summary,
.sidebar-control-disclosure > summary,
.emergency-actions-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 0.55rem; min-height: 42px; padding: 0.62rem 0.75rem; color: var(--muted); cursor: pointer; font-size: 0.85rem; font-weight: 600; list-style: none; }
.bot-control-disclosure > summary::-webkit-details-marker,
.sidebar-control-disclosure > summary::-webkit-details-marker,
.emergency-actions-disclosure > summary::-webkit-details-marker { display: none; }
.bot-control-disclosure > summary::after,
.sidebar-control-disclosure > summary::after,
.emergency-actions-disclosure > summary::after { content: '+'; color: var(--accent); font-family: var(--mono); font-size: 1rem; }
.bot-control-disclosure[open] > summary::after,
.sidebar-control-disclosure[open] > summary::after,
.emergency-actions-disclosure[open] > summary::after { content: '−'; }
.bot-control-disclosure > summary,
.sidebar-control-disclosure > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.55rem; row-gap: 0.1rem; color: var(--text); }
.bot-control-disclosure > summary small,
.sidebar-control-disclosure > summary small { grid-column: 1; color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.bot-control-disclosure > summary::after,
.sidebar-control-disclosure > summary::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.bot-control-disclosure-body,
.sidebar-control-disclosure > form,
.emergency-actions-body { padding: 0.75rem; border-top: 1px solid var(--line); }
.bot-routine-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.emergency-actions-disclosure { margin-top: 0.65rem; border-color: var(--bad); }
.emergency-actions-disclosure.card { padding: 0; }
.emergency-actions-disclosure > summary { color: var(--bad); }
.emergency-actions-disclosure > summary::after { color: var(--bad); }
.emergency-actions-body { display: flex; flex-direction: column; gap: 0.45rem; }
.emergency-actions-body > p { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.action-consequence { margin: -0.1rem 0 0.2rem; color: var(--faint); font-size: 14px; line-height: 1.4; }
.emergency-paper-reset { margin-top: 0.65rem; padding: 0.2rem 0.65rem 0.65rem; border: 1px solid var(--bad); border-radius: var(--radius-sm); background: var(--bad-tint); }
.emergency-paper-reset > summary { display: flex; align-items: center; min-height: 44px; color: var(--bad); cursor: pointer; font-size: 14px; font-weight: 600; }
.emergency-paper-reset .action-consequence { margin: 0 0 0.65rem; }
.emergency-option { display: flex; align-items: center; gap: 0.45rem; min-height: 44px; margin-bottom: 0.35rem; color: var(--muted); font-size: 14px; }
#action-msg,
#trading-action-msg { min-height: 1px; margin-top: 0.2rem; font-size: 0.85rem; }

/* Section title (used across all tabs) */
.section-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }

/* Hamburger menu button (mobile only) */
.sidebar-toggle { display: none; position: fixed; top: 0.75rem; left: 0.75rem; z-index: 200; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.6rem; color: var(--text); cursor: pointer; line-height: 1; align-items: center; gap: 0.45rem; min-width: 76px; font-size: 0.9rem; font-weight: 600; }
.sidebar-toggle [aria-hidden="true"] { font-size: 1.1rem; line-height: 1; }
.mobile-operator-header,
.tab-bar .mobile-tab-more,
.mobile-tab-more-menu { display: none; }
.mobile-tab-label { display: none; }
.sidebar-runtime-disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.sidebar-runtime-disclosure > summary { min-height: 42px; padding: 0.62rem 0.75rem; color: var(--muted); cursor: pointer; font-size: 0.85rem; font-weight: 600; list-style: none; }
.sidebar-runtime-disclosure > summary::-webkit-details-marker { display: none; }
.sidebar-runtime-disclosure > summary::after { content: '+'; float: right; color: var(--accent); }
.sidebar-runtime-disclosure[open] > summary::after { content: '−'; }
.sidebar-runtime-body { display: flex; flex-direction: column; gap: 0.55rem; padding: 0.75rem; border-top: 1px solid var(--line); }

/* Sidebar overlay for mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); z-index: 149; }

@media (max-width: 1024px) {
  .main-content { padding: 1.25rem 1.5rem; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-rail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .overview-support-grid,
  .safety-command-grid,
  .safety-lower-grid { grid-template-columns: 1fr; }
  .safety-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-coverage-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-coverage-explanation { grid-column: 1 / -1; }
  .copy-status-metrics,
  .copy-status-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connector-status-grid { grid-template-columns: 1fr; }
}

/* Settings are an operational surface at every viewport, so customer-facing
   instructions, status, labels, and controls keep the shared readability floor. */
#tab-settings :is(p, .caption, .alert, .settings-section-title, .settings-section-desc, .setting-name, .setting-desc, .hint, .form-hint, .label, .value, label, .btn, input, select, textarea, .settings-tab-btn) { font-size: 14px; }
#tab-settings :is(.btn, .settings-tab-btn) { min-height: 44px; }
#tab-settings .connector-toggle-row > div > div:first-child { font-size: 14px !important; }
.dashboard-layout .toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

@media (max-width: 768px) {
  .sidebar-toggle { display: none; }
  .sidebar-overlay.open { display: block; }

  .mobile-operator-header { position: sticky; top: 0; z-index: 60; display: grid; grid-template-columns: minmax(64px, 1fr) auto auto auto; align-items: center; gap: 0.4rem; min-height: 58px; margin: 0 -1rem 0.75rem; padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--line); overflow: hidden; isolation: isolate; background: var(--bg); backdrop-filter: none; }
  .mobile-header-identity { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
  .mobile-header-logo { width: 28px; height: 28px; flex-shrink: 0; }
  .mobile-header-identity strong { display: block; line-height: 1.1; font-size: 15px; }
  .mobile-header-state { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; font-size: 14px; }
  .mobile-header-state span { padding: 0.2rem 0.42rem; border: 1px solid var(--line); border-radius: 999px; }
  .mobile-header-state [data-mobile-runner][data-tone="running"] { color: var(--good); }
  .mobile-header-state [data-mobile-runner][data-tone="stopped"] { color: var(--muted); }
  .mobile-header-state [data-mobile-runner][data-tone="blocked"] { color: var(--bad); }
  .mobile-header-action,
  .mobile-header-menu { min-height: 44px; padding: 0.55rem 0.65rem; white-space: nowrap; font-size: 14px; }
  .mobile-header-menu { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-weight: 600; }

  .tab-btn,
  .settings-tab-btn,
  .first-screen-action,
  .sidebar-toggle { min-height: 44px; }
  .first-screen-command { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.75rem; font-size: 14px; }
  .first-screen-money { grid-column: 1 / -1; grid-row: 2; padding: 0.75rem 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .first-screen-action { grid-column: 2; grid-row: 1 / 3; align-self: end; }

  .dashboard-layout { grid-template-columns: 1fr; z-index: auto; }
  .sidebar { position: fixed; top: 0; left: 0; width: 280px; height: 100vh; z-index: 150; transform: translateX(-100%); transition: transform 0.25s ease; border-right: 1px solid var(--line); }
  .sidebar.open { transform: translateX(0); }

  .main-content { padding: 0 1rem 1rem; max-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .overview-command { flex-direction: column; align-items: stretch; }
  .overview-command-actions { display: none; }
  .share-privacy-note { text-align: left; }
  .overview-rail { display: flex; }
  .overview-support-grid { grid-template-columns: 1fr; }
  .safety-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .safety-command-grid,
  .safety-lower-grid { grid-template-columns: 1fr; }
  .safety-card-header,
  .go-live-callout { align-items: flex-start; flex-direction: column; }
  .market-coverage-layout { grid-template-columns: 1fr; }
  .market-coverage-explanation { grid-column: auto; }
  .market-scope-pill { max-width: 100%; text-align: left; }
  .copy-timeline-row { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .copy-timeline-time { grid-column: 2 / 4; order: -1; }
  .copy-status-metrics,
  .copy-status-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-mode-banner { align-items: flex-start; flex-direction: column; }
  .paper-reset-form { flex-wrap: wrap; }
  .stat-card { padding: 0.75rem 0.85rem; }
  .metric-card { padding: 0.75rem 0.85rem; }
  .stat-value { font-size: 1.15rem; }
  .metric-card .value { font-size: 1.05rem; }
  .form-row { grid-template-columns: 1fr; }
  .setup-header, .wizard-body, .wizard-nav, .wizard-progress { padding-left: 1.25rem; padding-right: 1.25rem; }
  .settings-tabs { flex-wrap: wrap; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .currency-grid { grid-template-columns: repeat(3, 1fr); }
  .help-diagram { flex-direction: column; }
  .diagram-arrow { transform: rotate(90deg); padding: 0; justify-content: center; }
  #tab-settings :is(input:not([type="hidden"]):not([type="checkbox"]), select, textarea) { min-height: 44px; font-size: 16px; }
  .dashboard-layout .toggle { width: 44px; height: 44px; }
  .dashboard-layout .toggle .slider { inset: 12px 4px; }

  /* Tables: horizontal scroll on mobile */
  .table-wrap, div[style*="overflow-y:auto"] { overflow-x: auto; }
  table { min-width: 600px; }

  .tab-bar { position: relative; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; gap: 0.35rem; margin: 0 0 0.85rem; padding: 0.2rem 0.2rem 0.55rem; border-bottom: 1px solid var(--line); background: var(--bg); }
  .tab-btn { min-width: 0; justify-content: center; padding: 0.62rem 0.25rem; font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
  .tab-btn.mobile-secondary-tab { display: none; }
  .tab-btn .desktop-tab-label { display: none; }
  .tab-btn .mobile-tab-label { display: inline; }
  .tab-bar .mobile-tab-more { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.62rem 0.25rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
  .mobile-tab-more-menu { position: absolute; top: calc(100% - 0.25rem); right: 0; z-index: 70; width: min(210px, 80vw); padding: 0.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
  .mobile-tab-more-menu:not([hidden]) { display: grid; gap: 0.3rem; }
  .mobile-tab-more-menu button { min-height: 44px; padding: 0.65rem 0.75rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; font-size: 14px; }

  /* Settings tabs wrap */
  .settings-tab-btn { font-size: 14px; padding: 0.62rem 0.8rem; }

  /* Log viewer */
  .log-viewer { font-size: 0.82rem; max-height: 300px; }

  /* Help container full-width */
  .help-container { max-width: 100%; }

  /* Section title */
  .section-title { font-size: 0.95rem; }

  .money-currency-control { justify-content: flex-start; flex-wrap: wrap; }
  .money-currency-control select { min-height: 44px; }
}

@media (max-width: 480px) {
  .main-content { padding: 0 0.65rem 0.75rem; }
  .mobile-operator-header { grid-template-columns: minmax(58px, 1fr) auto auto auto; margin: 0 -0.65rem 0.65rem; padding-right: 0.45rem; padding-left: 0.45rem; }
  .mobile-header-action,
  .mobile-header-menu { padding-right: 0.5rem; padding-left: 0.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .overview-command { padding: 0.85rem; }
  .overview-command h1 { font-size: 1.35rem; }
  .first-screen-command { display: flex; flex-direction: column; align-items: stretch; padding: 0.9rem; }
  .first-screen-money { width: 100%; }
  .first-screen-action { width: 100%; justify-content: center; }
  .safety-kpi-grid { grid-template-columns: 1fr; }
  .safety-kpi-card .value { font-size: 1.45rem; }
  .safety-check-row { grid-template-columns: 14px minmax(0, 1fr); align-items: start; }
  .safety-check-state { grid-column: 2; }
  .copy-timeline-row { grid-template-columns: 10px minmax(0, 1fr); }
  .copy-timeline-time,
  .decision-pill { grid-column: 2; width: max-content; }
  .copy-status-metrics,
  .copy-status-trust { grid-template-columns: 1fr; }
  .connector-toggle-row { align-items: flex-start; flex-direction: column; }
  .paper-mode-stats { align-items: flex-start; flex-direction: column; gap: 0.25rem; }
  .paper-reset-form { width: 100%; justify-content: space-between; }
  .health-stream { grid-template-columns: 10px minmax(0, 1fr); }
  .health-pill { grid-column: 2; width: max-content; }
  .stat-card { padding: 0.6rem 0.7rem; }
  .metric-card { padding: 0.6rem 0.7rem; }
  .stat-value { font-size: 1.05rem; }
  .metric-card .value { font-size: 1rem; }
  .card-header h3 { font-size: 0.9rem; }
  table { font-size: 0.82rem; min-width: 500px; }
  thead th { padding: 0.5rem; }
  tbody td { font-size: 0.82rem; padding: 0.5rem; }
  .tab-btn { min-width: 0; padding: 0.62rem 0.1rem; font-size: 14px; }
  .mobile-tab-more { padding: 0.62rem 0.1rem; font-size: 14px; }
  .settings-tabs { gap: 0; }
  .settings-tab-btn { font-size: 14px; padding: 0.62rem 0.8rem; }
  .help-nav { gap: 0.25rem; }
  .help-nav-btn { font-size: 0.82rem; padding: 0.35rem 0.6rem; }
  .section-title { font-size: 0.92rem; }
  .centered-card { padding: 1.5rem; }
  .brand-mark h1 { font-size: 1.2rem; }
}

@media (max-width: 520px) {
  .settings-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 0.25rem; border-bottom: 1px solid var(--line); padding: 0.25rem; }
  .settings-tab-btn { min-width: 0; min-height: 44px; padding: 0.62rem 0.8rem; font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); white-space: normal; }
  .settings-tab-btn.active { background: var(--accent-tint); border-color: var(--accent); }
}

/* UTILITIES */
.text-green { color: var(--good); }
.text-red { color: var(--bad); }
.text-yellow { color: var(--warn); }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.hidden { display: none; }
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* Global loading bar */
#htmx-progress { position: fixed; top: 0; left: 0; height: 2px; z-index: 9999; background: var(--accent); width: 0; transition: width 0.4s ease; }

/* Update banner */
.update-banner { padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm); margin-bottom: 0.6rem; font-size: 0.85rem; line-height: 1.4; background: var(--panel2); color: var(--text); }
.update-available { border-color: var(--accent); background: var(--accent-tint); }
.update-progress { border-color: var(--info); background: var(--info-tint); }
.update-error { border-color: var(--warn); background: var(--warn-tint); }
.update-notes { margin-top: 0.3rem; font-size: 0.82rem; color: var(--muted); white-space: pre-line; }

/* Performance: account value chart and its range buttons */
.chart-card { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.chart-card-title { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.range-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chart-canvas { width: 100%; max-height: 320px; }

/* Daily P&L calendar */
.pnl-cal-wrap { margin-top: 0.75rem; padding: 0.85rem 0.85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--inset); }
.pnl-cal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.pnl-cal-title { color: var(--text); font-weight: 600; font-size: 0.9rem; }
.pnl-cal-sub { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }
.pnl-cal-total { padding: 0.32rem 0.7rem; border-radius: 999px; font-weight: 600; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.pnl-cal-total.delta-positive { background: var(--good-tint); color: var(--good); }
.pnl-cal-total.delta-negative { background: var(--bad-tint); color: var(--bad); }
.pnl-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.pnl-cal-dow > div { color: var(--muted); font-size: 0.8rem; padding-left: 0.4rem; }
.pnl-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pnl-cal-cell { position: relative; min-height: 78px; border-radius: var(--radius-sm); padding: 0.45rem 0.55rem 0.5rem; background: var(--panel); border: 1px solid var(--line-soft); display: flex; flex-direction: column; justify-content: space-between; }
.pnl-cal-cell.profit { background: var(--good-tint); border-color: var(--good); }
.pnl-cal-cell.loss { background: var(--bad-tint); border-color: var(--bad); }
.pnl-cal-cell.today { box-shadow: inset 0 0 0 1px var(--warn); }
.pnl-cal-cell .day { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.pnl-cal-cell .month { color: var(--faint); font-size: 0.8rem; }
.pnl-cal-cell .amt { font-weight: 600; font-size: 0.85rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pnl-cal-cell .amt.profit { color: var(--good); }
.pnl-cal-cell .amt.loss { color: var(--bad); }
.pnl-cal-cell .meta { color: var(--faint); font-size: 0.8rem; }
.pnl-cal-legend { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--faint); }
.pnl-cal-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.pnl-cal-legend .lg-profit::before { background: var(--good); }
.pnl-cal-legend .lg-loss::before { background: var(--bad); }
.pnl-cal-legend .lg-open::before { background: var(--warn); }

/* CONSOLE KIT SHELL: the header and its ⋯ menu (console-kit.css) replace the sidebar; these rules only
   fit the blocks that moved into the menu and the share button that moved to Performance. */
.share-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin-bottom: 1rem; }
.share-toolbar .share-privacy-note { color: var(--faint); font-size: 13px; }
.pt-menu-panel .sidebar-version-row { padding: 6px 0; }
.pt-menu-panel .sidebar-runtime-disclosure,
.pt-menu-panel .sidebar-control-disclosure { margin-bottom: 0.5rem; }
.pt-menu-panel #update-area:empty { display: none; }
.pt-menu-panel .update-banner { margin: 0.5rem 0; }
.pt-menu-panel .licence-line { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: baseline; }

/* GOING LIVE: "Am I ready for live?" and the Live check (partials/go_live.html), and the typed LIVE dialog. */
.go-live-panel:empty { display: none; }
.go-live-panel { margin-top: 16px; }
.go-live-block { margin-top: 14px; }
.go-live-block h3 { margin: 0 0 6px; font-size: 16px; }
.go-live-verdict, .go-live-headline { margin: 0 0 8px; font-weight: 600; line-height: 1.5; }
.go-live-headline[data-overall="passed"] { color: var(--good); }
.go-live-headline[data-overall="failed"] { color: var(--bad); }
.go-live-headline[data-overall="ready_except_licence"], .go-live-headline[data-overall="incomplete"] { color: var(--warn); }
.go-live-lines { margin: 0 0 8px; padding-left: 1.1rem; color: var(--muted); line-height: 1.55; }
.go-live-steps { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.go-live-steps li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); line-height: 1.5; }
.go-live-mark { font-size: 13px; font-weight: 700; color: var(--muted); }
.go-live-steps li[data-status="pass"] .go-live-mark { color: var(--good); }
.go-live-steps li[data-status="fail"] .go-live-mark { color: var(--bad); }
.go-live-steps li[data-status="cannot_check"] .go-live-mark { color: var(--warn); }
.go-live-fix { display: block; color: var(--muted); font-size: 13px; }
.go-live-error { color: var(--bad); font-weight: 600; }
.go-live-plan { margin: 12px 0; padding: 12px; border: 1px solid var(--pt-warn-edge); border-radius: var(--radius-sm); background: var(--warn-tint); }
.go-live-plan h4 { margin: 0 0 6px; font-size: 15px; }
.go-live-plan p { margin: 0 0 10px; line-height: 1.55; }
.go-live-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.go-live-run .htmx-indicator { display: none; }
.go-live-run.htmx-request .htmx-indicator { display: inline; }
.pt-live-dialog { max-width: 540px; width: calc(100% - 32px); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); }
.pt-live-dialog h2 { margin: 0 0 10px; font-size: 20px; }
.pt-live-dialog p, .pt-live-lines { color: var(--muted); line-height: 1.55; }
.pt-live-lines { padding-left: 1.1rem; }
.pt-live-dialog label { display: block; margin: 14px 0 6px; font-weight: 600; }
.pt-live-dialog input { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--inset); color: var(--text); font: inherit; }
.pt-live-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 720px) { .go-live-steps li { grid-template-columns: 1fr; gap: 2px; } }
