:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf1f0;
  background: #101414;
  --panel: #19201f;
  --panel-top: #202927;
  --border: #35403d;
  --muted: #a7b3ae;
  --accent: #a7edc4;
  --positive: #79e2ad;
  --negative: #ff9e9a;
  --warning: #f5c47b;
  --info: #a7c5ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; min-width: 280px; }
button, input, textarea { font: inherit; }
button, a, input, textarea, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
.page { max-width: 1540px; margin: auto; padding: 42px clamp(16px, 4vw, 64px) 56px; }
.header, .identity, .account-controls, .toolbar, .detail-head, .row-tools { display: flex; align-items: center; }
.header, .toolbar, .detail-head { justify-content: space-between; gap: 16px; }
.header { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.identity { gap: 12px; min-width: 0; }
.mark { background: #273831; display: flex; align-items: end; gap: 3px; padding: 10px; border-radius: 9px; width: 38px; height: 38px; flex: none; }
.mark i { display: block; background: var(--accent); width: 4px; height: 7px; border-radius: 2px; }
.mark i:nth-child(2) { height: 13px; }
.mark i:nth-child(3) { height: 18px; }
h1 { font-size: clamp(1.2rem, 3vw, 1.7rem); line-height: 1.16; margin: 0; letter-spacing: -.03em; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { margin: 0 0 14px; font-size: 1rem; }
h4 { margin: 0; font-size: .875rem; }
p { line-height: 1.5; }
.account-controls, .row-tools { gap: 8px; }
.button { display: inline-flex; min-height: 42px; padding: 0 13px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: #edf1f0; font-weight: 650; cursor: pointer; text-decoration: none; font-size: .875rem; }
.button.primary { background: var(--accent); color: #11271b; border-color: var(--accent); }
.button.quiet { color: var(--muted); }
.button:hover, .tabs button:hover { filter: brightness(1.14); }
button:disabled { opacity: .65; cursor: wait; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.login { margin: 48px auto 12px; padding: clamp(20px, 5vw, 36px); max-width: 460px; }
.login p { color: var(--muted); }
.login .permissions { font-size: .875rem; margin-bottom: 0; }
.toolbar { margin: 24px 0 16px; }
.tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; min-height: 42px; padding: 0 13px; border-radius: 7px; font-weight: 650; cursor: pointer; font-size: .875rem; }
.tabs button[aria-pressed="true"] { background: var(--panel-top); border-color: var(--border); color: var(--accent); }
.tabs span { font-size: .75rem; color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.freshness { color: var(--muted); font-size: .875rem; margin: 0; text-align: right; }
.freshness.stale, .message[data-kind="warning"] { color: var(--warning); }
.message { color: var(--muted); font-size: .875rem; }
.message:empty { display: none; }
.message[data-kind="error"] { color: var(--negative); }
.message a { color: inherit; margin-left: 6px; }
.empty { padding: 28px; color: var(--muted); margin: 0; }
.positions { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.positions table { min-width: 980px; }
th, td { padding: 13px 10px; line-height: 1.35; text-align: right; font-variant-numeric: tabular-nums; }
th { background: var(--panel-top); color: var(--muted); font-weight: 600; }
th:first-child, td:first-child, .left { text-align: left; }
.positions th:first-child, .positions td:first-child { padding-left: 16px; }
.positions th:last-child, .positions td:last-child { padding-right: 16px; }
td { border-top: 1px solid var(--border); }
.positions tr[data-selected="true"] td { background: #263b31; }
.symbol { min-width: 92px; }
.symbol button { border: none; min-height: 36px; padding: 2px 0; text-align: left; color: var(--accent); background: none; font-weight: 750; cursor: pointer; }
.symbol small { color: var(--muted); margin-left: 0; display: block; }
.status { display: inline-flex; align-items: center; padding: 4px 8px; color: var(--muted); background: #2b3633; font-weight: 650; border-radius: 7px; }
.status.profit-locked, .positive { color: var(--positive); }
.status.unprotected, .negative { color: var(--negative); }
.status.breakeven { color: var(--info); }
.status.at-risk { color: var(--warning); }
.detail { margin-top: 15px; padding: 20px; }
.detail-head { align-items: start; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.detail-head p { margin: 6px 0 0; color: var(--muted); font-size: .875rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 19px 0; }
dl { margin: 0; }
.metric { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; border-top: 1px solid var(--border); padding: 9px 0; margin: 0; font-size: .875rem; }
.metric dt { color: var(--muted); }
.metric dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; }
.detail section + section { margin-top: 20px; }
.detail-grid section + section { margin-top: 0; }
.detail-rows { overflow: auto; }
.detail-rows table { min-width: 485px; }
.help, .hint, .form-status { color: var(--muted); font-size: .875rem; }
.help { margin: 10px 0; }
.callout { color: var(--warning); font-size: .875rem; }
.entry { border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; overflow: hidden; }
.entry summary { padding: 13px; background: var(--panel-top); cursor: pointer; }
.entry-body { padding: 12px; }
.entry-body > p { margin: 0 0 10px; }
label { display: block; color: var(--muted); font-size: .875rem; }
input, textarea { display: block; width: 100%; color: inherit; background: #101414; border: 1px solid var(--border); padding: 10px; margin: 6px 0 13px; border-radius: 6px; }
.notes input { max-width: 440px; }
textarea { min-height: 108px; resize: vertical; }
.basis-fields { display: grid; grid-template-columns: repeat(2, minmax(120px, 200px)); gap: 10px; }
.form-status[data-kind="error"] { color: var(--negative); }
@media (max-width: 700px) {
  .page { padding-top: 20px; }
  .header { padding-bottom: 16px; gap: 6px; }
  .identity { gap: 8px; }
  .mark { height: 32px; width: 32px; padding: 7px; }
  .account-controls { gap: 4px; }
  .account-controls .button { padding: 0 8px; }
  .toolbar { align-items: start; flex-direction: column; gap: 10px; margin-top: 16px; }
  .freshness { text-align: left; }
  .positions { border: 0; background: none; overflow: visible; }
  .positions table { min-width: 0; display: block; }
  .positions thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .positions tbody { display: block; }
  .positions tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 7px 10px 12px; margin-bottom: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
  .positions td { padding: 8px 5px !important; border: 0; text-align: left; overflow-wrap: anywhere; }
  .positions td:not(.symbol):not(.table-status)::before { display: block; content: attr(data-label); color: var(--muted); font-size: .75rem; margin-bottom: 4px; }
  .positions td.symbol { grid-column: span 2; }
  .positions td.table-status { grid-column: 3; justify-self: end; min-width: 100%; }
  .positions tr[data-selected="true"] { border-color: var(--accent); background: #263b31; }
  .positions .status { font-size: .75rem; }
  .detail { padding: 14px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .empty { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
}
@media (max-width: 355px) {
  .header { flex-wrap: wrap; }
  .basis-fields { grid-template-columns: minmax(0, 1fr); }
}
