/* Account monitor */
* { box-sizing: border-box; }
body { margin: 1rem 0; color: #666; background: #fff; font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: #0868b0; text-decoration: underline; }
button, input { font: inherit; }
button { padding: 5px 12px; color: #666; background: #fff; border: 1px solid #dce1e6; border-radius: 4px; cursor: pointer; }
button:hover { background: #f5f7f9; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #0868b0; outline-offset: 3px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: #888; font-weight: normal; }
.track-form { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.track-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.track-form input { min-width: 0; padding: 5px 8px; border: 1px solid #dce1e6; border-radius: 4px; color: #333; background: #fff; }
.account-field { flex: 1; max-width: 480px; }
.account-field input { font-family: Consolas, monospace; }
.symbol-field { width: 135px; }
.session-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }
.session-controls #reset-zoom { white-space: nowrap; }
#connection-status { font-size: 12px; }
#connection-status[data-state="live"] { color: #25845c; }
#connection-status[data-state="retry"] { color: #976000; }
.section-header { min-height: 28px; margin-bottom: 3px; flex-wrap: wrap; }
.card { padding: 4px; margin-bottom: 4px; background: white; border-radius: 4px; box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); }
.chart { position: relative; height: 45vh; min-height: 280px; }
.position-chart { height: 32vh; min-height: 240px; }
.chart-empty { position: absolute; inset: 45% 15px auto; text-align: center; color: #888; pointer-events: none; }
.hr { border-top: 1px solid rgba(0, 0, 0, .1); margin: 8px 0; }
.table-responsive { overflow: auto; max-height: 40vh; }
.table-responsive.card { padding-top: 0; border-top: 4px solid #fff; }
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background-color: #eee;
    border: 2px solid #fff;
}
#toggle-open-orders { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; }
#toggle-open-orders[aria-expanded="true"] .open-orders-plus { display: none; }
.order-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.order-tables .trade-side { margin: 0 0 4px 4px; }
@media (max-width: 720px) {
    .order-tables { grid-template-columns: minmax(0, 1fr); }
}
table { width: 100%; border-collapse: separate; border-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: .3rem; text-align: left; vertical-align: middle; border-top: 1px solid #dee2e6; }
thead th { position: sticky; top: 0; z-index: 1; background: #fff; border-top: 0; border-bottom: 2px solid #dee2e6; }
tbody > tr:first-child > * { border-top: 0; }
.scope-note { color: #888; font-size: 11px; margin: 8px 4px; }
.message { padding: 8px 10px; background: #fff8e9; border: 1px solid #eadbb6; border-radius: 4px; }
.trade-side { display: inline-block; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.trade-side.buy { background: #e6f3ff; color: #0868b0; }
.trade-side.sell { background: #fff0f3; color: #b72547; }
.details { padding: 14px 16px; color: #333; background: #fff; border: 1px solid #dce1e6; border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, .18); }
.details { position: fixed; z-index: 1050; width: 350px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; }
[hidden] { display: none !important; }
.details dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.details dt { color: #666; font-weight: normal; }
.details dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.position-details { pointer-events: none; }
@media (max-width: 600px) {
    .track-form { flex-wrap: wrap; }
    .account-field { flex-basis: 100%; max-width: none; }
    .symbol-field { flex: 1; width: auto; }
    .session-controls { flex-shrink: 1; min-width: 0; }
}
