:root {
  color-scheme: dark;
  --page: #0d1117;
  --canvas: #131722;
  --card: #1e222d;
  --line: #2b3040;
  --text: #e6e8ed;
  --muted: #8b93a5;
  --gold: #d4af37;
  --green: #089981;
  --red: #f23645;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: max(0px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); background: var(--page); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
.shell { max-width: 1040px; margin: auto; padding: 18px 18px 100px; }
.topbar, .top-actions, .brand, .hero, .equity-line, .section-heading, .drawer-head { display: flex; align-items: center; justify-content: space-between; }
.topbar { padding: 4px 0 24px; }
.brand { justify-content: flex-start; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { color: var(--gold); font-size: 30px; line-height: 1; }
.brand strong, .brand small { display: block; letter-spacing: .12em; }
.brand strong { font-size: 11px; }
.brand small { color: var(--muted); font-size: 9px; margin-top: 4px; letter-spacing: .18em; }
.top-actions { gap: 11px; }
.feed-pill { border: 1px solid var(--line); border-radius: 20px; padding: 6px 9px; color: var(--muted); font: 10px ui-monospace, monospace; letter-spacing: .1em; display: inline-flex; align-items: center; gap: 6px; }
.feed-pill i { width: 7px; height: 7px; border-radius: 50%; display: block; background: var(--gold); box-shadow: 0 0 10px currentColor; }
.feed-pill.live { color: var(--green); }.feed-pill.live i { background: var(--green); }.feed-pill.sim i { background: var(--gold); }
.icon-button, .close-button { border: 0; background: transparent; color: var(--muted); min-width: 38px; min-height: 38px; font-size: 19px; }
.hero { background: radial-gradient(ellipse at 82% 10%, #1b2530 0%, var(--canvas) 62%); border: 1px solid var(--line); padding: 22px; border-radius: 15px; gap: 12px; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .19em; font-weight: 650; }
.equity-line { justify-content: flex-start; gap: 11px; flex-wrap: wrap; margin-top: 8px; }
.equity-value { font-size: clamp(26px, 6vw, 37px); font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.change { font-size: 12px; font-variant-numeric: tabular-nums; }
.positive { color: var(--green)!important; }.negative { color: var(--red)!important; }
.hero-sub { color: var(--muted); font-size: 11px; margin-top: 6px; }
.primary-button, .secondary-button, .ctrader-button { border: 0; background: var(--gold); color: #141414; border-radius: 9px; font-weight: 700; padding: 11px 15px; min-height: 42px; white-space: nowrap; }
.primary-button span { font-size: 18px; vertical-align: -1px; margin-right: 4px; }
.primary-button:active, .secondary-button:active, .ctrader-button:active { transform: translateY(1px); }
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 12px 0 28px; }
.metric-card { background: var(--card); border: 1px solid #252a36; border-radius: 10px; padding: 12px 11px; min-width: 0; }
.metric-card span, .metric-card strong { display: block; }
.metric-card span { font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.metric-card strong { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.section-heading { margin-bottom: 11px; gap: 12px; }
.section-heading h1 { margin: 5px 0 0; font-size: 19px; font-weight: 550; }
.section-heading h1 span { color: var(--muted); font-size: 13px; margin-left: 4px; }
.secondary-button { color: var(--text); background: #222a34; border: 1px solid #353d49; font-size: 11px; font-weight: 600; padding: 8px 11px; min-height: 36px; }
.positions-list { display: grid; gap: 8px; }
.position-card { border: 1px solid #282d3a; background: var(--card); border-radius: 11px; overflow: hidden; }
.position-summary { width: 100%; padding: 13px 10px; border: 0; background: transparent; text-align: left; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto auto 15px; align-items: center; gap: 7px; min-height: 68px; }
.asset-icon { display: grid; place-items: center; height: 32px; width: 32px; border-radius: 9px; background: #272d38; color: var(--gold); font-size: 10px; font-weight: 700; }
.instrument-name { display: block; font-size: 13px; font-weight: 600; }
.position-meta { display: block; color: var(--muted); font: 10px ui-monospace, monospace; margin-top: 5px; }
.position-side { font-size: 9px; padding: 5px 6px; border-radius: 5px; color: var(--green); background: #0c302b; }
.position-side.sell { color: var(--red); background: #351d27; }
.position-value { text-align: right; min-width: 84px; font-variant-numeric: tabular-nums; }
.position-value strong, .position-value small { display: block; }
.position-value strong { font-size: 12px; font-weight: 650; }
.position-value small { font-size: 9px; color: var(--muted); margin-top: 5px; }
.expand-chevron { color: var(--muted); font-size: 17px; transition: transform .18s; }
.position-summary[aria-expanded="true"] .expand-chevron { transform: rotate(180deg); }
.position-details { border-top: 1px solid var(--line); padding: 13px; }
.sparkline-wrap { height: 54px; }.sparkline { display: block; width: 100%; height: 54px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 0; }
.detail-grid span, .detail-grid strong { display: block; }
.detail-grid span { color: var(--muted); font-size: 9px; margin-bottom: 5px; }
.detail-grid strong { font: 11px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.lock-button { background: transparent; border: 1px solid #3b414e; border-radius: 7px; padding: 8px 10px; color: var(--gold); font-size: 10px; }
.lock-button span { color: var(--muted); }
.footnote { text-align: center; color: #737b89; font-size: 9px; padding-top: 20px; }
.hidden { display: none!important; }
.app-content { display: none; }
.app-content.authenticated { display: block; }
.auth-screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; overflow-y: auto; padding: 28px 20px; background: #0d1117; }
.auth-screen.hidden { display: none!important; }
.auth-card { width: min(100%, 340px); text-align: center; }
.auth-brand { justify-content: center; margin-bottom: 48px; }
.auth-brand strong { text-align: left; }
.auth-card > .eyebrow { color: var(--gold); }
.auth-card h1 { margin: 11px 0 7px; font-size: 23px; font-weight: 550; }
.auth-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 29px 0 13px; }
.pin-dots span { width: 12px; height: 12px; border: 1px solid #596170; border-radius: 50%; background: transparent; transition: background .12s, border-color .12s; }
.pin-dots span.filled { border-color: var(--gold); background: var(--gold); }
.auth-message { min-height: 20px; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.auth-message.error { color: #ff7b72; }
.auth-message.locked { color: var(--gold); font-size: 14px; margin: 22px 0; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.pin-pad button { min-height: 58px; border: 1px solid #292e3a; border-radius: 10px; background: #1e222d; color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
.pin-pad button:active { border-color: var(--gold); background: #292a25; }
.pin-pad button.pin-action { color: var(--muted); font-size: 12px; }
.pin-pad[hidden] { display: none; }
.auth-footer { margin-top: 30px; color: #727987; font-size: 9px; letter-spacing: .16em; }
.auth-footer span { color: var(--gold); }
.auth-toast { position: fixed; z-index: 30; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; padding: 11px 16px; border: 1px solid #d4af3780; border-radius: 9px; background: #282518; color: var(--gold); font-size: 12px; transition: opacity .2s, transform .2s; white-space: nowrap; }
.auth-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.sign-out-button { width: 100%; margin-top: 18px; padding: 11px; border: 1px solid #3a414d; border-radius: 8px; background: #202630; color: var(--muted); font-size: 11px; }
.backdrop { position: fixed; inset: 0; z-index: 5; background: #0009; backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 6; right: 0; top: 0; bottom: 0; width: min(390px, 92vw); background: #151a24; border-left: 1px solid var(--line); padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); transform: translateX(102%); transition: transform .25s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { margin-bottom: 24px; align-items: flex-start; }
.drawer-head h2 { font-size: 20px; font-weight: 550; margin: 6px 0 0; }
.close-button { font-size: 26px; line-height: 1; }
.settings-form { display: grid; gap: 15px; }
.settings-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.settings-form input, .settings-form select, .chat-form textarea { width: 100%; color: var(--text); border: 1px solid #333a48; border-radius: 7px; outline: none; padding: 11px; background: #0f141c; }
.settings-form input:focus, .settings-form select:focus, .chat-form textarea:focus { border-color: var(--gold); }
.profile-name { margin: -14px 0 18px; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.full-width { margin-top: 4px; }
.manage-users { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.manage-users h3 { margin: 0 0 11px; font-size: 12px; font-weight: 600; }
.user-list { display: grid; gap: 7px; }
.managed-user { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid #2d3440; border-radius: 7px; color: var(--muted); font-size: 10px; }
.managed-user button { border: 0; background: transparent; color: #ff7b72; font-size: 10px; }
.add-user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.add-user-form label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.add-user-form input { width: 100%; min-width: 0; padding: 9px; color: var(--text); border: 1px solid #333a48; border-radius: 7px; background: #0f141c; }
.add-user-form button { grid-column: 1 / -1; }
.settings-note { display: grid; gap: 6px; border-left: 2px solid var(--green); padding: 10px 12px; background: #0e201f; margin: 20px 0; font-size: 11px; }
.settings-note strong { color: var(--green); }.settings-note span { color: var(--muted); line-height: 1.45; }
.ctrader-button { display: flex; justify-content: space-between; text-decoration: none; background: #262d37; border: 1px solid #3a414d; color: var(--text); font-size: 12px; }
.inline-message { color: var(--muted); font-size: 11px; margin-top: 12px; min-height: 16px; }
.architect-fab { position: fixed; z-index: 4; width: 52px; height: 52px; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); border: 1px solid #ead477; border-radius: 50%; color: #17140b; background: linear-gradient(145deg, #f1dc83, #bd9630); font-size: 22px; box-shadow: 0 8px 25px #0008; }
.gold { color: var(--gold); }
.architect-drawer { display: flex; flex-direction: column; }
.chat-messages { flex: 1; min-height: 150px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-bottom: 15px; }
.chat-bubble { max-width: 92%; border-radius: 10px; padding: 11px 12px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble.assistant { background: #202630; align-self: flex-start; color: #dce1e8; }.chat-bubble.user { background: #292a25; color: #e7d99a; align-self: flex-end; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-form textarea { resize: none; min-height: 43px; max-height: 120px; font-size: 12px; }
.chat-form button { border: 0; border-radius: 8px; color: #15140f; background: var(--gold); height: 40px; width: 42px; font-size: 19px; }
.clean-mode .metrics-grid .metric-card:nth-child(n+3), .clean-mode .position-meta, .clean-mode .footnote { display: none; }
.flash-up { animation: flashUp .45s ease-out; }.flash-down { animation: flashDown .45s ease-out; }
@keyframes flashUp { 0% { background-color: #0b493f; } 100% { background-color: transparent; } }
@keyframes flashDown { 0% { background-color: #541d2a; } 100% { background-color: transparent; } }
@media (min-width: 700px) {
  .shell { padding: 25px 28px 80px; }
  .metrics-grid { grid-template-columns: repeat(6, 1fr); }
  .position-summary { grid-template-columns: 42px minmax(0, 1fr) 70px 130px 18px; padding: 15px 16px; }
  .asset-icon { width: 36px; height: 36px; }
  .detail-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms!important; transition-duration: .01ms!important; } }
