:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --surface: #101216;
  --line: #252830;
  --text: #f4f3ef;
  --muted: #8d929d;
  --accent: #f0b90b;
  --positive: #42d6a4;
  --negative: #ff667a;
  --radius: 18px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
.login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #191b20 0%, var(--bg) 48%); }
.login-gate[hidden] { display: none; }
.login-gate form { width: min(420px, 100%); animation: enter .4s ease-out both; }
.login-gate h1 { margin-bottom: 18px; }
.login-gate form > p:not(.eyebrow) { color: var(--muted); margin: 0 0 30px; }
.login-gate label, .pin-field { display: grid; gap: 9px; margin-top: 17px; color: var(--muted); font-size: 12px; }
.login-gate input, .pin-field input { width: 100%; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; color: var(--text); font-size: 18px; transition: border-color .16s ease; }
.login-gate input:focus, .pin-field input:focus { border-color: var(--accent); }
.login-gate button { width: 100%; margin-top: 28px; padding: 15px 18px; border: 0; border-radius: 12px; background: var(--accent); color: #111; font-weight: 850; cursor: pointer; }
.login-gate small { display: block; min-height: 18px; margin-top: 14px; color: var(--negative); }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 64px; animation: enter .45s ease-out both; }
.shell[hidden] { display: none; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--muted); letter-spacing: .12em; font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 64px); line-height: .96; letter-spacing: -.055em; }
.connection { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; text-align: right; }
.connection span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.connection span.live { background: var(--positive); box-shadow: 0 0 0 5px color-mix(in srgb, var(--positive) 12%, transparent); }
.connection small { grid-column: 1 / -1; color: var(--muted); margin-top: 4px; }
.connection button { grid-column: 1 / -1; justify-self: end; margin-top: 8px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.connection button:hover { color: var(--text); }
.account-strip { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.account-strip div { padding: 24px 18px 24px 0; }
.account-strip span, .controls label, .execution span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.account-strip strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.hedge-guard { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--positive); }
.hedge-guard.risk { color: var(--negative); }
.hedge-guard span { color: var(--muted); text-align: right; }
.positions { display: grid; grid-template-columns: 1fr 100px 1fr; gap: 28px; padding: 42px 0; border-bottom: 1px solid var(--line); }
.position { min-width: 0; }
.position-title { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.position-title span { font-weight: 800; letter-spacing: .08em; }
.position-title strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.position-quantity { display: flex; gap: 10px; align-items: baseline; margin: 27px 0 31px; }
.position-quantity strong { font-size: clamp(46px, 7vw, 82px); line-height: .9; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.position-quantity span { color: var(--muted); font-weight: 700; }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 24px; padding: 11px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.hedge-axis { display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; align-items: center; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.hedge-axis span { width: 1px; height: 100%; background: var(--line); }
.hedge-axis b { padding: 12px 0; writing-mode: vertical-rl; }
.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.controls { display: grid; grid-template-columns: 150px 220px 1fr; column-gap: 24px; align-items: end; padding: 38px 0 28px; }
.controls label { grid-column: 1 / 2; align-self: center; margin: 0; }
.quantity-field { display: flex; align-items: baseline; border-bottom: 2px solid var(--accent); padding: 4px 0 10px; }
.quantity-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; }
.quantity-field span { color: var(--muted); font-weight: 700; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions button, dialog button { border: 0; border-radius: 13px; padding: 16px 20px; background: var(--accent); color: #111; text-align: left; cursor: pointer; transition: transform .16s ease, opacity .16s ease, background .16s ease; }
.actions button:hover:not(:disabled), dialog button:hover { transform: translateY(-2px); }
.actions button span { display: block; font-weight: 850; font-size: 17px; }
.actions button small { display: block; margin-top: 4px; opacity: .68; }
.actions button:disabled { opacity: .28; cursor: not-allowed; filter: grayscale(1); }
#actionHint { grid-column: 2 / -1; margin: 15px 0 0; color: var(--muted); font-size: 12px; }
.execution { padding: 28px 0; border-top: 1px solid var(--line); animation: reveal .25s ease-out both; }
.execution-head { display: flex; justify-content: space-between; align-items: baseline; }
.execution-head strong { color: var(--positive); }
.execution-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 18px; margin-top: 25px; }
.execution-grid strong { font-size: 15px; font-variant-numeric: tabular-nums; }
dialog { width: min(480px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #15171b; color: var(--text); box-shadow: 0 28px 90px #000b; }
dialog::backdrop { background: #050609d9; backdrop-filter: blur(5px); }
dialog form { padding: 28px; }
dialog h2 { margin: 0 0 12px; font-size: 26px; }
dialog p { color: var(--muted); line-height: 1.6; }
.pin-field { margin-top: 22px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
dialog button { text-align: center; font-weight: 800; }
dialog button.secondary { background: #24272e; color: var(--text); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 48px)); padding: 14px 18px; border-radius: 12px; background: #1d2026; color: var(--text); box-shadow: 0 16px 48px #0008; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 620px); padding-top: 24px; }
  .account-strip { grid-template-columns: 1fr 1fr; }
  .hedge-guard { display: grid; }
  .hedge-guard span { text-align: left; }
  .positions { grid-template-columns: 1fr; gap: 28px; }
  .hedge-axis { grid-template-columns: 1fr auto 1fr; grid-template-rows: auto; }
  .hedge-axis span { width: 100%; height: 1px; }
  .hedge-axis b { writing-mode: initial; padding: 0 12px; }
  .controls { grid-template-columns: 1fr; row-gap: 15px; }
  .controls label, #actionHint { grid-column: auto; }
  .actions { grid-template-columns: 1fr; }
  .execution-grid { grid-template-columns: 1fr 1fr; }
}
