/* Pool — Legend-inspired dark terminal. Single source of truth; no legacy rules. */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("/static/vendor/inter/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/vendor/inter/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/vendor/inter/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("/static/vendor/inter/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 800; font-style: normal; font-display: swap; src: url("/static/vendor/inter/inter-latin-800-normal.woff2") format("woff2"); }
:root {
  --amb: rgba(96, 118, 255, .10);  /* set live by JS: green when the day is up, red when down */
  --bg-0: #0d0c09;
  --bg-1: #141209;
  --panel: rgba(255, 255, 255, 0.032);
  --panel-solid: #171410;
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f0ede4;
  --muted: #a8a294;
  --dim: #6d6759;
  --up: #8fa068;                 /* Mizan sage */
  --up-glow: rgba(143, 160, 104, 0.18);
  --down: #d65f48;               /* warm Mizan red */
  --down-glow: rgba(214, 95, 72, 0.16);
  --accent: #c9a54e;             /* Mizan gold */
  --gold: #c9a54e;
  --topbar-h: 46px;
  --toolbar-h: 54px;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1300px 620px at 50% -12%, var(--amb), transparent 62%),
    radial-gradient(1100px 650px at -8% 30%, rgba(96, 118, 255, 0.07), transparent 60%),
    radial-gradient(900px 700px at 108% 75%, rgba(143, 160, 104, 0.05), transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
  transition: background 1.2s ease;
  color: var(--text);
  font: 13px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "cv11";
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:is(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
.up { color: var(--up); } .down { color: var(--down); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ---------- inputs & buttons ---------- */
input, select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  transition: border-color .12s;
}
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { border-color: var(--accent); outline: none; }
input:disabled, select:disabled { opacity: .4; }
.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 10px; color: var(--muted); font-size: 12px; transition: all .12s;
}
.ghost:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.ghost.danger:hover { color: var(--down); border-color: var(--down); background: var(--down-glow); }
.ghost.active { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.ghost.mini, select.mini { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
select.mini { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); color: var(--text); }
.primary {
  border: 0; border-radius: 999px; padding: 10px; font-weight: 700; font-size: 13.5px;
  color: #06120d; transition: filter .12s, transform .05s;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: scale(.99); }
.primary.buy { background: linear-gradient(180deg, #9fb175, #7c8d57); box-shadow: 0 4px 20px rgba(143, 160, 104, .35), inset 0 1px 0 rgba(255,255,255,.25); }
.primary.sell { background: linear-gradient(180deg, #dd7a5f, #c05138); color: #1a0e08; box-shadow: 0 4px 20px rgba(214, 95, 72, .35), inset 0 1px 0 rgba(255,255,255,.22); }
.primary.neutral { background: var(--text); color: #0d0c09; }
.primary:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.linkbtn { background: none; border: 0; color: var(--muted); padding: 4px 6px; }
.linkbtn:hover { color: var(--text); }
.badge { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); letter-spacing: .02em; }
.badge.paper { border-color: rgba(242, 185, 75, .5); color: var(--gold); background: rgba(242, 185, 75, .08); }
.badge.live { border-color: rgba(214, 95, 72, .55); color: var(--down); background: var(--down-glow); }
.badge.open { border-color: rgba(143, 160, 104, .5); color: var(--up); background: var(--up-glow); }

/* ---------- top bar ---------- */
@keyframes flash-up { 0% { background: rgba(143, 160, 104, .3); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: rgba(214, 95, 72, .3); } 100% { background: transparent; } }
.flash-up { animation: flash-up .5s ease-out; border-radius: 4px; }
.flash-down { animation: flash-down .5s ease-out; border-radius: 4px; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--amb), transparent 260%), rgba(10, 11, 13, 0.66);
  transition: background 1.2s ease;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: relative; z-index: 30;
}
.topbar .brand { font-weight: 800; letter-spacing: .03em; display: flex; align-items: baseline; gap: 8px; }
.topbar .brand .wordmark { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 17px; letter-spacing: 0; }
.topbar .brand .mizan-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .22em; color: var(--accent); opacity: .9; }
.topbar .brand .mizan-tag .ar { letter-spacing: 0; font-weight: 400; margin-left: 2px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { text-decoration: none; padding: 5px 11px; border-radius: 8px; color: var(--muted); transition: all .12s; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--text); background: var(--panel-2); }
.topbar .stats { display: flex; gap: 22px; margin-left: auto; }
.topbar .stat { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .stat span { font-size: 10.5px; color: var(--dim); font-weight: 500; }
.topbar .stat b { font-weight: 600; font-size: 13px; }
.topbar form { margin: 0; }

/* ---------- trade toolbar: search + tabs + actions ---------- */
.toolbar {
  height: var(--toolbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 14, 18, 0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  position: relative; z-index: 25;
  overflow: visible;
}
.gsearch { position: relative; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.gsearch .gsym { font-weight: 800; font-size: 14px; min-width: 3em; white-space: nowrap; }
.gsearch input { width: 230px; padding: 5px 9px; }
.results {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 200; width: 320px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 10px;
  max-height: 280px; overflow: auto; box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
}
.gsearch .results { left: calc(3em + 10px); }
.results button { display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: left; background: none; border: 0; padding: 8px 12px; }
.results button:hover { background: var(--panel-2); }
.results .sym { font-weight: 700; }
.results .name { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs-bar { display: flex; align-items: center; gap: 3px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tab {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 5px 11px; color: var(--muted); font-weight: 600; font-size: 12px;
  white-space: nowrap; display: flex; align-items: center; gap: 7px; transition: all .12s;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.tab .tab-x { color: transparent; font-size: 13px; line-height: 1; padding: 0 1px; }
.tab:hover .tab-x { color: var(--dim); }
.tab .tab-x:hover { color: var(--down); }
.tab.add { padding: 5px 10px; font-size: 14px; }
.add-wrap { position: relative; }
.add-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 200; width: 330px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .65); padding: 5px;
}
.add-menu button { display: flex; flex-direction: column; width: 100%; text-align: left; background: none; border: 0; padding: 8px 11px; border-radius: 8px; gap: 1px; }
.add-menu button:hover { background: var(--panel-2); }
.add-menu button span { color: var(--muted); font-size: 11.5px; }

/* ---------- canvas & windows ---------- */
.canvas {
  position: relative;
  height: calc(100vh - var(--topbar-h) - var(--toolbar-h));
  overflow: hidden;
  padding: 0;
}
.win {
  position: absolute;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(28, 32, 42, 0.55), rgba(16, 18, 24, 0.55));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 3px solid var(--bg-0);
  overflow: hidden;
  min-width: 0; min-height: 0;
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color .18s, box-shadow .18s;
  animation: win-in .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes win-in { from { opacity: 0; transform: scale(.975); } to { opacity: 1; transform: scale(1); } }
.win:hover { border-color: var(--line-strong); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.win.dragging { z-index: 20; opacity: .92; box-shadow: 0 24px 60px rgba(0, 0, 0, .7); transition: none; }
.ghost-tile { position: absolute; z-index: 15; border-radius: var(--radius); pointer-events: none; border: 1.5px dashed var(--accent); background: rgba(122, 167, 255, .07); }
.ghost-tile.bad { border-color: var(--down); background: var(--down-glow); }
.win-head {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 6px 0 9px; flex: none;
  border-bottom: 1px solid var(--line);
  cursor: grab; user-select: none; font-size: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
}
.win-head .accent { box-shadow: 0 0 8px currentColor; }
.canvas.locked .win-head { cursor: default; }
.win-head .accent { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.win-head .title { font-weight: 700; white-space: nowrap; }
.win-head .sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.win-head .sub.up { color: var(--up); } .win-head .sub.down { color: var(--down); }
.win-head .controls { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.win-head .link { background: none; border: 0; font-size: 11px; padding: 0 2px; color: var(--up); }
.win-head .link.off { color: var(--dim); }
.win-head .x { background: none; border: 0; color: transparent; font-size: 16px; line-height: 1; padding: 0 5px; }
.win:hover .win-head .x { color: var(--dim); }
.win-head .x:hover { color: var(--down); }
.win-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.win-resize {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; opacity: 0; transition: opacity .12s;
  background: linear-gradient(135deg, transparent 55%, var(--line-strong) 55%, var(--line-strong) 65%, transparent 65%, transparent 78%, var(--line-strong) 78%, var(--line-strong) 88%, transparent 88%);
}
.win:hover .win-resize { opacity: 1; }
.canvas.locked .win-resize { display: none; }
.empty { flex: 1; display: grid; place-items: center; color: var(--dim); padding: 12px; text-align: center; }

/* ---------- widget internals ---------- */
.tf { display: flex; gap: 1px; }
.tf button { background: none; border: 0; border-radius: 6px; padding: 2px 7px; color: var(--dim); font-size: 11.5px; font-weight: 600; }
.tf button:hover { color: var(--muted); }
.tf button.active { color: var(--text); background: var(--panel-2); }
.tabs { display: flex; gap: 1px; }
.tabs button { background: none; border: 0; border-radius: 6px; padding: 3px 9px; color: var(--dim); font-weight: 600; font-size: 12px; }
.tabs button.active { color: var(--text); background: var(--panel-2); }
.chart-host { flex: 1; min-height: 0; position: relative; }
.chart-host .empty { position: absolute; inset: 0; pointer-events: none; }
.tv-credit { font-size: 9.5px; color: var(--dim); padding: 1px 10px 3px; flex: none; }
.tv-credit a { color: var(--dim); }
.pos-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: none;
  padding: 5px 10px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--up-glow), transparent 60%);
  font-size: 12px;
}
.pos-bar.losing { background: linear-gradient(90deg, var(--down-glow), transparent 60%); }
.pos-bar .sep { width: 1px; height: 14px; background: var(--line-strong); }
.pos-bar .acts { display: flex; gap: 4px; margin-left: auto; }
.pos-bar .ghost { padding: 2px 8px; font-size: 11.5px; }
.pad { padding: 12px; }
.big { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 10px; font-size: 12px; }
.kv span { color: var(--muted); } .kv b { font-weight: 500; text-align: right; }

/* watchlist */
.win .search { padding: 8px; position: relative; flex: none; }
.win .search input { width: 100%; }
.win .search .results { left: 8px; right: 8px; width: auto; }
.wl { list-style: none; margin: 0; padding: 3px 0; }
.wl li { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; padding: 6px 10px; cursor: pointer; border-left: 2px solid transparent; transition: background .1s; }
.wl li:hover { background: var(--panel-2); }
.wl li.active { background: var(--panel-2); border-left-color: var(--accent); }
.wl .sym { font-weight: 700; }
.wl .px { text-align: right; font-weight: 600; }
.wl .sub { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.wl .rm { background: none; border: 0; color: transparent; padding: 0 2px; font-size: 13px; line-height: 1; }
.wl li:hover .rm { color: var(--dim); }
.wl .rm:hover { color: var(--down); }

/* ticket */
.ticket { padding: 11px; display: flex; flex-direction: column; gap: 9px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: rgba(0, 0, 0, .35); padding: 3px; border-radius: 999px; }
.seg button { border: 0; background: none; padding: 6px; border-radius: 999px; color: var(--muted); font-weight: 700; transition: all .15s; }
.seg button.buy.active { background: var(--up-glow); color: var(--up); box-shadow: inset 0 0 0 1px rgba(143, 160, 104, .35); }
.seg button.sell.active { background: var(--down-glow); color: var(--down); box-shadow: inset 0 0 0 1px rgba(214, 95, 72, .35); }
.seg button.active:not(.buy):not(.sell) { background: var(--panel-2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--muted); }
.field input, .field select { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.check input { accent-color: var(--up); width: auto; }
.est { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.est b { color: var(--text); }
.ticket .contract { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; background: rgba(122, 167, 255, .1); border: 1px solid rgba(122, 167, 255, .3); border-radius: 8px; font-weight: 700; font-size: 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 600; font-size: 11px; position: sticky; top: 0; background: rgba(18, 20, 26, .92); backdrop-filter: blur(8px); z-index: 1; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
td .sym { font-weight: 700; }
.empty-row td { color: var(--dim); padding: 18px 10px; text-align: center; }
.tbl-wrap { flex: 1; overflow: auto; }

/* options chain */
table.chain th.calls, table.chain th.puts { text-align: center; color: var(--text); background: var(--panel-solid); }
table.chain th.strike, table.chain td.strike { background: rgba(255, 255, 255, .045); font-weight: 700; text-align: center; }
table.chain td.call, table.chain td.put { cursor: pointer; transition: background .08s; }
table.chain td.call:hover, table.chain td.put:hover { background: var(--panel-2); }
table.chain td.held { background: rgba(122, 167, 255, .12); }
table.chain td.selected { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
table.chain tr.atm td { border-top: 1.5px solid var(--gold); }

/* symbol bar */
.symbar { display: flex; align-items: center; gap: 14px; padding: 4px 12px; height: 100%; min-height: 0; }
.symbar .big { font-size: 19px; min-width: 3.5em; }
.symbar .search { position: relative; padding: 0; flex: 0 0 220px; }
.symbar .search .results { left: 0; right: 0; }
.symbar .chips { display: flex; gap: 4px; flex-wrap: wrap; overflow: hidden; min-width: 0; }
.chip { background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); font-size: 12px; font-weight: 600; transition: all .1s; }
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { color: var(--text); border-color: var(--accent); background: rgba(122, 167, 255, .12); }

/* toasts & modal */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 500; }
.toast { background: rgba(24, 27, 34, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line-strong); border-left: 3px solid var(--text); padding: 9px 13px; border-radius: 10px; max-width: 380px; box-shadow: 0 12px 32px rgba(0, 0, 0, .55); animation: toast-in .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.err { border-left-color: var(--down); }
.toast.ok { border-left-color: var(--up); }
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 400; }
.modal { background: rgba(22, 25, 32, .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line-strong); border-radius: 16px; padding: 18px; width: 380px; max-width: calc(100vw - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, .7); animation: modal-in .18s cubic-bezier(.2, .8, .3, 1); }
@keyframes modal-in { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 10px; font-size: 15px; }
.modal dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0 0 14px; font-size: 12.5px; }
.modal dt { color: var(--muted); }
.modal dd { margin: 0; text-align: right; font-weight: 600; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- portfolio & statement pages ---------- */
.page { padding: 18px 22px 48px; max-width: 1240px; margin: 0 auto; }
.page h1 { font-size: 19px; margin: 0 0 4px; font-weight: 800; }
.page h2 { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 28px 0 8px; }
.flash { padding: 8px 12px; border-left: 3px solid var(--up); background: var(--panel); border-radius: 0 8px 8px 0; margin-bottom: 14px; }
.flash.err { border-left-color: var(--down); }
.warn { border-left: 3px solid var(--down); background: var(--panel); padding: 8px 12px; margin: 10px 0; border-radius: 0 8px 8px 0; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: linear-gradient(180deg, rgba(28,32,42,.5), rgba(16,18,24,.5)); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.kpi span { display: block; font-size: 11px; color: var(--dim); font-weight: 500; }
.kpi b { font-size: 17px; font-weight: 700; }
.kpi small { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: linear-gradient(180deg, rgba(28,32,42,.5), rgba(16,18,24,.5)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card .panel-head { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 12px; color: var(--muted); }
.chart-box { height: 240px; }
.legend { display: flex; gap: 14px; padding: 6px 11px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 2.5px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
form.card { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
form.card h3 { margin: 0; font-size: 13px; }
form.card p { margin: 0; color: var(--muted); font-size: 11.5px; }
form.card button { margin-top: 4px; }
.investor-actions { display: flex; gap: 4px; justify-content: flex-end; position: relative; }
.investor-actions form { margin: 0; display: inline; }
details.inline { display: inline; position: relative; }
details.inline summary { list-style: none; cursor: pointer; display: inline-block; }
details.inline summary::-webkit-details-marker { display: none; }
details.inline form.card { position: absolute; z-index: 50; width: 230px; text-align: left; right: 0; top: calc(100% + 4px); box-shadow: 0 16px 40px rgba(0,0,0,.6); background: var(--panel-solid); }
.login { max-width: 340px; margin: 14vh auto; }

@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .canvas { height: auto; overflow: visible; }
  .win { position: static !important; width: auto !important; height: 360px !important; margin: 8px; outline: 0; }
  .win-resize { display: none; }
  .toolbar { flex-wrap: wrap; height: auto; padding: 6px 12px; gap: 8px; }
  .topbar .stats { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- trade-from-the-chart ---------- */
.chart-trade-pill {
  position: absolute; right: 66px; z-index: 8;
  background: rgba(20, 24, 32, .85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 3px 11px; font-size: 11.5px; font-weight: 700; color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45); white-space: nowrap;
  transition: border-color .12s;
}
.chart-trade-pill:hover { border-color: var(--accent); color: var(--accent); }
.chart-trade-menu {
  position: absolute; right: 66px; z-index: 9; width: 180px;
  background: rgba(22, 25, 32, .95); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .6); animation: modal-in .14s cubic-bezier(.2,.8,.3,1);
}
.chart-trade-menu .head { padding: 8px 12px 6px; font-size: 11px; font-weight: 800; color: var(--muted); border-bottom: 1px solid var(--line); }
.chart-trade-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; font-size: 12.5px; font-weight: 600; }
.chart-trade-menu button:hover { background: var(--panel-2); }
.chart-trade-menu button[data-side="buy"] { color: var(--up); }
.chart-trade-menu button[data-side="sell"] { color: var(--down); }

/* ---------- Legend color pass v8 ---------- */
:root {
  --up: #8fa068;            /* Mizan sage */
  --up-glow: rgba(143, 160, 104, 0.16);
  --down: #d65f48;          /* Mizan warm red */
  --down-glow: rgba(214, 95, 72, 0.15);
}
.up { color: var(--up); } .down { color: var(--down); }

/* hover OHLC strip above every chart */
.ohlc { flex: none; padding: 3px 12px 1px; font-size: 11px; color: var(--dim); letter-spacing: .01em; min-height: 19px; }
.ohlc b { font-weight: 600; }
.ohlc.idle { visibility: hidden; }

/* chain: pills, moneyness, spot chip */
.chain-wrap { scroll-behavior: smooth; }
table.chain td { padding: 4px 8px; }
table.chain td.itm { background: rgba(122, 167, 255, 0.055); }
table.chain td.call.itm { background: rgba(143, 160, 104, 0.07); }
table.chain td.put.itm { background: rgba(214, 95, 72, 0.06); }
.px-pill { display: inline-block; min-width: 52px; text-align: center; padding: 2px 8px; border-radius: 7px; font-weight: 600; transition: transform .08s, filter .12s; }
.px-pill.bid { background: rgba(214, 95, 72, 0.14); color: #e0947c; }
.px-pill.ask { background: rgba(143, 160, 104, 0.14); color: #4fe07a; }
td:hover > .px-pill { filter: brightness(1.25); transform: scale(1.04); }
tr.spot-row td { padding: 0; border-bottom: 0; position: relative; height: 20px; background: transparent !important; }
tr.spot-row td::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed rgba(255, 255, 255, 0.22); }
.spot-chip {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #1c1f27; border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 2px 12px; font-weight: 800; font-size: 11.5px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5); z-index: 2;
}
table.chain tr.atm td { border-top: 0; }
table.chain th.calls { color: var(--up); }
table.chain th.puts { color: var(--down); }

/* louder color across the app */
.wl .px { font-weight: 700; }
.wl li.active { border-left-color: var(--up); background: linear-gradient(90deg, rgba(143, 160, 104, .07), transparent 70%); }
.chart-trade-menu button i { display: inline-block; width: 7px; height: 7px; border-radius: 999px; margin-right: 8px; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge.open { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(143, 160, 104, .25); } 50% { box-shadow: 0 0 0 5px rgba(143, 160, 104, 0); } }
.tab.active { box-shadow: inset 0 -2px 0 var(--up); }
.pos-bar { background: linear-gradient(90deg, var(--up-glow), transparent 55%); }
.pos-bar.losing { background: linear-gradient(90deg, var(--down-glow), transparent 55%); }
.primary.buy { background: linear-gradient(180deg, #9fb175, #7c8d57); box-shadow: 0 4px 22px rgba(143, 160, 104, .35), inset 0 1px 0 rgba(255,255,255,.28); }
.primary.sell { background: linear-gradient(180deg, #dd7a5f, #c05138); color: #1a0e08; box-shadow: 0 4px 22px rgba(214, 95, 72, .35), inset 0 1px 0 rgba(255,255,255,.22); }
.seg button.buy.active { background: var(--up-glow); color: var(--up); box-shadow: inset 0 0 0 1px rgba(143, 160, 104, .4); }
.seg button.sell.active { background: var(--down-glow); color: var(--down); box-shadow: inset 0 0 0 1px rgba(214, 95, 72, .4); }

/* ---------- v9: seen-with-real-eyes pass ---------- */
/* solid-feeling cards tinted by the day color, Legend-like gutters */
.canvas { padding: 7px; }
.win {
  background: linear-gradient(180deg, color-mix(in srgb, var(--amb) 26%, #14161c), color-mix(in srgb, var(--amb) 10%, #0e1014));
  border: 1px solid rgba(255, 255, 255, 0.075);
  outline: 5px solid var(--bg-0);
  border-radius: 12px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.win-head { height: 34px; background: transparent; border-bottom: 1px solid rgba(255, 255, 255, 0.055); }
.win-head .title { font-size: 12.5px; letter-spacing: -.01em; }
.win-head .accent { width: 9px; height: 9px; border-radius: 3px; }

/* toolbar as Legend's control row */
.toolbar { height: 46px; gap: 12px; background: transparent; border-bottom: 0; padding: 8px 12px 0; }
.tab { padding: 7px 14px; border-radius: 10px; font-size: 12.5px; background: rgba(255, 255, 255, 0.045); border: 0; }
.tab.active { background: rgba(255, 255, 255, 0.10); color: var(--text); box-shadow: none; }
.tab.add { background: transparent; }
.day-pill {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px;
  font-size: 12.5px; background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; white-space: nowrap;
}
.day-pill .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--dim); }
.day-pill .lbl { color: var(--muted); }
.day-pill.up { background: rgba(143, 160, 104, 0.10); border-color: rgba(143, 160, 104, 0.25); }
.day-pill.up b, .day-pill.up .dot { color: var(--up); background: var(--up); }
.day-pill.up b { background: none; }
.day-pill.down { background: rgba(214, 95, 72, 0.10); border-color: rgba(214, 95, 72, 0.25); }
.day-pill.down b { color: var(--down); }
.day-pill.down .dot { background: var(--down); }
.gsearch input { width: 190px; background: rgba(255, 255, 255, 0.045); border-color: transparent; border-radius: 999px; padding: 6px 12px; }
.gsearch input:focus { border-color: var(--line-strong); }

/* chart internals: clean header, footer controls like Legend */
.pos-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 10px; padding: 4px 10px; font-size: 11.5px; border-bottom: 1px solid rgba(255,255,255,.05); }
.pos-bar::-webkit-scrollbar { display: none; }
.pos-bar > span { white-space: nowrap; }
.pos-bar .acts { margin-left: 0; }
.pos-bar .ghost { padding: 1px 9px; font-size: 11px; }
.chart-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 12px 6px; border-top: 1px solid rgba(255, 255, 255, 0.055); }
.chart-foot .lbl { font-size: 11px; color: var(--dim); }
.chart-foot .credit { font-size: 9px; color: rgba(255,255,255,.18); }
.chart-foot .tf button { padding: 3px 9px; border-radius: 7px; }
.ohlc { padding-top: 5px; }

/* ticket: custom selects, clear focus, honest Robinhood button */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%239aa0a9' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
.ticket { gap: 10px; padding: 12px; }
.ticket .field input, .ticket .field select { background: rgba(255, 255, 255, 0.05); border-color: transparent; border-radius: 10px; padding: 8px 10px; }
.ticket .field input:focus, .ticket .field select:focus { border-color: rgba(143, 160, 104, .5); background: rgba(255, 255, 255, 0.07); }
.ticket .field label { font-size: 11px; }
.primary { border-radius: 12px; padding: 12px; font-size: 14px; }
.primary.buy { background: var(--up); color: #06210a; box-shadow: none; }
.primary.buy:hover { filter: brightness(1.1); box-shadow: 0 6px 24px rgba(143, 160, 104, .35); }
.primary.sell { background: var(--down); color: #2a0d00; box-shadow: none; }
.primary.sell:hover { filter: brightness(1.08); box-shadow: 0 6px 24px rgba(214, 95, 72, .35); }
.est { border: 0; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 8px 10px; }
.seg { border-radius: 12px; background: rgba(255, 255, 255, 0.045); }
.seg button { border-radius: 9px; padding: 7px; }

/* tables: airier, subtle separators, hover rows */
th { background: transparent; font-size: 10.5px; color: rgba(255, 255, 255, 0.32); }
td { border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.win table { font-size: 12.5px; }
.win th, .win td { padding: 7px 10px; }

/* chain header: two sticky rows that stack instead of smearing */
table.chain thead tr:first-child th { top: 0; height: 24px; background: #16181e; z-index: 3; }
table.chain thead tr:last-child th { top: 24px; background: #14161c; z-index: 2; }
table.chain th.strike, table.chain td.strike { background: #1b1e26; }
.chain-wrap { scroll-padding-top: 52px; }
/* symbol bar: tighter, bigger type, calmer flash */
.symbar { padding: 2px 14px; gap: 16px; }
.symbar .big { font-size: 22px; }
.symbar .chips .chip { font-size: 11.5px; padding: 2px 9px; }
.flash-up, .flash-down { padding: 1px 6px; margin: -1px -6px; }
.day-pill .dot { display: none; }
.win .search input { background: rgba(255,255,255,.05); border-color: transparent; border-radius: 999px; padding: 7px 12px; }
.win .search input:focus { border-color: var(--line-strong); }

/* watchlist rows a touch bigger */
.wl li { padding: 8px 12px; }
.wl .sym { font-size: 13px; }

/* ================= v11: Legend/Apple pass — rounded rectangles, flat depth, no pills ================= */
:root { --bg-0: #0a0908; --panel-hi: #1a1712; --panel-lo: #12100b; --ctl: #262218; --ctl-hover: #322d20; --r: 8px; }
body { background: #000; letter-spacing: -0.008em; }
b, .num, td, .px, .stat b, .day-pill b, .symbar, .ohlc, .wl { font-variant-numeric: tabular-nums; }

/* panels: flat cards, hairline top light, black gutters, no glow */
.win {
  border: 0; border-radius: 11px; outline: 4px solid #000;
  background: linear-gradient(180deg, color-mix(in srgb, var(--amb) 20%, var(--panel-hi)), color-mix(in srgb, var(--amb) 7%, var(--panel-lo)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.win-head { border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.win-head .accent { border-radius: 2.5px; }
.canvas { padding: 6px; background: #000; }

/* kill the pill: every control is a rounded rectangle */
.ghost, .ghost.mini, .pos-bar .ghost { border-radius: 6px; background: var(--ctl); border: 0; color: #d6d7da; }
.ghost:hover { background: var(--ctl-hover); border: 0; }
.tab { border-radius: var(--r); padding: 6px 13px; background: transparent; color: var(--dim); }
.tab:hover { background: rgba(255, 255, 255, 0.05); }
.tab.active { background: var(--ctl); color: #fff; }
.badge, .chip { border-radius: 6px; }
.badge { background: #1a1b1e; border: 0; }
.day-pill { border-radius: var(--r); background: #1a1b1e; border: 0; padding: 7px 14px; }
.day-pill.up, .day-pill.down { background: #1a1b1e; border: 0; }
.day-pill .lbl { color: #e7e8ea; }
.gsearch input, .win .search input { border-radius: var(--r); background: #1a1b1e; border: 1px solid transparent; }
.gsearch input:focus, .win .search input:focus { background: #1f2025; border-color: rgba(255, 255, 255, 0.12); }
.text-btn { background: transparent; border: 0; color: #d6d7da; font: inherit; font-size: 12.5px; padding: 7px 12px; border-radius: var(--r); cursor: pointer; }
.text-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.icon-btn { background: transparent; border: 0; color: #9aa0a9; padding: 7px 9px; border-radius: var(--r); cursor: pointer; display: flex; align-items: center; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.icon-btn.on { color: #fff; background: var(--ctl); }
.chart-trade-pill { border-radius: 6px; }
.chart-trade-menu { border-radius: 10px; }
.spot-chip { border-radius: 7px; background: #26272b; border: 0; font-size: 12px; padding: 3px 12px; }
.est { border-radius: var(--r); }
.seg { border-radius: 9px; background: #1a1b1e; padding: 3px; }
.seg button { border-radius: 6px; }
.primary { border-radius: 9px; }
.ticket .field input, .ticket .field select { border-radius: var(--r); background: #1e1f24; }
.ticket .field input:focus, .ticket .field select:focus { background: #24252a; }
.add-menu, .results, .modal { border-radius: 12px; }
.add-menu .item { border-radius: 7px; }
.toast { border-radius: 10px; }
.wl li { border-radius: 0; }
.tf button { border-radius: 6px; }
.tf button.active { background: var(--ctl); color: #fff; }
.exp-select, select.mini { border-radius: 6px; background: var(--ctl); border: 0; }

/* chain price boxes: Legend rectangles, brighter figures */
.px-pill { border-radius: 5px; min-width: 60px; padding: 3px 6px; font-weight: 600; font-size: 12px; }
.px-pill.bid { background: rgba(214, 95, 72, 0.16); color: #ff7a36; }
.px-pill.ask { background: rgba(143, 160, 104, 0.17); color: #00d80a; }
td.selected .px-pill { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.65); }

/* OHLC lives inside the chart, Legend-style */
.chart-host .ohlc { position: absolute; top: 6px; left: 10px; z-index: 5; pointer-events: none; display: flex; gap: 5px; padding: 0; min-height: 0; font-size: 11.5px; }
.chart-host .ohlc span { color: #86898f; }
.chart-host .ohlc b { font-weight: 600; }

/* position strip: quiet neutral, color only in the numbers */
.pos-bar { background: transparent; border-bottom: 1px solid rgba(255, 255, 255, 0.04); padding: 5px 10px; }
.pos-bar.losing { background: transparent; }

/* typography contrast: bright primaries, dim secondaries */
.win-head .title { color: #fff; font-weight: 640; }
.win-head .sub { color: #9aa0a9; }
th { color: rgba(255, 255, 255, 0.35); font-weight: 500; }
td { color: #e7e8ea; }
.wl .sym { color: #fff; }
.symbar .big { font-weight: 700; letter-spacing: -0.02em; }

/* slim dark scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a2b30; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3b41; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* v11.1: panels keep presence to their bottom edge; neutral active chips */
:root { --panel-hi: #1a1b21; --panel-lo: #131419; }
.symbar .chips .chip.active { border-color: rgba(255, 255, 255, 0.45); background: var(--ctl); color: #fff; }

/* ================= v13: roles, live mode, motion ================= */

/* view-only accounts: trading affordances disappear entirely */
.role-viewer .chart-trade-pill, .role-viewer .chart-trade-menu { display: none !important; }
.role-viewer .pos-bar .acts { display: none; }
.role-viewer td .ghost.danger { display: none; }
body:not(.role-admin) .page.portfolio form,
body:not(.role-admin) .page.portfolio .ghost.danger,
body:not(.role-admin) .page.portfolio .danger-zone { display: none !important; }
.viewer-note { display: flex; flex-direction: column; gap: 6px; padding: 18px 16px; color: var(--dim); font-size: 12.5px; }
.viewer-note b { color: #e7e8ea; font-size: 13px; }

/* live money is unmistakable */
.badge.live { background: rgba(255, 59, 48, 0.16); color: #ff5b51; font-weight: 700; letter-spacing: .06em; }
.badge.paper { background: rgba(255, 214, 10, 0.12); color: #e7c14a; }
body.env-live .topbar { box-shadow: inset 0 2px 0 #ff3b30; }

/* user chip */
.user-chip { position: relative; }
.uc-btn { background: var(--ctl); border: 0; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; display: grid; place-items: center; }
.uc-btn:hover { background: var(--ctl-hover); }
.uc-avatar { color: #fff; font-weight: 700; font-size: 12px; }
.uc-menu { position: absolute; right: 0; top: 34px; background: #1b1c21; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; min-width: 200px; padding: 6px; z-index: 60; box-shadow: 0 16px 40px rgba(0,0,0,.6); }
.uc-menu .uc-name { padding: 8px 10px; color: var(--dim); font-size: 11.5px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 4px; }
.uc-menu a, .uc-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; color: #e7e8ea; text-decoration: none; background: none; border: 0; font: inherit; font-size: 12.5px; cursor: pointer; }
.uc-menu a:hover, .uc-menu button:hover { background: rgba(255,255,255,.06); }

/* ---------- auth screens ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--amb) 40%, transparent), transparent), #000; }
.auth-card { width: 380px; background: linear-gradient(180deg, #17181d, #101014); border-radius: 16px; padding: 28px; box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 30px 80px rgba(0,0,0,.6); animation: card-in .28s cubic-bezier(.2,.8,.2,1); }
.auth-card.wide { width: 460px; }
.auth-eyebrow { font-size: 9.5px; font-weight: 700; letter-spacing: .26em; color: var(--accent); margin-bottom: 8px; }
.auth-eyebrow .ar { letter-spacing: 0; font-weight: 400; }
.auth-brand { font-size: 30px; font-weight: 700; letter-spacing: 0; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.auth-sub { color: var(--dim); font-size: 12.5px; margin: 4px 0 18px; }
.auth-card .field { margin-bottom: 12px; }
.auth-card .field label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 5px; }
.auth-card .field .hint { color: rgba(255,255,255,.3); }
.auth-card input { width: 100%; box-sizing: border-box; background: #1e1f24; border: 1px solid transparent; border-radius: 9px; padding: 10px 12px; color: #fff; font: inherit; transition: border-color .15s, background .15s; }
.auth-card input:focus { outline: 0; border-color: rgba(255,255,255,.25); background: #24252a; }
.auth-card .primary { width: 100%; margin-top: 6px; }
.auth-note { color: var(--dim); font-size: 11.5px; margin-top: 14px; line-height: 1.5; }
.code-input { letter-spacing: .35em; font-size: 18px !important; text-align: center; font-variant-numeric: tabular-nums; }
.qr-row { display: flex; gap: 18px; align-items: flex-start; margin: 6px 0 16px; }
.qr { width: 168px; height: 168px; background: #fff; border-radius: 12px; padding: 8px; box-sizing: border-box; }
.qr-steps { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: #cfd0d4; }
.secret { background: #1e1f24; border-radius: 7px; padding: 6px 9px; font-size: 11px; color: var(--dim); word-break: break-all; }
.btn-link { display: block; text-align: center; text-decoration: none; }
.flash.err { background: rgba(255, 59, 48, .12); color: #ff8078; border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; }

/* ---------- admin console ---------- */
.page.admin { max-width: 1060px; margin: 0 auto; padding: 22px 18px 60px; display: flex; flex-direction: column; gap: 18px; }
.panel { background: linear-gradient(180deg, #16171c, #101014); border-radius: 13px; padding: 18px 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); animation: card-in .25s cubic-bezier(.2,.8,.2,1); }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.env-row { display: flex; gap: 12px; margin: 12px 0; }
.env-opt { flex: 1; background: #1a1b20; border: 1.5px solid transparent; border-radius: 11px; padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, background .15s, transform .12s; }
.env-opt:hover { background: #1f2026; }
.env-opt:active { transform: scale(.99); }
.env-opt b { font-size: 13.5px; }
.env-opt span { color: var(--dim); font-size: 11.5px; }
.env-opt.active { border-color: rgba(255,255,255,.4); }
.env-opt.danger.active { border-color: #ff3b30; background: rgba(255,59,48,.08); }
.env-opt.disabled { opacity: .45; cursor: not-allowed; }
.env-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 4px; }
.env-form .field { margin: 0; }
.env-form input { background: #1e1f24; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; color: #fff; font: inherit; width: 150px; }
.admin-users, .audit-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.admin-users td, .audit-table td { vertical-align: middle; }
.u-name { font-weight: 600; }
.u-acts { display: flex; gap: 6px; justify-content: flex-end; }
.ok-dot, .warn-dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; margin-right: 6px; }
.ok-dot { background: var(--up); } .warn-dot { background: #e7c14a; }
.user-create { display: flex; gap: 10px; margin-top: 14px; }
.user-create input, .user-create select { background: #1e1f24; border: 1px solid transparent; border-radius: 8px; padding: 9px 11px; color: #fff; font: inherit; }
.user-create input:focus { outline: 0; border-color: rgba(255,255,255,.22); }
.audit-table code { background: #1e1f24; padding: 2px 7px; border-radius: 5px; font-size: 11px; }

/* ---------- motion: quick, physical, quiet ---------- */
@keyframes card-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
@keyframes win-in { from { opacity: 0; transform: scale(.985); } }
.win { animation: win-in .18s cubic-bezier(.2,.8,.2,1); }
.ghost, .primary, .tab, .text-btn, .icon-btn, .seg button, .tf button, .env-opt, .uc-btn { transition: background .14s, color .14s, transform .1s, filter .14s, box-shadow .14s; }
.ghost:active, .primary:active, .tab:active, .text-btn:active, .seg button:active, .tf button:active { transform: scale(.965); }
.px-pill { transition: transform .1s, filter .12s, box-shadow .14s; }
tbody tr td { transition: background .12s; }
.day-pill b { transition: color .2s; }
.toast { animation: toast-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.add-menu, .uc-menu, .results, .chart-trade-menu { animation: menu-in .14s cubic-bezier(.2,.8,.2,1); transform-origin: top; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
.wl li, .win-head, .gsearch input { transition: background .14s, border-color .14s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   Phones & small screens: same windows, stacked. The desktop
   canvas becomes a scroll column, drag/resize is off, and a
   bottom tab bar jumps between windows. Nothing here touches
   layouts wider than 860px.
   ============================================================ */
@media (max-width: 860px) {
  html, body { height: auto; min-height: 100%; }
  body { -webkit-tap-highlight-color: transparent; }
  button, select, input { touch-action: manipulation; }

  /* canvas: absolute grid -> vertical stack */
  #canvas { position: static; display: flex; flex-direction: column; gap: 10px;
            padding: 10px 10px calc(76px + env(safe-area-inset-bottom)); height: auto; overflow: visible; }
  #canvas .win { position: static !important; left: auto !important; top: auto !important;
                 width: auto !important; height: auto !important; transform: none !important; }
  .win-resize { display: none; }
  .win-head { cursor: default; }
  .win-head .x { color: var(--dim); } /* no hover on touch; keep close reachable */

  /* read order on a phone: chart first, then the ticket, then the books */
  body.mobile #canvas .win[data-wtype="chart"]       { order: 1; }
  body.mobile #canvas .win[data-wtype="ticket"]      { order: 2; }
  body.mobile #canvas .win[data-wtype="watchlist"]   { order: 3; }
  body.mobile #canvas .win[data-wtype="positions"]   { order: 4; }
  body.mobile #canvas .win[data-wtype="orders"]      { order: 5; }
  body.mobile #canvas .win[data-wtype="options"]     { order: 6; }
  body.mobile #canvas .win[data-wtype="optionchart"] { order: 7; }
  body.mobile #canvas .win[data-wtype="quote"]       { order: 8; }
  body.mobile #canvas .win[data-wtype="account"]     { order: 9; }

  /* flex-basis 0 would size bodies from content; let the height rules below govern */
  .win .win-body { flex: none; }

  /* sensible heights per window type once the grid geometry is gone */
  .win[data-wtype="chart"] .win-body, .win[data-wtype="optionchart"] .win-body { height: 300px; }
  .win[data-wtype="options"] .win-body { height: 360px; }
  .win[data-wtype="watchlist"] .win-body { max-height: 280px; }
  .win[data-wtype="positions"] .win-body, .win[data-wtype="orders"] .win-body { max-height: 320px; }

  /* wide tables scroll sideways inside their window instead of crushing */
  .win-body { overflow-x: auto; }
  .win[data-wtype="positions"] table, .win[data-wtype="orders"] table, .win[data-wtype="options"] table { min-width: 560px; }
  td .acts { opacity: 1; } /* action buttons always visible: there is no hover on touch */

  /* topbar: two compact rows, stats scroll sideways */
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px; height: auto; min-height: 0; }
  .topbar .stats { order: 5; flex-basis: 100%; overflow-x: auto; gap: 12px; padding-bottom: 2px; }
  .topbar .stats::-webkit-scrollbar { display: none; }

  /* toolbar: layouts are a desktop concept; search + day pill carry the row */
  .toolbar { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; height: auto; min-height: 0; }
  .toolbar .tabs-bar, .toolbar #add-wrap, .toolbar #btn-lock, .toolbar #layout-status { display: none; }
  .toolbar .gsearch { flex: 1 1 150px; min-width: 0; }
  .chart-foot .credit, .win .credit { display: none; }
  .toolbar .gsearch input { width: 100%; }

  /* bottom tab bar */
  #mnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex;
          background: rgba(10, 10, 12, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
          border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  #mnav button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 700;
                 padding: 9px 2px; border-radius: 8px; letter-spacing: 0.02em; }
  #mnav button.on { color: var(--up); background: rgba(143, 160, 104, 0.10); }

  /* auth pages breathe on a phone */
  .auth-card { width: min(400px, calc(100vw - 28px)); padding: 22px 18px; }
  .auth-card.wide { width: calc(100vw - 28px); }
  .auth-card.wide { width: calc(100vw - 28px); }
  .qr-row { flex-wrap: wrap; }

  /* portfolio + admin pages: stack panels, let tables scroll */
  .page { padding: 12px 10px 40px; }
  .page .grid, .grid2 { grid-template-columns: 1fr !important; }
  .page table { display: block; overflow-x: auto; white-space: nowrap; }
  .env-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .user-create { flex-wrap: wrap; }
  .user-create input, .user-create select { flex: 1 1 140px; min-width: 0; }
}

/* ============================================================
   Client portal (/my): a statement, not a terminal. One number,
   one chart, four facts, Mizan-branded.
   ============================================================ */
.myp { max-width: 680px; margin: 0 auto; padding: 26px 18px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.myp-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.myp-brand { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 30px; font-weight: 700; }
.myp-signout { background: none; border: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.myp-signout:hover { color: var(--text); border-color: var(--accent); }
.myp-greet { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.myp-value { font-size: 44px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.myp-change { margin-top: 4px; font-size: 14.5px; font-weight: 600; }
.myp-change .chg.up { color: var(--up); } .myp-change .chg.down { color: var(--down); }
.myp-note { margin-top: 8px; font-size: 12px; color: var(--dim); min-height: 14px; }
.myp-chart-wrap { margin: 18px 0 6px; }
#my-chart { height: 240px; }
.myp-empty { height: 240px; display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 13px; }
.myp-ranges { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.myp-ranges button { background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.myp-ranges button.on { color: var(--accent); background: rgba(201, 165, 78, 0.12); }
.myp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.myp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.myp-card .k { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.myp-card .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.myp-card .v.up { color: var(--up); } .myp-card .v.down { color: var(--down); }
.myp-foot { margin-top: auto; padding-top: 30px; text-align: center; }
#my-foot-note { font-size: 11.5px; color: var(--dim); margin-bottom: 10px; }
.myp-product { font-size: 10px; font-weight: 700; letter-spacing: .2em; color: var(--accent); opacity: .8; }
.signout-mini { margin-top: 14px; text-align: center; }
.signout-mini button { background: none; border: 0; color: var(--dim); font-size: 12px; text-decoration: underline; cursor: pointer; }
.signout-mini button:hover { color: var(--muted); }

/* ---------- Security page + SMS affordances ---------- */
.sec-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; background: var(--panel); text-align: left; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-title { font-weight: 700; font-size: 14.5px; }
.sec-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--dim); border: 1px solid var(--line); }
.sec-badge.on { color: var(--up); background: var(--up-glow); border-color: rgba(143, 160, 104, .4); }
.sec-body { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 8px 0 12px; }
.sec-inline { display: flex; gap: 8px; align-items: center; }
.sec-inline input { flex: 1; min-width: 0; }
.sec-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.mini-btn { padding: 9px 16px !important; width: auto !important; }
.sec-back { margin-top: 18px; text-align: center; }
.sms-alt { margin-top: 12px; }
.sms-alt .ghost { width: 100%; }
.myp-top-acts { display: flex; gap: 8px; align-items: center; }
a.myp-signout { text-decoration: none; display: inline-block; }

/* ============================================================
   Amanah — the white-glove client face. Mizan's cream/sage/serif
   client aesthetic, scoped so the family terminal stays dark.
   ============================================================ */
body.amanah {
  --bg-0: #f5f1ec; --bg-1: #faf7f0;
  --panel: #ffffff; --panel-solid: #ffffff; --panel-2: #f0ebe2;
  --line: rgba(78, 84, 36, 0.13); --line-strong: rgba(78, 84, 36, 0.28);
  --text: #22201a; --muted: #5e5950; --dim: #8a857c;
  --up: #5f7040; --up-glow: rgba(107, 122, 78, 0.12);
  --down: #c74038; --down-glow: rgba(199, 64, 56, 0.10);
  --accent: #a8862f;
  background: linear-gradient(180deg, #faf7f0 0%, #f5f1ec 100%);
  color: var(--text);
}
body.amanah .auth-card, body.amanah .myp-card, body.amanah .sec-card {
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(78, 84, 36, 0.09), 0 1px 3px rgba(78, 84, 36, 0.06);
}
body.amanah .auth-card { border-radius: 20px; }
body.amanah .auth-brand { font-size: 34px; color: #4e5424; }
body.amanah .auth-welcome { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 6px 0 20px; }
body.amanah .auth-from { margin-top: 22px; text-align: center; font-size: 9.5px; font-weight: 700; letter-spacing: .26em; color: var(--accent); }
body.amanah .auth-from .ar { letter-spacing: 0; font-weight: 400; }
body.amanah input, body.amanah select {
  background: #faf8f4; border: 1px solid var(--line-strong); color: var(--text); border-radius: 12px;
}
body.amanah input:focus { border-color: #6b7a4e; box-shadow: 0 0 0 3px rgba(107, 122, 78, 0.15); outline: none; }
body.amanah input::placeholder { color: #a49e91; }
body.amanah .field label { color: var(--muted); }
body.amanah .primary.neutral { background: #4e5424; color: #f5f1ec; border-radius: 12px; box-shadow: 0 6px 18px rgba(78, 84, 36, 0.28); }
body.amanah .primary.neutral:hover { filter: brightness(1.1); }
body.amanah .flash.err { background: rgba(199, 64, 56, 0.08); border-color: rgba(199, 64, 56, 0.35); color: #a63330; }
body.amanah .flash.ok { background: rgba(107, 122, 78, 0.10); border-color: rgba(107, 122, 78, 0.35); color: #4e5424; }
body.amanah .ghost { border-color: var(--line-strong); color: #4e5424; }
body.amanah .code-input { letter-spacing: .35em; }
body.amanah .sec-badge.on { color: #4e5424; background: rgba(107, 122, 78, 0.12); border-color: rgba(107, 122, 78, 0.35); }
body.amanah code.secret { background: #f0ebe2; color: #4e5424; }

/* portal on cream */
body.amanah .myp-brand { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 21px; font-weight: 700; color: #4e5424; }
.myp-brand-from { font-family: inherit; font-style: italic; font-size: 13px; color: var(--accent); font-weight: 500; margin-left: 2px; }
body.amanah .myp-hero { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 30px; line-height: 1.25; color: #2c2a20; margin: 26px 0 26px; }
body.amanah .myp-hero span { color: #4e5424; }
.myp-vlabel { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
body.amanah .myp-value { color: #22201a; }
body.amanah .myp-signout { border-color: var(--line-strong); color: #4e5424; background: #fff; }
body.amanah .myp-signout:hover { border-color: #6b7a4e; color: #4e5424; }
body.amanah .myp-ranges button { color: var(--dim); }
body.amanah .myp-ranges button.on { color: #4e5424; background: rgba(107, 122, 78, 0.14); }
body.amanah .myp-card { border-radius: 16px; }
body.amanah .myp-product { color: var(--accent); }
body.amanah .myp-foot { border-top: 1px solid var(--line); margin-top: 34px; padding-top: 22px; }

body.amanah .auth-wrap { background: radial-gradient(1000px 520px at 50% -10%, rgba(107, 122, 78, 0.10), transparent), linear-gradient(180deg, #faf7f0, #f5f1ec); }
body.amanah input, body.amanah select { background: #faf8f4 !important; border-color: rgba(78, 84, 36, 0.28); color: #22201a !important; caret-color: #4e5424; }
body.amanah input:focus, body.amanah select:focus { border-color: #6b7a4e; box-shadow: 0 0 0 3px rgba(107, 122, 78, 0.15); }

/* stacked client lockup: Amanah over "from Mizan" */
.myp-lockup { display: flex; flex-direction: column; gap: 0; }
.myp-from { font-style: italic; font-size: 12.5px; color: var(--accent); font-weight: 500; margin-top: -2px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
body.amanah .myp-from { color: #a8862f; }

/* client portal: fluid on every screen */
body.amanah { overflow-x: hidden; }
.myp, .myp * { box-sizing: border-box; }
.myp { width: 100%; }
.myp-chart-wrap { overflow: hidden; border-radius: 12px; }
#my-chart { width: 100%; }
.myp-ranges { flex-wrap: wrap; }
.myp-ranges button { padding: 6px 12px; }
@media (min-width: 900px) {
  .myp { max-width: 880px; padding: 44px 32px 56px; }
  body.amanah .myp-hero { font-size: 38px; }
  .myp-value { font-size: 54px; }
  #my-chart { height: 300px; }
  .myp-cards { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .myp-ranges button { padding: 7px 18px; }
}
