/* ===== Fastoptionstrade theme — dark (default) + light ===== */
:root,
:root[data-theme="dark"] {
    --bg: #0a0e14;
    --panel: #111722;
    --panel-2: #0d1420;
    --line: #1e2a3a;
    --text: #c9d4e3;
    --muted: #8a9ab0;
    --up: #26c281;
    --dn: #ef5350;
    --accent: #4f8cff;
    --info: #4fc3f7;
    --up-soft: rgba(38, 194, 129, .14);
    --dn-soft: rgba(239, 83, 80, .14);
    --dn-strong: #c62828;                     /* the darker red of the buttons that SELL now (Sell, Close) */
    --accent-soft: rgba(79, 140, 255, .15);
    --info-soft: rgba(79, 195, 247, .14);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35);
    --accent-ink: #ffffff;
}

:root[data-theme="light"] {
    --bg: #eef1f6;
    --panel: #ffffff;
    --panel-2: #f3f6fa;
    --line: #dce3ec;
    --text: #17202e;
    --muted: #566579;
    --up: #0f9d70;
    --dn: #d93a37;
    --accent: #2563eb;
    --info: #1f7fb8;
    --up-soft: rgba(15, 157, 112, .12);
    --dn-soft: rgba(217, 58, 55, .1);
    --dn-strong: #b3261e;
    --accent-soft: rgba(37, 99, 235, .12);
    --info-soft: rgba(31, 127, 184, .1);
    --shadow: 0 1px 3px rgba(20, 40, 80, .08);
    --accent-ink: #ffffff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
h1:focus { outline: none; }

/* ---- helpers ---- */
.up { color: var(--up); }
.dn { color: var(--dn); }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.spacer { flex: 1; }

/* ---- buttons ---- */
.btn {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--panel-2);
    color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-buy { background: var(--up); color: #042616; border-color: var(--up); }
.btn-sell { background: var(--dn-strong); color: #fff; border-color: var(--dn-strong); }
.btn-block { width: 100%; display: block; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.inp, input[type="text"], input[type="email"], input[type="password"], select {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
    width: 100%;
}
.inp:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.checkline input { width: auto; }
.error { color: var(--dn); font-size: 13px; margin: 0 0 12px; }
.validation-message { color: var(--dn); font-size: 12px; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--up); }
.invalid { outline: 1px solid var(--dn); }

/* ---- theme toggle ---- */
.theme-btn {
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.theme-btn:hover { color: var(--text); border-color: var(--accent); }

/* ===== The small card of the sign-out page (Account/Logout). Log in, Create account and Reset password are
   the side panel of the landing page (landing.css). ===== */
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 28px 26px;
}
.auth-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-card .sub { margin-bottom: 20px; }


/* ===== App layout (authenticated) ===== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
/* The logo, the same as on the home page (landing.css ".logo"): green live dot, FAST in the text colour,
   OPTIONS in the home page's orange, its font. */
.brand { font-family: "Space Grotesk", 'Inter', system-ui, sans-serif; font-weight: 700; font-size: 19px; color: #e8eef5; letter-spacing: .5px; white-space: nowrap; }
:root[data-theme="light"] .brand { color: #0d1824; }
.brand b { color: #ff9f1a; }
.brand::before { content: ""; display: inline-block; vertical-align: calc(.368em - 4px); width: 8px; height: 8px; border-radius: 50%; background: #2bd49a; margin-right: 8px; animation: brand-pulse 2s infinite; }
@keyframes brand-pulse {
    0% { box-shadow: 0 0 0 0 rgba(43, 212, 154, .6); }
    70% { box-shadow: 0 0 0 9px rgba(43, 212, 154, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 212, 154, 0); }
}
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav .user { color: var(--text); font-weight: 600; font-size: 13px; }
.content { flex: 1; padding: 24px 26px; }

/* top-bar Logout + its CSS confirm modal (no layout interactivity needed) */
.logout-link { color: var(--accent); font-size: 14px; font-weight: 500; cursor: pointer; }
.logout-link:hover { color: var(--text); }
.logout-modal { display: none; position: fixed; inset: 0; z-index: 60; align-items: flex-start; justify-content: center; padding: 8vh 16px; }
.logout-toggle:checked ~ .logout-modal { display: flex; }
.logout-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); cursor: pointer; }
.logout-box { position: relative; width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.logout-box h2 { margin: 0 0 6px; font-size: 18px; }
.logout-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.logout-actions .btn { text-decoration: none; }

/* ===== cards / kpis / tables ===== */
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 16px; box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-size: 25px; font-weight: 700; margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ===== common page skeleton (PageSkeleton) — stands in the content area until the live page is drawn ===== */
.skel-bar {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 45%, var(--panel)) 50%, var(--line) 75%);
    background-size: 200% 100%;
    animation: skel-shine 1.4s linear infinite;
}
.skel-title { width: 180px; height: 22px; }
.skel-sub { width: 240px; max-width: 70%; margin-top: 10px; }
.skel-label { width: 55%; height: 10px; }
.skel-val { width: 70%; height: 24px; margin-top: 12px; }
.skel-block { display: flex; flex-direction: column; gap: 14px; }
.skel-heading { width: 160px; height: 14px; margin-bottom: 4px; }
.skel-line { width: 100%; }
.skel-short { width: 62%; }
@keyframes skel-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel-bar { animation: none; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge.call { background: var(--up-soft); color: var(--up); }
.badge.put { background: var(--dn-soft); color: var(--dn); }
.badge.ok { background: var(--up-soft); color: var(--up); }
.badge.off { background: var(--line); color: var(--muted); }
.badge.warn { background: rgba(239, 159, 39, .16); color: #c67b00; }
.paper-badge { white-space: nowrap; }   /* top bar: a paper account's prices are the delayed (paper) price */
/* Project rule: no native increment/decrement spinner on any number input. */
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.order-ticket .qty { width: 54px; text-align: center; }
.tbl .sltp { width: 66px; text-align: right; }
.pos-avail { margin-left: auto; font-size: 11px; color: var(--muted); }
.ord-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ord-edit label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.ord-edit .inp { width: 58px; text-align: right; }
.ord-actions { display: flex; gap: 6px; margin-top: 6px; }
.pill-sm { padding: 1px 8px; font-size: 10px; line-height: 1.6; }
.pos-close-btn { position: absolute; top: 34px; right: 12px; }

/* ===== source avatar (M/A/O); the quantity is a plain number beside it ===== */
.src-av { position: relative; display: inline-flex; width: 26px; height: 26px; flex: 0 0 auto; }
.src-av .av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
/* the tag number on the avatar's corner: rows with the same number carry the same tag (same position) */
.src-av .av-no { position: absolute; top: -4px; right: -6px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 9px; font-weight: 700; line-height: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.qty-plain { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* the broker's reason for refusing our last sell of a position */
.sell-problem { font-size: 11px; line-height: 1.4; color: var(--dn); padding: 0 2px 7px; }
/* the story of a position: one line per thing that happened, oldest first (opened from an Order history row) */
.btn-story { padding: 2px 8px; font-size: 11px; line-height: 1.5; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.btn-story:hover { border-color: var(--accent); color: var(--accent); }
.modal.modal-story { max-width: 760px; }
.story-body { max-height: 70vh; overflow-y: auto; }
.story { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.story-line { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.story-line:first-child { border-top: 0; }
.story-time { flex: 0 0 auto; min-width: 62px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.story-kind { flex: 0 0 62px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.story-kind.story-fired, .story-kind.story-closed { color: var(--dn); }
.story-kind.story-fill { color: var(--up); }
.story-kind.story-level, .story-kind.story-signal { color: var(--accent); }
.story-text { flex: 1 1 auto; color: var(--text); }
.story-foot { margin: 10px 0 0; }
/* order history: why a sell was made, the broker's reason, and the tag sent to the broker */
.cell-tag { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tbl td.muted-cell { white-space: nowrap; }   /* the date / time stays on one line */
/* Waiting Sell Order card: one row per line under column titles — Position · Qty · SL · TP · P/L · Sell ✕.
   The quantity, SL and TP are small boxes of a fixed width (the same under their titles on every row); the
   position's name takes whatever space is left. */
.otbl.wait .otbl-row, .otbl.wait .otbl-head { gap: 6px; }
.otbl.wait .c-pos { width: auto; flex: 1 1 0; gap: 6px; }
.otbl.wait .c-q { width: 36px; flex: 0 0 36px; text-align: center; }
.otbl.wait .c-lv { width: 46px; flex: 0 0 46px; text-align: center; font-weight: 700; }
.otbl.wait .c-pl { width: 50px; flex: 0 0 50px; }
/* A MARKET sell's row: its Qty / SL / TP boxes cannot be changed, so they are dimmed. */
.otbl.wait input:disabled { opacity: .5; cursor: not-allowed; }
.otbl.wait .c-act { display: flex; align-items: center; justify-content: flex-end; gap: 5px; width: 72px; flex: 0 0 72px; }
/* Sell = the DARKER red (it sells now, at market) — the same as Close in Open positions. */
.btn-place { padding: 4px 10px; font-size: 11px; white-space: nowrap; border: none; border-radius: 5px; cursor: pointer; flex: 0 0 auto; background: var(--dn-strong); color: #fff; font-weight: 600; }
.btn-place:hover { filter: brightness(1.12); }
/* CANCEL = a red ✕ icon button, the same on every card of the board (Waiting Sell Order, Outside Sell Orders,
   Pending Buy Orders). The board's buttons: DARKER RED, filled = sells now (Sell, Close); the normal red, as
   an outline = cancels / removes. The outline keeps Sell the strongest button on a row. The ✕ looks the same
   and works the same on every line — also on a default line with no SL and no TP. */
.btn-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--dn); border-radius: 5px; background: transparent; color: var(--dn); cursor: pointer; flex: 0 0 auto; }
.btn-x:hover { background: var(--dn-soft); }
/* Outside Sell Orders card */
.otbl.outside .c-pos { width: 124px; }
.otbl .c-kind { width: 30px; text-align: center; font-size: 11px; font-weight: 700; }
.otbl .c-tag { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.kind-sl { color: var(--dn); }
.kind-tp { color: var(--up); }
.av-manual .av { background: #2a3550; color: #cfe0ff; }
.av-auto .av { background: #0f6e56; color: #9fe1cb; }
.av-out .av { background: #633806; color: #fac775; }

/* ===== order / position mini-table (compact one-line rows) ===== */
.otbl { display: flex; flex-direction: column; }
.otbl-head { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 2px 2px 6px; }
.otbl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 7px 2px; border-top: 1px solid var(--line); }
.otbl .c-pos { width: 170px; display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.otbl .c-pos .sym { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
/* Open positions: Call / Put by the colour of the last letter (as on a Waiting Sell Order line), and when it was opened */
.otbl .c-pos .sym .cp-call { color: var(--up); }
.otbl .c-pos .sym .cp-put { color: var(--dn); }
.otbl.pos .c-pos { width: 128px; }
.otbl .c-time { width: 60px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.otbl .c-num { width: 46px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.otbl .c-pl { width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.otbl .c-qty { width: 32px; text-align: center; }
.otbl .c-end { margin-left: auto; }
.tag-pc { font-size: 9px; padding: 1px 5px; border-radius: 4px; }
.tag-put { background: var(--dn-soft); color: var(--dn); }
.tag-call { background: var(--up-soft); color: var(--up); }
.in-sl { width: 46px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; color: var(--text); font-size: 11px; text-align: right; }
.in-qty { width: 32px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; color: var(--text); font-size: 11px; text-align: right; }
.btn-sell { background: var(--dn-strong); color: #fff; border: none; border-radius: 5px; padding: 4px 13px; font-size: 11px; cursor: pointer; flex: 0 0 auto; }
.btn-sell:hover { filter: brightness(1.12); }
.otbl .c-side { width: 32px; text-align: center; }
.otbl.pend .c-pos { width: 104px; }
.otbl.pend .otbl-row, .otbl.pend .otbl-head { gap: 6px; }
.otbl.pend .in-sl { width: 42px; }
.otbl.pend .in-qty { width: 28px; }

/* SL / TP labels and the thin divider of a Pending Buy line */
.oo-sl-lbl { color: var(--dn); font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.oo-tp-lbl { color: var(--up); font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.oo-div { width: 1px; align-self: stretch; background: var(--line); flex: 0 0 auto; }

/* Single-line pending BUY row: identity · Buy price · SL/TP · countdown · | · Qty + Cancel */
.po-lot { margin-bottom: 8px; }
.po-line { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.po-id { display: flex; align-items: center; gap: 7px; min-width: 0; }
.po-sym { font-weight: 700; color: var(--text); font-size: 13px; white-space: nowrap; }
.po-sym .cp-call { color: var(--up); }
.po-sym .cp-put { color: var(--dn); }
.po-buy { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; margin-left: auto; }
.po-buy-lbl { color: var(--muted); font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.po-buy .in-sl { width: 46px; }
.po-exits { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.po-exits .in-sl { width: 44px; }
.po-ttl { font-size: 10px; font-weight: 700; color: #c08a2b; background: rgba(192, 138, 43, .14); border-radius: 5px; padding: 3px 7px; font-variant-numeric: tabular-nums; flex: 0 0 auto; white-space: nowrap; }
.po-ttl.urgent { color: #fff; background: var(--dn); }
.po-end { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.po-end .in-qty { width: 44px; }

/* ===== modal dialog ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
/* Admin users — Action controls (pen edit + activate/deactivate) on one line */
.row-actions { display: inline-flex; align-items: center; gap: 6px; }
.btn.btn-icon { display: inline-flex; align-items: center; gap: 5px; }
.btn.btn-icon svg { display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Fixed column widths so switching tabs (Clients/Analysts/System) doesn't reflow the table. */
.users-tbl { table-layout: fixed; }
.users-tbl th:nth-child(1), .users-tbl td:nth-child(1) { width: 22%; }
.users-tbl th:nth-child(2), .users-tbl td:nth-child(2) { width: 30%; }
.users-tbl th:nth-child(3), .users-tbl td:nth-child(3) { width: 14%; }
.users-tbl th:nth-child(4), .users-tbl td:nth-child(4) { width: 14%; }
.users-tbl th:nth-child(5), .users-tbl td:nth-child(5) { width: 20%; }
.users-tbl td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Deactivated users read as dimmed, but the Action buttons stay full strength. */
.users-tbl tr.inactive td:not(:last-child) { opacity: .5; }
/* Signal access — "Managing" selector (admin) + the viewer table's own fixed 6-column widths. */
.manage-bar { display: flex; align-items: center; gap: 12px; }
.manage-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.manage-select { width: auto; min-width: 220px; }
.viewer-tbl { table-layout: fixed; }
.viewer-tbl th:nth-child(1), .viewer-tbl td:nth-child(1) { width: 20%; }
.viewer-tbl th:nth-child(2), .viewer-tbl td:nth-child(2) { width: 26%; }
.viewer-tbl th:nth-child(3), .viewer-tbl td:nth-child(3) { width: 12%; }
.viewer-tbl th:nth-child(4), .viewer-tbl td:nth-child(4) { width: 13%; }
.viewer-tbl th:nth-child(5), .viewer-tbl td:nth-child(5) { width: 15%; }
.viewer-tbl th:nth-child(6), .viewer-tbl td:nth-child(6) { width: 14%; }
.viewer-tbl td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Add-viewer picker (Signal access) */
.pick-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px; border-bottom: 0.5px solid var(--line); }
.pick-row:last-child { border-bottom: none; }
.pick-name { font-size: 14px; }
.pick-sub { font-size: 12px; color: var(--muted); }
.pick-note { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
/* Right-align numeric columns and FIX their width so live-price updates don't reflow/flicker. */
.tbl th.r, .tbl td.r { text-align: right; white-space: nowrap; min-width: 62px; }
/* A little breathing room between stacked cards. */
.card:not(.kpi) { margin-bottom: 14px; }
.ok-msg { color: var(--up); font-size: 13px; margin: 6px 0; }
.num-pos { color: var(--up); font-weight: 600; }
.num-neg { color: var(--dn); font-weight: 600; }
.muted-cell { color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.link-sm { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.link-sm:hover { text-decoration: underline; }

/* System Monitor */
.mon-updated { color: var(--muted); font-size: 12px; margin-left: auto; }
.mon-table { width: 100%; border-collapse: collapse; }
.mon-table th, .mon-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; vertical-align: middle; }
.mon-table tbody tr:last-child td { border-bottom: none; }
.mon-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.mon-table th.r, .mon-table td.r { text-align: right; font-variant-numeric: tabular-nums; }
.mon-sym { font-weight: 600; color: var(--text); }
.mon-pid { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.px-note { margin-bottom: 12px; }   /* the line above the live / paper price check */
.px-note b { color: var(--text); }
.mon-bar { position: relative; height: 8px; min-width: 90px; border-radius: 5px; background: var(--line); overflow: hidden; }
.mon-bar > span { position: absolute; inset: 0 auto 0 0; display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s ease; }
.mon-bar.warn > span { background: var(--dn); }

/* dashboard two-column layout + open-positions panel */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 530px; gap: 16px; align-items: start; }
.dash-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-side { display: flex; flex-direction: column; gap: 16px; }
.pos-list { display: flex; flex-direction: column; gap: 10px; }
.pos-item { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pos-top { display: flex; align-items: center; justify-content: space-between; }
.pos-sym { font-weight: 700; font-size: 14px; }
.pos-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* The right column is 530px wide and the side menu 212px, so below 1300px the left column had too little room
   (58px at 1100px): from there down the right column goes UNDER the left one. */
@media (max-width: 1300px) { .dash-grid { grid-template-columns: 1fr; } }
/* The four figures need about 840px to stand in one line (a balance like $1,00,000.00 must not be cut).
   Where they have less, they stand two by two: with the right column beside them (1301–1649px), and on a
   screen up to 1100px. */
@media (min-width: 1301px) and (max-width: 1649px) { .dash-main .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } }
/* Positions & Orders page: the same board cards as the dashboard, two across (one across on a narrow screen),
   in reading order — Open positions, Waiting Sell Order, Outside Sell Orders, Pending Buy Orders. */
.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1150px) { .board-grid { grid-template-columns: 1fr; } }
.board-next { margin-top: 20px; }
/* Order history (one shared component). Dashboard: today's orders as a short card that scrolls after ~8 rows. */
.hist-scroll { max-height: 318px; overflow-y: auto; }
.tbl.tbl-compact { font-size: 12px; }
.tbl.tbl-compact th { padding: 6px 6px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tbl.tbl-compact td { padding: 7px 6px; white-space: nowrap; }
.tbl.tbl-compact th.r, .tbl.tbl-compact td.r { min-width: 0; }
/* Order history: an order with a reason shows a small "i" beside its status; a click opens the reason in a popup */
.hist-status { white-space: nowrap; }
.btn-info { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 5px; padding: 0; vertical-align: middle; border: 1px solid var(--accent); border-radius: 50%; background: transparent; color: var(--accent); font: italic 700 11px/1 Georgia, 'Times New Roman', serif; cursor: pointer; }
.btn-info:hover { background: var(--accent); color: var(--accent-ink); }
/* The reason box: a small panel that opens beside the "i" that was clicked (--x / --y = where the click was).
   It hangs just under the icon, reaching to the LEFT of it (the icon sits near the right edge of its card),
   and is always kept inside the window. The backdrop is invisible: it only catches the click that closes it. */
.why-backdrop { position: fixed; inset: 0; z-index: 59; }
.why-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px);
    left: clamp(8px, calc(var(--x) - 292px), calc(100vw - 328px));
    top: calc(var(--y) + 14px);
    padding: 10px 12px 12px; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .45); }
/* The "i" was in the lower part of the window: the box opens ABOVE it (set by the small script in App.razor). */
:root.why-above .why-pop { top: auto; bottom: calc(100vh - var(--y) + 14px); max-height: calc(var(--y) - 22px); overflow-y: auto; }
.why-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.why-pop-title { font-size: 13px; font-weight: 700; color: var(--text); }
.hist-why-order { margin: 0 0 8px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.hist-why-order strong { color: var(--text); }
.hist-why-text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
/* Positions & Orders: the history scrolls INSIDE its card — the page does not grow as older orders are loaded.
   The column titles stay at the top while it scrolls. */
.hist-scroll-full { max-height: 56vh; overflow-y: auto; }
.hist-scroll-full .tbl th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
/* Positions & Orders: the "Load older orders" line under the table */
.hist-more { display: flex; align-items: center; gap: 12px; padding-top: 12px; }
.hist-more .sub { margin: 0; }
/* On this page only: Pending Buy Orders comes before Outside Sell Orders (the dashboard keeps its own order). */
.board-grid .board-positions { order: 1; }
.board-grid .board-waiting { order: 2; }
.board-grid .board-pending { order: 3; }
.board-grid .board-outside { order: 4; }

/* creator groups (outer) on the signals page — one section per "Created by" user, wrapping the ticker cards */
.creator-grid { display: flex; flex-direction: column; gap: 18px; }
.creator-card { display: flex; flex-direction: column; }
.creator-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 4px 4px 10px; font-family: inherit; background: none; border: none; border-bottom: 1px solid var(--line); margin-bottom: 12px; cursor: pointer; color: var(--text); text-align: left; }
.creator-name { font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.creator-count { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ticker (symbol) cards on the signals page */
.sym-grid { display: flex; flex-direction: column; gap: 12px; }
.sym-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sym-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-family: inherit; background: none; border: none; cursor: pointer; color: var(--text); text-align: left; }
.sym-head:hover { background: var(--panel-2); }
.sym-head .chev, .creator-head .chev { color: var(--muted); font-size: 20px; width: 20px; line-height: 1; text-align: center; }
.sym-name { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.sym-price { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.sym-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.sym-card .tbl { padding: 0 6px 6px; table-layout: fixed; width: 100%; }
/* fixed layout + centered cells so every ticker card's columns line up identically */
.sym-card .tbl th, .sym-card .tbl td { text-align: center; overflow: hidden; text-overflow: ellipsis; }
.sym-card .order-ticket { justify-content: center; }
/* Signals table: quantity, Mkt / Lmt and the price box stand at the same place in every row. Each action button
   has the same width (46px); a row with only Sell (a sell signal has no Buy) gets ONE Sell button as wide as
   Buy + Sell together (two buttons and the 4px gap between them), so no empty space is left. */
.sym-card .order-ticket .ticket-act { flex: 0 0 46px; }
.sym-card .order-ticket .ticket-act:only-of-type { flex-basis: 96px; }
.sym-card .order-ticket .ticket-act .btn { width: 100%; padding-left: 0; padding-right: 0; text-align: center; }
/* explicit column widths so the Order ticket has room and every card matches */
.sym-card .tbl .c-time { width: 72px; }
.sym-card .tbl .c-opt { width: 112px; }
.sym-card .tbl .c-side { width: 76px; }
.sym-card .tbl .c-entry { width: 72px; }
.sym-card .tbl .c-live { width: 64px; }
.sym-card .tbl .c-min { width: 64px; }
.sym-card .tbl .c-max { width: 64px; }
.sym-card .tbl .c-gex { width: 88px; }
.sym-card .tbl .c-order { width: 230px; }
.sym-card .tbl .c-date { width: 72px; }
.sym-card .tbl .c-exit { width: 70px; }
.sym-card .tbl .c-det { width: 96px; }
.sym-card .tbl .c-notes { width: 180px; }
.tbl-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }   /* a thin bar in the theme's colours, not the browser's white one */

/* show-more toggle + inline order ticket */
.cards-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.toggle-pill { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.toggle-pill:hover { color: var(--text); }
.toggle-pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.action-note { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.order-ticket { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.inp-sm { padding: 6px 8px; font-size: 12px; height: auto; }
.inp-xs { padding: 4px 6px; font-size: 11px; height: auto; line-height: 1.2; }
.order-ticket .inp-xs { flex: 0 0 auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--panel-2); flex: 0 0 auto; }
.seg-btn { border: none; background: none; color: var(--muted); font-size: 11px; font-weight: 700; padding: 4px 9px; cursor: pointer; line-height: 1.3; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover:not(.on) { color: var(--text); }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); }
.order-ticket .qty { width: 46px; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.order-ticket .lim { width: 84px; -moz-appearance: textfield; appearance: textfield; }
.order-ticket .ttl { width: 42px; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.order-ticket .ttl-unit { font-size: 10px; color: var(--muted); }
.order-ticket .lim::-webkit-outer-spin-button,
.order-ticket .lim::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.order-ticket .lim:disabled { opacity: .45; }
/* Disabled ticket (e.g. no position to sell): greyed, not clickable; the wrapper span keeps the
   hover tooltip working even though the button itself is disabled (pointer-events off on the button). */
.order-ticket .qty:disabled { opacity: .45; }
.order-ticket .seg-btn:disabled { opacity: .45; cursor: not-allowed; }
.order-ticket .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ticket-act { display: inline-flex; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.ticket-err { color: var(--dn); font-size: 11px; margin: 4px 0 0; }
.ticket-note { color: var(--muted); font-size: 11px; font-style: italic; margin: 4px 0 0; white-space: nowrap; }
.ticket-none { color: var(--muted); font-size: 11px; font-style: italic; white-space: nowrap; }
.btn-danger { background: var(--dn-soft); color: var(--dn); border: 1px solid transparent; }
.btn-danger:hover { background: var(--dn); color: #fff; }

/* ── Create-signal: pinned self group + its dialog ───────────────────────────── */
.self-creator { border: 1px solid var(--accent); border-radius: 14px; padding: 12px 14px 14px; background: var(--accent-soft); }
.self-creator .creator-head.self-head { border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent); cursor: default; }
.self-head .cs-you { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.self-head .create-btn { margin-left: auto; }
.empty-self { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 22px 14px; border: 1px dashed var(--line); border-radius: 10px; background: var(--panel); }
.empty-self .es-title { font-weight: 700; color: var(--text); }

.cs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-seg { display: flex; width: 100%; border: 1px solid var(--line); border-radius: var(--radius, 8px); overflow: hidden; }
.cs-seg-btn { flex: 1 1 0; text-align: center; background: var(--panel-2); border: none; color: var(--muted); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cs-seg-btn + .cs-seg-btn { border-left: 1px solid var(--line); }
.cs-seg-btn:hover:not(.on) { color: var(--text); }
.cs-seg-btn:focus { outline: none; }
/* Clean inset ring on keyboard focus so Tabbing onto CALL/PUT doesn't spill a default outline over the pill. */
.cs-seg-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.cs-seg-btn.on.call, .cs-seg-btn.on.buy { background: var(--up-soft); color: var(--up); }
.cs-seg-btn.on.put, .cs-seg-btn.on.sell { background: var(--dn-soft); color: var(--dn); }
.cs-preview { display: flex; align-items: center; gap: 6px; min-height: 38px; background: var(--panel-2); border: 1px dashed var(--line); border-radius: var(--radius, 8px); padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--text); }
.cs-preview.ok { border-color: var(--accent); color: var(--accent); }
.cs-preview.bad { border-color: var(--dn); }
.cs-preview .ph { color: var(--muted); font-weight: 400; }
.cs-preview .cs-live { margin-left: auto; color: var(--up); }
.cs-preview .cs-nolive { margin-left: auto; color: var(--dn); }
.cs-note { color: var(--muted); font-size: 12px; padding: 9px 0; }
.cs-note.err { color: var(--dn); }
.cs-err { margin-top: 10px; }
.cs-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.cs-divider::before, .cs-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ===== responsive ===== */
@media (max-width: 640px) {
    .kpis { grid-template-columns: 1fr 1fr; }
    .content { padding: 18px 14px; }
    .topbar { padding: 10px 14px; }
    .auth-card { padding: 24px 18px; }
    .nav { width: 100%; margin-left: 0; }

    /* Less empty space on a phone. A signals table sits three boxes deep (page → analyst card → ticker card),
       and each box kept its desktop padding, so the table started 30px in from each edge. Now 14px. */
    .content { padding: 12px 6px; }
    .topbar { padding: 8px 8px; }
    .page-head { margin-bottom: 12px; }
    .kpis { gap: 8px; margin-bottom: 12px; }
    .card { padding: 12px; }
    .card:not(.kpi) { margin-bottom: 10px; }
    .dash-grid, .dash-main, .dash-side { gap: 12px; }
    .creator-grid { gap: 12px; }
    .self-creator { padding: 8px 6px 6px; }
    .creator-head { padding: 4px 4px 8px; margin-bottom: 8px; }
    .sym-head { padding: 11px 10px; gap: 8px; }

    /* The signals table on a phone. The columns stand in another order than on a wide screen, so that the
       Order column (quantity, Mkt / Lmt, price, Buy, Sell) is reached with a short swipe:
           Time · Option · Entry · price · ORDER · Min · Max · GEX
       The Side column is hidden — the option's last letter says it: green C = call, red P = put.
       A table cannot change the order of its columns, so on a phone each row is laid out as a line of boxes
       (the "k-…" class of each cell gives its place and width; see SignalCards.razor). The Order column is wide
       enough for its controls (it was 230px for a 316px row, so the last button was cut off). */
    .sym-card .tbl { display: block; width: max-content; min-width: 100%; padding: 0; }
    .sym-card .tbl colgroup { display: none; }
    .sym-card .tbl thead, .sym-card .tbl tbody { display: block; }
    .sym-card .tbl tr { display: flex; align-items: stretch; }
    .sym-card .tbl th, .sym-card .tbl td { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: border-box; white-space: nowrap; }
    .sym-card .tbl th { padding: 7px 4px; }
    .sym-card .tbl td { padding: 8px 4px; }
    .sym-card .tbl .k-date { order: 1; width: 50px; }
    .sym-card .tbl .k-time { order: 2; width: 46px; }
    .sym-card .tbl .k-opt { order: 3; width: 82px; }
    .sym-card .tbl .k-side { display: none; }
    .sym-card .tbl .k-entry { order: 4; width: 46px; }
    .sym-card .tbl .k-live { order: 5; width: 48px; }
    .sym-card .tbl .k-order { order: 6; width: 306px; flex-direction: column; }
    .sym-card .tbl .k-min { order: 7; width: 46px; }
    .sym-card .tbl .k-max { order: 8; width: 46px; }
    .sym-card .tbl .k-gex { order: 9; width: 56px; }
    .sym-card .tbl .k-exit { order: 10; width: 56px; }
    .sym-card .tbl .k-det { order: 11; width: 74px; }
    .sym-card .tbl .k-notes { order: 12; width: 170px; justify-content: flex-start; }
    .sym-card .order-ticket .lim { width: 64px; }
    .opt-cp { font-weight: 800; }
    .opt-cp.call { color: var(--up); }
    .opt-cp.put { color: var(--dn); }

    /* "Your signals": name and count on one line, the Create signal button on its own line below */
    .creator-name { white-space: nowrap; }
    .creator-head.self-head { flex-wrap: wrap; row-gap: 10px; }
    .self-head .creator-count { margin-left: auto; }
    .self-head .create-btn { flex: 1 0 100%; margin-left: 0; white-space: nowrap; }
}
/* Top bar on a phone or a small tablet: one line — menu button, logo, the word "Paper", theme button, avatar.
   The rest of the paper sentence is in the avatar's panel. */
@media (max-width: 820px) {
    .topbar { gap: 8px; }
    .topbar .pb-more { display: none; }
}
/* a narrow phone: the four figures stay two by two, a little smaller, so they do not fill the whole screen */
@media (max-width: 400px) {
    .kpis { gap: 10px; }
    .kpi { padding: 12px; }
    .kpi .val { font-size: 19px; }
    .kpi .sub { font-size: 12px; }
}

/* ===== framework error ui ===== */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* small pill with a value (signal access, settings) */
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip b { font-weight: 700; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 7px var(--up); display: inline-block; }

/* ===== password show/hide ===== */
.pwd-wrap { position: relative; }
.pwd-wrap .inp { padding-right: 42px; }
.pwd-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; }
.pwd-toggle:hover { color: var(--text); }

/* ===== public landing ===== */
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-top { display: flex; align-items: center; gap: 16px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.pub-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.pub-nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.pub-nav a:hover { color: var(--text); text-decoration: none; }
.pub-nav a.btn-primary, .pub-nav a.btn-primary:hover { color: var(--accent-ink); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.pub main { flex: 1; }
.pub-foot { border-top: 1px solid var(--line); padding: 18px 26px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }

/* The landing page itself (Home.razor) has its own stylesheet: landing.css. */
.section { max-width: 900px; margin: 0 auto; padding: 44px 40px; }
.section h2 { font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.section > p { color: var(--muted); font-size: 15px; line-height: 1.7; max-width: 72ch; }

.legal { max-width: 820px; }
.legal-list { color: var(--muted); font-size: 14px; line-height: 1.7; padding-left: 20px; }
.legal-list li { margin-bottom: 14px; }

@media (max-width: 640px) {
    .section { padding: 32px 18px; }
    .pub-top { padding: 12px 16px; }
    .pub-foot { padding: 16px; }
}

/* brand as link */
.pub-top .brand, a.brand { text-decoration: none; }
.pub-top .brand:hover, a.brand:hover { text-decoration: none; }


/* left sidebar nav */
.topbar .spacer { flex: 1; }

/* ===== Top bar: the user's avatar and its panel (UserMenu.razor) =====
   Order at the right end of the bar: paper badge, theme button, avatar. The panel is shown while the hidden
   box "user-toggle" is ticked; the see-through area behind it closes it. */
.topbar { position: relative; }
.topbar .theme-btn { order: 5; }
.avatar { order: 6; flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; letter-spacing: .3px; cursor: pointer; user-select: none; }
.avatar:hover { filter: brightness(1.08); }
.avatar-lg { order: 0; width: 42px; height: 42px; font-size: 14px; cursor: default; }
.avatar-lg:hover { filter: none; }
.user-scrim { display: none; }
.user-toggle:checked ~ .user-scrim { display: block; position: fixed; inset: 0; z-index: 57; }
.user-panel { display: none; position: absolute; top: calc(100% + 6px); right: 10px; z-index: 58; width: 280px; max-width: calc(100vw - 20px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, .4); padding: 12px; }
.user-toggle:checked ~ .user-panel { display: block; }
.um-who { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.um-names { min-width: 0; }
.um-name { font-weight: 700; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-email { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-paper { display: block; margin: 0 0 8px; padding: 7px 10px; font-weight: 600; }
.um-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; }
.um-item:hover { background: var(--panel-2); text-decoration: none; }
.um-item svg { flex: none; color: var(--muted); }
.um-logout, .um-logout svg { color: var(--dn); }
.app-body { flex: 1; display: flex; min-height: 0; }
.sidenav { width: 212px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-cap { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 14px 12px 6px; opacity: .7; }
.side-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; }
.side-item:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.side-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-item svg { flex: none; }
/* A nav group with a parent heading and indented sub-items (e.g. Admin › Users, System Monitor). */
.side-group { display: flex; align-items: center; gap: 11px; padding: 14px 12px 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .8; }
.side-group svg { flex: none; }
.side-sub { display: flex; flex-direction: column; gap: 2px; margin-left: 15px; padding-left: 9px; border-left: 1px solid var(--line); }
/* ===== Phone: menu panel + quick tabs (up to 760px) =====
   The menu button (top bar) and the dark area beside the open panel are labels of the hidden box
   "menu-toggle" in MainLayout; the panel is open while that box is ticked. On a wider screen the button, the
   dark area and the bottom tabs are not shown and the side menu stands at the left as always. */
.menu-btn, .menu-scrim, .bottom-tabs { display: none; }
@media (max-width: 760px) {
    .app-body { display: block; }

    /* the menu button, left of the logo */
    .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); cursor: pointer; }

    /* the side menu: a panel that slides in from the left */
    .sidenav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 56; width: min(280px, 82vw); overflow-y: auto; padding: 16px 12px; border-right: 1px solid var(--line); box-shadow: 0 0 40px rgba(0, 0, 0, .45); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
    .app-shell:has(.menu-toggle:checked) .sidenav { transform: none; visibility: visible; }
    .side-item { padding: 12px 12px; font-size: 15px; }
    .side-item span { white-space: nowrap; }
    .app-shell:has(.menu-toggle:checked) .menu-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); cursor: pointer; }
    html:has(.menu-toggle:checked) { overflow: hidden; }   /* the page behind does not scroll while the panel is open */

    /* the quick tabs, always at the bottom; the page keeps room for them */
    .bottom-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
    .bottom-tabs .tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 9px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
    .bottom-tabs .tab.on { color: var(--accent); background: var(--accent-soft); }
    .bottom-tabs .tab svg { flex: none; }
    .content { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* settings / cards stack */
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 4px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Settings · connected-accounts table: centered columns + equal-size Active control (badge vs button) */
.tbl th.col-center, .tbl td.col-center { text-align: center; }
.acct-active { display: inline-flex; align-items: center; justify-content: center; min-width: 108px; height: 32px; padding: 0 12px; box-sizing: border-box; font-size: 13px; font-weight: 600; }
/* Activate / Deactivate: one width, so the row's buttons line up whichever of the two it shows */
.acct-switch { min-width: 96px; justify-content: center; }
/* "No account is active" line above the table, and the warning inside the deactivate dialog */
.acct-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: rgba(239, 159, 39, .14); border: 1px solid rgba(239, 159, 39, .45); color: var(--text); font-size: 13px; line-height: 1.45; }
.acct-warn { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.acct-warn-list { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--text); }

/* toggle switch */
.tog { position: relative; width: 40px; height: 22px; background: var(--line); border: 1px solid var(--muted); border-radius: 999px; cursor: pointer; padding: 0; }
.tog.on { background: var(--up); border-color: var(--up); }
/* off knob uses a muted fill so the control stays visible on light cards; on knob is white on green */
.tog span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.tog.on span { left: 20px; background: #fff; }

/* ===== My Analysts page ===== */
/* master auto banner — reflects the account-level switch (managed in Settings) */
.ma-master { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ma-master.on { border-color: var(--up); }
.ma-master-title { font-size: 15px; font-weight: 700; }
/* one card per analyst the client follows */
/* Compact cards: name + quick Auto toggle + a small SL/Profit/Qty summary + an Edit button. The full
   editable form lives in the dialog, so extra per-analyst fields later don't bloat the card face. */
.ma-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.analyst-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.analyst-card.revoked { border-color: var(--dn); background: var(--dn-soft); opacity: .8; }
/* the user's own "self" card — pinned first, accented so it reads as "you" */
.analyst-card.self-card { border-color: var(--accent); }
.self-card .ac-ini { background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.ma-none { margin-top: 4px; }
.ac-head { display: flex; align-items: center; gap: 10px; }
.ac-ini { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.analyst-card.revoked .ac-ini { background: var(--line); color: var(--muted); }
.ac-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-auto { display: flex; align-items: center; gap: 9px; }
.ac-auto-lbl { font-size: 13px; color: var(--muted); }
.badge.revoked-badge { background: var(--dn-soft); color: var(--dn); }

/* read-only summary chips on the card face */
.ac-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ac-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.ac-chip-k { color: var(--muted); }
.ac-chip-v { font-weight: 700; }

.ac-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.ac-msg { margin: 0; font-size: 12px; margin-right: auto; }
.ac-edit { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; }
.ac-note { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dn); margin-top: 12px; }

/* Edit dialog form */
.ac-auto-field { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; cursor: help; }
.ac-auto-field label { cursor: help; }
.ac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ac-grid .field { margin-bottom: 0; }
/* Stop loss / Profit: the label with its on-off switch on the same line, the % box below */
.ac-switch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.ac-grid .field > label { display: flex; align-items: center; min-height: 22px; }   /* same label height as the fields with a switch, so the boxes line up */
.ac-grid .field .inp:disabled { color: var(--muted); background: var(--panel-2); cursor: not-allowed; }
.ac-dlg-msg { margin: 12px 0 0; font-size: 13px; }
@media (max-width: 560px) { .ac-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }


