:root {
  color-scheme: dark;
  --void: #08090c;
  --board: #0c0e13;
  --panel: #12151b;
  --panel-2: #181c24;
  --line: #292f3a;
  --line-soft: rgba(255, 255, 255, 0.075);
  --text: #f4f6f8;
  --muted: #8d96a6;
  --cyan: #8d9cff;
  --cyan-deep: #20263d;
  --blue: #8d9cff;
  --amber: #d9b86c;
  --rose: #ff6b7a;
  --green: #38c793;
  --accent: #7c8cff;
  --accent-strong: #6677f4;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.26);
  --radius: 18px;
  --display: "Manrope", sans-serif;
  --body: "Manrope", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
.signal-bridge { margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.signal-bridge > summary { cursor: pointer; padding: 18px 20px; font-weight: 700; }
.signal-bridge > summary span { margin-left: 12px; font: 12px var(--mono); color: var(--muted); }
.signal-bridge-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; padding: 4px 24px 24px; }
.signal-bridge-body h2 { font: 600 22px var(--display); }
.signal-bridge-body h3 { font: 600 18px var(--display); }
.signal-bridge-body p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.signal-bridge-body fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; padding: 12px; }
.signal-bridge-body fieldset label { display: flex; align-items: center; gap: 10px; padding: 8px 0; font: 12px var(--mono); }
.signal-bridge-body .field { margin: 14px 0; }
.signal-bridge-body input[readonly] { width: 100%; }
.signal-bridge-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.signal-agreement { display: block; margin: 16px 0 0; padding: 18px; border-left: 3px solid var(--cyan); background: var(--panel-2); font: 500 18px/1.5 var(--mono); overflow-wrap: anywhere; }
.signal-bridge summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
@media(max-width: 700px) { .signal-bridge-body { grid-template-columns: 1fr; padding: 4px 16px 20px; gap: 18px; } .signal-bridge > summary span { display: block; margin: 8px 0 0; } }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html { min-height: 100%; background: var(--void); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--board);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(132, 153, 183, 0.13);
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font: 600 18px/1 var(--display); letter-spacing: -0.03em; }
.brand-mark { width: 28px; height: 28px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 5px; border: 1px solid #444; background: #111; border-radius: 8px; }
.brand-mark i { display: block; background: var(--cyan); border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 8px; opacity: .5; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 10px; opacity: .72; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.account-summary { display: flex; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #090909; }
.account-switch { min-width: 0; display: flex; }
.account-switch select { width: min(250px, 25vw); height: 34px; padding: 0 27px 0 12px; border: 0; border-radius: 0; color: #fff; background: transparent; font: 600 10px/1 var(--mono); text-transform: uppercase; text-overflow: ellipsis; }
.account-switch select.live-mode { border-color: rgba(255,95,115,.65); color: #ff9aa8; }
.balance-pill { min-width: 112px; padding: 8px 12px; overflow: hidden; border-left: 1px solid var(--line); color: var(--muted); font: 600 10px/1 var(--mono); text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.balance-pill.authorized { color: #fff; }
.status-pill { min-width: 94px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(16, 24, 39, .7); font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.status-pill i, .sample-state i { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #566276; }
.status-pill[data-state="connecting"] i { background: var(--amber); box-shadow: 0 0 12px rgba(255, 202, 106, .7); animation: pulse 1.2s infinite; }
.status-pill[data-state="live"] { color: var(--cyan); border-color: rgba(255, 255, 255, .26); }
.status-pill[data-state="live"] i { background: var(--cyan); box-shadow: 0 0 12px rgba(255, 255, 255, .55); }
.status-pill[data-state="polling"] { color: var(--amber); border-color: rgba(255, 202, 106, .25); }
.status-pill[data-state="polling"] i { background: var(--amber); }
.status-pill[data-state="error"] { color: var(--rose); border-color: rgba(255, 127, 145, .25); }
.status-pill[data-state="error"] i { background: var(--rose); }

.button, .icon-button, .add-tool, .close-button, .remove-widget { border: 0; color: inherit; }
.button { min-height: 42px; padding: 0 18px; border: 1px solid #fff; border-radius: 10px; font-weight: 750; font-size: 13px; }
.button-primary { color: #000; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 7px 20px rgba(255,255,255,.12); }
.button-primary:hover { background: #e8e8e8; transform: translateY(-1px); }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.42); border-radius: 10px; background: #101010; }
.icon-button:hover { border-color: #3b4d68; background: var(--panel-2); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.board {
  position: relative;
  min-height: calc(100vh - 112px);
  padding: 16px clamp(14px, 2vw, 30px) 76px;
  background: #000;
}
.board::before { display: none; }
.empty-state { position: relative; min-height: min(60vh, 570px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-glyph { width: 100px; height: 100px; position: relative; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 50%; background: rgba(11, 17, 29, .76); box-shadow: 0 0 0 9px rgba(11,17,29,.48), 0 0 0 10px rgba(111,168,255,.08); font: 500 25px/1 var(--mono); color: var(--cyan); }
.empty-glyph::after { content: ""; position: absolute; inset: 50% -24px auto; height: 1px; background: linear-gradient(90deg, transparent, var(--blue), transparent); opacity: .55; transform: rotate(-24deg); }
.empty-glyph span { position: absolute; }
.empty-glyph span:first-child { left: 23px; top: 22px; }
.empty-glyph span:last-child { right: 23px; bottom: 21px; }
.empty-state p { margin: 0 0 7px; font: 600 21px/1.2 var(--display); letter-spacing: -.03em; }
.empty-state > span { max-width: 350px; color: var(--muted); font-size: 13px; }
.add-tool-wrap { position: fixed; z-index: 20; right: 24px; bottom: 24px; }
.add-tool { height: 48px; padding: 0 20px 0 16px; display: flex; align-items: center; gap: 10px; border: 1px solid #fff; border-radius: 999px; background: #fff; color: #000; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.add-tool:hover { transform: translateY(-2px); box-shadow: 0 15px 36px rgba(0,0,0,.43); }
.add-tool span { font: 400 23px/1 var(--body); }

.widget-grid { position: relative; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 0; }
.widget { min-width: 0; overflow: hidden; container-type: inline-size; border: 1px solid var(--line-soft); border-radius: var(--radius); background: #080808; box-shadow: var(--shadow); transition: border-color .2s ease, transform .2s ease; }
.widget.wide { grid-column: auto; }
.multi-widget .widget-grid { grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr)); align-items: start; }
.widget.dragging { opacity: .45; transform: scale(.985); }
.widget.drag-target { border-color: var(--cyan); }
.widget-header { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.widget-title-wrap { min-width: 0; display: flex; align-items: center; gap: 13px; }
.widget-index { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.23); border-radius: 7px; background: rgba(255,255,255,.07); color: var(--cyan); font: 500 9px/1 var(--mono); }
.widget-title { margin: 0; font: 600 14px/1.2 var(--display); letter-spacing: -.02em; }
.widget-subtitle { display: none; }
.widget-actions { display: flex; align-items: center; gap: 6px; }
.drag-handle { padding: 4px; color: #66758b; font-size: 18px; cursor: grab; user-select: none; }
.remove-widget, .close-button { width: 30px; height: 30px; padding: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.remove-widget:hover, .close-button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.widget-toolbar { min-height: 49px; padding: 6px 12px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line-soft); background: #050505; }
.widget-toolbar label { display: grid; gap: 5px; }
.widget-toolbar label > span { color: var(--muted); font: 500 9px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
select, input { border: 1px solid var(--line); border-radius: 8px; background: #0b0b0b; color: var(--text); }
.widget-toolbar select { height: 31px; max-width: 175px; padding: 0 29px 0 9px; font: 500 11px/1 var(--mono); }
.widget-toolbar label > .number-field { height: 31px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #0b0b0b; color: var(--text); font: 500 11px/1 var(--mono); letter-spacing: 0; text-transform: none; }
.number-field input { width: 88px; height: 100%; padding: 0 7px 0 10px; border: 0; border-radius: 0; background: transparent; font: 500 11px/1 var(--mono); }
.number-field input:focus { outline: 0; }
.number-field em { padding-right: 10px; color: var(--muted); font-size: 9px; font-style: normal; }
.sample-state { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--muted); font: 400 9px/1 var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.sample-state.active i { background: var(--cyan); box-shadow: 0 0 8px rgba(255,255,255,.45); }
.range-warning { padding: 9px 18px; border-bottom: 1px solid rgba(255,202,106,.14); color: var(--amber); background: rgba(255,202,106,.06); font-size: 10px; }
.widget-body { min-height: 310px; padding: 18px; }
.chart-shell { position: relative; height: 220px; }
.chart-shell.compact { height: 180px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr); gap: 18px; align-items: center; }
.data-table { width: 100%; border-collapse: collapse; font: 400 10px/1.5 var(--mono); }
.data-table th { padding: 6px 8px; text-align: right; color: #77869b; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table td { padding: 5px 8px; border-top: 1px solid var(--line-soft); text-align: right; }
.data-table .hot { color: var(--amber); }
.data-table .cool { color: var(--blue); }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.metric { padding: 14px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(5,10,17,.24); }
.metric span { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 7px; font: 500 22px/1 var(--mono); letter-spacing: -.05em; }
.metric strong.cyan { color: var(--cyan); }.metric strong.amber { color: var(--amber); }.metric strong.rose { color: var(--rose); }
.inline-control { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; color: var(--muted); font-size: 11px; }
.inline-control select, .inline-control input { height: 32px; padding: 0 9px; font: 500 11px/1 var(--mono); }
.threshold-track { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; min-height: 120px; border: 1px solid var(--line-soft); border-radius: 13px; }
.threshold-segment { display: grid; place-items: center; padding: 17px 10px; text-align: center; background: rgba(6,11,19,.22); }
.threshold-segment + .threshold-segment { border-left: 1px solid var(--line-soft); }
.threshold-segment span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.threshold-segment strong { margin-top: 7px; font: 500 25px/1 var(--mono); }
.heatmap-wrap { overflow-x: auto; }
.heatmap { width: 100%; min-width: 590px; table-layout: fixed; border-collapse: separate; border-spacing: 3px; font: 400 9px/1 var(--mono); }
.heatmap th { height: 24px; color: var(--muted); font-weight: 400; }
.heatmap td { height: 34px; border-radius: 4px; text-align: center; color: rgba(255,255,255,.82); transition: background .2s ease; }
.matrix-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-cell { padding: 15px; min-height: 78px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(5,10,17,.24); }
.stat-cell span { color: var(--muted); font-size: 10px; }
.stat-cell strong { display: block; margin-top: 9px; font: 500 18px/1 var(--mono); }
.test-result { margin-top: 12px; padding: 13px; display: flex; align-items: center; justify-content: space-between; border-radius: 10px; background: rgba(111,168,255,.08); font-size: 11px; }
.test-result strong { color: var(--blue); font-family: var(--mono); }
.significance-layout { display: grid; grid-template-columns: 150px 1fr; gap: 18px; }
.digit-focus { display: grid; place-items: center; min-height: 190px; border: 1px solid var(--line-soft); border-radius: 13px; background: radial-gradient(circle, rgba(94,228,215,.1), transparent 65%); }
.digit-focus strong { display: block; font: 500 64px/1 var(--mono); color: var(--cyan); }
.digit-focus span { display: block; margin-top: 10px; color: var(--muted); font-size: 10px; text-align: center; }
.significance-data { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.signal-flag { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; color: var(--muted); font-size: 11px; }
.signal-flag b { color: var(--green); font: 500 11px/1 var(--mono); text-transform: uppercase; }
.signal-flag.significant b { color: var(--amber); }
.empty-data { min-height: 255px; display: grid; place-items: center; color: var(--muted); text-align: center; font-size: 12px; }

.modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 10, .76); backdrop-filter: blur(8px); }
.modal-panel { position: relative; width: min(680px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: #090909; box-shadow: 0 35px 100px rgba(0,0,0,.8); }
.settings-panel { width: min(450px, 100%); }
.modal-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 18px; border-bottom: 1px solid var(--line-soft); background: rgba(9,9,9,.97); backdrop-filter: blur(12px); }
.eyebrow { color: var(--cyan); font: 500 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.modal-head h2 { margin: 7px 0 0; font: 600 22px/1.2 var(--display); letter-spacing: -.04em; }
.modal-head p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.tool-picker-panel { width: min(860px, 100%); }
.tool-list { padding: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tool-choice { min-height: 88px; padding: 15px; display: flex; gap: 13px; align-items: flex-start; text-align: left; border: 1px solid transparent; border-radius: 12px; color: var(--text); background: rgba(5,10,17,.28); }
.tool-choice:hover { border-color: rgba(94,228,215,.28); background: rgba(94,228,215,.06); }
.tool-choice > span { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--cyan); font: 500 9px/1 var(--mono); }
.tool-choice strong { display: block; font: 600 13px/1.2 var(--display); }
.tool-choice small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.tool-choice.frequency-choice > span { color: var(--green); background: rgba(56,199,147,.08); }
.tool-choice.bubble-choice > span { color: var(--cyan); background: rgba(141,156,255,.1); border-radius: 50%; }
.tool-choice.mesh-choice > span { color: var(--amber); background: rgba(217,184,108,.08); transform: rotate(45deg); }
.tool-choice.mesh-choice > span::first-letter { transform: rotate(-45deg); }
.settings-panel form { padding: 24px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { font-size: 12px; font-weight: 700; }
.field small { color: var(--muted); font-weight: 500; }
.field input, .field select { width: 100%; height: 44px; padding: 0 12px; }
.field em { color: var(--muted); font-size: 10px; font-style: normal; }
.auth-note { margin-bottom: 18px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: #111; }
.auth-note strong, .auth-note span { display: block; }
.auth-note strong { font-size: 11px; }
.auth-note span { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.api-auth-card { margin-bottom: 18px; padding: 14px; display: grid; grid-template-columns: 1fr; gap: 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: #050505; }
.api-auth-card > div, .api-connect-status { grid-column: 1 / -1; }
.api-auth-card > div strong, .api-auth-card > div small { display: block; }
.api-auth-card > div strong { font-size: 12px; }
.api-auth-card > div small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.api-auth-card .compact-field { margin: 0; }
.api-auth-card .compact-field input { height: 40px; }
.api-connect-button { grid-column: 1 / -1; color: #fff; background: #171717; }
.api-connect-button:hover { background: #242424; }
.api-connect-status { min-height: 14px; margin: 0; color: var(--muted); font: 500 9px/1.4 var(--mono); }
.form-error { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; color: var(--rose); background: rgba(255,127,145,.08); font-size: 11px; }
.button-wide { width: 100%; }
.toast-region { position: fixed; z-index: 150; right: 18px; top: 78px; display: grid; justify-items: end; gap: 7px; pointer-events: none; }
.toast { max-width: 340px; padding: 10px 13px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(17,17,17,.97); box-shadow: 0 14px 38px rgba(0,0,0,.48); font: 500 10px/1.4 var(--mono); animation: toast-in .22s ease-out; }
.toast::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #aaa; }
.toast.error { border-color: rgba(255,127,145,.3); color: #ffc1ca; }
.toast.error::before, .toast.loss::before { background: var(--rose); box-shadow: 0 0 9px rgba(255,95,115,.7); }
.toast.trade { border-color: rgba(255,255,255,.3); color: #fff; }
.toast.trade::before { background: #fff; box-shadow: 0 0 9px rgba(255,255,255,.65); animation: pulse 1s infinite; }
.toast.win { border-color: rgba(40,209,124,.42); color: #a9f6cc; }
.toast.win::before { background: var(--green); box-shadow: 0 0 9px rgba(40,209,124,.7); }
.toast.loss { border-color: rgba(255,95,115,.42); color: #ffc1ca; }
footer { min-height: 44px; display: grid; place-items: center; padding: 10px; color: #5d6a7d; background: var(--void); font-size: 10px; }

/* Focused frequency workspace */
.frequency-widget { width: 100%; max-width: none; margin: 0; }
.frequency-widget .widget-body { display: grid; gap: 10px; padding: 10px; }

.digit-filter { min-height: 48px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line-soft); border-radius: 11px; background: #080808; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.filter-heading span, .panel-heading span { display: block; font: 600 11px/1.2 var(--display); }
.filter-heading small, .panel-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.filter-heading small { display: none; }
.reset-digits { min-height: 30px; padding: 6px 11px; border: 1px solid rgba(255,255,255,.35); border-radius: 7px; color: #fff; background: rgba(255,255,255,.09); font: 600 9px/1 var(--mono); white-space: nowrap; }
.reset-digits:hover:not(:disabled) { border-color: rgba(255,255,255,.4); }
.reset-digits:disabled { opacity: .35; cursor: default; }
.digit-switches { display: grid; grid-template-columns: repeat(10, 36px); gap: 5px; justify-content: end; }
.digit-switch { position: relative; min-width: 0; height: 36px; padding: 3px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.34); border-radius: 8px; color: var(--text); background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }
.digit-switch:hover { border-color: #fff; background: rgba(255,255,255,.15); transform: translateY(-1px); }
.digit-switch > i { position: absolute; right: 5px; top: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 7px rgba(255,255,255,.5); }
.digit-switch strong { font: 650 14px/1 var(--mono); }
.digit-switch small { display: none; }
.digit-switch.muted { border-color: rgba(127,149,180,.08); color: #566276; background: rgba(5,10,17,.22); }
.digit-switch.muted > i { background: #465265; box-shadow: none; }
.digit-switch.muted small { color: #566276; }

.frequency-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; }
.frequency-chart-panel, .strategy-panel { min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 13px; background: #080808; }
.panel-heading { min-height: 49px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.direction-tag { color: #62738a !important; font: 500 8px/1 var(--mono) !important; letter-spacing: .09em; }
.frequency-chart { height: 350px; padding: 9px 12px 5px 6px; }
.ledger-head, .ledger-row { display: grid; grid-template-columns: 1.15fr .75fr .9fr 1fr; align-items: center; }
.ledger-head { min-height: 45px; padding: 0 13px; border-bottom: 1px solid var(--line-soft); color: #697a90; font: 500 8px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.ledger-head span:not(:first-child), .ledger-row > span:not(:first-child) { text-align: right; }
.ledger-row { min-height: 36px; padding: 0 13px; border-bottom: 1px solid rgba(127,149,180,.075); font: 400 10px/1 var(--mono); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row > span:first-child { display: flex; align-items: center; gap: 7px; }
.ledger-row > span:first-child i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.ledger-row b { font-size: 11px; font-weight: 500; }
.ledger-row em { padding: 3px 5px; border-radius: 4px; color: #67758a; background: rgba(127,149,180,.08); font-size: 7px; font-style: normal; text-transform: uppercase; }
.ledger-row .hot { color: var(--amber); }
.ledger-row .cool { color: var(--blue); }
.ledger-row.muted { color: #4d596b; background: rgba(4,8,14,.17); }
.ledger-row.muted > span:first-child i { background: #3f4b5d; }
.digit-ledger { display: grid; grid-template-columns: 1fr 1fr; }
.digit-ledger .ledger-head { display: none; }
.digit-ledger .ledger-rows { display: contents; }
.digit-ledger .ledger-row:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.strategy-panel { padding: 10px; display: grid; grid-auto-rows: auto; align-content: start; gap: 7px; }
.strategy-head, .capital-row, .session-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.strategy-head span { display: block; font-size: 11px; font-weight: 600; }
.strategy-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; }
.strategy-head > b { padding: 4px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 500 7px/1 var(--mono); }
.strategy-head > b.active { color: #071414; border-color: var(--green); background: var(--green); }
.signal-strip { padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 8px; background: #101010; }
.signal-strip strong, .signal-strip span { display: block; }
.signal-strip strong { font-size: 10px; }
.signal-strip span { margin-top: 4px; color: var(--muted); font: 500 8px/1 var(--mono); }
.capital-row { min-height: 42px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; color: #b7b7b7; background: #050505; font-size: 9px; }
.capital-row strong { color: #fff; font: 650 14px/1 var(--mono); letter-spacing: -.03em; }
.control-section { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(255,255,255,.025); }
.control-section-head { min-height: 34px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.control-section-head span, .control-section-head small { display: block; }
.control-section-head span { font-size: 9px; font-weight: 650; }
.control-section-head small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.control-section-head > i { padding: 3px 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 500 6px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.execution-grid, .risk-limit-grid { display: grid; gap: 6px; padding: 7px; }
.execution-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.risk-limit-grid { grid-template-columns: repeat(2, 1fr); }
.execution-grid label, .risk-limit-grid label { display: grid; gap: 4px; }
.execution-grid label > span:first-child, .risk-limit-grid label > span:first-child { color: var(--muted); font-size: 7px; font-weight: 500; }
.execution-grid input, .risk-limit-grid input { width: 100%; height: 30px; padding: 0 8px; font: 500 9px/1 var(--mono); }
.input-with-unit { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #0b0b0b; }
.input-with-unit input { min-width: 0; border: 0; border-radius: 0; background: transparent; }
.input-with-unit em { padding-right: 7px; color: var(--muted); font: 500 7px/1 var(--mono); font-style: normal; }
.risk-limit-grid label { position: relative; padding-left: 8px; }
.risk-limit-grid label::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; border-radius: 2px; background: var(--green); }
.risk-limit-grid .stop-loss-field::before { background: var(--rose); }
.session-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.session-row > div { min-height: 38px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--muted); font-size: 7px; }
.session-row strong, .session-row b { color: #fff; font: 600 8px/1 var(--mono); text-align: right; }
.positive { color: var(--green) !important; }
.negative { color: var(--rose) !important; }
.arm-strategy { width: 100%; height: 42px; border: 1px solid #fff; border-radius: 9px; color: #000; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 8px 22px rgba(255,255,255,.1); font-size: 12px; font-weight: 800; letter-spacing: .015em; }
.arm-strategy::before { content: "▶"; margin-right: 7px; font-size: 9px; }
.arm-strategy:hover:not(:disabled) { background: #e7e7e7; transform: translateY(-1px); }
.arm-strategy.is-running { border-color: var(--rose); color: #fff; background: var(--rose); box-shadow: 0 8px 22px rgba(255,95,115,.2); }
.arm-strategy.is-running::before { content: "■"; }
.arm-strategy.is-running:hover:not(:disabled) { background: #e34f63; }
.arm-strategy:disabled { border-color: var(--line); color: #666; background: #151515; cursor: not-allowed; }
.trade-status { min-height: 24px; margin: 0; color: var(--muted); font-size: 7px; line-height: 1.45; }
.trade-history { min-height: 0; overflow: hidden; border-top: 1px solid var(--line-soft); }
.trade-history-head { padding: 7px 0 5px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.trade-history-head > div { display: flex; align-items: center; gap: 5px; }
.trade-history-head span { font-size: 8px; font-weight: 600; }
.trade-history-head button { min-height: 26px; padding: 4px 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; color: #fff; background: #151515; font-size: 8px; font-weight: 700; }
.trade-history-head button:hover { border-color: #fff; background: #222; }
.trade-history-head button:disabled { opacity: .35; cursor: default; }
.trade-history > div:last-child { max-height: 112px; overflow-y: auto; }
.trade-history p { margin: 12px 0; color: var(--muted); font-size: 8px; text-align: center; }
.trade-row { min-height: 29px; display: grid; grid-template-columns: 48px 34px minmax(66px, 1fr) minmax(72px, 1fr); align-items: center; gap: 5px; border-top: 1px solid rgba(255,255,255,.06); font: 500 8px/1 var(--mono); }
.trade-row time, .trade-row span { color: var(--muted); }
.trade-row strong { text-align: right; }
.trade-route { display: flex; align-items: center; justify-content: center; gap: 4px; }
.trade-route i { color: #fff; font-size: 10px; font-style: normal; font-weight: 700; }
.trade-route em { color: var(--muted); font-style: normal; }

.history-panel { width: min(1500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
#historyMeta { margin: 7px 0 0; color: var(--muted); font: 500 11px/1.35 var(--mono); }
.history-table-wrap { height: min(720px, calc(100vh - 142px)); overflow: auto; }
.history-table { width: 100%; min-width: 1210px; border-collapse: collapse; font: 500 11px/1.4 var(--mono); }
.history-table th { position: sticky; z-index: 1; top: 0; padding: 13px 12px; border-bottom: 1px solid var(--line); color: #b0b0b0; background: #090909; text-align: left; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.history-table td { height: 62px; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.history-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.history-table td b { display: block; font-size: 10px; }
.history-table .digit-cell { color: #fff; font-size: 20px; line-height: 1; letter-spacing: -.05em; }
.history-live { background: rgba(40,209,124,.035); }
.result-chip { min-width: 48px; padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 999px; font-size: 9px; font-weight: 700; }
.result-chip.win { color: var(--green); }
.result-chip.loss { color: var(--rose); }
.result-chip.live { color: #fff; }
.live-pulse { display: inline-flex; align-items: center; gap: 7px; color: #a9f6cc; }
.live-pulse::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(40,209,124,.75); animation: pulse 1s infinite; }
.history-empty { height: 180px; color: var(--muted); text-align: center; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.clear-history-button { min-height: 32px; padding: 0 11px; border: 1px solid rgba(255,95,115,.48); border-radius: 8px; color: #ff9aaa; background: rgba(255,95,115,.08); font-size: 9px; font-weight: 700; }
.clear-history-button:hover:not(:disabled) { border-color: var(--rose); background: rgba(255,95,115,.15); }
.clear-history-button:disabled { opacity: .35; cursor: default; }

.multi-widget .widget-header { min-height: 54px; padding-block: 9px; }
.multi-widget .widget-index { width: 30px; height: 30px; }
.multi-widget .widget-title { font-size: 14px; }
.multi-widget .widget-subtitle { font-size: 9px; }
.multi-widget .widget-toolbar { min-height: 50px; padding-block: 7px; }
.multi-widget .frequency-workspace { grid-template-columns: minmax(0, 1fr) 250px; }
.multi-widget .frequency-chart { height: 260px; }
.multi-widget .strategy-panel { padding: 7px; gap: 5px; }
.multi-widget .trade-history > div:last-child { max-height: 72px; }

@container (max-width: 700px) {
  .frequency-workspace, .multi-widget .frequency-workspace { grid-template-columns: 1fr; }
  .digit-filter { display: grid; gap: 6px; }
  .filter-heading > div { display: none; }
  .digit-switches { grid-template-columns: repeat(10, minmax(26px, 1fr)); width: 100%; }
  .strategy-panel { min-height: 230px; }
  .risk-grid { grid-template-columns: repeat(2, 1fr); }
}

@keyframes pulse { 50% { opacity: .45; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
@media (max-width: 1080px) {
  .ledger-row { min-height: 52px; grid-template-columns: 1fr .75fr .9fr 1fr; }
  .ledger-row:nth-child(odd) { border-right: 1px solid var(--line-soft); }
}
@media (max-width: 950px) {
  .split-layout { grid-template-columns: 1fr; }
  .split-layout .data-table { margin-top: 4px; }
  .digit-switches { justify-content: start; }
}
@media (max-width: 640px) {
  .app-header { padding: 9px 12px; flex-wrap: wrap; gap: 7px; }
  .brand { font-size: 16px; }
  .brand > span:last-child { display: none; }
  .header-actions { min-width: 0; flex: 1; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .account-summary:not(.has-account) { display: none; }
  .account-summary.has-account { order: 10; width: 100%; flex: 0 0 100%; border-radius: 9px; }
  .account-switch { flex: 1; }
  .account-switch select { width: 100%; height: 36px; padding-left: 10px; font-size: 9px; }
  .balance-pill { min-width: 128px; display: grid; place-items: center; padding: 7px 10px; font-size: 10px; }
  .status-pill { min-width: 0; padding: 8px; }
  .status-pill span { display: none; }
  .button { padding: 0 13px; }
  .board { padding: 10px 12px 72px; }
  .add-tool-wrap { right: 12px; bottom: 14px; }
  .toast-region { top: 64px; right: 9px; display: grid; }
  .toast { max-width: calc(100vw - 18px); padding: 9px 11px; font-size: 9px; }
  .has-widgets .add-tool { width: 46px; height: 46px; padding: 0; justify-content: center; gap: 0; overflow: hidden; font-size: 0; }
  .has-widgets .add-tool span { font-size: 24px; }
  .widget-grid { gap: 14px; }
  .multi-widget .widget-grid { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .multi-widget .widget { flex: 0 0 100%; scroll-snap-align: start; }
  .widget { border-radius: 14px; }
  .widget-header, .widget-toolbar, .widget-body { padding-left: 14px; padding-right: 14px; }
  .widget-header, .multi-widget .widget-header { min-height: 44px; padding-block: 6px; }
  .widget-toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .widget-toolbar label, .widget-toolbar select, .widget-toolbar .number-field { width: 100%; max-width: none; }
  .number-field input { width: 100%; }
  .sample-state { grid-column: 1 / -1; width: 100%; margin-left: 0; }
  .frequency-widget .widget-body { padding: 9px; gap: 9px; }
  .digit-filter { padding: 8px; display: grid; gap: 7px; }
  .filter-heading { align-items: flex-start; }
  .digit-switches { grid-template-columns: repeat(5, minmax(38px, 1fr)); gap: 6px; }
  .digit-switch { height: 34px; }
  .arm-strategy { height: 46px; font-size: 13px; }
  .frequency-workspace, .multi-widget .frequency-workspace { grid-template-columns: 1fr; }
  .frequency-chart, .multi-widget .frequency-chart { height: 292px; padding-inline: 2px 7px; }
  .panel-heading { padding: 12px; }
  .direction-tag { display: none !important; }
  .strategy-panel, .multi-widget .strategy-panel { min-height: 0; padding: 9px; grid-template-rows: repeat(7, auto); gap: 7px; }
  .risk-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .risk-grid input { height: 36px; font-size: 10px; }
  .capital-row { min-height: 48px; }
  .capital-row strong { font-size: 15px; }
  .trade-history > div:last-child, .multi-widget .trade-history > div:last-child { max-height: 96px; }
  .trade-history p { margin: 8px 0 2px; }
  .digit-ledger { grid-template-columns: 1fr; }
  .ledger-row:nth-child(odd) { border-right: 0; }
  .ledger-row { min-height: 42px; }
  .metric-row, .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .significance-layout { grid-template-columns: 1fr; }
  .digit-focus { min-height: 120px; }
  .tool-list { grid-template-columns: 1fr; }
  .modal { padding: 10px; }
  .modal-panel { max-height: calc(100vh - 20px); }
  .history-panel { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 14px; }
  .history-panel .modal-head { padding: 16px; }
  .history-table-wrap { height: calc(100vh - 116px); padding: 8px; }
  .history-table { min-width: 0; font-size: 10px; }
  .history-table thead { display: none; }
  .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; width: 100%; }
  .history-table tr { margin-bottom: 9px; overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: #0d0d0d; }
  .history-table td { min-height: 38px; height: auto; padding: 8px 10px; display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 10px; white-space: normal; text-align: right; }
  .history-table td::before { content: attr(data-label); color: var(--muted); font: 600 8px/1 var(--mono); letter-spacing: .07em; text-align: left; text-transform: uppercase; }
  .history-table td > * { justify-self: end; }
  .history-table td small { margin-top: 3px; }
  .history-table .digit-cell { font-size: 22px; }
  .history-table .history-empty { display: grid; min-height: 180px; place-items: center; grid-template-columns: 1fr; text-align: center; }
  .history-table .history-empty::before { display: none; }
}
@media (max-width: 390px) {
  .brand > span:last-child { display: none; }
  .add-tool { height: 44px; }
  .risk-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Bubble field and transition mesh */
.product-ui .visual-widget .widget-body { min-height: 0; padding: 12px; display: grid; gap: 10px; }
.product-ui .visual-controlbar { min-height: 58px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.product-ui .visual-controlbar > div:first-child { min-width: 0; display: flex; align-items: center; gap: 11px; }
.product-ui .visual-label { color: var(--muted); font: 600 8px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.product-ui .visual-segmented { padding: 3px; display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--void); }
.product-ui .visual-segmented button { min-height: 31px; padding: 0 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 650; white-space: nowrap; }
.product-ui .visual-segmented button:hover { color: var(--text); }
.product-ui .visual-segmented button.active { color: #fff; background: var(--accent); box-shadow: 0 4px 14px rgba(90,109,226,.2); }
.product-ui .barrier-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; }
.product-ui .barrier-control select { width: 58px; height: 34px; padding: 0 8px; }
.product-ui .visual-legend { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font: 500 8px/1 var(--mono); white-space: nowrap; }
.product-ui .visual-legend span { display: inline-flex; align-items: center; gap: 6px; }
.product-ui .visual-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.product-ui .visual-legend i.hot { background: var(--green); box-shadow: 0 0 9px rgba(56,199,147,.5); }
.product-ui .visual-legend i.cold { background: var(--rose); box-shadow: 0 0 9px rgba(255,107,122,.45); }
.product-ui .visual-legend i.current { border: 1px solid var(--accent); background: transparent; box-shadow: 0 0 0 3px rgba(124,140,255,.1); }

.product-ui .bubble-stage,
.product-ui .mesh-stage { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(circle at 55% 25%,rgba(124,140,255,.08),transparent 34%),var(--void); }
.product-ui .bubble-stage-head,
.product-ui .mesh-stage-head { min-height: 56px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.product-ui .bubble-stage-head > div:first-child,
.product-ui .mesh-stage-head > div:first-child { display: grid; gap: 5px; }
.product-ui .bubble-stage-head span,
.product-ui .mesh-stage-head span { font-size: 11px; font-weight: 700; }
.product-ui .bubble-stage-head small,
.product-ui .mesh-stage-head small,
.product-ui .bubble-stage-head > div:last-child { color: var(--muted); font: 500 8px/1.35 var(--mono); }
.product-ui .bubble-stage svg { width: 100%; height: clamp(340px,42vw,520px); min-height: 340px; display: block; }
.product-ui .digit-bubble { transition: transform .7s cubic-bezier(.2,.9,.25,1); }
.product-ui .bubble-core { stroke: rgba(196,203,255,.72); stroke-width: 1; filter: drop-shadow(0 12px 14px rgba(16,20,42,.25)); transition: r .6s cubic-bezier(.2,.9,.25,1),opacity .25s; }
.product-ui .bubble-halo { fill: transparent; stroke: transparent; stroke-width: 2; opacity: 0; transition: r .6s cubic-bezier(.2,.9,.25,1),stroke .25s,opacity .25s; }
.product-ui .digit-bubble.right-group .bubble-core { filter: hue-rotate(-12deg) drop-shadow(0 12px 14px rgba(25,40,110,.28)); }
.product-ui .digit-bubble.most .bubble-core { stroke: var(--green); stroke-width: 3; }
.product-ui .digit-bubble.most .bubble-halo { stroke: var(--green); opacity: .34; }
.product-ui .digit-bubble.least .bubble-core { stroke: var(--rose); stroke-width: 2.5; opacity: .76; }
.product-ui .digit-bubble.least .bubble-halo { stroke: var(--rose); opacity: .24; }
.product-ui .digit-bubble.current .bubble-halo { stroke: var(--cyan); opacity: 1; animation: bubble-current 1.45s ease-out infinite; }
.product-ui .bubble-number { fill: #fff; font: 700 22px/1 var(--mono); dominant-baseline: middle; }
.product-ui .bubble-percent { fill: rgba(255,255,255,.72); font: 500 9px/1 var(--mono); }
.product-ui .bubble-divider { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 7; }
.product-ui .bubble-group-label { fill: var(--muted); font: 600 9px/1 var(--mono); text-anchor: middle; letter-spacing: .16em; }
.product-ui .bubble-group-label.active { fill: var(--cyan); }
.product-ui .bubble-footer { min-height: 66px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.product-ui .bubble-footer > div:first-child { min-width: 0; display: grid; gap: 8px; }
.product-ui .bubble-footer > div:first-child > span,
.product-ui .chain-strip > span { color: var(--muted); font: 600 8px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.product-ui .recent-digit-ribbon { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.product-ui .recent-digit-ribbon::-webkit-scrollbar { display: none; }
.product-ui .recent-digit-ribbon i { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--panel-2); font: 600 10px/1 var(--mono); font-style: normal; }
.product-ui .recent-digit-ribbon i.current { border-color: var(--accent); color: #fff; background: var(--accent); }
.product-ui .recent-digit-ribbon > span { color: var(--muted); font-size: 9px; }
.product-ui .bubble-extremes { display: flex; gap: 8px; }
.product-ui .bubble-extremes span { min-width: 76px; padding: 8px 10px; display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 8px; }
.product-ui .bubble-extremes b { color: var(--text); font: 600 10px/1 var(--mono); }
.product-ui .bubble-extremes span:first-child b { color: var(--green); }
.product-ui .bubble-extremes span:last-child b { color: var(--rose); }

.product-ui .mesh-stage-head button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel-2); font-size: 8px; }
.product-ui .mesh-layout { position: relative; min-height: 480px; }
.product-ui .mesh-graph { min-width: 0; min-height: 480px; }
.product-ui .mesh-graph svg { width: 100%; height: 100%; min-height: 480px; display: block; }
.product-ui .mesh-orbit { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 8; }
.product-ui .mesh-edge { fill: none; stroke: var(--muted); stroke-width: var(--edge-width); opacity: var(--edge-opacity); pointer-events: none; }
.product-ui .mesh-edge-active { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-dasharray: 7 7; filter: drop-shadow(0 0 5px rgba(56,199,147,.55)); pointer-events: none; animation: mesh-flow .8s linear infinite; }
.product-ui .mesh-node { cursor: pointer; outline: none; }
.product-ui .mesh-node-core { fill: var(--panel-2); stroke: var(--accent); stroke-width: 1.5; transition: fill .2s,stroke .2s,stroke-width .2s; }
.product-ui .mesh-node-pulse { fill: rgba(124,140,255,.04); stroke: rgba(124,140,255,.16); opacity: .7; }
.product-ui .mesh-node:hover .mesh-node-core,
.product-ui .mesh-node.selected .mesh-node-core { fill: var(--accent); stroke: #cbd2ff; stroke-width: 2.5; }
.product-ui .mesh-node.current .mesh-node-pulse { stroke: var(--green); opacity: .8; animation: bubble-current 1.45s ease-out infinite; }
.product-ui .mesh-node.current .mesh-node-core { stroke: var(--green); stroke-width: 3; }
.product-ui .mesh-node-digit,
.product-ui .mesh-node-share { fill: var(--text); text-anchor: middle; font-family: var(--mono); pointer-events: none; }
.product-ui .mesh-node-digit { font-size: 16px; font-weight: 700; }
.product-ui .mesh-node-share { fill: var(--muted); font-size: 7px; }
.product-ui .mesh-node.selected .mesh-node-digit,
.product-ui .mesh-node.selected .mesh-node-share { fill: #fff; }
.product-ui .mesh-center-kicker,
.product-ui .mesh-center-digit,
.product-ui .mesh-center-caption { fill: var(--muted); text-anchor: middle; font-family: var(--mono); }
.product-ui .mesh-center-kicker,
.product-ui .mesh-center-caption { font-size: 7px; letter-spacing: .12em; }
.product-ui .mesh-center-digit { fill: var(--text); font-size: 35px; font-weight: 700; }
.product-ui .mesh-inspector { position: absolute; z-index: 3; top: 12px; right: 12px; width: 238px; max-height: calc(100% - 24px); min-width: 0; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb,var(--panel-2) 90%,transparent); box-shadow: 0 14px 40px rgba(0,0,0,.18); backdrop-filter: blur(12px); }
.product-ui .mesh-empty { min-height: 82px; display: grid; align-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.product-ui .mesh-empty b { color: var(--text); font-size: 12px; }
.product-ui .mesh-empty span { max-width: 180px; font-size: 9px; line-height: 1.55; }
.product-ui .inspector-title { padding-bottom: 14px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.product-ui .inspector-title > span,
.product-ui .probability-list > span,
.product-ui .incoming-list > span { color: var(--muted); font: 600 8px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.product-ui .inspector-title strong { margin-top: 2px; color: var(--cyan); font: 700 28px/1 var(--mono); }
.product-ui .inspector-title small { color: var(--muted); font-size: 8px; }
.product-ui .probability-list { margin-top: 15px; display: grid; gap: 7px; }
.product-ui .probability-list > span { margin-bottom: 3px; }
.product-ui .probability-row { display: grid; grid-template-columns: 18px 1fr 29px 20px; align-items: center; gap: 7px; opacity: .48; }
.product-ui .probability-row.observed { opacity: 1; }
.product-ui .probability-row > i { color: var(--text); font: 600 9px/1 var(--mono); font-style: normal; }
.product-ui .probability-row > span { height: 4px; overflow: hidden; border-radius: 999px; background: var(--line); }
.product-ui .probability-row > span b { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg,var(--accent),var(--green)); }
.product-ui .probability-row em,
.product-ui .probability-row small { color: var(--muted); font: 500 7px/1 var(--mono); font-style: normal; text-align: right; }
.product-ui .incoming-list { margin-top: 17px; display: grid; gap: 9px; }
.product-ui .incoming-list > div { display: flex; flex-wrap: wrap; gap: 5px; }
.product-ui .incoming-list i { padding: 6px 7px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--void); font: 600 8px/1 var(--mono); font-style: normal; }
.product-ui .incoming-list i b { color: var(--green); }
.product-ui .incoming-list i small { color: var(--muted); }
.product-ui .incoming-list em { color: var(--muted); font-size: 8px; }
.product-ui .chain-strip { min-height: 72px; padding: 12px 14px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.product-ui .chain-strip > div { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.product-ui .chain-strip > div::-webkit-scrollbar { display: none; }
.product-ui .chain-strip > div > i { min-height: 30px; padding: 0 8px; flex: 0 0 auto; display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-style: normal; }
.product-ui .chain-strip i span { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 5px; color: #fff; background: var(--accent); font: 600 8px/1 var(--mono); }
.product-ui .chain-strip i b { color: var(--muted); font-size: 8px; }
.product-ui .chain-strip i em { margin-left: 3px; color: var(--green); font: 600 7px/1 var(--mono); font-style: normal; }
.product-ui .chain-strip > div > em { color: var(--muted); font-size: 9px; }

.product-ui .manual-trade-dock { display: grid; grid-template-columns: minmax(250px,1.15fr) minmax(220px,.8fr) minmax(250px,.9fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.product-ui .manual-suggestion,
.product-ui .manual-settings,
.product-ui .manual-actions { min-width: 0; padding: 14px; }
.product-ui .manual-settings,
.product-ui .manual-actions { border-left: 1px solid var(--line); }
.product-ui .manual-suggestion { position: relative; background: linear-gradient(135deg,rgba(124,140,255,.09),transparent 72%); }
.product-ui .manual-suggestion::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--muted); }
.product-ui .manual-suggestion[data-bias="over"]::before { background: var(--green); box-shadow: 0 0 15px rgba(56,199,147,.4); }
.product-ui .manual-suggestion[data-bias="under"]::before { background: var(--rose); box-shadow: 0 0 15px rgba(255,107,122,.34); }
.product-ui .manual-suggestion-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.product-ui .manual-suggestion-head span,
.product-ui .manual-settings > span,
.product-ui .manual-actions > span,
.product-ui .manual-session span { color: var(--muted); font: 600 8px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.product-ui .manual-suggestion-head i { padding: 4px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 600 7px/1 var(--mono); font-style: normal; }
.product-ui .manual-suggestion > strong { margin-top: 10px; display: block; color: var(--text); font-size: 16px; letter-spacing: -.025em; }
.product-ui .manual-suggestion[data-bias="over"] > strong { color: var(--green); }
.product-ui .manual-suggestion[data-bias="under"] > strong { color: var(--rose); }
.product-ui .suggestion-volume { height: 6px; margin: 12px 0 8px; display: flex; gap: 3px; overflow: hidden; border-radius: 999px; background: var(--line); }
.product-ui .suggestion-volume i { flex: 0 0 50%; transition: flex-basis .45s ease; }
.product-ui .suggestion-volume i:first-child { background: linear-gradient(90deg,#34415f,#6b7ba6); }
.product-ui .suggestion-volume i:last-child { background: linear-gradient(90deg,var(--accent),var(--green)); }
.product-ui .manual-suggestion > small { color: var(--muted); font-size: 8px; line-height: 1.45; }
.product-ui .manual-settings { display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 10px; }
.product-ui .manual-settings > span { grid-column: 1 / -1; }
.product-ui .manual-settings label { min-width: 0; display: grid; gap: 6px; }
.product-ui .manual-settings label > small { color: var(--muted); font-size: 8px; }
.product-ui .manual-money-input,
.product-ui .manual-duration-input { height: 40px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.product-ui .manual-money-input em { padding-left: 9px; color: var(--muted); font: 600 7px/1 var(--mono); font-style: normal; }
.product-ui .manual-duration-input em { padding-right: 9px; color: var(--muted); font: 600 7px/1 var(--mono); font-style: normal; }
.product-ui .manual-money-input input,
.product-ui .manual-duration-input input { min-width: 0; width: 100%; height: 38px; padding: 0 8px; border: 0; background: transparent; font: 600 10px/1 var(--mono); }
.product-ui .manual-actions { display: grid; align-content: start; gap: 10px; }
.product-ui .manual-actions > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.product-ui .manual-trade-button { min-height: 54px; padding: 8px; display: grid; place-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-2); }
.product-ui .manual-trade-button small { color: var(--muted); font: 500 7px/1 var(--mono); letter-spacing: .08em; }
.product-ui .manual-trade-button strong { font-size: 11px; }
.product-ui .manual-trade-button.over { border-color: rgba(56,199,147,.36); background: rgba(56,199,147,.08); }
.product-ui .manual-trade-button.over strong { color: var(--green); }
.product-ui .manual-trade-button.under { border-color: rgba(255,107,122,.32); background: rgba(255,107,122,.07); }
.product-ui .manual-trade-button.under strong { color: var(--rose); }
.product-ui .manual-trade-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.15); }
.product-ui .manual-trade-button:disabled { opacity: .42; cursor: wait; }
.product-ui .manual-session { grid-column: 1 / -1; min-height: 52px; padding: 9px 12px; display: grid; grid-template-columns: minmax(220px,1fr) auto auto; align-items: center; gap: 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.product-ui .manual-session > div:not(.manual-history-actions) { min-width: 0; display: grid; gap: 5px; }
.product-ui .manual-session strong { overflow: hidden; color: var(--text); font-size: 9px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.product-ui .manual-session b { color: var(--text); font: 600 11px/1 var(--mono); }
.product-ui .manual-history-actions { display: flex; gap: 6px; }
.product-ui .manual-history-actions button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--void); font-size: 8px; font-weight: 650; }
.product-ui .manual-history-actions button:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.product-ui .manual-history-actions button:disabled { opacity: .4; cursor: default; }
.product-ui .suggestion-auto { grid-column: 1 / -1; border-top: 1px solid var(--line); background: var(--panel); }
.product-ui .suggestion-auto summary { min-height: 52px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text); cursor: pointer; list-style: none; }
.product-ui .suggestion-auto summary::-webkit-details-marker { display: none; }
.product-ui .suggestion-auto summary > span { display: grid; grid-template-columns: 8px auto; align-items: center; column-gap: 8px; }
.product-ui .suggestion-auto summary i { width: 7px; height: 7px; grid-row: 1 / 3; border-radius: 50%; background: var(--muted); }
.product-ui .suggestion-auto.is-running summary i { background: var(--green); box-shadow: 0 0 10px rgba(56,199,147,.6); animation: pulse 1.2s infinite; }
.product-ui .suggestion-auto summary b { font-size: 10px; }
.product-ui .suggestion-auto summary small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.product-ui .suggestion-auto summary > em { color: var(--muted); font: 600 8px/1 var(--mono); font-style: normal; }
.product-ui .suggestion-auto summary > em::after { content: " +"; color: var(--accent); }
.product-ui .suggestion-auto[open] summary > em::after { content: " −"; }
.product-ui .suggestion-auto-body { padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.55fr); gap: 12px; border-top: 1px solid var(--line); background: var(--void); }
.product-ui .auto-settings-grid { display: grid; grid-template-columns: repeat(5,minmax(96px,1fr)); gap: 8px; }
.product-ui .auto-settings-grid label { min-width: 0; display: grid; gap: 6px; }
.product-ui .auto-settings-grid label > span:first-child,
.product-ui .auto-execution span { color: var(--muted); font: 600 7px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.product-ui .auto-input { height: 38px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.product-ui .auto-input input { width: 100%; min-width: 0; height: 36px; padding: 0 8px; border: 0; background: transparent; font: 600 9px/1 var(--mono); }
.product-ui .auto-input em { padding-right: 8px; color: var(--muted); font: 600 7px/1 var(--mono); font-style: normal; }
.product-ui .auto-execution { padding: 9px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.product-ui .auto-execution > div { min-width: 0; display: grid; gap: 6px; }
.product-ui .auto-execution strong { color: var(--text); font-size: 8px; line-height: 1.45; }
.product-ui .auto-execution button { min-width: 92px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; color: #fff; background: var(--accent); font-size: 9px; font-weight: 750; }
.product-ui .auto-execution button.is-running { background: var(--rose); }
.product-ui .auto-execution button:hover:not(:disabled) { filter: brightness(1.12); }
.product-ui .auto-execution button:disabled { opacity: .45; cursor: wait; }

html[data-theme="light"] .product-ui .bubble-stage,
html[data-theme="light"] .product-ui .mesh-stage { background: radial-gradient(circle at 55% 25%,rgba(89,107,221,.08),transparent 35%),#fbfcfe; }
html[data-theme="light"] .product-ui .bubble-core { filter: drop-shadow(0 12px 15px rgba(52,63,113,.16)); }
html[data-theme="light"] .product-ui .mesh-node-core { fill: #fff; }
html[data-theme="light"] .product-ui .mesh-node:hover .mesh-node-core,
html[data-theme="light"] .product-ui .mesh-node.selected .mesh-node-core { fill: var(--accent); }
html[data-theme="light"] .product-ui .mesh-node.selected .mesh-node-digit,
html[data-theme="light"] .product-ui .mesh-node.selected .mesh-node-share { fill: #fff; }
html[data-theme="light"] .product-ui .manual-trade-dock { background: #fff; }
html[data-theme="light"] .product-ui .manual-suggestion { background: linear-gradient(135deg,rgba(89,107,221,.08),transparent 72%); }
html[data-theme="light"] .product-ui .manual-settings,
html[data-theme="light"] .product-ui .manual-actions,
html[data-theme="light"] .product-ui .manual-session { background-color: #f8f9fc; }
html[data-theme="light"] .product-ui .suggestion-auto { background: #fff; }
html[data-theme="light"] .product-ui .suggestion-auto-body { background: #f3f5f9; }

@keyframes bubble-current { 0% { transform: scale(.88); opacity: 1; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes mesh-flow { to { stroke-dashoffset: -14; } }

@container (max-width: 720px) {
  .product-ui .visual-controlbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .product-ui .visual-controlbar > div:first-child { align-items: stretch; flex-direction: column; gap: 7px; }
  .product-ui .visual-legend { width: 100%; margin: 0; justify-content: flex-start; }
  .product-ui .mesh-layout { min-height: 0; }
  .product-ui .mesh-graph,
  .product-ui .mesh-graph svg { min-height: 390px; }
  .product-ui .mesh-inspector { position: static; width: auto; max-height: none; min-height: 0; margin: 0 10px 10px; }
  .product-ui .mesh-empty { min-height: 130px; }
  .product-ui .manual-trade-dock { grid-template-columns: 1fr 1fr; }
  .product-ui .manual-suggestion { grid-column: 1 / -1; }
  .product-ui .manual-settings { border-left: 0; border-top: 1px solid var(--line); }
  .product-ui .manual-actions { border-top: 1px solid var(--line); }
  .product-ui .suggestion-auto-body { grid-template-columns: 1fr; }
  .product-ui .auto-settings-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .product-ui .tool-picker-panel .modal-head { padding: 17px; }
  .product-ui .tool-list { grid-template-columns: 1fr; padding: 10px; }
  .product-ui .tool-choice { min-height: 74px; }
  .product-ui .visual-widget .widget-body { padding: 8px; gap: 8px; }
  .product-ui .visual-controlbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .product-ui .visual-controlbar > div:first-child { align-items: stretch; flex-direction: column; gap: 7px; }
  .product-ui .visual-segmented { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .product-ui .visual-segmented button { min-width: 0; padding: 0 6px; }
  .product-ui .barrier-control { justify-content: space-between; }
  .product-ui .visual-legend { width: 100%; margin: 0; justify-content: space-between; }
  .product-ui .bubble-stage svg { height: auto; min-height: 300px; }
  .product-ui .bubble-stage-head > div:last-child { display: none; }
  .product-ui .bubble-footer { align-items: stretch; flex-direction: column; }
  .product-ui .bubble-extremes { display: grid; grid-template-columns: 1fr 1fr; }
  .product-ui .bubble-extremes span { min-width: 0; }
  .product-ui .mesh-layout { min-height: 0; }
  .product-ui .mesh-graph,
  .product-ui .mesh-graph svg { min-height: 360px; }
  .product-ui .mesh-inspector { position: static; width: auto; max-height: none; min-height: 0; margin: 0 8px 8px; padding: 12px; }
  .product-ui .mesh-empty { min-height: 76px; }
  .product-ui .probability-list { grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 13px; }
  .product-ui .probability-list > span { grid-column: 1 / -1; }
  .product-ui .manual-trade-dock { grid-template-columns: 1fr; }
  .product-ui .manual-suggestion,
  .product-ui .manual-settings,
  .product-ui .manual-actions { grid-column: 1; border-left: 0; }
  .product-ui .manual-settings,
  .product-ui .manual-actions { border-top: 1px solid var(--line); }
  .product-ui .manual-session { grid-column: 1; grid-template-columns: 1fr auto; gap: 10px; }
  .product-ui .manual-session > div:first-child { grid-column: 1 / -1; }
  .product-ui .suggestion-auto summary { min-height: 56px; }
  .product-ui .suggestion-auto-body { padding: 9px; grid-template-columns: 1fr; }
  .product-ui .auto-settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-ui .auto-execution { grid-template-columns: 1fr; }
  .product-ui .auto-execution button { width: 100%; min-height: 44px; }
}

html[data-theme="light"] {
  color-scheme: light;
  --void: #eef1f6;
  --board: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #f1f4f8;
  --line: #d8dee8;
  --line-soft: rgba(18, 24, 38, .085);
  --text: #161923;
  --muted: #687386;
  --cyan: #596bdd;
  --cyan-deep: #e8ebff;
  --blue: #596bdd;
  --amber: #9b7427;
  --rose: #d94b60;
  --green: #16875f;
  --accent: #596bdd;
  --accent-strong: #4659cd;
  --shadow: 0 16px 45px rgba(24, 35, 58, .09);
}
html[data-theme="light"] .app-header { border-bottom-color: rgba(15,23,42,.14); background: rgba(255,255,255,.96); }
html[data-theme="light"] .board { background: var(--board); }
html[data-theme="light"] .brand-mark { border-color: #c7cdd5; background: #eef1f4; }
html[data-theme="light"] .account-summary,
html[data-theme="light"] select,
html[data-theme="light"] input { color: var(--text); background: #ffffff; }
html[data-theme="light"] .account-switch select { color: var(--text); background: transparent; }
html[data-theme="light"] .balance-pill.authorized { color: var(--text); }
html[data-theme="light"] .status-pill { background: #f5f6f8; }
html[data-theme="light"] .icon-button { border-color: #b9c0ca; background: #f5f6f8; }
html[data-theme="light"] .widget,
html[data-theme="light"] .digit-filter,
html[data-theme="light"] .frequency-chart-panel,
html[data-theme="light"] .strategy-panel { background: #ffffff; }
html[data-theme="light"] .widget-toolbar { background: #f8f9fa; }
html[data-theme="light"] .number-field { background: #ffffff; }
html[data-theme="light"] .signal-strip,
html[data-theme="light"] .auth-note { background: #f5f6f8; }
html[data-theme="light"] .api-auth-card { border-color: rgba(15,23,42,.18); background: #ffffff; }
html[data-theme="light"] .modal-panel,
html[data-theme="light"] .modal-head,
html[data-theme="light"] .history-table th { background: #ffffff; }
html[data-theme="light"] .modal-backdrop { background: rgba(31,41,55,.42); }
html[data-theme="light"] .button-primary,
html[data-theme="light"] .add-tool,
html[data-theme="light"] .arm-strategy:not(.is-running) { border-color: #111827; color: #ffffff; background: #111827; box-shadow: 0 8px 22px rgba(17,24,39,.16); }
html[data-theme="light"] .button-primary:hover,
html[data-theme="light"] .add-tool:hover,
html[data-theme="light"] .arm-strategy:not(.is-running):hover { background: #273244; }
html[data-theme="light"] .api-connect-button { color: #ffffff; background: #273244; }
html[data-theme="light"] .reset-digits,
html[data-theme="light"] .trade-history-head button { border-color: rgba(15,23,42,.28); color: var(--text); background: #f2f4f7; }
html[data-theme="light"] .reset-digits:hover:not(:disabled),
html[data-theme="light"] .trade-history-head button:hover:not(:disabled) { border-color: #667085; background: #e8ebef; }
html[data-theme="light"] .digit-switch { border-color: rgba(15,23,42,.28); background: rgba(15,23,42,.055); box-shadow: none; }
html[data-theme="light"] .digit-switch:hover { border-color: #111827; background: rgba(15,23,42,.1); }
html[data-theme="light"] .digit-switch.muted { color: #98a2b3; background: #f2f4f7; }
html[data-theme="light"] .strategy-head > b.active { color: #ffffff; }
html[data-theme="light"] .session-row strong,
html[data-theme="light"] .session-row b,
html[data-theme="light"] .trade-route i,
html[data-theme="light"] .history-table .digit-cell { color: var(--text); }
html[data-theme="light"] .toast { background: rgba(255,255,255,.98); box-shadow: 0 14px 38px rgba(15,23,42,.18); }
html[data-theme="light"] .toast.trade { color: var(--text); }
html[data-theme="light"] .history-live { background: rgba(9,146,80,.055); }
@media (max-width: 640px) {
  html[data-theme="light"] .history-table tr { background: #ffffff; }
}

/* Product-grade workspace pass */
.product-ui { letter-spacing: -.006em; }
.product-ui .app-header {
  min-height: 64px;
  padding: 10px clamp(16px, 2.4vw, 36px);
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--board) 94%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,.025);
}
.product-ui .brand { gap: 10px; font-size: 16px; letter-spacing: -.025em; }
.product-ui .brand-mark { width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 10px; background: var(--text); }
.product-ui .brand-mark i { background: var(--board); }
.product-ui .account-summary { border-radius: 10px; background: var(--panel); }
.product-ui .account-switch select { height: 38px; }
.product-ui .balance-pill { min-width: 124px; display: grid; place-items: center; }
.product-ui .status-pill { min-height: 38px; border-radius: 10px; background: var(--panel); font-size: 9px; }
.product-ui .button { min-height: 40px; border-radius: 10px; }
.product-ui .button-primary { border-color: #10a37f; color: #fff; background: #10a37f; box-shadow: none; }
.product-ui .button-primary:hover { border-color: #0d8f70; background: #0d8f70; }
.product-ui .icon-button { width: 40px; height: 40px; border-color: var(--line); border-radius: 10px; background: var(--panel); }
.product-ui .board { min-height: calc(100vh - 104px); padding: 18px clamp(12px, 1.7vw, 26px) 76px; background: var(--board); }
.product-ui .add-tool { height: 46px; border-color: #10a37f; color: #fff; background: #10a37f; box-shadow: 0 10px 26px rgba(0,0,0,.26); }
.product-ui .add-tool:hover { background: #0d8f70; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.product-ui.has-widgets .add-tool { width: 48px; padding: 0; justify-content: center; gap: 0; overflow: hidden; font-size: 0; }
.product-ui.has-widgets .add-tool span { font-size: 24px; }
.product-ui .widget { border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); }
.product-ui .widget-header { min-height: 56px; padding: 10px 14px; }
.product-ui .widget-index { width: 30px; height: 30px; border-color: rgba(16,163,127,.35); color: #6fe3c0; background: rgba(16,163,127,.1); }
.product-ui .widget-title { font-size: 15px; }
.product-ui .widget-toolbar { min-height: 58px; padding: 9px 14px; background: color-mix(in srgb, var(--panel) 76%, var(--board)); }
.product-ui .widget-toolbar select,
.product-ui .widget-toolbar label > .number-field { height: 36px; border-color: var(--line); background: var(--panel); }
.product-ui .sample-state { padding: 7px 9px; border: 1px solid var(--line-soft); border-radius: 8px; }
.product-ui .frequency-widget .widget-body { gap: 12px; padding: 12px; }
.product-ui .digit-filter { min-height: 56px; padding: 9px 11px; border-color: var(--line); border-radius: 12px; background: var(--panel); }
.product-ui .reset-digits { border-color: var(--line); background: var(--panel-2); }
.product-ui .digit-switch { height: 38px; border-color: var(--line); background: var(--panel-2); box-shadow: none; }
.product-ui .digit-switch:hover { border-color: #777; background: color-mix(in srgb, var(--panel-2) 80%, var(--text)); }
.product-ui .digit-switch > i { background: #10a37f; box-shadow: none; }
.product-ui .frequency-workspace { grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; }
.product-ui .frequency-chart-panel,
.product-ui .strategy-panel { border-color: var(--line); border-radius: 14px; background: var(--panel); }
.product-ui .panel-heading { min-height: 56px; padding: 11px 14px; }
.product-ui .panel-heading span { font-size: 12px; }
.product-ui .panel-heading small { margin-top: 5px; font-size: 8px; }
.product-ui .frequency-chart { height: 410px; padding: 12px 16px 8px 8px; }
.product-ui .strategy-panel { padding: 12px; gap: 9px; }
.product-ui .strategy-head { min-height: 32px; }
.product-ui .strategy-head span { font-size: 12px; }
.product-ui .strategy-head small { margin-top: 4px; font-size: 8px; }
.product-ui .strategy-head > b { padding: 5px 8px; border-radius: 7px; font-size: 7px; }
.product-ui .signal-strip { padding: 10px 11px; border-left: 3px solid #10a37f; border-radius: 9px; background: var(--panel-2); }
.product-ui .signal-strip strong { font-size: 11px; }
.product-ui .signal-strip span { margin-top: 5px; font-size: 8px; }
.product-ui .control-section { border-color: var(--line); border-radius: 10px; background: color-mix(in srgb, var(--panel) 86%, var(--board)); }
.product-ui .control-section-head { min-height: 38px; padding: 8px 10px; }
.product-ui .control-section-head span { font-size: 10px; }
.product-ui .control-section-head small { font-size: 7px; }
.product-ui .execution-grid,
.product-ui .risk-limit-grid { padding: 8px; gap: 7px; }
.product-ui .execution-grid input,
.product-ui .risk-limit-grid input,
.product-ui .input-with-unit { height: 34px; border-color: var(--line); background: var(--panel); }
.product-ui .risk-limit-section { background: var(--panel-2); }
.product-ui .risk-limit-grid label { padding: 7px 7px 7px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
.product-ui .risk-limit-grid label::before { inset: 7px auto 7px 6px; }
.product-ui .risk-limit-grid input { height: 30px; padding-inline: 0; border: 0; border-radius: 0; background: transparent; font-size: 11px; }
.product-ui .session-row > div { min-height: 42px; padding: 8px 10px; border-color: var(--line); background: color-mix(in srgb, var(--panel) 82%, var(--board)); }
.product-ui .session-row strong,
.product-ui .session-row b { font-size: 9px; }
.product-ui .arm-strategy { height: 46px; border-color: #10a37f; color: #fff; background: #10a37f; box-shadow: none; }
.product-ui .arm-strategy:hover:not(:disabled) { border-color: #0d8f70; background: #0d8f70; }
.product-ui .arm-strategy.is-running { border-color: var(--rose); background: var(--rose); }
.product-ui .trade-status { min-height: 28px; padding: 0 2px; font-size: 8px; }
.product-ui .trade-history { padding-top: 2px; }
.product-ui .trade-history-head { padding: 8px 0 6px; }
.product-ui .trade-history-head span { font-size: 9px; }
.product-ui .trade-history-head button { min-height: 28px; border-color: var(--line); border-radius: 7px; background: var(--panel-2); }
.product-ui .modal-panel { border-radius: 16px; box-shadow: 0 28px 90px rgba(0,0,0,.42); }
.product-ui .settings-panel form { padding: 22px; }
.product-ui .api-auth-card,
.product-ui .auth-note { border-color: var(--line); background: var(--panel-2); }
.product-ui .api-connect-button { border-color: var(--line); background: var(--panel-2); }

html[data-theme="light"] .product-ui .app-header { background: rgba(255,255,255,.96); box-shadow: 0 1px 0 rgba(15,23,42,.06); }
html[data-theme="light"] .product-ui .brand-mark { background: #111827; }
html[data-theme="light"] .product-ui .brand-mark i { background: #fff; }
html[data-theme="light"] .product-ui .button-primary,
html[data-theme="light"] .product-ui .add-tool,
html[data-theme="light"] .product-ui .arm-strategy:not(.is-running) { border-color: #10a37f; color: #fff; background: #10a37f; }
html[data-theme="light"] .product-ui .widget,
html[data-theme="light"] .product-ui .digit-filter,
html[data-theme="light"] .product-ui .frequency-chart-panel,
html[data-theme="light"] .product-ui .strategy-panel { background: #fff; }
html[data-theme="light"] .product-ui .widget-toolbar { background: #f7f7f5; }
html[data-theme="light"] .product-ui .digit-switch,
html[data-theme="light"] .product-ui .control-section,
html[data-theme="light"] .product-ui .session-row > div { background: #f7f7f5; }
html[data-theme="light"] .product-ui .signal-strip,
html[data-theme="light"] .product-ui .risk-limit-section { background: #f2f3f1; }
html[data-theme="light"] .product-ui .risk-limit-grid label { background: #fff; }
html[data-theme="light"] .product-ui .input-with-unit { background: #fff; }

@media (max-width: 950px) {
  .product-ui .frequency-workspace { grid-template-columns: 1fr; }
  .product-ui .frequency-chart { height: 360px; }
}
@media (max-width: 640px) {
  .product-ui .app-header { min-height: 58px; }
  .product-ui .board { padding: 10px 10px 70px; }
  .product-ui .widget-header { min-height: 50px; padding: 8px 11px; }
  .product-ui .widget-toolbar { padding: 8px 11px; }
  .product-ui .frequency-widget .widget-body { padding: 8px; gap: 8px; }
  .product-ui .digit-filter { padding: 8px; }
  .product-ui .frequency-chart { height: 320px; padding: 8px 7px 5px 2px; }
  .product-ui .strategy-panel { padding: 10px; gap: 8px; grid-template-rows: none; }
  .product-ui .execution-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-ui .execution-grid input { min-width: 0; }
  .product-ui .risk-limit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-ui.has-widgets .add-tool { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Institutional terminal redesign */
.product-ui {
  min-width: 320px;
  color: var(--text);
  background: var(--board);
  font-size: 14px;
  letter-spacing: -.012em;
}
.product-ui .app-header {
  min-height: 68px;
  padding: 10px clamp(16px, 2.6vw, 42px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--void) 92%, transparent);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.product-ui .brand { gap: 12px; }
.product-ui .brand-mark {
  width: 34px;
  height: 34px;
  padding: 8px;
  border: 1px solid rgba(141,156,255,.28);
  border-radius: 11px;
  background: linear-gradient(145deg, #2b335d, #171c31);
  box-shadow: inset 0 1px rgba(255,255,255,.1);
}
.product-ui .brand-mark i { background: #bec6ff; }
.product-ui .brand-copy { display: grid; gap: 3px; }
.product-ui .brand-copy strong { font-size: 15px; line-height: 1; letter-spacing: -.025em; }
.product-ui .brand-copy small { color: var(--muted); font: 500 8px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.product-ui .header-actions { gap: 8px; }
.product-ui .account-summary {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.product-ui .account-switch select { height: 40px; font-size: 10px; }
.product-ui .balance-pill { min-width: 132px; padding-inline: 14px; font-size: 11px; }
.product-ui .status-pill { min-height: 40px; min-width: 88px; border-radius: 11px; background: var(--panel); font-size: 9px; }
.product-ui .button { min-height: 42px; border-radius: 11px; font-size: 12px; }
.product-ui .button-primary,
.product-ui .api-connect-button { border-color: var(--accent); color: #fff; background: var(--accent); box-shadow: none; }
.product-ui .button-primary:hover,
.product-ui .api-connect-button:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.product-ui .icon-button { width: 42px; height: 42px; border-color: var(--line); border-radius: 11px; background: var(--panel); }
.product-ui .theme-toggle svg { width: 17px; height: 17px; stroke-linecap: round; stroke-linejoin: round; }
.product-ui .theme-icon-moon { display: none; }
html[data-theme="light"] .product-ui .theme-icon-sun { display: none; }
html[data-theme="light"] .product-ui .theme-icon-moon { display: block; }

.product-ui .board {
  min-height: calc(100vh - 108px);
  padding: clamp(14px, 2vw, 28px) clamp(12px, 2.6vw, 42px) 28px;
  background:
    radial-gradient(circle at 50% -180px, rgba(124,140,255,.08), transparent 420px),
    var(--board);
}
.product-ui .widget-grid { gap: 18px; }
.product-ui .widget {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.product-ui .widget-header {
  min-height: 66px;
  padding: 12px 18px;
  border-bottom-color: var(--line-soft);
}
.product-ui .widget-title-wrap { gap: 12px; }
.product-ui .widget-index {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #c7ceff;
  background: rgba(124,140,255,.14);
  font-size: 9px;
}
.product-ui .widget-title { font-size: 16px; font-weight: 650; }
.product-ui .widget-subtitle { display: block; margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.product-ui .drag-handle { color: var(--muted); }
.product-ui .widget-toolbar {
  min-height: 70px;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: minmax(138px, 180px) minmax(160px, 210px) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  border-bottom-color: var(--line-soft);
  background: color-mix(in srgb, var(--panel) 74%, var(--void));
}
.product-ui .widget-toolbar label > span { font-size: 8px; letter-spacing: .08em; }
.product-ui .widget-toolbar select,
.product-ui .widget-toolbar label > .number-field { width: 100%; max-width: none; height: 39px; border-color: var(--line); border-radius: 9px; background: var(--panel); }
.product-ui .widget-toolbar select { font-size: 11px; }
.product-ui .number-field input { width: 100%; font-size: 11px; }
.product-ui .sample-state {
  justify-self: end;
  align-self: end;
  min-height: 39px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  font-size: 9px;
}
.product-ui .sample-state.active i { background: var(--accent); box-shadow: 0 0 10px rgba(124,140,255,.55); }
.product-ui .frequency-widget .widget-body { gap: 12px; padding: 14px; }

.product-ui .digit-filter {
  min-height: 64px;
  padding: 10px 12px 10px 16px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  border-color: var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 88%, var(--panel-2));
}
.product-ui .filter-heading > div { display: block; }
.product-ui .filter-heading span { font-size: 11px; }
.product-ui .filter-heading small { display: block; max-width: 400px; font-size: 8px; line-height: 1.45; }
.product-ui .reset-digits { min-height: 34px; border-color: var(--line); border-radius: 8px; background: var(--panel-2); }
.product-ui .digit-switches { grid-template-columns: repeat(10, 42px); gap: 6px; }
.product-ui .digit-switch {
  width: 42px;
  height: 42px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: none;
}
.product-ui .digit-switch:hover { border-color: var(--accent); background: rgba(124,140,255,.1); transform: translateY(-1px); }
.product-ui .digit-switch > i { background: var(--accent); box-shadow: none; }
.product-ui .digit-switch strong { font-size: 15px; }
.product-ui .digit-switch.muted { border-color: transparent; color: #5f6877; background: color-mix(in srgb, var(--void) 62%, var(--panel)); }

.product-ui .frequency-workspace { grid-template-columns: minmax(0, 1fr) minmax(360px, 410px); gap: 12px; align-items: stretch; }
.product-ui .frequency-chart-panel,
.product-ui .strategy-panel { border-color: var(--line); border-radius: 15px; background: var(--panel); }
.product-ui .panel-heading { min-height: 70px; padding: 13px 18px; border-bottom-color: var(--line-soft); }
.product-ui .panel-heading span { font-size: 13px; }
.product-ui .panel-heading small { margin-top: 5px; font-size: 9px; }
.product-ui .chart-heading-meta { display: flex; align-items: center; gap: 12px; }
.product-ui .current-tick-readout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 500 9px/1 var(--mono) !important;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.product-ui .current-tick-readout b { min-width: 34px; color: var(--text); font: 600 24px/1 var(--mono); text-align: center; }
.product-ui .direction-tag { color: var(--muted) !important; }
.product-ui .frequency-chart { height: 470px; padding: 16px 20px 12px 10px; }

.product-ui .strategy-panel,
.product-ui.multi-widget .strategy-panel {
  padding: 17px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.product-ui .strategy-head { min-height: 38px; }
.product-ui .strategy-head span { font-size: 14px; font-weight: 650; }
.product-ui .strategy-head small { margin-top: 5px; font-size: 8px; }
.product-ui .strategy-head > b { padding: 6px 9px; border-color: var(--line); border-radius: 7px; font-size: 8px; letter-spacing: .08em; }
.product-ui .strategy-head > b.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.product-ui .signal-strip {
  padding: 14px;
  border: 1px solid rgba(124,140,255,.22);
  border-left: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(124,140,255,.105), rgba(124,140,255,.025));
}
.product-ui .signal-eyebrow { margin: 0 0 7px !important; color: var(--blue) !important; font: 600 8px/1 var(--mono) !important; letter-spacing: .1em; text-transform: uppercase; }
.product-ui .signal-strip strong { font-size: 14px; letter-spacing: -.02em; }
.product-ui .momentum-rail { height: 8px; margin-top: 13px; display: flex; gap: 3px; overflow: hidden; border-radius: 999px; background: var(--void); }
.product-ui .momentum-rail i { min-width: 2px; transition: flex-basis .25s ease; }
.product-ui .momentum-rail i:first-child { background: #6577e8; }
.product-ui .momentum-rail i:last-child { background: #9b79dc; }
.product-ui .signal-strip [data-side-counts] { margin-top: 8px; font-size: 9px; }
.product-ui .session-row { gap: 8px; }
.product-ui .session-row > div {
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  align-content: center;
  justify-content: start;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--panel-2);
}
.product-ui .session-row > div span { font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.product-ui .session-row strong,
.product-ui .session-row b { margin-top: 6px; font-size: 14px; text-align: left; }
.product-ui .control-section { overflow: visible; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; background: transparent; }
.product-ui .risk-limit-section { background: transparent; }
.product-ui .control-section-head { min-height: 45px; padding: 11px 0 7px; border: 0; }
.product-ui .control-section-head span { font-size: 11px; }
.product-ui .control-section-head small { margin-top: 3px; font-size: 8px; }
.product-ui .control-section-head > i { border-color: var(--line); font-size: 7px; }
.product-ui .execution-grid,
.product-ui .risk-limit-grid { padding: 0; gap: 9px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-ui .execution-grid label,
.product-ui .risk-limit-grid label { gap: 6px; padding: 0; border: 0; background: transparent; }
.product-ui .execution-grid label > span:first-child,
.product-ui .risk-limit-grid label > span:first-child { font-size: 8px; }
.product-ui .risk-limit-grid label::before { display: none; }
.product-ui .execution-grid input,
.product-ui .risk-limit-grid input,
.product-ui .input-with-unit {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 11px;
}
.product-ui .risk-limit-grid input { padding: 0 10px; }
.product-ui .input-with-unit input { height: 40px; border: 0; background: transparent; }
.product-ui .input-with-unit em { padding-right: 10px; font-size: 8px; }
.product-ui .arm-strategy {
  flex: 0 0 auto;
  height: 50px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(84,101,220,.22);
  font-size: 13px;
}
.product-ui .arm-strategy:hover:not(:disabled) { background: var(--accent-strong); }
.product-ui .arm-strategy.is-running { background: var(--rose); box-shadow: 0 8px 24px rgba(255,107,122,.16); }
.product-ui .trade-status { min-height: 20px; padding: 0 2px; font-size: 9px; line-height: 1.5; }
.product-ui .trade-history { overflow: visible; padding-top: 2px; border-top-color: var(--line-soft); }
.product-ui .trade-history-head { padding: 11px 0 8px; }
.product-ui .trade-history-head span { font-size: 10px; }
.product-ui .trade-history-head button { min-height: 34px; padding: 0 11px; border-color: var(--line); border-radius: 8px; background: var(--panel-2); font-size: 8px; }
.product-ui .trade-history > div:last-child,
.product-ui.multi-widget .trade-history > div:last-child { max-height: none; overflow: visible; }
.product-ui .trade-row { min-height: 38px; grid-template-columns: 58px 38px minmax(76px, 1fr) minmax(82px, 1fr); gap: 8px; font-size: 9px; }
.product-ui .trade-route i { font-size: 11px; }

.product-ui .add-tool-wrap {
  position: static;
  padding: 18px 0 2px;
  display: flex;
  justify-content: center;
}
.product-ui .add-tool,
.product-ui.has-widgets .add-tool {
  width: auto;
  height: 44px;
  padding: 0 17px;
  gap: 9px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel);
  box-shadow: none;
  font-size: 11px;
}
.product-ui .add-tool:hover { border-color: var(--accent); background: rgba(124,140,255,.08); box-shadow: none; }
.product-ui.has-widgets .add-tool span { font-size: 19px; }
.product-ui footer { min-height: 40px; color: var(--muted); background: var(--void); font-size: 9px; }

.product-ui .modal-backdrop { background: rgba(4,6,11,.78); }
.product-ui .modal-panel { border-color: var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 30px 100px rgba(0,0,0,.52); }
.product-ui .modal-head { padding: 20px 22px; border-bottom-color: var(--line); background: color-mix(in srgb, var(--panel) 94%, transparent); }
.product-ui .history-close-button { width: auto; min-width: 64px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 10px; font-weight: 700; }
.product-ui .settings-panel form { padding: 22px; }
.product-ui .auth-note,
.product-ui .api-auth-card { border-color: var(--line); border-radius: 12px; background: var(--panel-2); }
.product-ui .history-table th { background: var(--void); }

.product-ui.multi-widget .widget-grid { grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr)); }
@container (max-width: 1120px) {
  .product-ui .frequency-workspace,
  .product-ui.multi-widget .frequency-workspace { grid-template-columns: 1fr; }
  .product-ui .frequency-chart { height: 360px; }
}

html[data-theme="light"] .product-ui .app-header { background: rgba(255,255,255,.94); }
html[data-theme="light"] .product-ui .brand-mark { border-color: rgba(89,107,221,.2); background: linear-gradient(145deg, #6879e6, #4c5fcf); }
html[data-theme="light"] .product-ui .brand-mark i { background: #fff; }
html[data-theme="light"] .product-ui .widget-toolbar,
html[data-theme="light"] .product-ui .digit-filter { background: #f8f9fc; }
html[data-theme="light"] .product-ui .signal-strip { background: linear-gradient(145deg, rgba(89,107,221,.09), rgba(89,107,221,.025)); }
html[data-theme="light"] .product-ui .risk-limit-section,
html[data-theme="light"] .product-ui .risk-limit-grid label { background: transparent; }
html[data-theme="light"] .product-ui .button-primary,
html[data-theme="light"] .product-ui .api-connect-button,
html[data-theme="light"] .product-ui .arm-strategy:not(.is-running) { border-color: var(--accent); background: var(--accent); }
html[data-theme="light"] .product-ui .add-tool,
html[data-theme="light"] .product-ui.has-widgets .add-tool { border-color: var(--line); color: var(--text); background: var(--panel); box-shadow: none; }
html[data-theme="light"] .product-ui .add-tool:hover { border-color: var(--accent); background: rgba(89,107,221,.07); }
html[data-theme="light"] .product-ui .history-table th { color: var(--muted); background: #f2f4f8; }

@media (max-width: 760px) {
  .product-ui.multi-widget .widget-grid { display: grid; grid-template-columns: minmax(0,1fr); overflow: visible; scroll-snap-type: none; }
  .product-ui.multi-widget .widget { width: 100%; flex: none; scroll-snap-align: none; }
  .product-ui .app-header { min-height: 58px; padding: 8px 10px; }
  .product-ui .brand-copy small { display: none; }
  .product-ui .brand-mark { width: 32px; height: 32px; }
  .product-ui .header-actions { flex: 1; justify-content: flex-end; gap: 6px; }
  .product-ui .status-pill { min-width: 38px; width: 38px; padding: 0; }
  .product-ui .status-pill span { display: none; }
  .product-ui .button { min-height: 40px; padding-inline: 12px; }
  .product-ui .icon-button { width: 40px; height: 40px; }
  .product-ui .account-summary.has-account { order: 10; width: 100%; border-radius: 10px; }
  .product-ui .account-switch select { width: 100%; }
  .product-ui .balance-pill { min-width: 124px; }
  .product-ui .board { padding: 8px 8px 18px; }
  .product-ui .widget { border-radius: 15px; }
  .product-ui .widget-header { min-height: 58px; padding: 10px 12px; }
  .product-ui .widget-title { font-size: 14px; }
  .product-ui .widget-subtitle { font-size: 8px; }
  .product-ui .widget-toolbar { min-height: 108px; padding: 10px 12px; grid-template-columns: 1fr 1fr; gap: 9px; }
  .product-ui .sample-state { grid-column: 1 / -1; justify-self: stretch; justify-content: flex-start; min-height: 34px; }
  .product-ui .frequency-widget .widget-body { gap: 8px; padding: 8px; }
  .product-ui .digit-filter { padding: 10px; grid-template-columns: 1fr; gap: 9px; }
  .product-ui .filter-heading { width: 100%; }
  .product-ui .filter-heading small { display: none; }
  .product-ui .digit-switches { width: 100%; grid-template-columns: repeat(5, minmax(44px, 1fr)); gap: 7px; }
  .product-ui .digit-switch { width: 100%; height: 44px; }
  .product-ui .frequency-workspace,
  .product-ui.multi-widget .frequency-workspace { grid-template-columns: 1fr; gap: 8px; }
  .product-ui .panel-heading { min-height: 64px; padding: 11px 12px; }
  .product-ui .chart-heading-meta { gap: 7px; }
  .product-ui .direction-tag { display: none !important; }
  .product-ui .current-tick-readout { font-size: 8px !important; }
  .product-ui .current-tick-readout b { min-width: 28px; font-size: 22px; }
  .product-ui .frequency-chart,
  .product-ui.multi-widget .frequency-chart { height: 330px; padding: 10px 8px 8px 2px; }
  .product-ui .strategy-panel,
  .product-ui.multi-widget .strategy-panel { min-height: 0; padding: 14px; gap: 12px; }
  .product-ui .strategy-head span { font-size: 13px; }
  .product-ui .signal-strip { padding: 13px; }
  .product-ui .signal-strip strong { font-size: 13px; }
  .product-ui .session-row > div { min-height: 64px; }
  .product-ui .session-row strong,
  .product-ui .session-row b { font-size: 15px; }
  .product-ui .execution-grid,
  .product-ui .risk-limit-grid { gap: 9px; }
  .product-ui .execution-grid input,
  .product-ui .risk-limit-grid input,
  .product-ui .input-with-unit { height: 46px; font-size: 12px; }
  .product-ui .input-with-unit input { height: 44px; }
  .product-ui .arm-strategy { height: 52px; font-size: 14px; }
  .product-ui .trade-status { font-size: 10px; }
  .product-ui .trade-history-head span { font-size: 11px; }
  .product-ui .trade-history-head button { min-height: 36px; }
  .product-ui .trade-row { min-height: 43px; grid-template-columns: 58px 38px minmax(72px, 1fr) minmax(78px, 1fr); font-size: 9px; }
  .product-ui .add-tool-wrap { padding: 12px 0 0; }
  .product-ui .add-tool,
  .product-ui.has-widgets .add-tool { width: 100%; height: 48px; justify-content: center; font-size: 12px; }
  .product-ui .modal { align-items: end; padding: 8px; }
  .product-ui .modal-panel { width: 100%; max-height: calc(100vh - 16px); border-radius: 18px; }
  .product-ui .history-panel { width: 100%; }
  .product-ui .history-panel .modal-head { padding: 16px; }
  .product-ui .history-panel .modal-head { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .product-ui .history-panel .modal-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .product-ui .history-panel .modal-actions button { width: 100%; min-height: 42px; }
  .product-ui .history-table-wrap { height: calc(100dvh - 190px); min-height: 220px; padding: 8px; }
  .product-ui .history-table tr { border-color: var(--line); background: var(--panel-2); }
  .product-ui .history-table td { min-height: 42px; padding: 9px 11px; }
  .product-ui .history-table .digit-cell { font-size: 24px; }
  .product-ui .toast-region { top: 62px; right: 8px; left: 8px; justify-items: stretch; }
  .product-ui .toast { width: 100%; max-width: none; }
}

@media (max-width: 390px) {
  .product-ui .brand-copy { display: none; }
  .product-ui .button-primary { padding-inline: 10px; font-size: 11px; }
  .product-ui .widget-index { width: 31px; height: 31px; }
  .product-ui .execution-grid,
  .product-ui .risk-limit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
