/* Copy the Desk wears the BORSA Desk's own clothes (desk.borsa321.com, ui/static/style.css, the phone view):
   the same navy ground, panels, lines, Space Grotesk + IBM Plex Mono, the Unbounded wordmark, lime for the brand
   and for actions, green up, red down, amber for paper and for waits. One dark theme, as the desk. */
:root {
  --bg: #090c12;
  --panel: #0f131c;
  --panel-2: #151a26;
  --line: #222a3a;
  --line-2: #3a4560;
  --text: #e9edf5;
  --muted: #8b95a9;
  --dim: #5d6679;
  --lime: #d1fe17;
  --lime-ink: #0a0d14;
  --lime-wash: #2b3b10;
  --green: #3ddc97;
  --green-wash: #123326;
  --red: #ff5d73;
  --red-wash: #3a1620;
  --amber: #f5b942;
  --amber-wash: #3a2e12;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --mark: "Unbounded", "Space Grotesk", sans-serif;
  /* older names, still used by the owner page */
  --ground: var(--bg); --ink: var(--text); --pink: var(--red);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
p { margin: 0; }
.hidden { display: none !important; }

/* ---------- top bar, as the desk's ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: rgba(9, 12, 18, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: inherit; text-decoration: none; }
.brand svg { width: 26px; height: 26px; display: block; flex: none; }
.brand h1, .brand .word { margin: 0; font: 800 13px/1 var(--mark); letter-spacing: -.01em; text-transform: uppercase; white-space: nowrap; }
.brand .word span { color: var(--lime); }
.badge { font: 700 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px;
  background: var(--lime-wash); color: var(--lime); white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; justify-content: flex-end; font-size: 12.5px; color: var(--muted); }
#who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-family: var(--mono); font-size: 11.5px; }
@media (max-width: 30rem) { #who { display: none; } }
.signout { display: inline-flex; align-items: center; height: 32px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: 600 12px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.signout:hover { border-color: var(--line-2); }

/* ---------- the column ---------- */
.app { max-width: 76rem; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.screen { display: grid; gap: 14px; max-width: 32rem; margin: 0 auto; }
.screen > *, .col > * { min-width: 0; }
.col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.col:empty { display: none; }

/* Home and amount come in three blocks: phone = one column (a, c, b on home; a, b, c on amount);
   wide = two columns, the desk's open positions on the right. */
.split { grid-template-areas: "a" "b" "c"; }
#s-amount.split { grid-template-areas: "a" "b" "c"; }
.col-a { grid-area: a; } .col-b { grid-area: b; } .col-c { grid-area: c; }
@media (min-width: 60rem) {
  .split, #s-amount.split { max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "a b" "c b"; grid-template-rows: auto 1fr; column-gap: 20px; align-items: start; }
  .split:has(> .col-b > .deskbook.hidden) { max-width: 32rem; grid-template-columns: minmax(0, 1fr); grid-template-areas: "a" "c"; }
  .split .col-b { position: sticky; top: 76px; }
  .split .col-b .dklist { max-height: calc(100dvh - 300px); overflow-y: auto; }
}

/* the home actions: one row of icon buttons, as the desk's icon buttons */
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tool.go { grid-column: 1 / -1; grid-auto-flow: column; justify-content: center; min-height: 46px; padding: 0 14px; font-size: 13.5px; }
.tool { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 66px; padding: 10px 4px 9px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; font: 600 11.5px/1.1 var(--sans); color: var(--text); cursor: pointer; text-align: center; }
.tool:hover { border-color: var(--line-2); }
.tool svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tool.go { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.tool.warn { color: var(--red); }
.tool .i-play { display: none; }
.tool.is-paused .i-play { display: block; fill: currentColor; }
.tool.is-paused .i-pause { display: none; }
.tool.is-paused { color: var(--lime); border-color: color-mix(in srgb, var(--lime) 40%, transparent); }

/* labels: the desk's mono capitals */
.step, h2, .k, .tile span, .matrix .h {
  font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.step { justify-self: start; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 10.5px; letter-spacing: .1em;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.step::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }
h1 { font: 600 28px/1.1 var(--sans); letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h2 { margin: 6px 2px 0; }
.lede { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- cards ---------- */
.card, .box, .dklist, .confirm, .channel, .hero {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px;
}
.box { display: grid; gap: 10px; }
details.box { display: block; }
details.box .howto { margin-top: 12px; }
details.box summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.box summary::-webkit-details-marker { display: none; }
details.box summary::after { content: "+"; font: 500 16px var(--mono); color: var(--lime); }
details.box[open] summary::after { content: "−"; }

/* ---------- forms ---------- */
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
input[type="email"], input[type="text"], input[type="password"] {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 15px; color: var(--text);
}
input::placeholder { color: var(--dim); }
input:focus { border-color: var(--lime); outline: none; box-shadow: 0 0 0 3px rgba(209, 254, 23, .12); }
.money { position: relative; }
.money span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--dim); font: 600 26px var(--sans); }
.money input { padding: 14px 16px 14px 36px; font: 600 30px/1.1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; border-radius: 16px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.presets button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 0; cursor: pointer; font: 600 12px var(--mono); letter-spacing: .04em; color: var(--text); }
.presets button:hover { border-color: var(--lime); color: var(--lime); }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; color: var(--text); font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--lime); margin: 1px 0 0; }
.terms { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.terms li::marker { color: var(--dim); }
.howto { counter-reset: h; list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13.5px; color: var(--muted); }
.howto li { counter-increment: h; position: relative; padding-left: 30px; }
.howto li::before { content: counter(h, decimal-leading-zero); position: absolute; left: 0; top: 0; font: 600 11px/1.9 var(--mono); color: var(--lime); }
.howto b { color: var(--text); font-weight: 600; }
.example { font-size: 13.5px; color: var(--muted); }
.example b { color: var(--lime); font: 600 13.5px var(--mono); }

/* ---------- buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 48px; border: 0; border-radius: 12px;
  padding: 0 16px; font: 600 14.5px var(--sans); cursor: pointer; background: var(--lime); color: var(--lime-ink); text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { background: var(--panel-2); color: var(--dim); cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--line-2); filter: none; }
.btn.danger { background: var(--red); color: var(--lime-ink); }
.link { background: none; border: 0; padding: 6px 0; color: var(--lime); cursor: pointer; font: 600 13px var(--sans); }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.small-btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; height: 34px; padding: 0 12px; cursor: pointer;
  font: 600 12.5px var(--sans); white-space: nowrap; color: var(--text); }
.small-btn.go { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- messages ---------- */
.err { font-size: 13px; color: var(--red); min-height: 1.2em; }
.err:empty, #kind:empty { display: none; }
.saved { font-size: 12.5px; color: var(--lime); min-height: 1.2em; }
.banner { background: var(--red-wash); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); color: var(--text); border-radius: 14px; padding: 11px 13px; font-size: 13.5px; }
.pausedbar { background: var(--amber-wash); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); color: var(--amber); border-radius: 14px; padding: 11px 13px; font-size: 13px; }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }
.mail { width: 56px; height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; margin: 12px auto 0; }
.mail svg { width: 24px; height: 24px; stroke: var(--lime); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- pills, as the desk's market pill and badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 7px; font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.chip.on { color: var(--lime-ink); background: var(--lime); border-color: var(--lime); }
.chip.paper { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-wash); }
.chip.live { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-wash); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.on .dot { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .chip.on .dot { animation: none; } }

