/* AumSwaps Trade Desk
   Palette from the AumSwaps logo: the "a" (#A19CBA), the "S" (#B4A7C7), the wordmark (#B8ACCB).
   Light is lilac paper with aubergine ink; dark is aubergine with lilac ink. One bold element: the
   session ribbon, which carries the logo's a-to-S gradient. Everything else stays quiet. */

:root {
  --ground: #F6F4FA;        /* page */
  --surface: #FFFFFF;       /* tables, tickets, inputs */
  --sunk: #EEEAF5;          /* table heads, tracks, hover */
  --line: #E2DCEC;
  --line-strong: #CFC6DE;
  --ink: #251E35;           /* text */
  --muted: #6D6584;
  --brand: #6F6497;         /* readable violet for links, focus, primary actions */
  --brand-a: #A19CBA;       /* logo "a" */
  --brand-s: #B4A7C7;       /* logo "S" */
  --brand-soft: #E9E3F3;
  --long: #1E7F62;  --long-soft: #E3F2EC;
  --short: #B93B55; --short-soft: #F8E6EA;
  --attn: #A86A0C;  --attn-soft: #FBF0DC;
  --danger-fill: #B93B55;
  --on-brand: #FFFFFF;
  --shadow: 0 1px 0 rgba(37, 30, 53, .04), 0 6px 18px -12px rgba(37, 30, 53, .25);
  --radius: 10px;           /* panels and tickets */
  --radius-ctl: 6px;        /* buttons, inputs, tags */
  --display: "Josefin Sans", "Futura", "Century Gothic", system-ui, sans-serif;
  --text: "Albert Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #16121E; --surface: #1E1929; --sunk: #241E31; --line: #2E2740; --line-strong: #3E3555;
    --ink: #ECE7F5; --muted: #A59DBA; --brand: #C3B6DA; --brand-soft: #2B2340;
    --long: #4CC59C; --long-soft: #173027; --short: #F27D93; --short-soft: #3A1C27;
    --attn: #E9B451; --attn-soft: #3A2E15; --danger-fill: #C9465F; --on-brand: #1A1524;
    --shadow: 0 1px 0 rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #16121E; --surface: #1E1929; --sunk: #241E31; --line: #2E2740; --line-strong: #3E3555;
  --ink: #ECE7F5; --muted: #A59DBA; --brand: #C3B6DA; --brand-soft: #2B2340;
  --long: #4CC59C; --long-soft: #173027; --short: #F27D93; --short-soft: #3A1C27;
  --attn: #E9B451; --attn-soft: #3A2E15; --danger-fill: #C9465F; --on-brand: #1A1524;
  --shadow: 0 1px 0 rgba(0, 0, 0, .25); color-scheme: dark;
}

