:root {
  --bg: #070a10;
  --panel: #0d121b;
  --panel-2: #0a0f17;
  --panel-3: #111824;
  --line: rgba(255,255,255,.075);
  --line-soft: rgba(255,255,255,.045);
  --text: #eef4ff;
  --muted: #8592a6;
  --soft: #b8c3d2;
  --green: #4ee3a6;
  --red: #ff6f7e;
  --cyan: #67cfff;
  --violet: #927cff;
  --amber: #ffcc6e;
  --radius: 22px;
  --shadow: 0 26px 90px rgba(0,0,0,.34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% -10%, rgba(107,102,255,.12), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(54,178,255,.075), transparent 24%),
    var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.aurora { position: fixed; pointer-events: none; filter: blur(90px); opacity: .12; z-index: -1; }
.aurora-one { width: 420px; height: 420px; border-radius: 50%; background: #725cff; top: -210px; left: -120px; }
.aurora-two { width: 360px; height: 360px; border-radius: 50%; background: #36bfff; top: -160px; right: -130px; }

.shell { width: min(1600px, 100%); margin: 0 auto; padding: 18px 22px 40px; }
.glass {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16,22,32,.97), rgba(9,14,22,.97));
  box-shadow: var(--shadow);
}
.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px 10px 13px;
  border-radius: 18px;
  position: sticky;
  top: 10px;
  z-index: 40;
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.bot-orb {
  width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg,#7b6cff,#4cc9ff); font-weight: 900;
  box-shadow: 0 0 28px rgba(100,111,255,.28); flex: 0 0 auto;
}
.bot-orb span { font-size: 16px; }
.brand h1 { margin: 2px 0 0; font-size: 15px; letter-spacing: -.01em; }
.brand-subtitle { display: block; color: var(--muted); font-size: 9px; margin-top: 2px; }
.brand-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.brand-links a { color: #8fd8ff; font-size: 9px; text-decoration: none; }
.brand-links a:hover { color: #d8efff; text-decoration: underline; }
.eyebrow { font-size: 9px; font-weight: 800; letter-spacing: .16em; color: #647389; }
.status-cluster { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 9px; font-size: 10px; color: #c4cede;
  background: rgba(255,255,255,.02); white-space: nowrap;
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: #64748b; }
.badge.online i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.badge.online { border-color: rgba(78,227,166,.18); }
.badge.waiting i { background: var(--amber); box-shadow: 0 0 9px rgba(255,204,110,.45); }
.badge.muted i { background: #677489; }

.hero-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.82fr) minmax(340px, .92fr);
  gap: 16px;
  align-items: stretch;
}
.hero-grid.chart-disabled { grid-template-columns: minmax(0,1.3fr) minmax(340px,.92fr); }
.chart-workspace { min-width: 0; border-radius: var(--radius); overflow: hidden; }
.chart-toolbar {
  min-height: 76px; padding: 15px 17px; display: flex; align-items: center;
  justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line);
}
.realtime-title-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.realtime-title-row h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.subtle { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 5px 0 0; }
.chart-controls { display: flex; align-items: end; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.chart-field { display: grid; gap: 4px; }
.chart-field span { color: #68778d; font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.chart-field input, .chart-field select {
  color: var(--text); background: #090e16; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; outline: none; font-size: 10px;
}
.chart-field input { width: 118px; text-transform: uppercase; font-weight: 800; }
.chart-field select { min-width: 72px; }
.chart-field input:focus, .chart-field select:focus { border-color: rgba(103,207,255,.4); box-shadow: 0 0 0 3px rgba(103,207,255,.06); }
.ghost-button {
  border: 1px solid var(--line); background: #090e16; color: #c7d1df;
  border-radius: 10px; padding: 8px 10px; font-size: 10px; transition: .15s ease;
}
.ghost-button:hover { border-color: rgba(103,207,255,.25); background: #101824; color: #fff; }
.ghost-button:disabled { opacity: .5; cursor: wait; }
.chart-icon-button { min-width: 38px; font-size: 15px; }
.chart-live-strip {
  display: grid; grid-template-columns: .8fr 1fr 2fr .8fr; gap: 1px;
  background: var(--line); border-bottom: 1px solid var(--line);
}
.chart-live-strip > div { min-width: 0; padding: 10px 12px; background: #0c121b; }
.chart-live-strip span { display: block; font-size: 9px; color: #6f7d91; margin-bottom: 4px; }
.chart-live-strip strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chartLivePrice { color: var(--green); font-size: 14px; }

.realtime-chart-shell {
  height: clamp(500px, 59vh, 680px); min-height: 500px; position: relative; overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.034) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
    #080d14;
  background-size: 54px 54px;
}
.realtime-chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.realtime-chart-overlay {
  position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center;
  gap: 9px; text-align: center; padding: 26px; color: #d8e8f3;
  background: rgba(3,10,18,.78); backdrop-filter: blur(7px);
}
.realtime-chart-overlay span { color: var(--muted); font-size: 10px; }
.realtime-chart-overlay.error { color: #ffd1d9; background: rgba(22,7,13,.84); line-height: 1.55; }
.chart-spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(103,207,255,.15); border-top-color: var(--cyan); animation: chartSpin .8s linear infinite; }
@keyframes chartSpin { to { transform: rotate(360deg); } }
.chart-legend { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; padding: 10px 13px; color: #708097; font-size: 9px; border-top: 1px solid var(--line-soft); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 3px; border-radius: 4px; display: inline-block; }
.legend-dot.entry { background: var(--amber); }
.legend-dot.stop { background: var(--red); }
.legend-dot.tp1 { background: var(--cyan); }
.legend-dot.tp2 { background: var(--violet); }
.legend-dot.tp3 { background: var(--green); }
.legend-zone { width: 10px; height: 7px; border-radius: 2px; display: inline-block; }
.legend-zone.profit { background: rgba(78,227,166,.23); border: 1px solid rgba(78,227,166,.35); }
.legend-zone.risk { background: rgba(255,111,126,.22); border: 1px solid rgba(255,111,126,.35); }
.chart-disabled-placeholder { height: 500px; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 7px; background: #080d14; }
.chart-disabled-placeholder strong { color: var(--text); }

.basket-strip { display: grid; grid-template-columns: 1.25fr 1.15fr repeat(4, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.basket-strip > div { min-width: 0; padding: 11px 12px; background: #0c121b; }
.basket-strip > div > span, .basket-state > span { display: block; font-size: 8px; color: #6f7d91; margin-bottom: 5px; letter-spacing: .05em; }
.basket-strip strong { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.basket-state-line { display: flex; gap: 7px; align-items: center; min-width: 0; }
.direction { color: #9ba8b9; font-weight: 900; letter-spacing: .05em; }
.direction.buy { color: var(--green); }
.direction.sell { color: var(--red); }
.pill { display: inline-flex; align-items: center; width: max-content; max-width: 100%; border-radius: 999px; padding: 4px 7px; border: 1px solid var(--line); font-size: 8px; color: #aab6c6; background: rgba(255,255,255,.02); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.good, .pill.positive, .pill.success { color: var(--green); border-color: rgba(78,227,166,.22); background: rgba(78,227,166,.06); }
.pill.warning, .pill.caution { color: var(--amber); border-color: rgba(255,204,110,.22); background: rgba(255,204,110,.06); }
.pill.cautious { color: var(--amber); border-color: rgba(255,204,110,.22); background: rgba(255,204,110,.06); }
.pill.calm { color: var(--cyan); border-color: rgba(103,207,255,.20); background: rgba(103,207,255,.05); }
.pill.danger, .pill.negative { color: var(--red); border-color: rgba(255,111,126,.22); background: rgba(255,111,126,.06); }

.analyst-panel { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; min-width: 0; }
.analyst-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.analyst-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.02em; }
.analyst-refresh { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; font-size: 15px; }
.stance-card { margin-top: 17px; padding: 14px; border: 1px solid rgba(78,227,166,.16); background: linear-gradient(180deg, rgba(78,227,166,.065), rgba(78,227,166,.025)); border-radius: 16px; }
.section-label { font-size: 8px; letter-spacing: .14em; color: #657489; font-weight: 800; }
.stance-card h3 { margin: 7px 0 7px; font-size: 22px; line-height: 1.18; letter-spacing: -.04em; }
.stance-card p { margin: 0; color: #9dafbe; font-size: 11px; line-height: 1.58; }
.recent-trade-card { margin-top: 10px; padding: 11px 12px; border: 1px solid rgba(146,124,255,.18); border-radius: 14px; background: linear-gradient(180deg, rgba(146,124,255,.065), rgba(146,124,255,.022)); }
.recent-trade-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-trade-meta { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aaa0df; font-size: 8px; font-weight: 800; letter-spacing: .04em; }
.recent-trade-card p { margin: 7px 0 0; color: #b8c2d1; font-size: 10px; line-height: 1.55; }
.recent-trade-card.win { border-color: rgba(78,227,166,.20); background: linear-gradient(180deg, rgba(78,227,166,.055), rgba(78,227,166,.018)); }
.recent-trade-card.win .recent-trade-meta { color: var(--green); }
.recent-trade-card.loss { border-color: rgba(255,111,126,.18); background: linear-gradient(180deg, rgba(255,111,126,.045), rgba(255,111,126,.015)); }
.recent-trade-card.loss .recent-trade-meta { color: #e9959f; }
.recent-trade-card.flat .recent-trade-meta { color: #94a2b6; }
.analyst-section-label { margin: 15px 0 8px; }
.reason-list { display: grid; gap: 8px; }
.reason { position: relative; padding: 10px 11px 10px 39px; min-height: 42px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.017); color: #aebaca; font-size: 10px; line-height: 1.48; }
.reason::before { content: "◎"; position: absolute; left: 10px; top: 9px; width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; color: var(--cyan); background: rgba(103,207,255,.07); border: 1px solid rgba(103,207,255,.12); font-size: 9px; }
.reason.skeleton { min-height: 43px; color: transparent; overflow: hidden; }
.reason.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.035), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.watch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.watch-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #0a1018; min-width: 0; }
.watch-card span { display: block; color: #6f7d91; font-size: 8px; margin-bottom: 5px; }
.watch-card strong { display: block; font-size: 10px; line-height: 1.4; }
.data-note { margin-top: 10px; padding: 10px; border-radius: 11px; border: 1px solid rgba(255,204,110,.16); background: rgba(255,204,110,.045); color: #b9aa80; font-size: 9px; line-height: 1.5; }
.analyst-footnote { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.read-only-chip { display: inline-flex; border: 1px solid rgba(146,124,255,.28); background: rgba(146,124,255,.07); color: #d9d2ff; padding: 5px 7px; border-radius: 999px; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.analyst-footnote p { color: #59677a; font-size: 8px; line-height: 1.5; margin: 7px 0 0; }

.lower-workspace { margin-top: 16px; }
.workspace-tabs { display: flex; gap: 5px; width: max-content; max-width: 100%; padding: 6px; border-radius: 14px; overflow-x: auto; box-shadow: none; }
.workspace-tab-button { border: 0; background: transparent; color: #718097; border-radius: 9px; padding: 8px 11px; font-size: 9px; white-space: nowrap; }
.workspace-tab-button.active { background: #151d29; color: var(--text); }
.workspace-tab-panel { display: none; margin-top: 10px; }
.workspace-tab-panel.active { display: block; }
.performance-card, .history-card, .system-card { border-radius: var(--radius); padding: 16px; }
.performance-heading, .system-heading, .table-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.performance-heading h2, .system-heading h2, .table-heading h2 { margin: 4px 0 0; font-size: 16px; }
.performance-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.period-switch { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #090e16; }
.period-button { border: 0; background: transparent; color: #758399; border-radius: 7px; padding: 6px 8px; font-size: 9px; }
.period-button.active { background: #172131; color: var(--text); }
.history-notice { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(255,204,110,.17); border-radius: 12px; color: #c0af81; background: rgba(255,204,110,.045); font-size: 9px; line-height: 1.5; }
.account-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 13px; }
.summary-tile { border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: rgba(255,255,255,.015); min-width: 0; }
.summary-tile.primary { background: linear-gradient(180deg, rgba(103,207,255,.06), rgba(103,207,255,.018)); }
.summary-tile span { display: block; color: #758399; font-size: 8px; margin-bottom: 6px; }
.summary-tile strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-tile.subdued-metric strong { font-size: 14px; font-weight: 750; }
.performance-card .summary-tile.subdued-metric .negative-text { color: #c98f98 !important; }
.summary-tile small { display: block; color: #637186; font-size: 8px; margin-top: 4px; line-height: 1.35; }
.metric-value { color: var(--text); }
.positive-text, .buy-text { color: var(--green) !important; }
.negative-text, .sell-text { color: var(--red) !important; }
.balance-panel { margin-top: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #0a1018; }
.chart-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chart-title-row strong { display: block; margin-top: 5px; font-size: 11px; }
.sync-time { color: #66758a; font-size: 9px; }
.chart-wrap { min-height: 220px; position: relative; margin-top: 8px; }
#balanceChart { width: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-content: center; color: #637186; text-align: center; font-size: 10px; }
.chart-note { color: #5d6a7d; font-size: 8px; line-height: 1.5; margin: 8px 0 0; }
.table-heading { align-items: center; margin-bottom: 10px; }
.table-heading > span { color: #6d7b90; font-size: 9px; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 9px; min-width: 780px; }
th { text-align: left; color: #66758a; font-weight: 700; padding: 9px 8px; border-bottom: 1px solid var(--line); background: #0a1018; position: sticky; top: 0; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); color: #bac6d5; }
.empty-cell { text-align: center; color: #66758a; padding: 24px; }
.status-text { color: #93a0b3; }
.status-text.closed { color: var(--green); }
.status-text.sync_pending { color: var(--amber); }
.status-text.partial { color: var(--cyan); }

.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-heading h3 { margin: 4px 0 0; font-size: 14px; }
.timeline-card h3 { margin: 5px 0 12px; font-size: 14px; }
.timeline { display: grid; gap: 7px; }
.timeline-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #0a1018; }
.timeline-item strong { display: block; font-size: 9px; text-transform: capitalize; }
.timeline-item span { display: block; color: #66758a; font-size: 8px; margin-top: 4px; }
.timeline-empty { color: #66758a; font-size: 9px; padding: 18px 0; }
.system-heading { align-items: center; }
.raw-facts { max-height: 560px; overflow: auto; margin: 12px 0 0; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #060a10; color: #9fb0c5; font: 9px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
footer { color: #4f5c6e; font-size: 8px; text-align: center; margin-top: 18px; }

/* Fullscreen keeps the proven realtime chart module intact. */
#realtimeChartCard:fullscreen { width: 100vw; height: 100vh; margin: 0; border-radius: 0; background: #06101d; overflow: hidden; }
#realtimeChartCard:fullscreen .realtime-chart-shell { height: calc(100vh - 205px); min-height: 300px; }
#realtimeChartCard:fullscreen .basket-strip { display: none; }

/* Realtime LongX setup overlay, retained from v0.3.6 behavior. */
.longx-trade-overlay { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.longx-trade-zone { position: absolute; z-index: 1; min-width: 26px; border-radius: 4px; pointer-events: none; box-sizing: border-box; box-shadow: inset 0 0 0 1px rgba(255,255,255,.045); }
.longx-trade-zone.profit { background: linear-gradient(90deg, rgba(27,255,82,.19), rgba(27,255,82,.07)); border: 1px solid rgba(77,255,19,.28); }
.longx-trade-zone.risk { background: linear-gradient(90deg, rgba(255,9,9,.21), rgba(255,9,9,.075)); border: 1px solid rgba(255,80,80,.29); }
.longx-trade-zone.runner { background: linear-gradient(90deg, rgba(78,227,166,.10), rgba(78,227,166,.018)); border: 1px dashed rgba(78,227,166,.24); box-shadow: none; }
.longx-trade-zone.runner::after { color: rgba(147,245,203,.68); }
.longx-trade-zone::after { content: attr(data-label); position: absolute; right: 9px; top: 7px; color: rgba(255,255,255,.53); font-size: 9px; font-weight: 900; line-height: 1; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.longx-level-pill { position: absolute; right: 8px; z-index: 5; min-width: 146px; padding: 7px 11px; border-radius: 6px; border: 1px solid rgba(255,255,255,.17); color: #fff; font-size: 10px; font-weight: 900; line-height: 1; letter-spacing: .025em; text-transform: uppercase; white-space: nowrap; text-align: center; transform: translateY(-50%); box-sizing: border-box; box-shadow: 0 9px 18px rgba(0,0,0,.30), inset 0 0 0 1px rgba(255,255,255,.11); }
.longx-level-pill.entry { background: #159cff; border-color: #6fc5ff; }
.longx-level-pill.stop { background: #ff0909; border-color: #ff6565; }
.longx-level-pill.tp { background: #4dff13; border-color: #9dff6d; color: #062700; }
.longx-level-pill.runner-live { background: #0d6f53; border-color: #65e7b7; color: #e9fff7; box-shadow: 0 0 22px rgba(78,227,166,.18), 0 9px 18px rgba(0,0,0,.30); }
.longx-setup-badge { position: absolute; z-index: 5; top: 10px; left: 10px; max-width: calc(100% - 200px); padding: 7px 10px; border-radius: 999px; border: 1px solid rgba(103,207,255,.30); background: rgba(2,9,16,.82); color: #d8edf8; font-size: 9px; font-weight: 900; letter-spacing: .04em; box-shadow: 0 8px 22px rgba(0,0,0,.28); }
.longx-setup-badge.muted { color: #7e91a3; border-color: rgba(255,255,255,.09); }
.longx-trade-overlay.trade-closed .longx-trade-zone { opacity: .34; filter: saturate(.75); }
.longx-trade-overlay.trade-closed .longx-level-pill { opacity: .72; }
.longx-trade-overlay.trade-active .longx-setup-badge { border-color: rgba(78,227,166,.38); }
.longx-trade-overlay.runner-open-ended .longx-setup-badge::after { content: " · RUNNER OPEN-ENDED"; color: #82e9c2; }
.longx-trade-overlay.trade-pending .longx-setup-badge { border-color: rgba(255,204,110,.34); }

@media (max-width: 1220px) {
  .hero-grid { grid-template-columns: minmax(0,1.45fr) minmax(320px,.9fr); }
  .realtime-chart-shell { height: 520px; min-height: 460px; }
  .account-summary { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .basket-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 940px) {
  .hero-grid, .hero-grid.chart-disabled { grid-template-columns: 1fr; }
  .analyst-panel { min-height: 520px; }
  .realtime-chart-shell { height: 500px; min-height: 420px; }
  .analyst-footnote { margin-top: 18px; }
}
@media (max-width: 720px) {
  .shell { padding: 10px; }
  .topbar { top: 6px; }
  .brand-subtitle { display: none; }
  .status-cluster .badge:nth-child(n+2) { display: none; }
  .chart-toolbar, .performance-heading, .system-heading { align-items: flex-start; flex-direction: column; }
  .chart-controls { width: 100%; justify-content: flex-start; }
  .chart-live-strip { grid-template-columns: 1fr 1fr; }
  .ohlc-cell { grid-column: 1 / -1; }
  .basket-strip { grid-template-columns: 1fr 1fr; }
  .account-summary { grid-template-columns: 1fr 1fr; }
  .watch-grid { grid-template-columns: 1fr; }
  .performance-actions { width: 100%; justify-content: flex-start; }
  .realtime-chart-shell { height: 430px; min-height: 380px; }
  .stance-card h3 { font-size: 19px; }
}
@media (max-width: 480px) {
  .chart-field.symbol-field { flex: 1; }
  .chart-field.symbol-field input { width: 100%; }
  .chart-controls { display: grid; grid-template-columns: 1fr 72px auto auto auto; }
  .chart-controls .ghost-button { padding: 8px; }
  .chart-live-strip { grid-template-columns: 1fr; }
  .ohlc-cell { grid-column: auto; }
  .account-summary { grid-template-columns: 1fr; }
  .basket-strip { grid-template-columns: 1fr 1fr; }
  .workspace-tabs { width: 100%; }
}

.timeline-standalone { width: 100%; }
.timeline-standalone .timeline { margin-top: 12px; }

/* v0.4 access, quota, paywall, and account manager */
.quota-badge.danger { color: #ffb3b3; border-color: rgba(255,80,90,.38); background: rgba(120,20,30,.22); }
.account-menu { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.account-menu a, .account-menu button { color: var(--cyan); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.account-menu form { margin: 0; }
.access-paywall { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 20px; background: rgba(1,6,12,.68); backdrop-filter: blur(9px); }
.access-paywall.hidden { display: none; }
.access-paywall::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, rgba(92,105,255,.18), transparent 44%); pointer-events: none; }
.paywall-card { position: relative; width: min(520px, 100%); padding: 40px; text-align: center; border-color: rgba(115,166,255,.3); box-shadow: 0 32px 90px rgba(0,0,0,.58); }
.paywall-card h2 { margin: 10px 0; font-size: clamp(25px,4vw,38px); }
.paywall-card p { color: var(--muted); line-height: 1.65; }
.paywall-lock { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 22px; background: linear-gradient(145deg,#7c65ff,#38c8ff); color: white; font-size: 24px; font-weight: 900; box-shadow: 0 12px 35px rgba(70,126,255,.38); }
.paywall-actions { display: flex; justify-content: center; gap: 12px; margin: 25px 0 15px; flex-wrap: wrap; }
.upgrade-button, .zalo-button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 0 20px; border: 0; border-radius: 12px; color: white; text-decoration: none; font-weight: 800; cursor: pointer; }
.upgrade-button { background: linear-gradient(135deg,#6f5cff,#318dff); box-shadow: 0 10px 30px rgba(77,93,255,.28); }
.zalo-button { background: linear-gradient(135deg,#0788f5,#03b8ff); box-shadow: 0 10px 30px rgba(3,158,255,.24); }

.access-page { min-height: 100vh; color: var(--text); background: #030910; }
.access-header { position: relative; z-index: 2; width: min(1180px,calc(100% - 32px)); margin: 18px auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.access-header nav { display: flex; gap: 18px; flex-wrap: wrap; }
.access-header a { color: #bfd5e4; text-decoration: none; }
.access-brand { font-weight: 900; letter-spacing: .06em; }
.access-brand span { color: var(--cyan); }
.access-content { position: relative; z-index: 1; width: min(1180px,calc(100% - 32px)); margin: 48px auto 80px; }
.auth-card { width: min(460px,100%); margin: 9vh auto 0; padding: 34px; }
.auth-card h1, .pricing-hero h1, .manager-heading h1 { margin: 8px 0 10px; }
.auth-card > p, .pricing-hero p { color: var(--muted); line-height: 1.65; }
.access-form { display: grid; gap: 16px; margin-top: 25px; }
.access-form label { display: grid; gap: 7px; color: #aebfca; font-size: 12px; font-weight: 700; }
.access-form input, .access-form select, .manager-search input, .manager-actions input { width: 100%; min-height: 44px; padding: 0 13px; color: var(--text); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(2,10,17,.72); }
.access-form.compact { margin-top: 12px; }
.auth-switch { margin-top: 20px; text-align: center; }
.auth-switch a, .manager-heading a, .manager-table a { color: var(--cyan); }
.flash { width: min(780px,100%); margin: 0 auto 14px; padding: 12px 15px; border-radius: 10px; background: rgba(70,215,160,.14); border: 1px solid rgba(70,215,160,.28); }
.flash.error { background: rgba(255,78,94,.12); border-color: rgba(255,78,94,.28); }
.pricing-hero { max-width: 720px; margin: 80px auto 36px; text-align: center; }
.pricing-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.pricing-card { padding: 28px; }
.pricing-card.featured { border-color: rgba(89,139,255,.52); transform: translateY(-8px); }
.pricing-card > span { color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.pricing-card p { color: var(--muted); line-height: 1.6; }
.pricing-contact { margin: 30px 0; text-align: center; }
.manager-heading { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin: 45px 0 22px; }
.manager-search { display: flex; gap: 8px; width: min(460px,100%); }
.manager-search button, .manager-actions button { min-height: 42px; padding: 0 15px; border: 1px solid rgba(100,205,255,.28); border-radius: 10px; background: rgba(61,151,210,.16); color: var(--text); cursor: pointer; }
.manager-table-card { padding: 22px; overflow: auto; margin-bottom: 20px; }
.manager-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.manager-table th, .manager-table td { padding: 13px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: top; }
.manager-table th { color: var(--muted); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.manager-table code { white-space: pre-wrap; color: #a9c4d3; font-size: 10px; }
.plan-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: rgba(95,117,255,.18); color: #c4cbff; font-size: 10px; font-weight: 800; }
.plan-pill.free { background: rgba(255,255,255,.08); color: #b1c1cc; }
.manager-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.manager-card, .manager-actions { padding: 24px; }
.manager-card dl { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.manager-card dt { color: var(--muted); }
.manager-card dd { margin: 0; font-weight: 700; }
.manager-actions { margin: 18px 0; }
.manager-actions > div { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.manager-actions form { display: flex; gap: 7px; }
.manager-actions button.danger { border-color: rgba(255,74,90,.35); color: #ffb1b8; background: rgba(180,35,50,.14); }

@media (max-width: 800px) {
  .account-menu > span { display: none; }
  .pricing-grid, .manager-detail-grid { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }
  .manager-heading { align-items: stretch; flex-direction: column; }
  .manager-card dl { grid-template-columns: 1fr; gap: 5px; }
  .manager-card dd { margin-bottom: 10px; }
}