/* ---------- home: the hero card, as the desk's equity card ---------- */
.hero { display: grid; gap: 12px; }
.status { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.big { font: 600 30px/1.05 var(--sans); letter-spacing: -.02em; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--panel-2); border-radius: 12px; padding: 9px 10px; display: grid; gap: 3px; min-width: 0; }
.tile b { font: 600 15px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nudge { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 1px solid #2c3a1a;
  background: linear-gradient(180deg, #141a10, var(--panel)); border-radius: 18px; padding: 12px 14px; font-size: 13.5px; }
.nudge button { background: var(--lime); color: var(--lime-ink); border: 0; border-radius: 10px; height: 34px; padding: 0 12px; font: 600 12.5px var(--sans); cursor: pointer; white-space: nowrap; }

/* today's orders */
.list { display: grid; }
.row { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row time { font: 500 11.5px var(--mono); color: var(--dim); }
.row .what { font-family: var(--mono); font-weight: 700; font-size: 13.5px; }
.row .what b { font: 600 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; margin-right: 6px;
  background: var(--panel-2); color: var(--muted); vertical-align: 1px; }
.row .what b.buy { background: var(--green-wash); color: var(--green); }
.row .what b.sell { background: var(--red-wash); color: var(--red); }
.row .sub { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.row .st { font: 600 10px var(--mono); letter-spacing: .08em; text-align: right; color: var(--muted); max-width: 9rem; }
.st.skip { color: var(--amber); }
.up { color: var(--green); }
.down { color: var(--red); }
.buy { color: var(--green); }
.sell { color: var(--red); }

/* copied positions, as the desk's position rows */
.pos { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.pos:first-child { border-top: 0; padding-top: 0; }
.pos:last-child { padding-bottom: 0; }
.sym { font: 700 14px var(--mono); min-width: 54px; }
.side { font: 600 9.5px var(--mono); letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; background: var(--green-wash); color: var(--green); text-transform: uppercase; }
.side.short { background: var(--red-wash); color: var(--red); }
.qty { font: 500 12px var(--mono); color: var(--muted); }
.pos .r { margin-left: auto; text-align: right; font: 600 13px var(--mono); }
.pos .r small { display: block; font: 500 10.5px var(--mono); color: var(--muted); white-space: nowrap; }

/* ---------- the desk's open positions (catch-up) ---------- */
.deskbook { display: grid; gap: 10px; }
.dklist { padding: 4px 14px; }
.dk { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.dk:first-child { border-top: 0; }
.dk > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.dk > div:first-child > b { font: 700 14px var(--mono); min-width: 46px; }
.dk .sub { display: block; flex-basis: 100%; font: 500 10.5px var(--mono); color: var(--muted); }
.dk .r { text-align: right; font: 600 13.5px var(--mono); font-variant-numeric: tabular-nums; }
.dk .r b { font-weight: 600; }
.dk .r .sub { text-align: right; }
.dk .you { grid-column: 1 / 3; font: 500 11.5px var(--mono); color: var(--text); background: var(--panel-2); border-radius: 8px; padding: 6px 9px; font-variant-numeric: tabular-nums; }
.dk .you.no { color: var(--amber); font-family: var(--sans); font-size: 12px; background: var(--amber-wash); }
.done { font: 600 9.5px var(--mono); letter-spacing: .08em; color: var(--lime); background: var(--lime-wash); border-radius: 4px; padding: 2px 6px; }
.dktotal { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0 10px; border-top: 1px solid var(--line-2); font-size: 13px; }
.dktotal span:nth-child(even) { text-align: right; font: 600 13.5px var(--mono); font-variant-numeric: tabular-nums; }
.dktotal .k { align-self: center; }
.q { font: 600 15px var(--sans); margin-top: 4px; }
.confirm { display: grid; gap: 10px; border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.confirm.go { border-color: #2c3a1a; background: linear-gradient(180deg, #141a10, var(--panel)); }

/* ---------- account summary on the amount screen ---------- */
.ok { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 13.5px; align-items: center; }
.ok dt { font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.ok dd { margin: 0; text-align: right; font-family: var(--mono); }
.ok dd .chip { vertical-align: 1px; }

/* ---------- segmented choice, as the desk's ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button { background: transparent; border: 1px solid transparent; border-radius: 9px; min-height: 38px; padding: 0 8px; cursor: pointer; font: 600 13px var(--sans); color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--lime-wash); color: var(--lime); border-color: color-mix(in srgb, var(--lime) 35%, transparent); }

/* ---------- alerts ---------- */
.channel { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.channel .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--lime); font: 700 14px var(--mono); }
.channel .name { display: grid; gap: 1px; min-width: 0; font-size: 14px; }
.channel .name b { font-weight: 600; }
.channel .name small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; font-family: var(--mono); }
.matrix { display: grid; grid-template-columns: 1fr 3.8rem 3.8rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px; }
.matrix > * { padding: 10px 0; border-top: 1px solid var(--line); }
.matrix .h { border-top: 0; text-align: center; padding: 6px 0; }
.matrix .h:first-child { text-align: left; }
.matrix .what { font-size: 13.5px; display: grid; gap: 1px; }
.matrix .what small { color: var(--muted); font-size: 11.5px; }
.matrix .cell { display: grid; place-items: center; }
.sw { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); position: relative; cursor: pointer; margin: 0; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--dim); transition: transform .15s; }
.sw:checked { background: var(--lime); border-color: var(--lime); }
.sw:checked::after { transform: translateX(16px); background: var(--lime-ink); }
.sw:disabled { opacity: .5; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .sw::after { transition: none; } }
.tgmsg { background: #17212b; border-radius: 14px 14px 14px 4px; padding: 11px 13px; font-size: 13.5px; display: grid; gap: 4px; max-width: 20rem; }
.tgmsg .from { color: #6ab3f3; font-weight: 600; font-size: 12.5px; }
.tgmsg .t { font-family: var(--mono); color: var(--muted); font-size: 11px; justify-self: end; }

/* ---------- wider screens: the column gets a little air ---------- */
@media (min-width: 48rem) {
  .app { padding-top: 40px; }
  h1 { font-size: 32px; }
  .brand svg { width: 30px; height: 30px; }
  .brand h1, .brand .word { font-size: 15px; }
}

/* the positions block's tabs, as the desk's segmented control */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 0; border-radius: 9px; background: none;
  color: var(--dim); font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
.tabs .n { font-weight: 600; color: var(--lime); letter-spacing: 0; }
.tabs .n:empty { display: none; }
.pane { display: grid; gap: 10px; }
.pos .r b { font-weight: 600; }

/* change the amount, in place on home */
.amtcard { display: grid; gap: 12px; border-color: #2c3a1a; background: linear-gradient(180deg, #141a10, var(--panel)); }
.amt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.amt-head b { font-size: 15px; font-weight: 600; }
