:root {
  color-scheme: dark;
  font: 13px/1.4 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #d6dee8;
  background: #0b1017;
  font-synthesis: none;
  --surface: #111923;
  --border: #26313f;
  --muted: #8b9bad;
  --accent: #56d6a0;
  --red: #f38787;
  --amber: #e7be72;
  --blue: #91b9ee;
}
* {box-sizing: border-box}
body {margin: 0}
button, input, select, textarea {font: inherit}
button, a, input, select {touch-action: manipulation}
button {cursor: pointer}
button:disabled {cursor: default; opacity: .5}
a {color: inherit}
h1, h2, h3, p {margin-top: 0}
h1 {font-size: 17px; font-weight: 650; line-height: 1.3; margin-bottom: 0}
h2 {font-size: 12px; font-weight: 650; margin-bottom: 0}
p:last-child {margin-bottom: 0}
[hidden] {display: none !important}
:focus-visible {outline: 2px solid var(--blue); outline-offset: 2px}
input, select, textarea {min-height: 30px; background: #0c131d; border: 1px solid #354252; border-radius: 3px; color: #e5eaf0; padding: 5px 8px; max-width: 100%}
input:disabled, select:disabled {opacity: .65}
input[type=checkbox] {width: 15px; height: 15px; min-height: 15px; accent-color: var(--accent); margin: 0; flex-shrink: 0}
label {display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #b7c4d3}
.sr-only {position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0}
.muted {color: var(--muted)}
.small {font-size: 11px}
.positive {color: var(--accent)}
.negative {color: var(--red)}
.warning {color: var(--amber)}
.mono, .numeric, .metric-value, .big-number {font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums}
.eyebrow {font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--muted); margin-bottom: 0}
.button {border: 1px solid transparent; border-radius: 3px; padding: 5px 10px; min-height: 30px; font-weight: 600; font-size: 11px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px}
.button.primary {background: #3ca77c; border-color: #4dc591; color: #071a12}
.button.primary:hover {background: #59cb9d}
.button.subtle {background: #172231; color: #cbd7e5; border-color: #354354}
.button.subtle:hover {background: #223248}
.button.compact {padding: 4px 8px}
.button.wide {width: 100%}
.badge {display: inline-flex; align-items: center; border: 1px solid #334255; background: #192332; color: #aebed0; border-radius: 3px; padding: 2px 6px; font-size: 10px; font-weight: 600; line-height: 1.35; white-space: nowrap}
.badge.live, .badge.good {color: #7bdfb2; border-color: #28513f; background: #12291f}
.badge.warn {color: var(--amber); border-color: #5b4930; background: #2c251b}
.badge.bad {color: var(--red); border-color: #603438; background: #2b1d23}
.notice {border: 1px solid #30465d; background: #132133; color: #b5cbe3; border-radius: 3px; padding: 8px 10px; font-size: 11px; margin-bottom: 10px; overflow-wrap: anywhere}
.notice.error {border-color: #60363e; background: #2b1a22; color: #ffbaba}
.notice.warning {border-color: #584a31; background: #272218; color: var(--amber)}
.error-text {min-height: 1.4em; color: var(--red); font-size: 12px; margin: 6px 0}
.brand-mark {color: var(--accent); font-size: 24px; line-height: 1}
.brand {display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-decoration: none; white-space: nowrap}
.brand b {color: var(--accent)}
.topbar {height: 46px; padding: 0 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 20px; background: #101720; position: sticky; top: 0; z-index: 30}
.account-name {font: 11px "SFMono-Regular", Consolas, monospace; color: var(--muted); border-left: 1px solid #34404f; padding-left: 20px}
.header-controls {display: flex; gap: 8px; align-items: center; margin-left: auto}
.header-controls select {border-color: transparent; background: transparent; min-width: 76px; font-size: 12px}
.app-layout {width: 100%; min-width: 0}
.navigation {height: 37px; padding: 0 16px; position: sticky; top: 46px; background: #101720; border-bottom: 1px solid var(--border); display: flex; align-items: stretch; gap: 8px; z-index: 25}
.navigation button {border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 0 13px; display: flex; gap: 7px; align-items: center; font-size: 12px; font-weight: 500}
.navigation button>span {font-size: 15px; width: 16px; text-align: center}
.navigation button[aria-current=page] {color: #e7eef7; border-bottom-color: var(--accent); background: #17231f}
.navigation button:hover {color: #fff; background: #182331}
.nav-footnote {margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 10px; white-space: nowrap}
.nav-reference {letter-spacing: .07em; color: #6e8094}
main {padding: 12px 16px; min-width: 0}
.page-heading {display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; min-height: 26px; gap: 10px}
.page-heading>div {display: flex; align-items: baseline; gap: 12px}
.page-heading .eyebrow {padding-right: 12px; border-right: 1px solid #33404e}
#live-status {margin-left: auto}
.panel {background: var(--surface); border: 1px solid var(--border); border-radius: 4px; margin-bottom: 10px; min-width: 0}
.panel-heading {display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 35px; padding: 7px 10px; border-bottom: 1px solid var(--border)}
.panel-heading p {margin: 3px 0 0}
.heading-unit {font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 5px}
.pnl-hero {border-top: 2px solid #42675c}
.pnl-strip {display: grid; grid-template-columns: 1.2fr repeat(4,minmax(0,1fr))}
.pnl-strip>div {padding: 12px 14px; border-right: 1px solid var(--border); min-width: 0}
.pnl-strip>div:last-child {border: 0}
.metric-label {font-size: 10px; color: var(--muted); margin-bottom: 5px; white-space: nowrap}
.metric-value {font-size: 20px; line-height: 1.3; overflow-wrap: anywhere}
.big-number {font-size: 24px; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere}
.pnl-window {display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 10px; color: var(--muted); border-top: 1px solid var(--border); padding: 6px 10px}
.panel-note {padding: 6px 10px; margin: 0}
.overview-grid {display: grid; grid-template-columns: minmax(0,1fr) minmax(340px,.42fr); gap: 10px}
.service-name {text-transform: capitalize; font-weight: 500}
.empty {padding: 18px 12px; border: 1px solid var(--border); border-radius: 3px; text-align: center; color: var(--muted); font-size: 12px}
.empty p {margin-top: 6px}
.empty-cell {text-align: center; padding: 20px 12px; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: normal}
.table-wrap {overflow: auto; border: 1px solid var(--border); border-radius: 3px; scrollbar-color: #3b4b5e #101720; scrollbar-width: thin; overscroll-behavior-x: contain}
.panel>.table-wrap {border: 0; border-radius: 0 0 3px 3px}
table {border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums}
thead {color: #9dafc4; text-align: left}
th {font-size: 10px; font-weight: 500; padding: 0 9px; height: 32px; white-space: nowrap; border-bottom: 1px solid #354151; background: #17212e}
thead th {position: sticky; top: 0; z-index: 3}
td {padding: 5px 9px; border-bottom: 1px solid #202c3a; white-space: nowrap; height: 32px}
tbody tr {background: var(--surface)}
tbody tr:nth-child(even) {background: #121d29}
tbody tr:hover {background: #1b2a3a}
tbody tr:last-child td {border-bottom: 0}
.numeric {text-align: right}
th.numeric {font-family: inherit}
.wrap {white-space: normal; min-width: 180px; max-width: 440px}
.cell-sub {display: block; color: var(--muted); font-size: 10px; margin-top: 2px; font-family: inherit}
.symbol-button {font: 600 12px "SFMono-Regular", Consolas, monospace; background: none; border: 0; padding: 2px 0; color: #c4d9f2; min-height: 24px; text-align: left}
.symbol-button:hover {color: var(--accent); text-decoration: underline}
.symbol-cell {font-weight: 600; color: #c4d9f2}
.sort-button {font: inherit; color: inherit; border: 0; padding: 6px 0; background: transparent; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 28px}
.sort-button:hover {color: #e8f1fc}
.sort-arrow {font-size: 12px; color: #647a92}
th[aria-sort=ascending], th[aria-sort=descending] {color: #d5e6fa; background: #203147}
th[aria-sort=ascending] .sort-arrow, th[aria-sort=descending] .sort-arrow {color: var(--accent)}
.builders-table {max-height: 410px}
/* A changing order phase or quantity must not move neighboring columns. */
.builders-table table {table-layout: fixed; min-width: 1140px}
.builders-table th:nth-child(1) {width: 130px}
.builders-table th:nth-child(2) {width: 135px}
.builders-table th:nth-child(3), .builders-table th:nth-child(4), .builders-table th:nth-child(5) {width: 110px}
.builders-table th:nth-child(6) {width: 270px}
.builders-table th:nth-child(8) {width: 90px}
.builders-table td {white-space: normal; overflow-wrap: anywhere}
.builders-table .symbol-button {max-width: 100%; overflow-wrap: anywhere}
.positions-table {max-height: 300px}
.services-table th, .services-table td {padding-left: 7px; padding-right: 7px}
.markets-table {max-height: calc(100dvh - 246px); min-height: 100px}
.toolbar {display: flex; gap: 14px; align-items: end; margin-bottom: 10px; flex-wrap: wrap}
.toolbar .search-label {width: 260px; max-width: 100%}
.toolbar .search-label input {width: 100%}
.inline-check {display: flex; flex-direction: row; align-items: center; gap: 6px; min-height: 30px; font-size: 11px}
.market-summary {display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 10px; color: var(--muted)}
#more-markets, #more-audit {margin-top: 8px; max-width: 240px; display: flex; margin-left: auto; margin-right: auto}
.settings-workspace {display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,1fr); gap: 12px; align-items: start}
.settings-edit-pane, .settings-reference-pane {min-width: 0}
.settings-reference-pane {position: sticky; top: 95px}
.settings-overview .panel-heading {align-items: start}
.settings-overview>.small {padding: 0 10px; font-size: 10px; color: var(--muted)}
.settings-matrix th:first-child {position: sticky; left: 0; z-index: 2; min-width: 145px; max-width: 205px; white-space: normal; box-shadow: 1px 0 var(--border)}
.settings-matrix thead th:first-child {z-index: 4}
.settings-matrix tbody th {border-bottom: 1px solid var(--border); color: #bdccdc; background: #15202c; font-weight: 500; padding: 5px 9px}
.settings-matrix td {min-width: 100px}
.settings-matrix td .cell-sub, .settings-matrix tbody th .cell-sub {display: inline; font-size: 9px; margin-left: 8px}
.settings-matrix .override-cell {background: #172e28; color: #7bdfb2; font-weight: 600}
.settings-matrix .override-cell .cell-sub {color: #a1bcae; font-weight: 400}
.settings-matrix thead .symbol-button {display: block; font-size: 10px; line-height: 1.2; color: var(--blue); min-height: 20px; padding: 0 0 5px}
#exchange-settings-table {max-height: 390px}
#symbol-overrides-table {max-height: 290px}
.override-search {padding: 8px 10px; max-width: 330px}
.scope-controls {display: flex; gap: 8px; align-items: end; flex-wrap: wrap; padding: 8px 10px}
.scope-controls label {flex: 1; min-width: 120px}
.settings-status {display: flex; gap: 8px; flex-wrap: wrap; font-size: 10px; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--border)}
.settings-group {border-radius: 3px}
.settings-group h2 {padding: 6px 10px; background: #17212e; border-bottom: 1px solid var(--border); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #a9bdd3}
.setting-field {padding: 5px 10px; border-bottom: 1px solid #24303d; display: grid; grid-template-columns: minmax(0,1fr) 235px; gap: 12px; align-items: center; min-height: 43px}
.setting-field:last-child {border-bottom: 0}
.setting-field:hover {background: #14202d}
.setting-info {display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; min-width: 0}
.setting-name {display: flex; align-items: center; gap: 5px; min-width: 0}
.setting-label {font-size: 11px; font-weight: 500; color: #cfdae8}
.setting-source {font-size: 9px; color: #7891a9; border: 1px solid #2c3e50; border-radius: 2px; padding: 1px 4px}
.setting-help {position: relative; flex-shrink: 0}
.setting-help summary {list-style: none; width: 22px; min-height: 24px; display: grid; place-items: center; color: #7990a9; cursor: pointer; font-size: 11px}
.setting-help summary::-webkit-details-marker {display: none}
.setting-help[open] summary {color: var(--accent)}
.setting-help p {position: absolute; z-index: 15; top: 22px; left: -80px; width: 260px; max-width: 76vw; margin: 0; padding: 10px; color: #c9d7e6; background: #1c2b3c; border: 1px solid #415973; border-radius: 3px; box-shadow: 0 5px 18px #0008; font-size: 11px; line-height: 1.5}
.setting-controls {display: grid; grid-template-columns: minmax(90px,1fr) 95px; gap: 10px; align-items: center}
.setting-controls>input {width: 100%; min-width: 0; text-align: right; font-family: "SFMono-Regular", Consolas, monospace; font-variant-numeric: tabular-nums}
.setting-controls>.inline-check {font-size: 10px; color: var(--muted)}
.setting-toggle {background: #0c131d; border: 1px solid #354252; border-radius: 3px; padding: 4px 8px}
.setting-controls>.setting-toggle {color: #c5d5e5; font-size: 11px}
.save-bar {position: sticky; bottom: 8px; background: #182535; border: 1px solid #40526a; border-radius: 3px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 20; box-shadow: 0 3px 14px #0005}
.save-bar>div {display: flex; gap: 6px}
#settings-editor {scroll-margin-top: 95px}
.audit-list {max-height: calc(100dvh - 300px)}
.audit-list table {min-width: 1000px}
.audit-list tbody td {border-bottom: 1px solid var(--border)}
.audit-item[data-expanded=true]>tr:first-child {background: #1b2c3e}
.audit-item pre {font-size: 11px; line-height: 1.5; overflow: auto; max-height: 330px; margin: 0; padding: 12px; background: #0a111a; white-space: pre-wrap; overflow-wrap: anywhere}
.audit-detail>td {padding: 0}
.reference-cell {max-width: 230px; overflow: hidden; text-overflow: ellipsis; font: 10px "SFMono-Regular", Consolas, monospace; color: var(--muted)}
.inspect-cell {width: 34px; text-align: center}
.inspect-button {width: 26px; height: 26px; border: 1px solid #34485f; border-radius: 3px; background: #1b2a3b; color: #aecbeb; font-size: 16px; line-height: 1}
.inspect-button:hover {color: var(--accent); border-color: #52796a}
#latest-audit {margin-bottom: 8px}
.page-footer {display: flex; justify-content: space-between; gap: 12px; color: #718399; font-size: 10px; margin-top: 12px; padding-bottom: 8px}
.toast {position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #193c2d; color: #bcf1d4; border: 1px solid #3e8864; border-radius: 4px; padding: 9px 14px; font-size: 12px; box-shadow: 0 5px 20px #0008; max-width: 90vw; z-index: 100}
.detail-list {margin: 6px 10px 8px; padding-left: 16px; font-size: 11px; color: var(--amber)}
.login-screen {min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: #0b1017}
.login-card {width: 100%; max-width: 340px; background: #111923; padding: 28px; border: 1px solid var(--border); border-top: 2px solid #42675c; border-radius: 4px}
.login-card>.brand-mark {margin-bottom: 15px}
.login-card .eyebrow {margin-bottom: 7px}
.login-card h1 {font-size: 24px; margin-bottom: 8px}
.login-card form {margin: 20px 0 16px}
.login-card input {width: 100%; margin-top: 5px; min-height: 36px}
.login-card .button {min-height: 36px}
@media(min-width:1700px) {
  .settings-workspace {grid-template-columns: minmax(680px,.9fr) minmax(0,1.1fr)}
  .settings-reference-pane {display: grid; grid-template-columns: 1fr; gap: 0}
  #exchange-settings-table {max-height: 440px}
}
@media(max-width:1150px) {
  .overview-grid {grid-template-columns: minmax(0,1fr)}
  .settings-workspace {grid-template-columns: minmax(0,1fr)}
  .settings-reference-pane {position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start}
  .settings-edit-pane {min-width: 0}
  .setting-field {grid-template-columns: minmax(0,1fr) 260px}
  .services-table {max-height: 180px}
}
@media(max-width:680px) {
  :root {font-size: 12px}
  .topbar {height: auto; min-height: 48px; padding: 6px 10px; gap: 6px; flex-wrap: wrap}
  .brand {font-size: 10px; gap: 5px}
  .account-name {display: none}
  .header-controls {gap: 3px; flex-wrap: wrap; justify-content: flex-end}
  .header-controls select {min-width: 62px; padding: 4px; font-size: 11px}
  .header-controls .button {font-size: 10px; padding: 4px}
  #trading-status {display: none}
  .navigation {height: 40px; top: 48px; padding: 0 6px; gap: 0; justify-content: space-around}
  .navigation button {padding: 0 9px; font-size: 11px; gap: 4px}
  .navigation button>span {font-size: 13px; width: 13px}
  .nav-footnote {display: none}
  main {padding: 10px 8px}
  .page-heading>div {gap: 8px}
  .page-heading .eyebrow {display: none}
  .page-heading h1 {font-size: 16px}
  .pnl-strip {grid-template-columns: repeat(2,minmax(0,1fr))}
  .pnl-strip>.net-metric {grid-column: 1/-1; border-right: 0; display: flex; justify-content: space-between; align-items: center}
  .net-metric .metric-label {margin: 0}
  .pnl-strip>div {padding: 9px 10px; border-bottom: 1px solid var(--border)}
  .pnl-strip>div:nth-child(odd) {border-right: 0}
  .pnl-strip>div:last-child {border-bottom: 1px solid var(--border)}
  .metric-value {font-size: 18px}
  .metric-label {font-size: 10px; white-space: normal}
  .big-number {font-size: 23px}
  .pnl-window {font-size: 9px; gap: 4px; border-top: 0}
  .panel-heading {padding: 7px 8px}
  .panel-heading .small {font-size: 10px}
  th, td {padding-left: 8px; padding-right: 8px}
  .table-wrap th:first-child, .table-wrap td:first-child {position: sticky; left: 0; z-index: 1; background: #14202d; box-shadow: 1px 0 var(--border)}
  .table-wrap thead th:first-child {z-index: 4; background: #17212e}
  .audit-detail td:first-child {position: static}
  .markets-table {max-height: calc(100dvh - 255px)}
  .toolbar {gap: 8px; margin-bottom: 8px}
  .toolbar .search-label {width: 190px; flex: 1; min-width: 130px}
  .market-summary {font-size: 9px; flex-wrap: wrap; gap: 3px}
  .settings-reference-pane {display: block}
  .setting-field {padding: 5px 8px; grid-template-columns: minmax(0,1fr) 162px; gap: 8px; min-height: 48px}
  .setting-controls {grid-template-columns: minmax(65px,1fr) 69px; gap: 6px}
  .setting-controls>.inline-check {font-size: 9px; gap: 4px}
  .setting-controls>.setting-toggle {font-size: 10px; padding: 4px}
  .setting-controls>input {padding: 5px; font-size: 12px}
  .setting-label {font-size: 10px}
  .setting-info {gap: 2px 5px}
  .setting-source {font-size: 8px}
  .setting-help p {left: auto; right: -150px; width: 235px}
  .save-bar {bottom: 6px; padding: 6px 8px}
  .save-bar .button {font-size: 10px; padding: 5px 8px}
  .save-bar>.small {font-size: 9px}
  .scope-controls label {min-width: 90px}
  .page-footer {flex-wrap: wrap; gap: 3px; font-size: 9px}
  .notice {font-size: 10px}
  .audit-list {max-height: calc(100dvh - 295px)}
}
@media(pointer:coarse) {
  input:not([type=checkbox]), select, .button, .symbol-button, .sort-button {min-height: 36px}
  .navigation button {min-height: 40px}
  .inspect-button {min-width: 34px; min-height: 34px}
  .setting-help summary {min-width: 24px; min-height: 30px}
}
@media(prefers-reduced-motion:no-preference) {
  .button, .navigation button {transition: background .12s, color .12s}
}

/* Account observation timestamps remain separate from transport connectivity. */
.account-age {margin-left:auto; font:10px "SFMono-Regular",Consolas,monospace; white-space:nowrap}
#live-status {margin-left:0}
th {text-align:left}
th.numeric {text-align:right}
@media(max-width:680px) {
  #trading-status {display:inline-flex; font-size:9px; padding:2px 4px}
  .account-age {font-size:9px}
  #live-status {font-size:9px}
}
@media(max-width:360px) {.brand {font-size:9px; letter-spacing:0}.header-controls {gap:2px}.header-controls select {min-width:52px}}
