:root {
  color-scheme: dark;
  --bg: #111411; --panel: #191d19; --raised: #222820; --line: #333c33;
  --text: #f0f2e9; --muted: #a8b1a5; --accent: #d3ec9e;
  --green: #a8d9b4; --amber: #f1cb8c; --red: #ffa99b;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.4; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a, select, summary { touch-action: manipulation; }
button, select, summary { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .6; }
button, input, select, a, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 550; }
h2 { font-size: .9375rem; font-weight: 600; }
h3 { font-size: .875rem; font-weight: 550; }
strong { font-weight: 600; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.shell { width: 100%; padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.subtle { color: var(--muted); }
.small { font-size: .8125rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px; border-bottom: 1px solid var(--line); }
.brand { font-size: 1.1rem; letter-spacing: -.035em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid #495347; background: var(--raised); border-radius: 6px; padding: 8px 12px; font-size: .875rem; font-weight: 500; transition: background .15s; }
.button:hover { background: #30392b; }
.button:active { background: #3b4534; }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.quiet:hover { background: var(--panel); color: var(--text); }
.button.primary { background: var(--accent); color: #202918; border-color: var(--accent); }
.button.primary:hover { background: #e1f7b7; }
.icon-button { width: 44px; padding: 0; }
.menu { position: relative; }
.menu > summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 6px; list-style: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--raised); }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 48px; z-index: 10; min-width: 144px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px #0006; }
.menu-items .button { width: 100%; justify-content: flex-start; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.badge.good { color: var(--green); background: #223127; border-color: #3d5b45; }
.badge.warn { color: var(--amber); background: #342d20; border-color: #5a4b32; }
.badge.bad { color: var(--red); background: #362823; border-color: #694538; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .75rem; padding: 5px 0; }
.live-label { letter-spacing: .05em; font-size: .6875rem; }
.notice, .alerts { padding: 8px 12px; border: 1px solid #69543b; background: #2f291f; color: var(--amber); border-radius: 6px; margin: 0 0 8px; font-size: .8125rem; }
.alerts { padding-left: 28px; }
.alerts li + li { margin-top: 4px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 0; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.metric { padding: 0 10px; min-width: 0; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric p { color: var(--muted); font-size: .75rem; }
.metric strong { display: block; font-size: clamp(1.125rem, 5.3vw, 1.375rem); line-height: 1.25; letter-spacing: -.025em; font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.primary-grid, .secondary-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 32px; }
.count { color: var(--muted); font-size: .75rem; font-weight: 400; margin-left: 4px; }
.empty { padding: 8px 0 12px; color: var(--muted); font-size: .875rem; }
.empty h3 { color: var(--muted); font-weight: 400; }
.empty p { margin-top: 4px; }
.position + .position { border-top: 1px solid var(--line); }
.position-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; min-height: 56px; padding: 5px 0; list-style: none; }
.position-summary::-webkit-details-marker { display: none; }
.position-summary > strong { font-size: 1rem; text-align: right; font-variant-numeric: tabular-nums; }
.position-summary .badge { justify-self: end; min-height: 20px; padding: 1px 5px; font-size: .75rem; }
.position-summary .symbol::before { content: '›'; display: inline-block; width: 12px; color: var(--muted); }
.position[open] > summary .symbol::before { content: '⌄'; }
.position-summary:hover { background: var(--raised); }
.symbol { font-weight: 600; font-size: .9375rem; overflow-wrap: anywhere; }
.direction { text-transform: uppercase; color: var(--muted); font-size: .75rem; font-weight: 400; margin-left: 6px; }
.position-size { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.position-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.position-data dt { color: var(--muted); font-size: .75rem; margin-bottom: 2px; }
.position-data dd { margin: 0; font-size: .875rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.legs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.leg-group { background: #131813; border-radius: 5px; padding: 8px; min-width: 0; }
.leg-group h3 { font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.leg-group p { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.leg-price, .leg-size { display: block; }
.leg-price { font-size: .875rem; }
.leg-size { color: var(--muted); font-size: .75rem; }
.leg + .leg { margin-top: 6px; }
.pending { border-top: 1px solid var(--line); }
.pending > summary { min-height: 44px; align-content: center; font-size: .8125rem; }
.pending p { color: var(--muted); font-size: .8125rem; padding: 4px 0 8px; }
select { min-height: 44px; padding: 6px 8px; color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: .8125rem; max-width: 100px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.event + .event { border-top: 1px solid var(--line); }
.event-line { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 36px; padding: 6px 0; font-size: .8125rem; list-style: none; overflow-wrap: anywhere; }
summary.event-line { min-height: 44px; }
.event-line::-webkit-details-marker { display: none; }
summary.event-line > span::after { content: ' ›'; color: var(--muted); }
.event-line time { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; align-self: start; padding-top: 1px; }
.event-detail { color: var(--muted); font-size: .8125rem; padding: 0 0 10px 48px; overflow-wrap: anywhere; }
.more { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--muted); font-size: .8125rem; }
.secondary { margin-top: 8px; border-top: 1px solid var(--line); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.secondary > summary { min-height: 44px; align-content: center; font-size: .8125rem; }
.secondary > summary > span { color: var(--muted); float: right; font-size: .75rem; }
.status-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .75rem; color: var(--muted); margin: 0 0 10px; }
.limits-panel dl { margin: 0; }
.limits-panel dl div { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .8125rem; }
.limits-panel dl:last-child div:last-child { border: 0; }
.limits-panel dt { color: var(--muted); }
.limits-panel dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.segmented { display: flex; gap: 8px; }
.segmented button { min-height: 44px; background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; padding: 6px 10px; font-size: .8125rem; }
.segmented button[aria-pressed=true] { color: var(--accent); border-bottom-color: var(--accent); }
.watch-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.watch-row { padding: 8px 0; }
.watch-row + .watch-row { border-top: 1px solid var(--line); }
.watch-row p { color: var(--muted); font-size: .8125rem; margin-top: 4px; overflow-wrap: anywhere; }
.watch-row details { font-size: .8125rem; }
.watch-row summary { color: var(--accent); min-height: 44px; align-content: center; }
.skip { position: absolute; left: 12px; top: -80px; padding: 12px; background: var(--accent); color: var(--bg); z-index: 20; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 430px; padding: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; }
.login-card > h1 { font-size: 2rem; margin-bottom: 28px; }
.login-card label { display: block; font-size: .875rem; margin-bottom: 8px; }
.login-card input { width: 100%; height: 50px; background: var(--bg); color: var(--text); border: 1px solid #66705f; border-radius: 8px; padding: 10px 12px; font-size: 1rem; }
.form-error { color: var(--red); font-size: .875rem; min-height: 24px; margin: 8px 0; }
.login-submit { width: 100%; min-height: 48px; }
@media (min-width: 768px) {
  .shell { padding-left: 20px; padding-right: 20px; }
  .primary-grid, .secondary-grid { gap: 12px; }
  .metrics { padding: 10px 0; }
  .metric { padding: 0 16px; }
  .metric strong { font-size: 1.5rem; }
  .position-data { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .login-body { padding: 18px; }
  .login-card { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
/* Results (realized, after fees) */
.stats { margin-top: 8px; padding-bottom: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stat-row p { color: var(--muted); font-size: .75rem; }
.stat-row strong { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart { margin: 10px 0 6px; }
.chart svg { display: block; width: 100%; height: 90px; background: var(--raised); border-radius: 6px; }
.chart .axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .up { fill: var(--green); }
.chart .down { fill: var(--red); }
.chart figcaption { display: flex; justify-content: space-between; color: var(--muted); font-size: .6875rem; margin-top: 3px; }
.strategy-table { width: 100%; border-collapse: collapse; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.strategy-table th, .strategy-table td { padding: 6px 4px; text-align: right; border-top: 1px solid var(--line); }
.strategy-table th:first-child { text-align: left; font-weight: 500; }
.strategy-table thead th { color: var(--muted); font-weight: 400; font-size: .75rem; border-top: 0; }
.strategy-table .count { display: block; margin-left: 0; }
/* The logo: a Socrates head (assets/icons/logo.svg) */
.brand a { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; display: block; }
.login-logo { width: 96px; height: 96px; border-radius: 22px; display: block; margin: 0 auto 12px; }