@font-face { font-family: "Albert Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/albert-sans-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Josefin Sans"; font-style: normal; font-weight: 300; font-display: swap;
  src: url(/static/fonts/josefin-sans-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: "Josefin Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/josefin-sans-latin-400-normal.woff2) format("woff2"); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink); font-family: var(--text);
  font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.error { color: var(--short); min-height: 1.2em; margin: 0; }
.long, .pos { color: var(--long); }
.short, .neg { color: var(--short); }
.attn { color: var(--attn); }
h1, h2, h3 { margin: 0; color: var(--ink); }
h1 { font-family: var(--display); font-weight: 300; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.2; }
h3 { font-family: var(--text); font-weight: 650; font-size: 16px; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 70% at 50% 0%, var(--brand-soft), var(--ground) 70%); }
.login-card { width: min(360px, 100%); display: grid; gap: 10px; }
.login-logo { width: 220px; height: auto; justify-self: center; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; text-align: center; }
.login-card > p { text-align: center; margin: 0 0 10px; }
.login-card .btn { margin-top: 4px; }

/* ---------- shell ---------- */
.shell {
  display: grid; min-height: 100vh;
  grid-template-columns: 212px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "rail top" "rail view";
}
.rail {
  grid-area: rail; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--surface);
}
.brand { display: grid; justify-items: start; gap: 2px; padding: 4px 10px 22px; text-decoration: none; }
.brand img { width: 150px; height: auto; display: block; }
.brand span { font-family: var(--display); font-weight: 300; color: var(--muted); font-size: 15px; letter-spacing: .02em; padding-left: 2px; }
.rail a.nav { text-decoration: none; padding: 8px 12px; border-radius: var(--radius-ctl); color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.rail a.nav:hover { color: var(--ink); background: var(--sunk); }
.rail a.nav.active { color: var(--ink); background: var(--brand-soft); font-weight: 650; }
.badge { background: var(--attn); color: var(--on-brand); font-size: 11.5px; font-weight: 700; min-width: 20px;
  text-align: center; border-radius: 999px; padding: 0 6px; line-height: 18px; }
:root[data-theme="dark"] .badge { color: #1A1524; }
.rail-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.rail-foot .linkish { text-align: left; padding: 7px 12px; border-radius: var(--radius-ctl); }
.rail-foot .linkish:hover { background: var(--sunk); }

.topbar {
  grid-area: top; display: grid; gap: 10px; padding: 14px 28px 10px;
  border-bottom: 1px solid var(--line); background: var(--ground); position: sticky; top: 0; z-index: 5;
}
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px 24px; flex-wrap: wrap; }
.strip-meta { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
.clock { font-family: var(--display); font-weight: 300; font-size: 30px; line-height: 1; letter-spacing: -0.01em; }
.session-label { color: var(--muted); font-size: 13.5px; }
.status { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 12.5px; font-weight: 550; padding: 2px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.pill.ok { color: var(--long); background: var(--long-soft); }
.pill.warn { color: var(--attn); background: var(--attn-soft); }
.pill.bad { color: #fff; background: var(--danger-fill); }

/* the session ribbon: the one bold element. 24 h of Eastern time; the trading windows carry the
   logo's a-to-S gradient; the needle is now; the hairline under it is today's loss budget. */
.ribbon { display: grid; gap: 4px; }
.session { width: 100%; height: 34px; display: block; overflow: visible; }
.session .day { fill: var(--sunk); }
.session .win { fill: url(#win-grad); opacity: .5; }
.session .win.active { opacity: 1; }
:root[data-theme="dark"] .session .win:not(.active) { opacity: .72; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .session .win:not(.active) { opacity: .72; } }
.session .tick { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.session .tick.major { stroke: var(--muted); opacity: .5; }
.session .now { stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.session .budget-bg { fill: var(--sunk); }
.session .budget { fill: var(--long); }
.session .budget.warn { fill: var(--attn); }
.session .budget.bad { fill: var(--short); }
.ribbon-hours { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.ribbon-hours span { position: absolute; top: 0; transform: translateX(-50%); }
.ribbon-hours span:first-child { transform: none; }
.ribbon-hours b { position: absolute; top: -40px; height: 24px; display: grid; place-items: center; font-weight: 650;
  font-size: 11.5px; color: #2A2340; white-space: nowrap; overflow: hidden; pointer-events: none; }

.view { grid-area: view; padding: 26px 28px 64px; min-width: 0; display: grid; gap: 28px; align-content: start; max-width: 1480px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head p { margin: 6px 0 0; color: var(--muted); max-width: 68ch; }

.wrap { white-space: normal !important; }
.flush { margin: 0; }
td.w-input { width: 120px; }

/* ---------- headline numbers: a ledger line, not a row of cards ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0;
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.figure { padding: 14px 18px 14px 0; display: grid; align-content: start; gap: 2px; }
.figure + .figure { padding-left: 18px; border-left: 1px solid var(--line); }
.figure .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.figure .value { font-weight: 300; font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; }
.figure .sub { color: var(--muted); font-size: 12.5px; }

/* ---------- panels and tables ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.panel { display: grid; gap: 12px; align-content: start; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head a { font-size: 13px; font-weight: 550; }
.panel + .panel-head, .panel-head.spaced { margin-top: 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
th { color: var(--muted); font-weight: 550; font-size: 12.5px; position: sticky; top: 0; background: var(--sunk); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable[aria-sort] { color: var(--ink); }
th.sortable[aria-sort="descending"]::after { content: " ↓"; }
th.sortable[aria-sort="ascending"]::after { content: " ↑"; }
tbody tr:hover { background: var(--ground); }
tbody tr:last-child td { border-bottom: 0; }
td.left, th.left { text-align: left; }
.sym { font-weight: 700; letter-spacing: .01em; }
.hot { color: var(--attn); font-weight: 700; }
.empty { padding: 26px; color: var(--muted); text-align: center; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: var(--radius-ctl); padding: 1px 7px; color: var(--muted); background: var(--sunk); }
.tag.long { color: var(--long); background: var(--long-soft); }
.tag.short { color: var(--short); background: var(--short-soft); }
.tag.long::before { content: "▲ "; font-size: 9px; vertical-align: 1px; }
.tag.short::before { content: "▼ "; font-size: 9px; vertical-align: 1px; }
.tag.live { color: #fff; background: var(--danger-fill); }

/* ---------- trade tickets ---------- */
.tickets { display: grid; gap: 14px; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: grid; gap: 12px; }
.ticket-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; }
.ticket-top h3 { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: -0.01em; }
.ticket-top h3 .long::before { content: "▲ "; font-size: 14px; vertical-align: 3px; }
.ticket-top h3 .short::before { content: "▼ "; font-size: 14px; vertical-align: 3px; }
.ticket-top .muted { font-size: 13px; }
.ticket dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px 18px; margin: 0;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ticket .span2 { grid-column: span 2; }
.ticket dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.ticket dd { margin: 0; font-weight: 650; }
.ticket dd.targets { display: grid; gap: 2px; font-weight: 600; }
.ticket dd.targets > span { white-space: nowrap; }
.ticket dd.targets .muted { font-weight: 500; font-size: 13px; }
.ticket .why { color: var(--muted); font-size: 13px; margin: 0; max-width: 90ch; }
.ticket .actions { display: flex; gap: 8px; }

/* ---------- controls ---------- */
.btn { font: inherit; font-weight: 600; border-radius: var(--radius-ctl); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); padding: 7px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn.primary:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.danger { color: var(--short); border-color: color-mix(in srgb, var(--short) 45%, var(--line)); }
.btn.danger:hover { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn[aria-selected="true"], .presets .btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); }
.linkish { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; font-weight: 500; }
.linkish:hover { color: var(--ink); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl); padding: 8px 10px; width: 100%; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[type=checkbox] { width: auto; accent-color: var(--brand); }
label { color: var(--muted); font-size: 13px; font-weight: 500; }

.rules { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
.fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: grid; gap: 14px; }
.fieldset > h2 { font-size: 20px; }
.fieldset > p { margin: -8px 0 0; color: var(--muted); font-size: 13.5px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 18px; align-items: start; }
.field { display: grid; gap: 4px; align-content: start; }
#add-rung { justify-self: start; }
.field small { color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.ladder { display: grid; gap: 8px; }
.ladder-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.sticky-side { position: sticky; top: 110px; display: grid; gap: 16px; }
.control-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--danger-fill); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.preview dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.preview dt { color: var(--muted); }
.preview dd { margin: 0; text-align: right; font-weight: 650; }
.save-bar { display: flex; gap: 10px; align-items: center; }
.save-bar .error { flex: 1; }

/* ---------- alerts feed ---------- */
.feed { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.feed-item { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: baseline; }
.feed-item:last-child { border-bottom: 0; }
.feed-item time { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.feed-item .t { font-weight: 650; }
.feed-item .b { color: var(--muted); font-size: 13.5px; }
.feed-item > .muted { font-size: 12px; }
.feed-item.critical { background: var(--short-soft); }
.feed-item.critical .t { color: var(--short); }
.feed-item.warning .t { color: var(--attn); }
.feed-item.unread { box-shadow: inset 3px 0 0 var(--brand); }

/* ---------- equity chart ---------- */
.chart { width: 100%; height: 280px; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chart .grid { stroke: var(--line); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--text); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--brand-a); opacity: .16; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(16px); opacity: 0;
  background: var(--ink); color: var(--ground); padding: 10px 18px; border-radius: var(--radius-ctl); font-weight: 550;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1180px) {
  .split, .rules { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
  .status { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "rail" "top" "view"; }
  .rail { flex-direction: row; align-items: center; overflow-x: auto; height: auto; position: sticky; top: 0; z-index: 6;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; gap: 4px; }
  .brand { padding: 0 8px 0 0; flex: none; }
  .brand img { width: 34px; }
  .brand img.full { display: none; }
  .brand span { display: none; }
  .rail a.nav { white-space: nowrap; padding: 6px 10px; }
  .rail-foot { margin: 0 0 0 auto; border-top: 0; padding: 0; display: flex; }
  .rail-foot .linkish { white-space: nowrap; }
  .topbar { position: static; padding: 12px 16px; }
  .clock { font-size: 26px; }
  .ribbon-hours span:nth-child(even) { display: none; }
  .ribbon-hours b { font-size: 0; }
  .view { padding: 18px 16px 48px; gap: 22px; }
  h1 { font-size: 28px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure, .figure + .figure { padding: 12px 12px 12px 0; border-left: 0; }
  .figure:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
  .figure .value { font-size: 28px; }
  .feed-item { grid-template-columns: 1fr; gap: 2px; }
  .ticket { padding: 14px; }
}
@media (min-width: 761px) { .brand img.mark { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, .toast { transition: none !important; }
}

.exch { white-space: nowrap; }
.exch-kraken { color: var(--brand); font-weight: 600; }
