:root {
  color-scheme: dark;
  --bg: #050713;
  --surface: rgba(11, 16, 35, .88);
  --surface-2: #0d142b;
  --surface-3: #121a35;
  --line: rgba(139, 158, 213, .14);
  --line-strong: rgba(139, 158, 213, .26);
  --text: #f6f8ff;
  --muted: #8792b2;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --purple: #8b5cf6;
  --purple-2: #a78bfa;
  --cyan: #22d3ee;
  --green: #2dd4bf;
  --red: #fb7185;
  --amber: #fbbf24;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(59,130,246,.19), transparent 31%),
    radial-gradient(circle at 100% 0%, rgba(139,92,246,.17), transparent 30%),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 338px;
  grid-template-rows: 66px minmax(0, 1fr);
  grid-template-areas: "top top top" "watch work trade";
  gap: 10px;
  padding: 0 10px 10px;
}
.topbar {
  grid-area: top;
  margin: 0 -10px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,7,19,.76);
  backdrop-filter: blur(24px);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 145px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--blue), var(--purple));
  box-shadow: 0 0 28px rgba(91,92,246,.42); font-weight: 900; letter-spacing: -.08em;
}
.brand-copy strong { display: block; font-size: 14px; letter-spacing: .14em; }
.brand-copy small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .11em; }
.market-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px currentColor; flex: 0 0 auto; }
.market-copy { display: grid; min-width: 120px; }
.market-copy strong { font-size: 13px; white-space: nowrap; }
.market-copy small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.live-price { font-size: 22px; font-weight: 780; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.price-change { color: var(--muted); font-size: 11px; font-weight: 750; }
.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill {
  min-height: 28px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(15,22,47,.7);
  font-size: 9px; font-weight: 800; letter-spacing: .06em; white-space: nowrap;
}
.pill.live { color: #b7f7e8; border-color: rgba(45,212,191,.25); background: rgba(45,212,191,.08); }
.pill.locked { color: #fecdd3; border-color: rgba(251,113,133,.24); background: rgba(251,113,133,.07); }
.pill.paper { color: #dbeafe; border-color: rgba(96,165,250,.25); background: rgba(59,130,246,.08); }
.panel {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 15px;
  background: linear-gradient(180deg, rgba(13,19,42,.94), rgba(7,11,27,.94));
  box-shadow: var(--shadow);
}
.panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; z-index: 3; background: linear-gradient(90deg, transparent, rgba(96,165,250,.3), rgba(167,139,250,.25), transparent); pointer-events: none; }
.icon-button, .ghost-button, .primary-button, .danger-outline, .text-button {
  border: 1px solid var(--line); border-radius: 9px; background: rgba(16,23,46,.8); cursor: pointer; transition: 160ms ease;
}
.icon-button { width: 35px; height: 35px; display: grid; place-items: center; font-size: 15px; }
.ghost-button, .danger-outline { min-height: 34px; padding: 0 11px; font-size: 10px; font-weight: 750; }
.primary-button { min-height: 42px; border: 0; padding: 0 15px; font-weight: 850; background: linear-gradient(135deg, var(--blue), var(--purple)); box-shadow: 0 10px 25px rgba(59,130,246,.2); }
.primary-button.buy { background: linear-gradient(135deg, #0f9f91, #2563eb); }
.primary-button.sell { background: linear-gradient(135deg, #e11d48, #7c3aed); }
.danger-outline { color: #fecdd3; border-color: rgba(251,113,133,.26); background: rgba(251,113,133,.06); }
.text-button { border: 0; padding: 0; background: transparent; color: var(--blue-2); font-size: 10px; }
button:hover:not(:disabled) { border-color: rgba(96,165,250,.44); transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.watchlist { grid-area: watch; display: flex; flex-direction: column; }
.panel-heading { min-height: 59px; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .content-heading h3, .forecast-detail-grid h3 { margin: 2px 0 0; font-size: 13px; }
.eyebrow { color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.watchlist-items { display: grid; padding: 8px; gap: 4px; }
.watch-item {
  width: 100%; min-height: 54px; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer;
}
.watch-item > span:first-child { display: grid; gap: 2px; }
.watch-item strong { color: var(--text); font-size: 11px; }
.watch-item small { font-size: 9px; }
.watch-item.active { border-color: rgba(96,165,250,.25); background: linear-gradient(135deg, rgba(59,130,246,.13), rgba(139,92,246,.08)); }
.watch-price { font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.sidebar-section { margin: 4px 10px 0; padding: 13px 3px; border-top: 1px solid var(--line); }
.metric-stack { display: grid; gap: 8px; margin-top: 9px; }
.metric-stack > div { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.metric-stack strong { color: var(--text); font-variant-numeric: tabular-nums; }
.section-row { display: flex; align-items: center; justify-content: space-between; }
#nextEvent { margin-top: 10px; display: grid; gap: 4px; }
#nextEvent strong { font-size: 11px; }
#nextEvent small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.sidebar-footer { margin-top: auto; display: flex; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.workspace { grid-area: work; min-height: 0; display: grid; grid-template-rows: minmax(390px, 1.5fr) minmax(225px, .7fr); gap: 10px; }
.chart-card { display: grid; grid-template-rows: 52px 30px minmax(260px, 1fr) auto; }
.chart-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-bottom: 1px solid var(--line); overflow: hidden; }
.select-control, input, select, textarea {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(5,8,22,.66); color: var(--text); outline: none;
}
.select-control { height: 34px; min-width: 104px; padding: 0 9px; font-weight: 750; font-size: 11px; }
input, select { height: 38px; padding: 0 10px; }
textarea { resize: vertical; padding: 9px 10px; }
input:focus, select:focus, textarea:focus { border-color: rgba(96,165,250,.56); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,8,22,.65); }
.segmented button { min-width: 38px; height: 27px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 800; }
.segmented button.active { color: white; background: linear-gradient(135deg, rgba(59,130,246,.88), rgba(91,92,246,.76)); box-shadow: 0 5px 15px rgba(59,130,246,.18); }
.chart-type { margin-left: auto; }
.chart-type button { min-width: 30px; }
.switch-control { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 32px; height: 18px; padding: 2px; border-radius: 999px; background: #28314d; transition: 160ms ease; }
.switch::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: #8994b3; transition: 160ms ease; }
.switch-control input:checked + .switch { background: linear-gradient(90deg, var(--blue), var(--purple)); }
.switch-control input:checked + .switch::after { transform: translateX(14px); background: white; }
.chart-status-row { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: var(--muted); font-size: 8px; overflow: hidden; }
.legend { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 12px; height: 3px; border-radius: 10px; }
.swatch.market { background: var(--green); }
.swatch.active-candle { background: var(--cyan); }
.swatch.forecast { background: linear-gradient(90deg,var(--blue),var(--purple)); }
.swatch.previous { background: linear-gradient(90deg,rgba(119,157,205,.67),rgba(147,118,202,.67)); }
.swatch.older { background: linear-gradient(90deg,rgba(143,151,162,.33),rgba(152,139,168,.33)); }
.chart-wrap { position: relative; min-height: 0; background: #070b1b; }
#chart { position: absolute; inset: 0; }
.chart-watermark { position: absolute; left: 20px; top: 20px; display: grid; pointer-events: none; opacity: .38; }
.chart-watermark span { font-size: 23px; font-weight: 900; letter-spacing: .12em; }
.chart-watermark small { color: var(--muted); font-size: 9px; }
.forecast-label { position: absolute; top: 13px; right: 14px; padding: 6px 8px; border: 1px solid rgba(167,139,250,.23); border-radius: 8px; color: #ddd6fe; background: rgba(76,29,149,.16); backdrop-filter: blur(10px); font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.stale-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,7,19,.62); backdrop-filter: blur(2px); color: var(--amber); font-size: 12px; font-weight: 850; z-index: 5; }
.advanced-strip { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.advanced-strip article { min-width: 0; padding: 9px 11px; border-right: 1px solid var(--line); }
.advanced-strip article:last-child { border-right: 0; }
.advanced-strip span, .stat-grid span { display: block; color: var(--muted); font-size: 7px; letter-spacing: .08em; text-transform: uppercase; }
.advanced-strip strong { display: block; margin-top: 3px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.advanced-strip small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lower-panel { display: grid; grid-template-rows: 43px minmax(0,1fr); }
.tab-bar { display: flex; gap: 3px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar button { min-width: 72px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 800; }
.tab-bar button.active { color: white; background: rgba(59,130,246,.13); }
.tab-content { display: none; min-height: 0; overflow: auto; padding: 12px; }
.tab-content.active { display: block; }
.content-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.content-heading > div:last-child { display: flex; gap: 7px; }
.content-heading p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.content-heading.compact { margin: 14px 0 7px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 9px; font-variant-numeric: tabular-nums; }
th { color: var(--muted); text-align: left; font-weight: 750; }
th, td { height: 34px; padding: 0 9px; border-bottom: 1px solid rgba(139,158,213,.08); white-space: nowrap; }
.empty-cell { height: 70px; color: var(--muted); text-align: center; }
.side-badge { display: inline-flex; min-width: 38px; justify-content: center; padding: 3px 6px; border-radius: 5px; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.side-badge.buy { color: #b7f7e8; background: rgba(45,212,191,.1); }
.side-badge.sell { color: #fecdd3; background: rgba(251,113,133,.1); }
.positive { color: var(--green); }
.negative { color: var(--red); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-grid article { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,8,22,.45); }
.stat-grid strong { display: block; margin-top: 5px; font-size: 16px; font-variant-numeric: tabular-nums; }
.forecast-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.list-stack { display: grid; gap: 6px; margin-top: 8px; }
.list-row { min-height: 34px; display: flex; justify-content: space-between; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 9px; }
.list-row strong { color: var(--text); }
.timeline-list { display: grid; gap: 7px; }
.timeline-item { display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,8,22,.35); }
.timeline-item time { color: var(--muted); font-size: 9px; }
.timeline-item strong { font-size: 10px; }
.timeline-item small { color: var(--muted); font-size: 8px; }
.impact { padding: 4px 7px; border-radius: 999px; font-size: 7px; font-weight: 850; text-transform: uppercase; }
.impact.high { color: #fecdd3; background: rgba(251,113,133,.12); }
.impact.medium { color: #fde68a; background: rgba(251,191,36,.1); }
.impact.low { color: #bae6fd; background: rgba(56,189,248,.1); }
.replay-controls { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.replay-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.replay-controls input { width: 110px; }
.replay-stats { margin-top: 12px; }
.mini-chart { min-height: 140px; margin-top: 10px; }
.journal-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 9px; }
.journal-card { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,8,22,.4); }
.journal-card header { display: flex; justify-content: space-between; align-items: center; }
.journal-card h4 { margin: 0; font-size: 11px; }
.journal-card p { color: var(--muted); font-size: 9px; line-height: 1.5; }
.journal-card footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.audit-list { display: grid; gap: 5px; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 8px; }
.audit-item { padding: 8px; border-bottom: 1px solid var(--line); color: var(--muted); }
.audit-item strong { color: var(--text); }
.trade-panel { grid-area: trade; display: flex; flex-direction: column; overflow-y: auto; }
.trade-heading { flex: 0 0 auto; }
.account-card { margin: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5,8,22,.48); }
.account-card > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.account-card span { color: var(--muted); font-size: 8px; }
.account-card strong { color: var(--text); font-size: 15px; }
.account-mini { display: flex; gap: 13px; margin-top: 9px; }
.account-mini strong { margin-left: 3px; font-size: 9px; }
.risk-banner { margin: 0 10px 10px; min-height: 48px; display: flex; gap: 9px; align-items: center; padding: 9px; border: 1px solid rgba(251,191,36,.18); border-radius: 10px; background: rgba(251,191,36,.05); }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: 0 0 auto; }
.risk-banner.safe { border-color: rgba(45,212,191,.2); background: rgba(45,212,191,.05); }
.risk-banner.safe .risk-dot { background: var(--green); }
.risk-banner.blocked { border-color: rgba(251,113,133,.25); background: rgba(251,113,133,.06); }
.risk-banner.blocked .risk-dot { background: var(--red); }
.risk-banner strong, .risk-banner small { display: block; }
.risk-banner strong { font-size: 9px; }
.risk-banner small { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.side-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 10px 8px; }
.side-toggle button { height: 35px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 850; }
.side-toggle .buy.active { color: #d5fff6; background: linear-gradient(135deg,rgba(13,148,136,.34),rgba(45,212,191,.12)); box-shadow: inset 0 0 0 1px rgba(45,212,191,.22); }
.side-toggle .sell.active { color: #ffe4e6; background: linear-gradient(135deg,rgba(225,29,72,.31),rgba(251,113,133,.12)); box-shadow: inset 0 0 0 1px rgba(251,113,133,.22); }
.order-kind { margin: 0 10px 9px; display: flex; }
.order-kind button { flex: 1; }
.trade-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 0 10px 10px; }
.trade-form label { display: grid; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .04em; }
.trade-form .full { grid-column: 1 / -1; }
.trade-form details { border-top: 1px solid var(--line); padding-top: 8px; }
.trade-form summary { cursor: pointer; color: #cbd5ef; font-size: 9px; font-weight: 800; }
.trade-form.nested { padding: 9px 0 0; }
.risk-preview { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.risk-preview span { padding: 7px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 7px; }
.risk-preview strong { display: block; margin-top: 3px; color: var(--text); font-size: 10px; }
.confirm-row { display: flex !important; grid-template-columns: auto 1fr; align-items: flex-start; gap: 7px !important; line-height: 1.4; }
.confirm-row input { width: 15px; height: 15px; accent-color: var(--purple); }
.security-note { margin: auto 10px 12px; padding: 9px; border: 1px solid rgba(96,165,250,.13); border-radius: 9px; background: rgba(59,130,246,.045); color: var(--muted); font-size: 8px; line-height: 1.5; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px,100vw); z-index: 80; padding: 14px; overflow-y: auto; border-left: 1px solid var(--line-strong); background: rgba(7,11,27,.97); backdrop-filter: blur(26px); box-shadow: var(--shadow); transform: translateX(105%); transition: 200ms ease; }
.drawer.open { transform: translateX(0); }
.drawer-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer-heading h2 { margin: 3px 0 0; font-size: 16px; }
.drawer > label, .login-card label { display: grid; gap: 6px; margin: 11px 0; color: var(--muted); font-size: 9px; font-weight: 750; }
.login-card, .session-card { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5,8,22,.45); }
.login-card .primary-button { width: 100%; }
.session-card { display: flex; align-items: center; justify-content: space-between; }
.session-card span, .session-card strong { display: block; }
.session-card span { color: var(--muted); font-size: 8px; }
.session-card strong { margin-top: 3px; font-size: 11px; }
.switch-control.wide { margin: 14px 0; }
.drawer > .primary-button { width: 100%; }
.drawer-note { margin-top: 16px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.drawer-note strong { font-size: 10px; }
.drawer-note p { color: var(--muted); font-size: 9px; line-height: 1.55; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(1,3,10,.64); backdrop-filter: blur(3px); }
.toast-stack { position: fixed; right: 15px; bottom: 15px; z-index: 100; display: grid; gap: 7px; }
.toast { min-width: 250px; max-width: min(380px,calc(100vw - 30px)); padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(10,15,34,.97); box-shadow: var(--shadow); font-size: 10px; animation: toast-in .18s ease; }
.toast.success { border-color: rgba(45,212,191,.3); }
.toast.error { border-color: rgba(251,113,133,.34); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1320px) {
  .app-shell { grid-template-columns: 205px minmax(0,1fr) 310px; }
  .market-copy { display: none; }
  .advanced-strip { grid-template-columns: repeat(3,1fr); }
  .advanced-strip article:nth-child(n+4) { display: none; }
  .legend span:nth-child(n+4) { display: none; }
}

@media (max-width: 1024px) {
  body { overflow: auto; }
  .app-shell {
    height: auto; min-height: 100dvh;
    grid-template-columns: 190px minmax(0,1fr);
    grid-template-rows: 62px minmax(600px,1fr) auto;
    grid-template-areas: "top top" "watch work" "trade trade";
    padding-bottom: 12px;
  }
  .topbar { position: sticky; top: 0; }
  .trade-panel { min-height: 530px; display: grid; grid-template-columns: 250px 1fr; grid-template-rows: auto auto 1fr; padding-bottom: 10px; }
  .trade-heading { grid-column: 1 / -1; }
  .account-card, .risk-banner { grid-column: 1; }
  .side-toggle, .order-kind, .trade-form, .security-note { grid-column: 2; }
  .side-toggle { grid-row: 2; }
  .order-kind { align-self: end; }
  .trade-form { grid-row: 3 / span 2; }
  .security-note { align-self: end; }
  .workspace { grid-template-rows: minmax(430px,60vh) minmax(300px,auto); }
  .chart-toolbar .ghost-button { display: none; }
}

@media (max-width: 720px) {
  :root { --shadow: 0 14px 45px rgba(0,0,0,.38); }
  body { overflow: hidden; }
  .mobile-only { display: grid !important; }
  .app-shell {
    height: 100dvh; min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 58px minmax(0,1fr) calc(60px + env(safe-area-inset-bottom));
    grid-template-areas: "top" "work" "nav";
    gap: 0; padding: 0;
  }
  .topbar { margin: 0; padding: max(8px,env(safe-area-inset-top)) 10px 6px; gap: 9px; position: relative; }
  .brand { min-width: auto; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .brand-copy { display: none; }
  .market-head { flex: 1; gap: 7px; overflow: hidden; }
  .connection-dot { width: 6px; height: 6px; }
  .live-price { font-size: 18px; }
  .price-change { font-size: 8px; }
  .top-actions .pill, #notificationButton { display: none; }
  .icon-button { width: 34px; height: 34px; }
  .watchlist { position: fixed; inset: 0 auto 0 0; width: min(310px,88vw); z-index: 90; border-radius: 0 15px 15px 0; transform: translateX(-105%); transition: 190ms ease; }
  .watchlist.open { transform: translateX(0); }
  .workspace { grid-area: work; display: block; overflow: hidden; }
  .chart-card, .lower-panel { height: 100%; border-radius: 0; border-left: 0; border-right: 0; }
  .chart-card { grid-template-rows: 48px 26px minmax(0,1fr) auto; }
  .chart-toolbar { padding: 6px 8px; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .chart-toolbar::-webkit-scrollbar { display: none; }
  .select-control { min-width: 92px; height: 34px; }
  .segmented.scrollable { flex: 0 0 auto; }
  .segmented button { min-width: 35px; height: 28px; }
  .chart-type { margin-left: 0; flex: 0 0 auto; }
  .switch-control { min-width: 85px; }
  .chart-status-row { padding: 0 8px; }
  .legend { max-width: 70%; overflow: hidden; }
  .legend span:nth-child(n+3) { display: none; }
  .forecast-label { top: 8px; right: 8px; font-size: 7px; }
  .chart-watermark { left: 12px; top: 12px; }
  .chart-watermark span { font-size: 18px; }
  .advanced-strip { grid-template-columns: repeat(2,1fr); max-height: 94px; overflow-y: auto; }
  .advanced-strip article { padding: 8px; }
  .advanced-strip article:nth-child(n+3) { display: none; }
  .lower-panel { display: none; grid-template-rows: 44px minmax(0,1fr); }
  .workspace.show-analysis .chart-card { display: none; }
  .workspace.show-analysis .lower-panel { display: grid; }
  .tab-content { padding: 10px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .forecast-detail-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 66px 1fr; }
  .timeline-item .impact { grid-column: 2; justify-self: start; }
  .replay-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .replay-controls label, .replay-controls input { width: 100%; }
  .replay-controls .primary-button { grid-column: 1 / -1; }
  .journal-grid { grid-template-columns: 1fr; }
  .trade-panel {
    position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); top: 10vh;
    z-index: 85; display: flex; min-height: 0; border-radius: 18px 18px 0 0; padding-bottom: max(12px,env(safe-area-inset-bottom));
    transform: translateY(110%); transition: 210ms cubic-bezier(.2,.8,.2,1);
  }
  .trade-panel.open { transform: translateY(0); }
  .trade-handle { width: 38px; height: 4px; border-radius: 10px; background: var(--line-strong); margin: 8px auto 0; }
  .trade-heading { min-height: 50px; }
  .trade-form { grid-template-columns: 1fr 1fr; overflow-y: visible; }
  .security-note { margin-bottom: 20px; }
  .mobile-nav {
    grid-area: nav; display: grid !important; grid-template-columns: repeat(5,1fr); align-items: start;
    padding: 5px 4px max(5px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
    background: rgba(5,7,19,.96); backdrop-filter: blur(22px); z-index: 75;
  }
  .mobile-nav button { height: 48px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 7px; font-weight: 750; }
  .mobile-nav button span { font-size: 16px; line-height: 1; }
  .mobile-nav button.active { color: var(--blue-2); background: rgba(59,130,246,.08); }
  .drawer { width: 100%; padding: max(14px,env(safe-area-inset-top)) 14px max(20px,env(safe-area-inset-bottom)); }
  .toast-stack { left: 10px; right: 10px; bottom: calc(68px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; width: 100%; }
}

@media (max-width: 390px) {
  .price-change { display: none; }
  .chart-toolbar .switch-control span:last-child { display: none; }
  .chart-toolbar .switch-control { min-width: 38px; }
  .trade-form { grid-template-columns: 1fr; }
  .trade-form .full { grid-column: 1; }
  .risk-preview { grid-template-columns: 1fr 1fr; }
  .risk-preview span:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
