:root {
    --bg: #070b12;
    --bg-2: #0a101a;
    --panel: #0d1522;
    --panel-2: #111b2b;
    --line: #1b2739;
    --line-2: #293a52;
    --text: #e8eef8;
    --muted: #8c9bb2;
    --gold: #e8b84b;
    --gold-2: #f6d98b;
    --green: #25d39c;
    --red: #f15b70;
    --blue: #6b9bff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 45px rgba(0, 0, 0, .35);
    --sidebar: 264px;
}

* {
    box-sizing: border-box;
}

/* Class rules such as .alert set display:flex, which would otherwise override
   the browser's default for the hidden attribute. */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    margin: 0;
    overflow-x: hidden;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font-family: "Vazirmatn", "IRANSansX", "IRANSans", "Segoe UI", Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

body.app-body,
body.guest-body {
    background:
        radial-gradient(900px 500px at 90% -10%, rgba(232, 184, 75, .08), transparent 60%),
        radial-gradient(700px 500px at 0% 0%, rgba(37, 211, 156, .05), transparent 55%),
        var(--bg);
    min-height: 100vh;
}

a {
    color: var(--gold-2);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: #fff;
}

h1, h2, h3, h4 {
    margin: 0 0 .45rem;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: -.2px;
}

h1 { font-size: clamp(1.9rem, 3.4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.2vw, 2rem); }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }

p {
    margin: 0 0 .75rem;
}

ul, ol {
    margin: 0;
    padding-inline-start: 1.2rem;
}

img, svg {
    max-width: 100%;
}

.ltr {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    /* Vazirmatn's locl feature renders ASCII digits as Persian glyphs under
       lang="fa"; numeric values must stay Latin. */
    font-feature-settings: "locl" 0;
    font-variant-numeric: lining-nums tabular-nums;
}

input[data-numeric="decimal"] {
    font-feature-settings: "locl" 0;
    font-variant-numeric: lining-nums tabular-nums;
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.small-note { margin-top: 1rem; font-size: .85rem; }
.pos { color: var(--green) !important; }
.neg { color: var(--red) !important; }

.container {
    width: min(1200px, calc(100% - 2.5rem));
    margin-inline: auto;
}

.container-narrow {
    width: min(920px, calc(100% - 2rem));
    margin-inline: auto;
}

.section {
    padding-block: 4.5rem;
}

.section-head {
    max-width: 660px;
    margin: 0 auto 2.4rem;
    text-align: center;
}

.section-head p {
    color: var(--muted);
}

.eyebrow {
    display: inline-block;
    margin-bottom: .5rem;
    color: var(--gold);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .5px;
}

/* ---------- Buttons, chips, badges ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: .62rem 1.1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--gold-2), var(--gold));
    color: #1b1305;
    box-shadow: 0 8px 22px rgba(232, 184, 75, .18);
}

.btn-primary:hover { color: #120d02; box-shadow: 0 10px 28px rgba(232, 184, 75, .3); }

.btn-gold {
    background: rgba(232, 184, 75, .14);
    border-color: rgba(232, 184, 75, .4);
    color: var(--gold-2);
}

.btn-ghost {
    background: rgba(255, 255, 255, .03);
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .06); }

.btn-danger {
    background: rgba(241, 91, 112, .12);
    border-color: rgba(241, 91, 112, .35);
    color: #ff8c9c;
}

.btn-danger:hover { background: rgba(241, 91, 112, .2); }

.btn-buy {
    background: linear-gradient(135deg, #2ee5aa, #12a97b);
    color: #04140f;
}

.btn-sell {
    background: linear-gradient(135deg, #ff7789, #cf344c);
    color: #fff;
}

.btn-lg { padding: .8rem 1.5rem; font-size: 1rem; border-radius: 13px; }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 9px; }
.btn-xs { padding: .22rem .55rem; font-size: .76rem; border-radius: 7px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 1.85rem; min-height: 1.85rem; padding: .28rem; }
.btn-icon svg { display: block; width: 15px; height: 15px; }
.btn-block { display: flex; width: 100%; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .03);
    font-size: .82rem;
    color: var(--muted);
}

.chip strong { color: var(--text); }
.chip-gold { border-color: rgba(232, 184, 75, .32); background: rgba(232, 184, 75, .08); color: var(--gold-2); }
.chip-gold strong { color: var(--gold-2); }

.demo-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .6rem;
    border-radius: 999px;
    border: 1px dashed rgba(232, 184, 75, .4);
    color: var(--gold-2);
    background: rgba(232, 184, 75, .06);
    font-size: .72rem;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: .12rem .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    background: rgba(255, 255, 255, .03);
    white-space: nowrap;
}

.badge-stack { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .35rem; }
.badge-ok { color: #7ff0c8; border-color: rgba(37, 211, 156, .35); background: rgba(37, 211, 156, .08); }
.badge-warn { color: var(--gold-2); border-color: rgba(232, 184, 75, .35); background: rgba(232, 184, 75, .08); }
.badge-bad { color: #ff9aaa; border-color: rgba(241, 91, 112, .35); background: rgba(241, 91, 112, .08); }

.pill {
    display: inline-flex;
    align-items: center;
    padding: .3rem .8rem;
    border-radius: 999px;
    border: 1px solid rgba(232, 184, 75, .3);
    background: rgba(232, 184, 75, .07);
    color: var(--gold-2);
    font-size: .78rem;
    font-weight: 600;
}

/* ---------- Guest header / footer ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(14px);
    background: rgba(7, 11, 18, .78);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    min-height: 72px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--gold-2), #b9821a);
    color: #180f02;
    font-weight: 900;
    font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(232, 184, 75, .22);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: .7rem; }

.site-nav {
    display: flex;
    gap: 1.4rem;
    font-size: .9rem;
}

.site-nav a { color: var(--muted); }
.site-nav a:hover, .site-nav a.is-active { color: var(--gold-2); }

.site-actions { display: flex; align-items: center; gap: .55rem; }

.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--line);
    background: rgba(8, 12, 19, .85);
    padding-top: 2.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
}

.footer-grid h4 { font-size: .9rem; margin-bottom: .8rem; color: var(--text); }
.footer-grid a, .footer-grid span { display: block; color: var(--muted); font-size: .86rem; margin-bottom: .35rem; }
.footer-grid a:hover { color: var(--gold-2); }
.footer-note { font-size: .82rem; margin-top: .8rem; max-width: 360px; }

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-block: 1rem;
    color: var(--muted);
    font-size: .8rem;
}

/* ---------- Hero / landing ---------- */

.hero {
    position: relative;
    padding-top: 4rem;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    inset-inline-end: -10%;
    top: -30%;
    width: 720px;
    height: 720px;
    background: radial-gradient(circle, rgba(232, 184, 75, .13), transparent 62%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 3rem;
    align-items: center;
    padding-bottom: 3rem;
}

.hero-copy h1 { margin: 1rem 0 1rem; }
.grad-text {
    background: linear-gradient(120deg, var(--gold-2), #f0a93f 60%, #fff1c7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead {
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 540px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .8rem;
    margin-top: 1.3rem;
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: .84rem;
}

.hero-panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(165deg, rgba(24, 35, 54, .9), rgba(11, 17, 28, .96));
    box-shadow: var(--shadow);
    padding: 1.3rem;
    overflow: hidden;
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(420px 200px at 85% 0%, rgba(232, 184, 75, .15), transparent 70%);
    pointer-events: none;
}

.panel-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-head > div { display: flex; flex-direction: column; gap: .1rem; }
.panel-head strong { font-size: 1rem; }
.panel-head .muted { font-size: .78rem; }

.live-dot {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--green);
    font-size: .75rem;
    font-weight: 700;
}

.live-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(37, 211, 156, .12);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.market-list { display: flex; flex-direction: column; gap: .55rem; }

.market-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 90px minmax(90px, auto);
    align-items: center;
    gap: .8rem;
    padding: .65rem .7rem;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, .02);
}

.market-id { display: flex; align-items: center; gap: .6rem; }
.market-id div { display: flex; flex-direction: column; line-height: 1.35; }
.market-id small { color: var(--muted); font-size: .68rem; }

.market-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 800;
}

.market-gold { background: rgba(232, 184, 75, .14); color: var(--gold-2); border: 1px solid rgba(232, 184, 75, .3); }
.market-crypto { background: rgba(107, 155, 255, .12); color: #a9c3ff; border: 1px solid rgba(107, 155, 255, .28); }

.spark { width: 100%; height: 32px; }

.market-price { text-align: end; display: flex; flex-direction: column; line-height: 1.3; }
.market-price strong { font-size: .94rem; }
.market-price small { font-size: .72rem; }

.panel-foot {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.panel-foot > div { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.panel-foot small { color: var(--muted); font-size: .7rem; }
.panel-foot strong { font-size: .9rem; }

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent);
}

.stats-strip > div { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.stats-strip strong { font-size: 1.35rem; color: var(--gold-2); }
.stats-strip span { color: var(--muted); font-size: .8rem; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.feature-card {
    position: relative;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(170deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .005));
    transition: border-color .18s ease, transform .18s ease;
}

.feature-card:hover { border-color: rgba(232, 184, 75, .3); transform: translateY(-3px); }
.feature-card p { color: var(--muted); font-size: .9rem; margin: 0; }

.feature-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: .9rem;
    border-radius: 12px;
    background: rgba(232, 184, 75, .1);
    border: 1px solid rgba(232, 184, 75, .25);
    color: var(--gold-2);
    font-weight: 800;
    font-size: .82rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    counter-reset: step;
}

.step {
    position: relative;
    padding: 1.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.step-num {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin-bottom: .8rem;
    background: rgba(232, 184, 75, .12);
    border: 1px solid rgba(232, 184, 75, .3);
    color: var(--gold-2);
    font-weight: 800;
}

.step p { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- Plans ---------- */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.plan-slot {
    display: flex;
    min-width: 0;
}

.plan-slot[hidden] { display: none !important; }

.plan-slot > .plan-card {
    flex: 1;
    min-width: 0;
    transition: opacity .16s ease, transform .16s ease;
}

.plan-grid.is-filtering-out > .plan-slot:not([hidden]) > .plan-card {
    opacity: 0;
    transform: translateY(8px) scale(.985);
}

.plan-slot.is-entering > .plan-card {
    animation: plan-filter-in .3s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: var(--plan-enter-delay, 0ms);
}

@keyframes plan-filter-in {
    from { opacity: 0; transform: translateY(12px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .plan-slot > .plan-card { transition: none; }
    .plan-slot.is-entering > .plan-card { animation: none; }
    .plan-grid.is-filtering-out > .plan-slot:not([hidden]) > .plan-card { opacity: 1; transform: none; }
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(175deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .008));
}

.plan-featured {
    border-color: rgba(232, 184, 75, .45);
    box-shadow: 0 20px 45px rgba(232, 184, 75, .09);
    background: linear-gradient(175deg, rgba(232, 184, 75, .09), rgba(255, 255, 255, .01));
}

.plan-ribbon {
    position: absolute;
    top: -11px;
    inset-inline-end: 1rem;
    padding: .12rem .6rem;
    border-radius: 999px;
    background: var(--gold);
    color: #1a1203;
    font-size: .68rem;
    font-weight: 800;
}

.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.plan-code { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .5px; }
.plan-size { font-size: 1.85rem; margin: .25rem 0 .1rem; }
.plan-head .muted { font-size: .74rem; margin: 0; }
.plan-fee { text-align: end; display: flex; flex-direction: column; }
.plan-fee span { font-size: 1.05rem; font-weight: 800; color: var(--gold-2); }
.plan-fee small { color: var(--muted); font-size: .65rem; }

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    border-top: 1px solid var(--line);
    padding-top: .9rem;
}

.plan-features li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .82rem;
    color: var(--muted);
}

.plan-features strong { color: var(--text); font-weight: 700; }
.plan-card .btn { margin-top: auto; }

.plan-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 1.25rem;
}

.plan-category-tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .48rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.plan-category-tab:hover { border-color: rgba(232, 184, 75, .45); color: var(--text); }
.plan-category-tab.is-active { border-color: rgba(232, 184, 75, .55); background: rgba(232, 184, 75, .12); color: var(--gold-2); }
.plan-category-tab span { padding: .05rem .4rem; border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: .7rem; }
.plan-category-badge { display: inline-flex; align-items: center; align-self: flex-start; margin-bottom: .35rem; padding: .16rem .55rem; border: 1px solid rgba(232, 184, 75, .28); border-radius: 999px; color: var(--gold-2); background: rgba(232, 184, 75, .08); font-size: .7rem; font-weight: 700; }

.table-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
    background: var(--panel);
}

.table-wide { min-width: 780px; }

.rules-note {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .8rem;
    margin-top: 1.2rem;
}

.rule-chip {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, .02);
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.rule-chip strong { color: var(--gold-2); font-size: .88rem; }
.rule-chip span { color: var(--muted); font-size: .8rem; line-height: 1.7; }

.faq { max-width: 820px; margin-inline: auto; display: flex; flex-direction: column; gap: .6rem; }

.faq details {
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel);
    padding: .2rem 1rem;
}

.faq summary {
    cursor: pointer;
    padding: .85rem 0;
    font-weight: 700;
    font-size: .94rem;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq summary::after { content: "+"; color: var(--gold); font-size: 1.2rem; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }

.cta-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 2.2rem;
    border: 1px solid rgba(232, 184, 75, .28);
    border-radius: 22px;
    background:
        radial-gradient(500px 200px at 85% 0%, rgba(232, 184, 75, .14), transparent 70%),
        linear-gradient(160deg, #111a2a, #0b111b);
}

.cta-band h2 { margin-bottom: .2rem; }
.cta-band p { color: var(--muted); margin: 0; }

.page-hero {
    padding: 3.4rem 0 1.6rem;
    border-bottom: 1px solid var(--line);
    background: radial-gradient(600px 300px at 85% 0%, rgba(232, 184, 75, .08), transparent 70%);
}

.page-hero p { color: var(--muted); max-width: 620px; }
.page-hero .hero-actions { margin-top: 1rem; }

/* ---------- Auth ---------- */

.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
    gap: 2.5rem;
    width: min(1050px, calc(100% - 2.5rem));
    margin: 3.5rem auto;
    align-items: stretch;
}

.auth-card {
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(170deg, #101a29, #0a121d);
    box-shadow: var(--shadow);
}

.auth-head { margin-bottom: 1.4rem; }
.auth-head p { color: var(--muted); font-size: .88rem; }

.auth-aside {
    padding: 2.4rem;
    border: 1px solid rgba(232, 184, 75, .22);
    border-radius: 22px;
    background:
        radial-gradient(420px 240px at 90% 0%, rgba(232, 184, 75, .14), transparent 65%),
        linear-gradient(165deg, rgba(18, 28, 45, .9), rgba(10, 16, 26, .95));
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.4rem;
}

.check-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .65rem; }
.check-list li { position: relative; padding-inline-start: 1.6rem; color: #cfdbeb; font-size: .92rem; }
.check-list li::before {
    content: "✓";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    color: var(--green);
    font-weight: 800;
}

.step-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.step-list li { display: flex; align-items: center; gap: .7rem; color: #d5e0ef; font-size: .92rem; }
.step-list span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(232, 184, 75, .13);
    border: 1px solid rgba(232, 184, 75, .3);
    color: var(--gold-2);
    font-size: .78rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.auth-quote {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
    color: var(--muted);
    font-size: .84rem;
}

.auth-quote span { color: var(--gold-2); font-size: .8rem; }
.auth-alt { text-align: center; color: var(--muted); font-size: .85rem; margin: 1rem 0 0; }
.passkey-login-block { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .9rem; }
.auth-divider { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .78rem; margin: .15rem 0 .55rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.passkey-status { line-height: 1.7; }
.passkey-status[data-state="error"] { color: var(--red); }
.passkey-status[data-state="success"] { color: var(--green); }
.passkey-status[data-state="muted"] { color: var(--muted); }
.passkey-register-form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.checkbox-field { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--text); }
.checkbox-field input { width: auto; min-width: 0; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: .35rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: .9rem 0; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 600; }

.field input,
.field select,
.filter-form select,
.select-field select {
    width: 100%;
    padding: .62rem .8rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
    font-size: .9rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus,
.field select:focus,
.filter-form select:focus,
.select-field select:focus {
    border-color: rgba(232, 184, 75, .55);
    box-shadow: 0 0 0 3px rgba(232, 184, 75, .1);
}

.field input::placeholder { color: #5f6d82; }
.check-inline { display: flex; align-items: flex-start; gap: .45rem; font-size: .8rem; line-height: 1.6; color: var(--text); }
.check-inline input[type="checkbox"] { width: 1rem; height: 1rem; min-width: 1rem; padding: 0; margin-top: .18rem; accent-color: var(--gold); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.details-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; }
.details-summary::-webkit-details-marker { display: none; }
.details-summary small { display: block; font-weight: 400; margin-top: .15rem; }
.form-hint { color: var(--muted); font-size: .76rem; margin: 0; }
.input-xs { width: 74px; padding: .28rem .4rem; font-size: .78rem; border-radius: 7px; }

.select-field { display: flex; flex-direction: column; gap: .2rem; font-size: .75rem; color: var(--muted); }
.select-field select { padding: .4rem 2rem .4rem .6rem; font-size: .82rem; min-width: 170px; }

.filter-form select { min-width: 190px; padding: .45rem .7rem; font-size: .84rem; }

/* Accounting filters keep their labels attached to real form controls. */
.accounting-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .65rem;
}
.accounting-filter .field { flex: 1 1 170px; min-width: 150px; }
.accounting-filter .field input,
.accounting-filter .field select { min-width: 0; }
.accounting-filter .filter-actions { display: flex; gap: .4rem; }
@media (max-width: 720px) {
    .accounting-filter .field { flex: 1 1 100%; }
    .accounting-filter .filter-actions { width: 100%; }
}

.inline-form { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }

.users-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.1rem;
}

.users-filter input,
.users-filter select {
    padding: .45rem .7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
    font-size: .82rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.users-filter input:focus,
.users-filter select:focus {
    border-color: rgba(232, 184, 75, .55);
    box-shadow: 0 0 0 3px rgba(232, 184, 75, .1);
}

.users-filter input::placeholder { color: #5f6d82; }
.users-filter .users-search { flex: 1 1 220px; max-width: 340px; }
.users-filter select { min-width: 150px; }

.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .55rem .8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    margin-bottom: .9rem;
}

.referral-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .7rem;
}

.ref-metric {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    padding: .65rem .8rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.ref-metric span { font-size: .72rem; color: var(--muted); }
.ref-metric strong { font-size: 1.05rem; }

@media (max-width: 700px) {
    .referral-summary { grid-template-columns: 1fr; }
}

.referral-link-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.referral-link-row input { flex: 1 1 260px; }
.ref-code {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--gold-2);
    padding: .25rem .55rem;
    border: 1px dashed rgba(232, 184, 75, .35);
    border-radius: 9px;
}

.bulk-state { font-size: .8rem; color: var(--muted); }
.table-check { width: 34px; }
.check-sm { width: 16px; height: 16px; accent-color: var(--gold-2); cursor: pointer; }

.users-table { min-width: 1080px; }
.users-table td { vertical-align: top; }
.users-table td .badge + .badge { margin-inline-start: .2rem; }
.user-row-actions { display: grid; gap: .35rem; justify-items: start; }
.service-row-actions { display: grid; gap: .35rem; justify-items: start; }

/* ---------- Alerts / flash ---------- */

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1rem;
}

.app-body .flash-stack { margin-inline: 0; width: 100%; }

.flash {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--panel-2);
    font-size: .86rem;
}

.flash-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    font-size: .72rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.flash-success { border-color: rgba(37, 211, 156, .35); background: rgba(37, 211, 156, .07); }
.flash-success .flash-icon { background: rgba(37, 211, 156, .15); color: #7ff0c8; }
.flash-error { border-color: rgba(241, 91, 112, .35); background: rgba(241, 91, 112, .07); }
.flash-error .flash-icon { background: rgba(241, 91, 112, .15); color: #ff9aaa; }
.flash-info { border-color: rgba(107, 155, 255, .35); background: rgba(107, 155, 255, .07); }

.flash-close {
    margin-inline-start: auto;
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 1.15rem;
    cursor: pointer;
    line-height: 1;
}

.alert {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-size: .88rem;
    margin-bottom: 1rem;
}

.alert a { color: inherit; text-decoration: underline; }
.alert-inline { margin: .8rem 0 0; }
.alert-bad { border-color: rgba(241, 91, 112, .35); background: rgba(241, 91, 112, .08); color: #ffb1bc; }
.alert-warn { border-color: rgba(232, 184, 75, .35); background: rgba(232, 184, 75, .07); color: var(--gold-2); }

/* ---------- App shell ---------- */

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.2rem 1rem;
    background: linear-gradient(180deg, #0c1420, #080d15);
    border-inline-end: 1px solid var(--line);
    z-index: 50;
    overflow-y: auto;
}

.sidebar .brand { padding: .3rem .3rem 1rem; border-bottom: 1px solid var(--line); }

.side-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-inline-end: .2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.side-label { color: #5f7088; font-size: .68rem; font-weight: 700; padding: .4rem .6rem; }

.side-group { flex: 0 0 auto; }
.side-group + .side-group { margin-top: .15rem; }
.side-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .45rem .6rem;
    border-radius: 8px;
    color: #7286a0;
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.side-group-head::-webkit-details-marker { display: none; }
.side-group-head:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.side-chevron {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-inline-end: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease;
}
.side-group[open] .side-chevron { transform: rotate(-135deg); }
.side-group-body { display: flex; flex-direction: column; gap: .15rem; padding: .2rem 0 .3rem; }
.side-link-row { display: flex; align-items: center; gap: .35rem; }
.side-link-row > .side-link { flex: 1 1 auto; min-width: 0; }
.side-link-row > .side-count { flex: 0 0 auto; margin-inline-start: 0; }

.side-group-tail { display: inline-flex; align-items: center; gap: .4rem; }
.side-count,
.side-group-count {
    min-width: 19px;
    padding: .02rem .34rem;
    border-radius: 999px;
    background: rgba(232, 184, 75, .16);
    border: 1px solid rgba(232, 184, 75, .32);
    color: var(--gold-2);
    font-size: .64rem;
    font-weight: 700;
    line-height: 1.55;
    text-align: center;
}
.side-count { margin-inline-start: auto; }
.side-count-link { text-decoration: none; }
.side-count-link:hover,
.side-count-link:focus-visible {
    background: rgba(232, 184, 75, .30);
    border-color: rgba(232, 184, 75, .55);
    color: #fff;
}
.side-count-link:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.side-group-count { font-size: .62rem; }

.side-count.is-count-pulsing,
.side-group-count.is-count-pulsing {
    animation: side-count-pulse .55s ease-out;
}
@keyframes side-count-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 184, 75, .35); }
    45% { transform: scale(1.22); box-shadow: 0 0 0 5px rgba(232, 184, 75, .12); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 184, 75, 0); }
}

.side-search { flex: 0 0 auto; }
.side-search-field { position: relative; display: flex; align-items: center; }
.side-search-input {
    width: 100%;
    padding: .5rem 1.9rem .5rem .7rem;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: #dfe7f2;
    font-size: .8rem;
    font-family: inherit;
}
.side-search-input::-webkit-search-cancel-button { display: none; }
.side-search-input:focus {
    outline: none;
    border-color: rgba(232, 184, 75, .45);
    box-shadow: 0 0 0 2px rgba(232, 184, 75, .12);
}
.side-search-input::placeholder { color: #6a7c93; }
.side-search-clear {
    position: absolute;
    inset-inline-end: .35rem;
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #c7d3e3;
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
}
.side-search-clear:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.side-search-empty { margin: .3rem .2rem 0; color: #7286a0; font-size: .72rem; }

.side-refresh {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    padding: 0 .2rem .55rem;
}
.side-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: 0 0 auto;
    padding: .28rem .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    color: #a9bbd1;
    font-family: inherit;
    font-size: .68rem;
    cursor: pointer;
}
.side-refresh-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side-refresh-btn[aria-busy="true"] { opacity: .55; cursor: progress; }
.side-refresh-btn:disabled { opacity: .45; cursor: not-allowed; }
.side-refresh-time { color: #5f7088; font-size: .65rem; text-align: end; }
.side-refresh.is-error .side-refresh-time { color: #f0a38a; }

.side-link {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .58rem .65rem;
    border-radius: 10px;
    color: #a9b7ca;
    font-size: .87rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.side-link:hover { background: rgba(255, 255, 255, .04); color: #fff; }

.side-link.is-active {
    background: linear-gradient(135deg, rgba(232, 184, 75, .14), rgba(232, 184, 75, .04));
    border-color: rgba(232, 184, 75, .26);
    color: var(--gold-2);
}

.side-icon { display: inline-flex; width: 19px; height: 19px; opacity: .9; }
.side-icon svg { width: 100%; height: 100%; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: .9rem; display: flex; flex-direction: column; gap: .7rem; }

.side-user { display: flex; align-items: center; gap: .6rem; }
.side-user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.side-user-meta strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta small { color: var(--muted); font-size: .68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(140deg, rgba(232, 184, 75, .3), rgba(232, 184, 75, .08));
    border: 1px solid rgba(232, 184, 75, .3);
    color: var(--gold-2);
    font-weight: 800;
    flex: 0 0 auto;
}

.avatar-sm { width: 32px; height: 32px; font-size: .85rem; }

.main {
    margin-inline-start: var(--sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1.6rem;
    background: rgba(7, 11, 18, .82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-start { display: flex; align-items: center; gap: .8rem; }
.topbar-end { display: flex; align-items: center; gap: .6rem; }
.page-title { font-size: 1.02rem; margin: 0; }
.page-sub { margin: 0; color: var(--muted); font-size: .7rem; }
.icon-btn { display: none; background: none; border: 0; color: var(--text); padding: .3rem; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }

.content {
    flex: 1;
    padding: 1.4rem 1.6rem 2.5rem;
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1.6rem;
    border-top: 1px solid var(--line);
    color: #5f7088;
    font-size: .72rem;
}

.sidebar-backdrop { display: none; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.3rem;
}

.page-head h2 { font-size: 1.45rem; margin-bottom: .15rem; }
.page-head p { color: var(--muted); font-size: .85rem; margin: 0; }

.back-link { display: inline-block; color: var(--muted); font-size: .78rem; margin-bottom: .2rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .9rem;
    margin-bottom: 1.4rem;
}

.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(170deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .006));
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.stat-card strong { font-size: 1.3rem; line-height: 1.4; }
.stat-card small { color: var(--muted); font-size: .72rem; }

.stat-card-link {
    color: inherit;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease;
}

.stat-card-link:hover,
.stat-card-link:focus-visible {
    border-color: rgba(232, 184, 75, .38);
    background: linear-gradient(170deg, rgba(232, 184, 75, .07), rgba(255, 255, 255, .006));
}

.stat-card-link:focus-visible {
    outline: 2px solid rgba(232, 184, 75, .65);
    outline-offset: 2px;
}

.stat-card-link .stat-card-cta {
    color: var(--gold-2);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

/* Optional profile completion meter. Width comes from the server-rendered
   percentage; the track is only a visual aid, not a form control. */
.progress {
    height: .45rem;
    margin: .2rem 0 .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
    overflow: hidden;
}
.progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-2), var(--gold));
}
.stat-label { color: var(--muted); font-size: .76rem; }

.stat-gold {
    border-color: rgba(232, 184, 75, .3);
    background: linear-gradient(160deg, rgba(232, 184, 75, .13), rgba(255, 255, 255, .01));
}

.stat-gold strong { color: var(--gold-2); }

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, .004)), var(--panel);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title h3 { margin: 0; font-size: .98rem; }
.panel-title p { margin: .1rem 0 0; font-size: .78rem; }

/* ---------- Collapsible terminal panels ---------- */
/* The six terminal sections can be minimized; the panel title stays visible. */
.panel.has-collapse > .panel-title { justify-content: flex-start; }
.panel.has-collapse > .panel-title > .panel-collapse { margin-inline-start: auto; }
.panel-collapse {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .32rem .55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    font: inherit;
    font-size: .72rem;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}
.panel-collapse:hover { color: var(--text); border-color: rgba(232, 184, 75, .45); }
.panel-collapse:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.panel-collapse-icon { display: inline-block; transition: transform .18s ease; }
.panel.is-collapsed > .panel-title { margin-bottom: 0; }
.panel.is-collapsed > :not(.panel-title) { display: none; }
.panel.is-collapsed .panel-collapse-icon { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    .panel-collapse-icon { transition: none; }
}

.two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 1.2rem; align-items: start; }
.two-col > * { min-width: 0; }

.sub-heading { margin-top: 1.1rem; font-size: .88rem; }

/* ---------- Empty states ---------- */

.empty-state {
    text-align: center;
    padding: 2.4rem 1rem;
    color: var(--muted);
}

.empty-state h4 { color: var(--text); margin-bottom: .3rem; }
.empty-state p { font-size: .86rem; margin-bottom: 1rem; }
.empty-state .btn { margin-top: .2rem; }
.empty-icon { font-size: 2.1rem; margin-bottom: .5rem; }
.empty-compact { padding: 1.2rem 1rem; }
.empty-compact p { margin: 0; }
.empty-cell { text-align: center; color: var(--muted); padding: 1.4rem !important; }

/* ---------- Tables ---------- */

.small-title { margin: 1.1rem 0 .55rem; font-size: .82rem; color: var(--muted, #94a3b8); letter-spacing: .02em; }

.table-wrap { width: 100%; overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    min-width: 620px;
}

.table th {
    text-align: start;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    padding: .6rem .65rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: .68rem .65rem;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
    vertical-align: middle;
}

.table tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table tbody tr:last-child td { border-bottom: 0; }

/* A queued or expired cooperative restart must be visible in the live list
   without hiding the row's real state, so the tint stays subtle and the badge
   remains the source of the status text. */
.table tbody tr.service-row-restart-pending > td { background: rgba(232, 184, 75, .10); }
.table tbody tr.service-row-restart-expired > td { background: rgba(241, 91, 112, .12); }
.table tbody tr.service-row-restart-pending > td:first-child { box-shadow: inset -3px 0 0 var(--gold); }
.table tbody tr.service-row-restart-expired > td:first-child { box-shadow: inset -3px 0 0 var(--red); }
.table tbody tr.service-row-restart-pending:hover > td { background: rgba(232, 184, 75, .14); }
.table tbody tr.service-row-restart-expired:hover > td { background: rgba(241, 91, 112, .16); }
.table .small { font-size: .72rem; }

.side-pill {
    display: inline-flex;
    align-items: center;
    padding: .08rem .5rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.side-buy { color: #7ff0c8; background: rgba(37, 211, 156, .1); }
.side-sell { color: #ff9aaa; background: rgba(241, 91, 112, .1); }

.action-stack { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }

/* Negative-balance review: disclosure rows keep long audit notes usable. */
.inline-details { flex: 1 1 100%; }
.inline-details > summary { list-style: none; cursor: pointer; display: inline-flex; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.negative-action-form .input-xs { width: 180px; }
@media (max-width: 700px) {
    .negative-action-form .input-xs { width: 100%; }
}

.filter-tab {
    padding: .35rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .8rem;
    background: rgba(255, 255, 255, .02);
}

.filter-tab:hover { color: var(--text); border-color: var(--line-2); }
.filter-tab.is-active { color: var(--gold-2); border-color: rgba(232, 184, 75, .35); background: rgba(232, 184, 75, .08); }

/* ---------- Account cards ---------- */

.account-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .9rem;
}

.account-card {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .018);
}

.account-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.account-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.account-plan { font-weight: 800; font-size: .95rem; }
.account-login { color: var(--muted); font-size: .78rem; }

.account-equity { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.account-equity > div { display: flex; flex-direction: column; gap: .1rem; }
.account-equity small { color: var(--muted); font-size: .68rem; }
.account-equity strong { font-size: .9rem; }

.meter-group { display: flex; flex-direction: column; gap: .55rem; }
.meter-row { display: flex; flex-direction: column; gap: .25rem; }
.meter-label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .72rem; color: var(--muted); }
.meter-label strong { color: var(--text); font-weight: 700; font-size: .72rem; }

.meter {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}

.meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--gold-2));
    transition: width .4s ease;
}

.meter-warn span { background: linear-gradient(90deg, #d99a2b, #ffcf6a); }
.meter-bad span { background: linear-gradient(90deg, #b83249, #ff7c8f); }

.account-actions { display: flex; gap: .5rem; margin-top: auto; }
.account-actions .btn { flex: 1; }

/* ---------- Account detail ---------- */

.rule-meter { padding: .7rem 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.rule-meter:last-of-type { border-bottom: 0; }
.meter-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .72rem; color: var(--muted); margin-top: .3rem; }

.rule-inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    padding-top: .9rem;
    margin-top: .4rem;
    border-top: 1px solid var(--line);
}

.rule-inline > div { display: flex; flex-direction: column; gap: .1rem; }
.rule-inline small { color: var(--muted); font-size: .7rem; }
.rule-inline strong { font-size: .85rem; }

.payout-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    padding: .8rem;
    border: 1px dashed var(--line-2);
    border-radius: 11px;
    margin-bottom: .9rem;
}

.payout-summary > div { display: flex; flex-direction: column; gap: .1rem; }
.payout-summary small { color: var(--muted); font-size: .7rem; }
.payout-summary strong { font-size: 1rem; }

.mini-list { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; padding: .35rem 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }

/* ---------- Wallet / payouts ---------- */

.wallet-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.6rem;
    border: 1px solid rgba(232, 184, 75, .28);
    border-radius: var(--radius);
    background:
        radial-gradient(500px 200px at 90% 0%, rgba(232, 184, 75, .16), transparent 70%),
        linear-gradient(160deg, #111b2a, #0b111b);
    margin-bottom: 1.2rem;
}

.wallet-hero > div:first-child { display: flex; flex-direction: column; gap: .2rem; }
.wallet-hero strong { font-size: 2.1rem; color: var(--gold-2); line-height: 1.3; }
.wallet-hero p { color: var(--muted); font-size: .82rem; margin: 0; }
.wallet-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.funded-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.funded-card { margin-bottom: 0; }
.funded-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.funded-stats > div { display: flex; flex-direction: column; gap: .1rem; }
.funded-stats small { color: var(--muted); font-size: .68rem; }
.funded-stats strong { font-size: .88rem; }
.payout-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: .7rem; }
.payout-form .field { flex: 1 1 11rem; min-width: 0; }
.payout-form .btn { flex: 0 0 auto; }
.payout-blockers { margin: .9rem 0 0; }
.payout-reject-form { align-items: flex-end; }
.payout-reject-reason { margin: 0; }
.payout-reject-reason span { font-size: .72rem; }
.payout-reject-reason input {
    min-width: 0;
    width: 15rem;
    max-width: 100%;
    padding: .35rem .5rem;
    font-size: .8rem;
}
.payout-reject-reason-text { color: var(--danger, #ff6b6b); margin-top: .25rem; line-height: 1.6; }
.payout-reject-reason-cell strong { color: var(--danger, #ff6b6b); font-weight: 600; }
@media (max-width: 768px) {
    .payout-reject-reason input { width: 100%; }
}


/* ---------- Terminal ---------- */

.terminal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.terminal-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: 1.3rem; margin: 0; }
.terminal-head-actions { display: flex; align-items: center; gap: .8rem; }
.feed-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--green); }

.terminal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: start;
}

.terminal-main { min-width: 0; }
.terminal-side { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 1rem; }

.terminal-scope {
    margin: 0 0 .7rem;
}

.terminal-scope-tabs {
    display: inline-flex;
    max-width: 100%;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .2rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
}

.terminal-scope-tab {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    padding: .38rem .7rem;
    font: inherit;
    font-size: .75rem;
    white-space: nowrap;
    cursor: pointer;
}

.terminal-scope-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .055);
}

.terminal-scope-tab.is-active {
    color: var(--gold-2);
    background: rgba(232, 184, 75, .13);
}

.terminal-scope-tab .ltr {
    margin-inline-start: .2rem;
    font-size: .72rem;
}

@media (max-width: 640px) {
    .terminal-scope-tabs { width: 100%; }
    .terminal-scope-tab { flex: 1; }
}

.symbol-tabs {
    display: flex;
    gap: .45rem;
    overflow-x: auto;
    padding-bottom: .4rem;
    margin-bottom: .7rem;
    cursor: grab;
    user-select: none;
    overscroll-behavior-x: contain;
}

.symbol-tabs.is-dragging { cursor: grabbing; }
.symbol-tabs .symbol-tab { cursor: inherit; -webkit-user-drag: none; }
.symbol-tabs.is-dragging .symbol-tab { cursor: grabbing; }

.symbol-tab {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
    white-space: nowrap;
}

.symbol-tab:hover { border-color: var(--line-2); color: var(--text); }
.symbol-tab.is-active { border-color: rgba(232, 184, 75, .4); background: rgba(232, 184, 75, .08); color: var(--text); }
.symbol-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dot-gold { background: var(--gold); }
.dot-crypto { background: var(--blue); }
.symbol-tab-price { color: var(--muted); font-size: .76rem; }

.chart-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    padding: .85rem 1rem 1rem;
    margin-bottom: 1rem;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .55rem;
    padding-bottom: .65rem;
    margin-bottom: .65rem;
    border-bottom: 1px solid var(--line);
}

.tf-tabs {
    display: flex;
    gap: .1rem;
    padding: .18rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
}

.tf-btn {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .7rem;
    padding: .2rem .48rem;
    cursor: pointer;
}

.tf-btn:hover { color: var(--text); }
.tf-btn.is-active { background: rgba(232, 184, 75, .15); color: var(--gold-2); }

.chart-indicators { display: flex; flex-wrap: wrap; gap: .28rem; }

.chart-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .18rem .55rem;
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    font: inherit;
    font-size: .68rem;
    cursor: pointer;
}

.chart-chip:hover { color: var(--text); border-color: var(--line-2); }
.chart-chip.is-active {
    border-color: rgba(232, 184, 75, .35);
    background: rgba(232, 184, 75, .09);
    color: var(--gold-2);
}

.chart-indicators { position: relative; }
.indicator-menu { position: relative; }
.indicator-menu-trigger { display: inline-flex; align-items: center; gap: .38rem; }
.indicator-menu-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 .28rem;
    border-radius: 999px;
    background: rgba(232, 184, 75, .14);
    color: var(--gold-2);
    font-size: .6rem;
    line-height: 1;
}
.indicator-menu-caret { font-size: .6rem; opacity: .7; }
.indicator-menu-panel {
    position: absolute;
    z-index: 30;
    inset-inline-start: 0;
    top: calc(100% + .45rem);
    width: min(340px, calc(100vw - 2rem));
    padding: .8rem;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: #0d1522;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .45);
}
.indicator-menu-panel[hidden] { display: none; }
.indicator-menu-head { display: flex; flex-direction: column; gap: .12rem; margin-bottom: .65rem; }
.indicator-menu-head strong { font-size: .8rem; }
.indicator-menu-head span { color: var(--muted); font-size: .64rem; }
.indicator-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .28rem .5rem; }
.indicator-option {
    display: flex;
    align-items: center;
    gap: .38rem;
    min-width: 0;
    padding: .3rem .35rem;
    border-radius: 7px;
    color: var(--text);
    font-size: .7rem;
    cursor: pointer;
}
.indicator-option:hover { background: rgba(255, 255, 255, .04); }
.indicator-option input { accent-color: var(--gold); width: 14px; height: 14px; flex: 0 0 auto; }
.indicator-option-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--indicator-color, var(--muted)); flex: 0 0 auto; }
.indicator-custom-ema { margin-top: .7rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.indicator-custom-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.indicator-custom-head strong { font-size: .74rem; }
.indicator-custom-head span { color: var(--muted); font-size: .62rem; }
.indicator-ema-form { display: flex; gap: .35rem; }
.indicator-ema-form input {
    width: 100%;
    min-width: 0;
    padding: .3rem .45rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
    font-size: .72rem;
}
.indicator-ema-form input:focus { outline: none; border-color: rgba(232, 184, 75, .55); }
.indicator-ema-error { margin: .35rem 0 0; color: #ff9b9b; font-size: .63rem; }
.indicator-ema-list { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .42rem; }
.indicator-ema-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .16rem .38rem .16rem .45rem;
    border: 1px solid color-mix(in srgb, var(--indicator-color) 45%, var(--line));
    border-radius: 999px;
    color: var(--text);
    font-size: .62rem;
}
.indicator-ema-chip button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    line-height: 1;
    cursor: pointer;
    padding: 0 .1rem;
}
.indicator-ema-chip button:hover { color: #ff9b9b; }
.indicator-ema-empty { color: var(--muted); font-size: .62rem; }
.indicator-menu-hint { margin: .65rem 0 0; color: var(--muted); font-size: .6rem; line-height: 1.65; }
.indicator-cloud-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.chart-tools { display: flex; gap: .3rem; }

.chart-tool {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    font: inherit;
    font-size: .68rem;
    padding: .2rem .5rem;
    cursor: pointer;
    min-width: 30px;
}

.chart-tool:hover { color: var(--text); border-color: var(--line-2); }
.chart-tool.is-active {
    border-color: rgba(232, 184, 75, .35);
    background: rgba(232, 184, 75, .09);
    color: var(--gold-2);
}

.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.quote-block h3 { margin: 0 0 .1rem; font-size: .88rem; color: var(--muted); }
.quote-line { display: flex; align-items: baseline; gap: .6rem; }
.quote-line strong { font-size: 1.9rem; line-height: 1.25; }
.quote-line span { font-size: .85rem; color: var(--green); }
.quote-block .muted { font-size: .72rem; }

.quote-meta { display: flex; gap: 1.2rem; }
.quote-meta > div { display: flex; flex-direction: column; gap: .05rem; text-align: end; }
.quote-meta small { color: var(--muted); font-size: .68rem; }
.quote-meta strong { font-size: .82rem; }
.quote-meta .quote-spread-pct { font-size: .62rem; }
.quote-meta .quote-spread {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: .18rem .45rem;
    margin: -.18rem -.45rem;
}
.quote-meta .quote-spread.is-spread-wide {
    border-color: rgba(232, 184, 75, .55);
    background: rgba(232, 184, 75, .09);
}
.quote-meta .quote-spread.is-spread-wide strong,
.quote-meta .quote-spread.is-spread-wide .quote-spread-pct { color: var(--gold-2); }
.quote-meta .quote-spread-warn {
    align-self: flex-end;
    margin-top: .1rem;
    padding: .08rem .35rem;
    font-size: .58rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .85rem;
    min-height: 24px;
    padding: .45rem 0 .5rem;
    font-size: .7rem;
    color: var(--muted);
}

.chart-legend b { color: var(--text); font-weight: 600; margin-inline-start: .2rem; }
.chart-legend i { font-style: normal; color: #5f7088; font-size: .62rem; }
.chart-legend-symbol { color: var(--gold-2); font-weight: 700; }
.chart-legend-change { font-weight: 700; }
.chart-legend-time { color: #66758c; }

.quick-trade {
    display: grid;
    gap: .55rem;
    margin: .5rem 0 .15rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(232, 184, 75, .24);
    border-radius: 10px;
    background:
        linear-gradient(120deg, rgba(232, 184, 75, .075), rgba(13, 21, 34, .25) 58%),
        rgba(255, 255, 255, .018);
}

.quick-trade[hidden] { display: none; }

.quick-trade-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .45rem .8rem;
}

.quick-trade-title { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.quick-trade-title strong { color: var(--gold-2); font-size: .8rem; }
.quick-trade-title span { color: var(--muted); font-size: .68rem; line-height: 1.65; }

.quick-trade-prices {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .85rem;
    font-size: .68rem;
    color: var(--muted);
}
.quick-trade-prices b { color: var(--text); margin-inline-start: .22rem; font-weight: 600; }
.quick-trade-prices > span:last-child b { color: var(--gold-2); }

.quick-trade-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(6rem, .7fr)) minmax(13rem, 1.2fr);
    gap: .5rem;
    align-items: end;
}

.quick-field { display: flex; flex-direction: column; gap: .22rem; min-width: 0; }
.quick-field > span { color: var(--muted); font-size: .66rem; font-weight: 600; }
.quick-field input {
    width: 100%;
    min-width: 0;
    padding: .42rem .55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font: inherit;
    font-size: .8rem;
    outline: none;
}
.quick-field input:focus { border-color: rgba(232, 184, 75, .55); box-shadow: 0 0 0 2px rgba(232, 184, 75, .1); }
.quick-field input::placeholder { color: #5f6d82; }
.quick-field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 2px rgba(241, 91, 112, .12); }
.quick-field-error { margin: 0; color: #ff9b9b; font-size: .62rem; line-height: 1.6; }

.quick-trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.quick-trade-actions .btn { padding: .55rem .6rem; border-radius: 8px; font-size: .78rem; }
.quick-trade-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

.quick-trade-note {
    margin: 0;
    padding: 0;
    color: var(--muted);
    font-size: .66rem;
    line-height: 1.65;
}
.quick-trade-note.is-pending { color: var(--gold-2); }
.quick-trade-note.is-success { color: #73e0b4; }
.quick-trade-note.is-error { color: #ff9b9b; }

.quick-trade-feedback-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.quick-trade-feedback {
    flex: 1 1 12rem;
    padding: .5rem .65rem;
    border-radius: 8px;
    font-size: .74rem;
    line-height: 1.7;
}
.quick-trade-feedback.is-pending { background: rgba(232, 184, 75, .12); color: var(--gold-2); }
.quick-trade-feedback.is-success { background: rgba(60, 200, 140, .14); color: #73e0b4; }
.quick-trade-feedback.is-error { background: rgba(239, 90, 90, .14); color: #ff9b9b; }
.quick-trade-retry { flex: 0 0 auto; }
.quick-trade-gate { margin-top: -.1rem; }

.chart-shell {
    height: 470px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, .035);
    border-radius: 10px;
    overflow: hidden;
    background: #0d1522;
}

.chart-canvas { width: 100%; height: 100%; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .7rem; flex-wrap: wrap; margin-top: .55rem; }
.chart-protection-warning { color: #e8b84b; font-size: .68rem; }

/* ---------- Chart drawing engine ---------- */

.drawing-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.drawing-hint {
    position: absolute;
    inset-inline-start: .6rem;
    bottom: .5rem;
    z-index: 4;
    padding: .25rem .55rem;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: rgba(9, 15, 25, .9);
    color: var(--muted);
    font-size: .68rem;
    pointer-events: none;
}

.drawing-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem .8rem;
    flex-wrap: wrap;
    padding: .5rem 0 .6rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .55rem;
}

.drawing-tools,
.drawing-actions {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-wrap: wrap;
}

.drawing-tool,
.drawing-action,
.drawing-menu summary {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 30px;
    padding: .25rem .55rem;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    font: inherit;
    font-size: .7rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.drawing-tool:hover,
.drawing-action:hover,
.drawing-menu summary:hover {
    color: var(--text);
    border-color: rgba(232, 184, 75, .45);
}

.drawing-tool.is-active,
.drawing-action.is-active,
.drawing-action[aria-pressed="true"] {
    color: #0b1019;
    border-color: var(--gold);
    background: var(--gold);
    font-weight: 700;
}

.drawing-tool-icon { font-size: .9rem; line-height: 1; }

.drawing-menu { position: relative; }
.drawing-menu summary { list-style: none; }
.drawing-menu summary::-webkit-details-marker { display: none; }
.drawing-menu summary::after { content: '▾'; font-size: .6rem; opacity: .7; }
.drawing-menu[open] summary { color: var(--text); border-color: rgba(232, 184, 75, .45); }

.drawing-menu-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + .35rem);
    inset-inline-start: 0;
    min-width: 180px;
    padding: .35rem;
    display: grid;
    gap: .15rem;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #101827;
    box-shadow: 0 18px 36px rgba(0, 0, 0, .45);
}

.drawing-menu-panel button {
    padding: .45rem .55rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .72rem;
    text-align: start;
    cursor: pointer;
}

.drawing-menu-panel button:hover { background: rgba(232, 184, 75, .12); color: var(--text); }

.drawing-sep { width: 1px; height: 20px; background: var(--line-2); margin-inline: .15rem; }

.drawing-save-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .68rem;
    color: var(--muted);
    white-space: nowrap;
}

.drawing-save-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.drawing-save-status[data-state="saved"] i { background: #25d39c; }
.drawing-save-status[data-state="saving"] i { background: var(--gold); animation: drawing-pulse 1s infinite; }
.drawing-save-status[data-state="dirty"] i { background: #e8b84b; }
.drawing-save-status[data-state="error"] i,
.drawing-save-status[data-state="conflict"] i { background: #f15b70; }
@keyframes drawing-pulse { 50% { opacity: .35; } }

.drawing-conflict {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .55rem;
    padding: .5rem .65rem;
    border: 1px solid rgba(241, 91, 112, .5);
    border-radius: 8px;
    background: rgba(241, 91, 112, .08);
    color: var(--text);
    font-size: .72rem;
}

.drawing-conflict > div { display: flex; gap: .3rem; flex-wrap: wrap; }

.drawing-objects {
    margin-top: .75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .015);
    overflow: hidden;
}

.drawing-objects-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .5rem .65rem;
    border-bottom: 1px solid var(--line);
    font-size: .75rem;
}

.drawing-objects-head strong { color: var(--text); }
.drawing-objects-head span { margin-inline-start: .4rem; }
.drawing-objects-close { border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.drawing-object-list { max-height: 260px; overflow: auto; }

.drawing-object-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: .35rem;
    padding: .35rem .55rem;
    border-bottom: 1px solid rgba(255, 255, 255, .035);
    font-size: .72rem;
}

.drawing-object-row:last-child { border-bottom: 0; }
.drawing-object-row.is-selected { background: rgba(232, 184, 75, .1); }
.drawing-object-main { min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.drawing-object-name { border: 0; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; }
.drawing-object-meta { color: var(--muted); font-size: .64rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawing-object-btn { width: 25px; height: 25px; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; color: var(--muted); font-size: .72rem; line-height: 1; cursor: pointer; padding: 0; }
.drawing-object-btn:hover { color: var(--text); border-color: rgba(232, 184, 75, .45); }
.drawing-object-btn.is-off { opacity: .42; }
.drawing-object-tools { display: flex; gap: .15rem; flex-wrap: wrap; justify-content: flex-end; }
.drawing-object-row .drawing-object-tools { grid-column: auto; }

.drawing-dialog { width: min(720px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); overflow: auto; }
.drawing-dialog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.drawing-dialog-grid .field { margin: 0; }
.drawing-tf-fieldset { margin: .65rem 0; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .72rem; }
.drawing-tf-fieldset legend { padding: 0 .3rem; color: var(--muted); font-size: .68rem; }
.drawing-template-row { display: flex; align-items: end; gap: .4rem; flex-wrap: wrap; margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.drawing-template-row .field { flex: 1 1 180px; margin: 0; }
.drawing-dialog-actions { justify-content: flex-end; flex-wrap: wrap; }
.drawing-toast { position: fixed; inset-inline-start: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 80; max-width: min(430px, calc(100vw - 2rem)); padding: .55rem .8rem; border: 1px solid var(--line-2); border-radius: 9px; background: #101827; color: var(--text); font-size: .75rem; box-shadow: 0 12px 28px rgba(0, 0, 0, .45); transition: opacity .2s ease, transform .2s ease; }
.drawing-toast.is-hiding { opacity: 0; transform: translateX(-50%) translateY(6px); }
@media (prefers-reduced-motion: reduce) { .drawing-toast { transition: none; } }

.terminal-live-notice { position: fixed; inset-inline-start: 50%; bottom: 4.5rem; transform: translateX(-50%); z-index: 85; max-width: min(520px, calc(100vw - 2rem)); padding: .7rem 1rem; border: 1px solid rgba(37, 211, 156, .45); border-radius: 10px; background: #101827; color: #a9f0d8; font-size: .8rem; line-height: 1.7; text-align: center; box-shadow: 0 12px 28px rgba(0, 0, 0, .45); animation: toast-in .18s ease-out; }
@media (prefers-reduced-motion: reduce) { .terminal-live-notice { animation: none; } }

.chart-card.is-drawing .chart-canvas canvas { cursor: crosshair !important; }

/* ---------- Chart context menu ---------- */
.chart-context-menu {
    position: fixed;
    z-index: 1300;
    width: min(270px, calc(100vw - 1rem));
    padding: .45rem;
    border: 1px solid rgba(232, 184, 75, .34);
    border-top: 2px solid var(--gold);
    border-radius: 0 0 12px 12px;
    background: rgba(13, 21, 34, .985);
    color: var(--text);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .025) inset;
    direction: rtl;
}
.chart-context-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    inset-inline-start: 16px;
    width: 54px;
    height: 8px;
    border-radius: 5px 5px 0 0;
    background: linear-gradient(90deg, var(--gold), rgba(232, 184, 75, .45));
}
.chart-context-menu[hidden] { display: none; }
.chart-context-head,
.chart-context-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .35rem .45rem;
}
.chart-context-head span {
    color: var(--gold-2);
    font-size: .66rem;
    font-weight: 700;
}
.chart-context-head b {
    color: var(--muted);
    font-size: .66rem;
    font-weight: 600;
}
.chart-context-price-row {
    margin: .15rem 0 .3rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
}
.chart-context-price-row span { color: var(--muted); font-size: .66rem; }
.chart-context-price-row strong { color: var(--gold-2); font-size: .76rem; font-weight: 700; }
.chart-context-actions { display: grid; gap: .12rem; }
.chart-context-action {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: .05rem .45rem;
    width: 100%;
    padding: .45rem .45rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.chart-context-action:hover { background: rgba(232, 184, 75, .1); }
.chart-context-action:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px rgba(232, 184, 75, .6); background: rgba(232, 184, 75, .1); }
.chart-context-action:disabled { opacity: .42; cursor: not-allowed; }
.chart-context-action:disabled:hover { background: transparent; }
.chart-context-icon {
    grid-row: 1 / span 2;
    align-self: center;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    text-align: center;
}
.chart-context-action.is-buy .chart-context-icon { color: #25d39c; }
.chart-context-action.is-sell .chart-context-icon { color: #f15b70; }
.chart-context-action.is-danger .chart-context-icon { color: #ff9b9b; }
.chart-context-copy { display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.chart-context-copy strong { font-size: .72rem; font-weight: 600; }
.chart-context-copy small { color: var(--muted); font-size: .62rem; line-height: 1.5; }
.chart-context-sep { height: 1px; margin: .25rem .35rem; background: var(--line); }
.chart-context-feedback {
    margin: .35rem .4rem .05rem;
    color: #73e0b4;
    font-size: .64rem;
    line-height: 1.6;
}
.chart-context-feedback.is-error { color: #ff9b9b; }
.chart-context-feedback[hidden] { display: none; }
@media (max-width: 620px) {
    .chart-context-menu { width: min(250px, calc(100vw - .75rem)); }
    .chart-context-copy strong { font-size: .69rem; }
}
@media (prefers-reduced-motion: reduce) {
    .chart-context-action { transition: none; }
}

@media (max-width: 760px) {
    .drawing-dialog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .drawing-bar { align-items: flex-start; }
    .drawing-tools, .drawing-actions { width: 100%; }
}

@media (max-width: 520px) {
    .drawing-dialog-grid { grid-template-columns: 1fr; }
    .drawing-tool span:last-child { display: none; }
    .drawing-tool { padding-inline: .4rem; }
    .drawing-object-row { grid-template-columns: minmax(0, 1fr) auto auto; }
    .drawing-object-tools { grid-column: 1 / -1; justify-content: flex-start; }
}


#chart-card:fullscreen {
    border-radius: 0;
    background: var(--panel);
    padding: 1.1rem;
    overflow: auto;
}

#chart-card:not(:fullscreen):not(.chart-fullscreen-fallback) #quick-trade-toggle { display: none; }
#chart-card:fullscreen.quick-trade-collapsed .quick-trade,
#chart-card.chart-fullscreen-fallback.quick-trade-collapsed .quick-trade { display: none; }
#chart-card:fullscreen .chart-shell { height: clamp(260px, calc(100vh - 420px), 760px); }
#chart-card:fullscreen.quick-trade-collapsed .chart-shell { height: clamp(300px, calc(100vh - 230px), 900px); }
#chart-card.chart-fullscreen-fallback {
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    background: var(--panel);
    padding: max(.85rem, env(safe-area-inset-top)) max(.85rem, env(safe-area-inset-right)) max(.85rem, env(safe-area-inset-bottom)) max(.85rem, env(safe-area-inset-left));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
body.chart-fullscreen-lock { overflow: hidden; }
#chart-card.chart-fullscreen-fallback .chart-shell { height: clamp(240px, calc(100dvh - 420px), 760px); }
#chart-card.chart-fullscreen-fallback.quick-trade-collapsed .chart-shell { height: clamp(280px, calc(100dvh - 230px), 900px); }

.account-live .panel-title { margin-bottom: .6rem; }
.live-equity { display: flex; flex-direction: column; gap: .1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.live-equity small { color: var(--muted); font-size: .72rem; }
.live-equity strong { font-size: 1.7rem; line-height: 1.3; }
.live-equity span { font-size: .78rem; color: var(--muted); }

.live-rows { display: flex; flex-direction: column; gap: .35rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.live-rows > div { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; }
.live-rows span { color: var(--muted); }
.live-rows strong { font-size: .82rem; }

.live-rules { padding-top: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.live-rule { display: flex; flex-direction: column; gap: .25rem; }
.live-target-amounts { display: flex; flex-wrap: wrap; gap: .2rem .85rem; font-size: .76rem; color: var(--muted); }
.live-target-amounts strong { color: var(--text); font-weight: 600; }
.live-days { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: var(--muted); padding-top: .3rem; }
.live-days strong { color: var(--text); font-size: .82rem; }

.order-panel .panel-title { margin-bottom: .7rem; }
.order-quote {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .7rem;
    border: 1px dashed var(--line-2);
    border-radius: 9px;
    font-size: .78rem;
    color: var(--muted);
}

.order-quote strong { color: var(--gold-2); font-size: .95rem; }
.order-estimate { display: flex; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--muted); }
.order-estimate strong { color: var(--text); }
.order-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.order-buttons .btn { padding-block: .7rem; }
.order-buttons .btn:disabled { opacity: .45; cursor: not-allowed; }
.order-gate-note {
    margin: 0;
    padding: .45rem .6rem;
    border-radius: 8px;
    font-size: .72rem;
    line-height: 1.7;
}
.order-gate-note.is-warn { background: rgba(245, 185, 66, .12); color: #f5c76a; }
.order-gate-note.is-bad { background: rgba(239, 90, 90, .14); color: #ff9b9b; }
.order-feedback {
    padding: .5rem .65rem;
    border-radius: 8px;
    font-size: .76rem;
    line-height: 1.7;
}
.order-feedback.is-success { background: rgba(60, 200, 140, .14); color: #73e0b4; }
.order-feedback.is-error { background: rgba(239, 90, 90, .14); color: #ff9b9b; }
.order-feedback-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.order-feedback-row .order-feedback { flex: 1 1 12rem; }
.order-retry { flex: 0 0 auto; }
.position-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.position-actions .inline-form { margin: 0; }
.trade-dialog {
    width: min(560px, calc(100vw - 2rem));
    padding: 1.1rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
}
.trade-dialog::backdrop { background: rgba(3, 6, 12, .72); }
.trade-dialog .panel-title { margin-bottom: .85rem; }
.table-positions { min-width: 700px; }

/* ---------- Error pages ---------- */

.error-page {
    max-width: 560px;
    margin: 4rem auto;
    padding: 3rem 2rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--panel);
}

.error-code {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(120deg, var(--gold-2), #b9821a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.error-page p { color: var(--muted); }
.error-page .hero-actions { justify-content: center; }

/* ---------- Notices, payments and KYC ---------- */

.notice {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .9rem 1.05rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    font-size: .84rem;
    line-height: 1.85;
}

.notice strong { color: var(--text); }
.notice-info { border-color: rgba(107, 155, 255, .35); background: rgba(107, 155, 255, .06); }
.notice-warn { border-color: rgba(232, 184, 75, .35); background: rgba(232, 184, 75, .06); }
.notice-error { border-color: rgba(241, 91, 112, .35); background: rgba(241, 91, 112, .06); }
.notice-list { display: flex; flex-direction: column; gap: .3rem; margin: .15rem 0 0; padding-inline-start: 1.1rem; }
.notice-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.demo-cleanup { border-color: rgba(241, 91, 112, .3); }
.demo-cleanup .referral-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.demo-cleanup-note { margin: .9rem 0 0; line-height: 1.9; }
.demo-cleanup-details { margin-top: .7rem; font-size: .8rem; color: var(--muted); }
.demo-cleanup-details summary { cursor: pointer; color: var(--gold-2); }
.demo-email-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.demo-email-list code {
    padding: .12rem .45rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .03);
    font-size: .72rem;
}
.demo-cleanup-form { display: grid; gap: .8rem; margin-top: .9rem; }
@media (max-width: 700px) {
    .demo-cleanup .referral-summary { grid-template-columns: 1fr; }
}
.stat-warn { border-color: rgba(232, 184, 75, .35); }
.stat-warn .stat-label { color: var(--gold-2); }
.small-strong { font-size: .92rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.filter-row .chip { cursor: pointer; }

.wallet-grid { align-items: start; }
.wallet-demo {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line-2);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.wallet-demo .wallet-actions { margin-top: .3rem; }

.checkout-summary,
.kyc-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    margin-bottom: 1rem;
}

.checkout-summary > div,
.kyc-summary > div {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .65rem .75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
}

.checkout-summary small,
.kyc-summary small { color: var(--muted); font-size: .72rem; }
.checkout-summary strong,
.kyc-summary strong { font-size: .9rem; }
.checkout-summary .big { font-size: 1.2rem; color: var(--gold-2); }

.upload-field input[type="file"] {
    padding: .5rem .6rem;
    font-size: .78rem;
    cursor: pointer;
}

.upload-field input[type="file"]::file-selector-button {
    margin-inline-end: .6rem;
    padding: .35rem .7rem;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: .78rem;
    cursor: pointer;
}

.doc-links,
.review-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem;
}

.kyc-layout .kyc-aside { align-self: start; }
.kyc-aside h3 { margin-top: .9rem; }
.kyc-aside h3:first-child { margin-top: 0; }

.secret-box {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin: 1rem 0 1.2rem;
    padding: 1rem 1.1rem;
    border: 1px dashed var(--line-2);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
}

.secret-box code {
    color: var(--gold-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    letter-spacing: .18em;
    word-break: break-all;
}

.secret-box .small { font-size: .78rem; }
.totp-setup {
    display: grid;
    grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}
.totp-qr-box { text-align: center; }
.totp-qr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 220px;
    height: 220px;
    padding: .55rem;
    border-radius: 14px;
    background: #fff;
}
.totp-qr img, .totp-qr canvas { display: block; max-width: 100%; height: auto; }
.totp-setup .secret-box { margin-top: 0; }
.secret-actions, .recovery-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}
.recovery-actions { margin-top: .75rem; }
.security-details { margin: .9rem 0; }
.security-details summary { cursor: pointer; color: var(--gold-2); }
@media (max-width: 640px) {
    .totp-setup { grid-template-columns: 1fr; }
    .totp-qr-box { justify-self: center; }
}
.narrow-form { max-width: 380px; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .35em; text-align: center; }
.setup-steps { margin-bottom: 1rem; }

.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .5rem;
    margin-bottom: .8rem;
}

.code-grid code {
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .02);
    color: var(--gold-2);
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .08em;
}

/* ---------- Admin audit and sessions ---------- */

.audit-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .7rem;
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}

.audit-filter .select-field { min-width: 210px; }
.audit-filter .audit-user-field { flex: 1 1 240px; max-width: 380px; }
.audit-filter .audit-date-field { flex: 0 0 155px; }
.audit-filter-actions { display: flex; gap: .4rem; margin-inline-start: auto; }

.audit-action { font-size: .84rem; }

.audit-details {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    font-size: .72rem;
    color: var(--muted);
    line-height: 1.7;
}

.audit-details b { color: var(--text); font-weight: 600; }

.audit-settings-change {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin: .2rem 0 .4rem;
}

.audit-setting-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .2rem .7rem;
    padding: .35rem .5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
}

.audit-setting-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem;
    min-width: 0;
}

.audit-setting-name code {
    color: var(--gold-2);
    font-size: .72rem;
    word-break: break-all;
}

.audit-setting-values {
    display: inline-flex;
    align-items: baseline;
    gap: .35rem;
    max-width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .74rem;
    direction: ltr;
    unicode-bidi: plaintext;
}

.audit-setting-old {
    color: var(--muted);
    text-decoration: line-through;
    overflow-wrap: anywhere;
}

.audit-setting-arrow { color: var(--muted); }
.audit-setting-new { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 560px) {
    .audit-setting-row { align-items: flex-start; flex-direction: column; }
}

.system-grid { align-items: start; }

.system-list {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.system-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: .48rem 0;
    border-bottom: 1px dashed var(--line);
    font-size: .82rem;
}

.system-list > div:last-child { border-bottom: 0; }
.system-list span { color: var(--muted); }
.system-list strong { font-weight: 600; text-align: left; word-break: break-word; }

@media (max-width: 560px) {
    .service-run-list > div { flex-direction: column; align-items: flex-start; gap: .15rem; }
    .service-run-list strong { text-align: start; }
}

.system-command {
    margin: .2rem 0 .6rem;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .03);
    color: var(--gold-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    text-align: left;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.log-output {
    max-height: 360px;
    overflow: auto;
    margin: 0;
    padding: .75rem .85rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(0, 0, 0, .24);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .76rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bridge-debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}
.bridge-debug-grid .unit-block { min-width: 0; }
.bridge-debug-grid h4 { margin: 0 0 .45rem; }
.bridge-debug-grid .log-output { min-height: 10rem; max-height: 420px; }
#bridge-quote-test-result > .table-wrap { margin-top: .75rem; }
#bridge-quote-test-quotes td { vertical-align: top; }

.session-device { font-size: .84rem; }
.session-agent {
    direction: ltr;
    text-align: right;
    max-width: 260px;
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .plan-grid { grid-template-columns: repeat(2, 1fr); }
    .account-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .terminal-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
        visibility: hidden;
        transition: transform .22s ease;
        box-shadow: -20px 0 50px rgba(0, 0, 0, .45);
    }

    .sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .sidebar-backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(3, 6, 10, .6);
        backdrop-filter: blur(2px);
    }

    .main { margin-inline-start: 0; }
    .icon-btn.menu-btn { display: inline-flex; }
    .topbar { padding: .7rem 1rem; }
    .content { padding: 1.1rem 1rem 2rem; }
    .app-footer { padding: .8rem 1rem; }
    .app-body .flash-stack { margin-top: .8rem; padding-inline: 1rem; }
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .hero { padding-top: 2.5rem; }
    .terminal-grid { grid-template-columns: 1fr; }
    .terminal-side { position: static; }
    .funded-grid { grid-template-columns: 1fr; }
    .auth-wrap { grid-template-columns: 1fr; margin-block: 2rem; }
    .auth-aside { order: -1; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .two-col { grid-template-columns: minmax(0, 1fr); }
    .rules-note { grid-template-columns: 1fr 1fr; }
    .steps { grid-template-columns: 1fr; }
    .site-nav { display: none; }
    .plan-grid { grid-template-columns: 1fr 1fr; }
    .market-row { grid-template-columns: 1fr auto; }
    .market-row .spark { display: none; }
    .cta-band { flex-direction: column; align-items: flex-start; }
    .terminal-head { flex-direction: column; }
    .quote-meta { gap: .9rem; }
    .auth-wrap { width: calc(100% - 2rem); }
    .chart-shell { height: 430px; }
    #chart-card:fullscreen .chart-shell { height: clamp(240px, calc(100vh - 430px), 700px); }
    #chart-card:fullscreen.quick-trade-collapsed .chart-shell { height: clamp(280px, calc(100vh - 230px), 820px); }
    #chart-card.chart-fullscreen-fallback .chart-shell { height: clamp(220px, calc(100dvh - 430px), 700px); }
    #chart-card.chart-fullscreen-fallback.quick-trade-collapsed .chart-shell { height: clamp(260px, calc(100dvh - 230px), 820px); }
    .quick-trade-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-trade-actions { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    body { font-size: 14px; }
    .container { width: calc(100% - 1.6rem); }
    .section { padding-block: 3rem; }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .feature-grid { grid-template-columns: 1fr; }
    .plan-grid { grid-template-columns: 1fr; }
    .account-grid { grid-template-columns: 1fr; }
    .rules-note { grid-template-columns: 1fr; }
    .stat-grid { gap: .6rem; }
    .page-head { flex-direction: column; }
    .topbar-end .chip { display: none; }
    .quote-line strong { font-size: 1.55rem; }
    .chart-shell { height: 350px; }
    .chart-toolbar { justify-content: flex-start; }
    .chart-indicators { order: 3; width: 100%; }
    .indicator-menu-panel { width: min(340px, calc(100vw - 1.6rem)); }
    .quick-trade-head { flex-direction: column; }
    .quick-trade-prices { width: 100%; }
    .quick-trade-body { grid-template-columns: minmax(0, 1fr); }
    .quick-trade-actions { grid-column: auto; }
    .account-equity { grid-template-columns: 1fr 1fr; }
    .funded-stats { grid-template-columns: 1fr 1fr; }
    .payout-form { flex-direction: column; align-items: stretch; }
    .footer-grid { grid-template-columns: 1fr; }
    .site-header-inner { flex-wrap: wrap; padding-block: .6rem; }
    .field-row,
    .field-row.three { grid-template-columns: 1fr; }
    .checkout-summary, .kyc-summary { grid-template-columns: 1fr; }
    .page-actions { width: 100%; }
    .audit-filter .audit-user-field { max-width: none; }
    .audit-filter .audit-date-field { flex: 1 1 100%; }
    .audit-filter-actions { margin-inline-start: 0; width: 100%; }
    .rule-inline { grid-template-columns: 1fr 1fr; }
    .app-footer { flex-direction: column; align-items: flex-start; gap: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Notifications */
.bell-btn {
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .03);
}
.bell-btn svg { width: 19px; height: 19px; }
.bell-btn:hover { border-color: var(--line-2); }
.bell-count {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--gold);
    color: #101010;
    font-size: .68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .6rem;
}
.notification-item {
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .015);
}
.notification-item.is-unread {
    border-color: rgba(232, 184, 75, .38);
    background: rgba(232, 184, 75, .045);
}
.notification-body { display: grid; gap: .35rem; }
.notification-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.notification-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.notification-body p { margin: 0; }

/* Legal pages and consent */
.check-field {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.9;
}
.check-field input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin-top: .25rem;
    accent-color: var(--gold);
    flex-shrink: 0;
}
.check-field a { color: var(--gold-2); text-decoration: none; }
.check-field a:hover { text-decoration: underline; }

.legal-page { max-width: 900px; padding-block: 2rem 3rem; }
.legal-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.legal-tabs .is-active { border-color: rgba(232, 184, 75, .45); color: var(--gold-2); }
.legal-content { display: grid; gap: 1.4rem; }
.legal-content h2 { margin: 0 0 .4rem; font-size: 1.02rem; color: var(--gold-2); }
.legal-content p { margin: .35rem 0; color: #c4cfe0; font-size: .9rem; line-height: 2; }

.footer-links { display: inline-flex; flex-wrap: wrap; gap: .9rem; }
.footer-links a { color: #7d8ea6; text-decoration: none; }
.footer-links a:hover { color: var(--gold-2); }

/* Admin market, plan and settings editors */
.radio-row {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .015);
}
.radio-row input { margin-top: .35rem; accent-color: var(--gold); flex-shrink: 0; }
.radio-row span { display: flex; flex-direction: column; gap: .1rem; }
.radio-row small { color: var(--muted); line-height: 1.8; }

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
}
.symbol-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: rgba(255, 255, 255, .015);
}
/* A spread wider than the configured threshold is a warning, not an error:
   the card stays usable but the border and badge make it impossible to miss. */
.symbol-card.is-spread-wide {
    border-color: rgba(232, 184, 75, .55);
    background: rgba(232, 184, 75, .045);
    box-shadow: 0 0 0 1px rgba(232, 184, 75, .2);
}
.table tbody tr.is-spread-wide > td {
    background: rgba(232, 184, 75, .045);
}
.table tbody tr.is-spread-wide > td:first-child {
    border-inline-start: 3px solid rgba(232, 184, 75, .55);
}
.symbol-head .symbol-badges { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.symbol-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .8rem;
}
.symbol-head small { display: block; }
.symbol-card .form { gap: .55rem; }

/* Bulk selection and collapsed symbol cards. The controls live outside the
   grid; every checkbox is associated with the bulk form by its form=""
   attribute so it can sit inside its own card without nesting forms. */
.symbol-bulk-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .2rem 0 .95rem;
    padding: .65rem .75rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .018);
}
.symbol-bulk-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    margin-inline-start: auto;
}
.symbol-bulk-hint { flex: 1 1 100%; margin: 0; }
.symbol-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    width: 1.65rem;
    height: 1.65rem;
    flex-shrink: 0;
    cursor: pointer;
}
.symbol-select input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: var(--gold);
    cursor: pointer;
}
.symbol-head-main { flex: 1 1 auto; min-width: 0; }
.symbol-card-toggle {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    white-space: nowrap;
}
.symbol-toggle-icon {
    display: inline-block;
    transition: transform .15s ease;
}
.symbol-card.is-collapsed { padding-bottom: .9rem; }
.symbol-card.is-collapsed .symbol-head { margin-bottom: 0; }
.symbol-card.is-collapsed .symbol-toggle-icon { transform: rotate(180deg); }
.symbol-card-body { min-width: 0; }
.symbol-card-body[hidden] { display: none; }
.symbol-card.is-selected {
    border-color: rgba(232, 184, 75, .6);
    box-shadow: 0 0 0 1px rgba(232, 184, 75, .22);
}
@media (max-width: 620px) {
    .symbol-bulk-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin-inline-start: 0;
    }
    .symbol-bulk-actions .btn { width: 100%; }
    .symbol-head { flex-wrap: wrap; }
    .symbol-head-main { flex: 1 1 calc(100% - 2.2rem); }
    .symbol-head .symbol-badges {
        width: 100%;
        justify-content: flex-start;
        padding-inline-start: 1.9rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .symbol-toggle-icon { transition: none; }
}

.plan-admin-grid { display: grid; gap: 1rem; }
.plan-admin-card .form { gap: .55rem; }
.form-section-title {
    margin: .8rem 0 0;
    font-size: .85rem;
    color: var(--gold-2);
    border-top: 1px solid var(--line);
    padding-top: .8rem;
}

.close-trade-form { display: flex; flex-direction: column; gap: .4rem; min-width: 260px; }
.close-trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.close-trade-grid .field span { font-size: .68rem; }
.close-trade-grid .field input,
.close-trade-grid .field select { padding: .3rem .45rem; font-size: .78rem; }
.close-trade-note { grid-column: 1 / -1; }

.device-accounts { display: flex; flex-direction: column; gap: .35rem; }
.device-account {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .35rem .5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}
.device-account:hover { border-color: rgba(232, 184, 75, .45); }

.device-ban-form { display: flex; flex-direction: column; gap: .35rem; min-width: 190px; }
.device-ban-form .field > span { font-size: .68rem; }
.device-ban-form .field input,
.device-ban-form .field select { padding: .3rem .45rem; font-size: .76rem; border-radius: 8px; }
.gate-days { display: flex; flex-wrap: wrap; gap: .25rem; max-width: 320px; }
.gate-days .badge { font-size: .68rem; white-space: nowrap; }
.ban-form { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 165px; }
.ban-form select { padding: .28rem .4rem; font-size: .72rem; border-radius: 8px; }
.abuse-decisions { display: flex; flex-direction: column; gap: .3rem; min-width: 170px; }

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid var(--line);
}
.pager-info { color: var(--muted); font-size: .78rem; }
.pager-links { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: .34rem .6rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    font-size: .8rem;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.pager-btn:hover { border-color: rgba(232, 184, 75, .45); background: rgba(232, 184, 75, .08); }
.pager-btn.is-active {
    border-color: rgba(232, 184, 75, .55);
    background: rgba(232, 184, 75, .14);
    color: var(--gold-2);
    font-weight: 700;
}
.pager-btn.is-disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pager-gap { color: var(--muted); padding: 0 .2rem; font-size: .8rem; }

/* ---- Trading analytics ---- */
.analytics-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .7rem;
    padding: .9rem 1rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .006));
}

.analytics-filter .field { flex: 1 1 170px; min-width: 150px; }
.analytics-filter .field input,
.analytics-filter .field select { padding: .5rem .7rem; font-size: .84rem; }
.analytics-filter-actions { display: flex; gap: .4rem; margin-inline-start: auto; }

.analytics-chart-panel { margin-bottom: 1.2rem; }
.equity-curve { display: block; width: 100%; height: auto; margin-top: .6rem; }
.equity-line { fill: none; stroke: var(--gold-2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.equity-zero { stroke: rgba(255, 255, 255, .16); stroke-dasharray: 4 4; }
.equity-axis { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .35rem; color: var(--muted); font-size: .72rem; }

.slippage-chart { display: block; width: 100%; height: auto; margin-top: .6rem; }
.slippage-zero { stroke: rgba(255, 255, 255, .18); stroke-dasharray: 4 4; }
.slippage-bar.is-cost { fill: var(--red); opacity: .82; }
.slippage-bar.is-gain { fill: var(--green); opacity: .82; }
.slippage-bar.is-flat { fill: var(--muted); opacity: .4; }
.slippage-bar:hover { opacity: 1; }
.slippage-legend { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem 1rem; margin-top: .45rem; color: var(--muted); font-size: .72rem; }
.slippage-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 2px; margin-inline-end: .25rem; vertical-align: middle; }
.slippage-dot.is-cost { background: var(--red); }
.slippage-dot.is-gain { background: var(--green); }

.analytics-side { display: flex; flex-direction: column; gap: 1.2rem; }
.analytics-note { margin: 1.2rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.9; }

@media (max-width: 620px) {
    .analytics-filter .field { flex: 1 1 100%; }
    .analytics-filter-actions { width: 100%; margin-inline-start: 0; }
    .analytics-filter-actions .btn { flex: 1; }
    .equity-axis { flex-wrap: wrap; }
    .slippage-legend { align-items: flex-start; }
}

/* ---- Payout status history ---- */
.payout-events { margin-top: .3rem; font-size: .72rem; }
.payout-events summary { cursor: pointer; color: var(--gold-2); }
.payout-events .mini-list li { flex-direction: column; align-items: flex-start; gap: .1rem; }
.payout-events .mini-list small { line-height: 1.7; }

/* ---- Payout request details (click a history row) ---- */
.payout-details-hint { margin: -.4rem 0 .8rem; }
/* A trade row opens its details page; trade-rows.js delegates the click so rows
   refreshed by polling keep working. Links inside cells stay usable. */
tr[data-trade-url] { cursor: pointer; }
tr[data-trade-url]:hover > td { background: rgba(232, 184, 75, .05); }
tr[data-trade-url]:focus-within > td { background: rgba(232, 184, 75, .07); }

.payout-row { cursor: pointer; }
.payout-row:hover > td { background: rgba(232, 184, 75, .05); }
.payout-row.is-open > td { background: rgba(232, 184, 75, .09); }
.payout-row:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.payout-row-hint { display: block; margin-top: .15rem; color: var(--gold-2); }
.payout-details-row > td { background: rgba(255, 255, 255, .02); }
.payout-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .55rem .9rem; }
.payout-details-grid > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.payout-details-grid small { color: var(--muted); font-size: .72rem; }
.payout-details-note { margin: .7rem 0 .2rem; }
.payout-timeline { margin: .4rem 0 0; }
.payout-timeline li { flex-direction: column; align-items: flex-start; gap: .1rem; }

/* ---- Account risk audit ---- */
.decision-stack { display: flex; flex-direction: column; gap: .7rem; }
.decision-card { padding: .85rem 1rem; }
.decision-card .details-summary { gap: .7rem; }
.decision-card .details-summary strong { font-size: .92rem; }
.decision-card .system-list { margin-top: .7rem; }
.audit-json {
    max-height: 18rem;
    overflow: auto;
    margin: .5rem 0 0;
    padding: .65rem .8rem;
    border-radius: .5rem;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.7;
}
.audit-subtitle { margin: 1rem 0 .45rem; font-size: .84rem; color: var(--gold-2); }
.table-compact td, .table-compact th { padding: .45rem .5rem; font-size: .78rem; }
.audit-replay { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
.audit-replay p { margin: 0; flex: 1 1 16rem; line-height: 1.9; }

/* ---- Manual stage review queue ---- */
.review-action-form { display: flex; flex-direction: column; gap: .35rem; min-width: 14rem; }
.review-action-form textarea { width: 100%; min-height: 2.8rem; resize: vertical; }
.review-action-form .action-stack { align-items: stretch; }
@media (max-width: 620px) {
    .review-action-form { min-width: 11rem; }
}

/* ---- Crypto payments ---- */
.notice-success { border-color: rgba(37, 211, 156, .35); background: rgba(37, 211, 156, .07); }
.check-row { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; margin-block: .55rem; cursor: pointer; }
.check-row input { margin-top: .35rem; accent-color: var(--gold); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-block: .8rem 1rem; }
.field-inline { flex-direction: row; align-items: center; gap: .5rem; }
.field-inline select { min-width: 12rem; }
.crypto-pay-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .8rem;
    padding: .85rem 1rem;
    margin-block: .55rem;
    border: 1px dashed var(--line-2);
    border-radius: 12px;
    background: var(--panel-2);
}
.crypto-pay-box small { flex: 1 1 100%; color: var(--muted); font-size: .76rem; }
.crypto-pay-box strong { font-size: 1.08rem; overflow-wrap: anywhere; }
.crypto-address { word-break: break-all; font-size: .95rem; }
.crypto-provider-card { margin-top: 1rem; padding: .85rem .95rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); min-width: 0; }
.crypto-provider-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.crypto-provider-head strong { display: block; font-size: .86rem; }
.crypto-provider-head small { display: block; margin-top: .15rem; color: var(--muted); font-size: .7rem; line-height: 1.7; }
.crypto-provider-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .8rem; margin-top: .65rem; }
.crypto-provider-facts > div { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.crypto-provider-facts span { color: var(--muted); font-size: .68rem; }
.crypto-provider-facts strong { font-size: .78rem; overflow-wrap: anywhere; }
.crypto-provider-card .form-hint { margin: .6rem 0 0; }
.crypto-checkout .panel:first-child { min-width: 0; }
.kv-list { display: flex; flex-direction: column; gap: .35rem; margin: 1rem 0; }
.kv-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; padding-block: .3rem; border-bottom: 1px dashed var(--line); }
.kv-list dt { color: var(--muted); font-size: .8rem; margin: 0; }
.kv-list dd { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.crypto-network { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-block: 1rem; min-width: 0; }
.crypto-network legend { padding-inline: .55rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.crypto-review-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: 1rem 1.1rem; margin-block: 1rem; min-width: 0; }
.crypto-review-card > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.crypto-review-form { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.crypto-order-details summary { cursor: pointer; color: var(--gold-2); font-size: .82rem; margin-block: .5rem; }
.crypto-order-details code { white-space: pre-wrap; word-break: break-word; }
.crypto-order-details .notice-list { margin-top: .6rem; }
@media (max-width: 620px) {
    .crypto-pay-box strong { font-size: .96rem; }
    .crypto-provider-facts { grid-template-columns: 1fr; }
    .field-inline { flex-direction: column; align-items: flex-start; }
    .field-inline select { width: 100%; min-width: 0; }
}

/* Phase 2 referral reward configuration and claim cards */
.reward-config-grid {
    display: grid;
    gap: 14px;
    margin: 18px 0;
}
.reward-config-card {
    border: 1px solid var(--border, #243044);
    border-radius: 12px;
    padding: 14px 16px 6px;
    background: rgba(10, 18, 32, 0.35);
}
.reward-config-card legend {
    padding: 0 8px;
    font-weight: 700;
}
.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}
.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.inline-check-field {
    align-self: end;
}
.form-notice {
    margin: 8px 0 16px;
}
.referral-entitlements {
    display: grid;
    gap: 14px;
}
.referral-entitlement {
    padding: 16px;
    border: 1px solid var(--border, #243044);
    border-radius: 12px;
}
.referral-claim-form {
    margin-top: 10px;
}
.plan-discount-field {
    margin: 10px 0;
}
.plan-discount-field input {
    font-family: monospace;
    direction: ltr;
    text-align: left;
}
.d-block {
    display: block;
}

/* Phase 4 support inbox */
.ticket-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .9rem;
    margin-bottom: 1.4rem;
}
.ticket-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: .8rem;
}
.ticket-tab {
    padding: .4rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .78rem;
}
.ticket-tab:hover,
.ticket-tab.is-active {
    color: var(--gold-2);
    border-color: rgba(232, 184, 75, .4);
    background: rgba(232, 184, 75, .08);
}
.ticket-list {
    display: grid;
    gap: .55rem;
}
.ticket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .85rem .95rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .015);
    color: inherit;
}
.ticket-row:hover {
    border-color: rgba(232, 184, 75, .35);
    background: rgba(232, 184, 75, .04);
}
.ticket-main {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}
.ticket-main strong {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .92rem;
}
.ticket-unread {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--gold-2);
    flex: 0 0 auto;
}
.ticket-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .8rem;
    margin-bottom: 1rem;
}
.ticket-thread {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}
.ticket-message {
    max-width: 88%;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .025);
}
.ticket-message.is-user {
    align-self: flex-start;
    border-start-start-radius: 4px;
}
.ticket-message.is-support {
    align-self: flex-end;
    border-color: rgba(232, 184, 75, .28);
    background: rgba(232, 184, 75, .06);
    border-start-end-radius: 4px;
}
.ticket-message.is-internal {
    max-width: 100%;
    align-self: stretch;
    border-style: dashed;
    border-color: rgba(241, 91, 112, .35);
    background: rgba(241, 91, 112, .045);
}
.ticket-message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .45rem;
    font-size: .8rem;
}
.ticket-message-body {
    font-size: .88rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
}
.ticket-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .7rem;
}
.ticket-attachment {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .35rem .55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, .18);
    font-size: .76rem;
    color: var(--text);
}
.ticket-attachment span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ticket-attachment:hover {
    border-color: rgba(232, 184, 75, .4);
}
.ticket-admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(250px, .75fr);
    gap: 1rem;
    align-items: start;
}
.ticket-admin-grid > * { min-width: 0; }
.ticket-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ticket-side .panel { margin-bottom: 0; }
.ticket-filter-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.7fr) repeat(3, minmax(120px, .8fr)) auto auto;
    gap: .55rem;
    align-items: end;
    margin-bottom: 1rem;
}
.ticket-filter-form .field { min-width: 0; }
.ticket-filter-form .btn { white-space: nowrap; }
.ticket-facts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .45rem .7rem;
    margin: 0;
    font-size: .8rem;
}
.ticket-facts dt { color: var(--muted); }
.ticket-facts dd { margin: 0; overflow-wrap: anywhere; }
.is-unread-row td { background: rgba(232, 184, 75, .035); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

@media (max-width: 1100px) {
    .ticket-admin-grid { grid-template-columns: minmax(0, 1fr); }
    .ticket-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ticket-filter-form .btn { justify-self: start; }
}

@media (max-width: 760px) {
    .ticket-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ticket-row { flex-direction: column; align-items: flex-start; }
    .ticket-message { max-width: 100%; }
    .ticket-filter-form { grid-template-columns: minmax(0, 1fr); }
    .ticket-filter-form .btn { width: 100%; }
}


/* Custom plan builder and user intelligence report */
.plan-builder-grid { align-items: start; }
.builder-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem .8rem; }
.builder-fields .field { min-width: 0; }
.builder-fields .field small { margin-inline-start: .3rem; font-size: .68rem; }
.builder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .8rem; margin-top: .9rem; }
.builder-actions form { margin: 0; }
.builder-price { display: flex; flex-direction: column; gap: .15rem; margin: .5rem 0 1rem; }
.builder-price strong { font-size: 1.9rem; color: var(--gold, #e8b84b); }
.builder-price small { color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; }
.builder-summary { display: grid; gap: .4rem; margin: 0 0 1rem; font-size: .8rem; }
.builder-summary > div { display: flex; justify-content: space-between; gap: .6rem; padding-bottom: .35rem; border-bottom: 1px dashed var(--line); }
.builder-summary dt { color: var(--muted); }
.builder-summary dd { margin: 0; text-align: end; }
.builder-price-breakdown { display: grid; gap: .35rem; margin: .6rem 0 1rem; font-size: .78rem; }
.builder-price-breakdown > div { display: flex; justify-content: space-between; gap: .6rem; }
.builder-price-breakdown span { color: var(--muted); }
.plan-builder-summary { position: sticky; top: 1rem; }
.report-bars { display: grid; gap: .45rem; }
.report-bar-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 100px; align-items: center; gap: .6rem; font-size: .74rem; }
.report-bar-row > strong { text-align: end; }
.report-bar-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.report-bar-track i { display: block; height: 100%; border-radius: inherit; }
.report-bar-track i.is-pos { background: #25d39c; }
.report-bar-track i.is-neg { background: #ef6a6a; }
.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
    .plan-builder-grid { grid-template-columns: minmax(0, 1fr); }
    .plan-builder-summary { position: static; }
    .stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .builder-fields { grid-template-columns: minmax(0, 1fr); }
    .report-bar-row { grid-template-columns: 76px minmax(0, 1fr) 84px; gap: .35rem; }
    .stat-grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Advanced custom plan builder: staged fields, tariff editor and breakdown */
.builder-step { margin: 0 0 1rem; padding: .7rem .8rem .4rem; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.builder-step legend { padding: 0 .35rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; }
.builder-step legend .small { font-weight: 400; }
.builder-field-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem; }
.hint { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); font-size: .65rem; color: var(--muted); cursor: help; }
.builder-lines { display: grid; gap: .45rem; margin: .4rem 0 1rem; font-size: .76rem; }
.builder-lines > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .6rem; padding-bottom: .35rem; border-bottom: 1px dashed var(--line); }
.builder-lines > div > span { overflow-wrap: anywhere; }
.builder-line-hint { grid-column: 1 / -1; font-size: .66rem; }
.builder-warnings { margin: 0 0 1rem; padding-inline-start: 1.1rem; color: #efc46a; display: grid; gap: .25rem; }
.tariff-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.tariff-metric { min-width: 0; margin: 0; }
.tariff-metric-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.tariff-metric .field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tariff-rules { display: grid; gap: .7rem; margin-bottom: 1rem; }
.tariff-rule { min-width: 0; margin: 0; }
.tariff-rule-flags { display: flex; flex-direction: column; justify-content: flex-end; gap: .2rem; min-width: 0; }
.tariff-conditions { margin-top: .5rem; }
.tariff-condition { display: grid; grid-template-columns: minmax(0, 1.2fr) 70px minmax(0, .9fr); gap: .35rem; min-width: 0; }
.tariff-condition select, .tariff-condition input { min-width: 0; }
.tariff-preview-line { display: flex; justify-content: space-between; gap: .6rem; padding: .2rem 0; border-bottom: 1px dashed var(--line); font-size: .76rem; }
.tight-list { margin: .3rem 0 0; padding-inline-start: 1.05rem; display: grid; gap: .4rem; font-size: .8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (max-width: 1100px) {
    .tariff-metrics { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .tariff-metric .field-row.three { grid-template-columns: minmax(0, 1fr); }
    .tariff-condition { grid-template-columns: minmax(0, 1fr); }
    .builder-step { padding: .6rem .55rem .3rem; }
}

/* Progressive AJAX forms */
.form.is-ajax-busy { opacity: .82; }
.form.is-ajax-busy button[type="submit"] { cursor: progress; }
.field-error { margin-top: .3rem; color: var(--red); font-size: .74rem; line-height: 1.6; }
.form-error { margin: 0 0 .85rem; padding: .65rem .8rem; border: 1px solid rgba(241, 91, 112, .4); border-radius: 10px; background: rgba(241, 91, 112, .08); color: #ffb9c2; font-size: .8rem; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red) !important; box-shadow: 0 0 0 2px rgba(241, 91, 112, .12); }
.ajax-toast-stack { position: fixed; inset-inline-end: 1rem; inset-block-end: 1rem; z-index: 90; display: grid; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
.ajax-toast { display: flex; align-items: flex-start; gap: .55rem; padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); box-shadow: var(--shadow); font-size: .8rem; animation: toast-in .18s ease-out; }
.ajax-toast > span { flex: 1; }
.ajax-toast-close { border: 0; background: transparent; color: inherit; font-size: 1rem; line-height: 1; padding: 0 .1rem; cursor: pointer; opacity: .75; }
.ajax-toast-close:hover { opacity: 1; }
.symbol-save-state { min-height: 1.2rem; margin: .45rem 0 0; color: var(--muted); }
.symbol-save-state.is-saved { color: #7ff0c8; }
.symbol-save-state.is-error { color: #ff9aaa; }
.captcha-error { margin: .35rem 0 0; color: #ff9aaa; font-size: .78rem; }
.ajax-toast.is-success { border-color: rgba(37, 211, 156, .45); color: #a9f0d8; }
.ajax-toast.is-error { border-color: rgba(241, 91, 112, .5); color: #ffb9c2; }
.ajax-toast.is-leaving {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
    .ajax-toast.is-leaving { transition: none; }
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* CMS public pages and editor */
.cms-body { font-size: .92rem; line-height: 1.95; }
.cms-body h1, .cms-body h2, .cms-body h3, .cms-body h4 { margin: 1.35em 0 .55em; line-height: 1.5; }
.cms-body h2 { color: var(--gold-2); font-size: 1.08rem; }
.cms-body p { margin: 0 0 .9em; color: var(--text); }
.cms-body ul, .cms-body ol { margin: .4em 0 1em; padding-inline-start: 1.3rem; }
.cms-body a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.cms-body blockquote { margin: 1em 0; padding: .6rem 1rem; border-inline-start: 3px solid var(--gold); background: rgba(232, 184, 75, .06); border-radius: 8px; }
.cms-body img { max-width: 100%; height: auto; border-radius: 12px; }
.cms-body table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .8rem; }
.cms-body th, .cms-body td { border: 1px solid var(--line); padding: .45rem .55rem; text-align: start; }
.cms-hero-image { width: 100%; max-height: 320px; object-fit: cover; border-radius: 16px; margin-bottom: 1.1rem; }
.cms-link-list { display: flex; flex-wrap: wrap; gap: .45rem .8rem; align-items: center; }
.cms-link-list a { color: var(--muted); font-size: .76rem; }
.cms-link-list a:hover { color: var(--gold); }
.cms-editor { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; line-height: 1.7; direction: ltr; text-align: left; }
.cms-version-list { display: grid; gap: .45rem; max-height: 360px; overflow: auto; }
.cms-version { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; justify-content: space-between; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 10px; font-size: .75rem; }
.cms-preview-bar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding: .6rem .8rem; border: 1px dashed var(--gold); border-radius: 12px; background: rgba(232, 184, 75, .06); font-size: .78rem; }
.cms-message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: .82rem; }
.attempt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin-bottom: .8rem; }
.attempt-stat { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.attempt-stat small { display: block; color: var(--muted); font-size: .66rem; margin-bottom: .2rem; }
.attempt-stat strong { font-size: .86rem; overflow-wrap: anywhere; }
@media (max-width: 900px) { .attempt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Admin role editor, settings registry and inline re-authentication. */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.35rem 0.9rem;
    margin: 0.6rem 0;
}
.check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.85rem;
    line-height: 1.5;
}
.check-row code {
    display: block;
    font-size: 0.72rem;
    opacity: 0.7;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.9rem 1.2rem;
}
.settings-field {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}
.settings-field.is-sensitive {
    border-inline-start: 3px solid rgba(232, 184, 75, 0.55);
}
.settings-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    font-size: 0.72rem;
    color: #8c9bb2;
    margin: 0.2rem 0 0;
}
.settings-warning {
    margin: 0.4rem 0 0;
    padding: 0.55rem 0.7rem;
    font-size: 0.78rem;
    line-height: 1.8;
}
.settings-warning[hidden] { display: none; }
.inline-password {
    width: 8.5rem;
    min-width: 0;
    padding-block: 0.25rem;
    font-size: 0.8rem;
}
.inline-editor summary {
    cursor: pointer;
    display: inline-block;
}
.inline-editor[open] > summary {
    margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
    .settings-grid,
    .permission-grid {
        grid-template-columns: 1fr;
    }
    .inline-form {
        flex-wrap: wrap;
    }
}

/* -------------------------------------------------------------------------
   API documentation
   ------------------------------------------------------------------------- */
.api-docs-wrap {
    display: grid;
    gap: 1rem;
    min-width: 0;
}
.api-docs-head .eyebrow {
    color: var(--gold);
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.api-docs-head p { max-width: 760px; }
.api-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}
.api-stat {
    background: linear-gradient(160deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    display: grid;
    gap: .2rem;
}
.api-stat span { color: var(--muted); font-size: .8rem; }
.api-stat strong { font-size: 1.45rem; color: var(--gold-2); }
.api-doc-toc {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(13, 21, 34, .82);
    position: sticky;
    top: .4rem;
    z-index: 5;
    backdrop-filter: blur(12px);
}
.api-doc-toc a {
    font-size: .8rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    color: var(--muted);
}
.api-doc-toc a:hover { background: var(--panel-2); color: var(--text); }
.api-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}
.api-info-card {
    border: 1px solid var(--line);
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    padding: .8rem;
    display: grid;
    gap: .3rem;
    min-width: 0;
}
.api-info-card > span { color: var(--muted); font-size: .78rem; }
.api-info-card code { overflow-wrap: anywhere; }
.api-info-card small { color: var(--muted); font-size: .74rem; line-height: 1.6; }
.api-doc-prose { color: var(--text); }
.api-doc-prose p { margin: .3rem 0 .7rem; }
.api-doc-prose ul { margin: .3rem 0 .7rem; padding-inline-start: 1.25rem; }
.api-doc-prose li { margin-bottom: .35rem; }
.api-code-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}
.api-code-pair h4 { color: var(--muted); font-size: .82rem; }
.api-code {
    margin: .35rem 0 .9rem;
    padding: .85rem 1rem;
    background: #060a11;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    max-width: 100%;
    font-size: .78rem;
    line-height: 1.65;
    tab-size: 2;
}
.api-code code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; white-space: pre; }
.api-reference { display: grid; gap: .7rem; scroll-margin-top: 4rem; }
.api-reference-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.api-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(120px, .7fr)) auto auto auto;
    gap: .5rem;
    align-items: center;
    padding: .65rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    position: sticky;
    top: 3.4rem;
    z-index: 4;
}
.api-toolbar input,
.api-toolbar select {
    width: 100%;
    min-width: 0;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: .45rem .6rem;
    font: inherit;
    font-size: .82rem;
}
.api-toolbar input:focus,
.api-toolbar select:focus { outline: 2px solid rgba(232, 184, 75, .35); border-color: var(--gold); }
.api-result-count { white-space: nowrap; }
.api-empty {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-sm);
}
.api-endpoint {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    scroll-margin-top: 4.5rem;
}
.api-endpoint[open] { border-color: var(--line-2); }
.api-endpoint > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem .85rem;
    flex-wrap: wrap;
    background: linear-gradient(180deg, rgba(255,255,255,.015), transparent);
}
.api-endpoint > summary::-webkit-details-marker { display: none; }
.api-endpoint > summary:hover { background: var(--panel-2); }
.api-path { font-size: .78rem; overflow-wrap: anywhere; color: var(--gold-2); }
.api-endpoint-title { color: var(--text); font-size: .88rem; font-weight: 700; }
.api-chevron { margin-inline-start: auto; color: var(--muted); transition: transform .15s ease; }
.api-endpoint[open] .api-chevron { transform: rotate(180deg); }
.method-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: .1rem .45rem;
    border-radius: 6px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    border: 1px solid currentColor;
}
.method-get { color: #63d6b0; background: rgba(37, 211, 156, .08); }
.method-post { color: #7fb0ff; background: rgba(107, 155, 255, .08); }
.method-patch { color: #f0c66a; background: rgba(232, 184, 75, .08); }
.method-delete { color: #ff8798; background: rgba(241, 91, 112, .08); }
.access-pill {
    font-size: .66rem;
    border-radius: 999px;
    padding: .05rem .45rem;
    border: 1px solid var(--line-2);
    color: var(--muted);
}
.access-public { color: #8fe3c9; border-color: rgba(37, 211, 156, .35); }
.access-user { color: #9cbcff; border-color: rgba(107, 155, 255, .35); }
.access-admin, .access-super { color: #f3d58b; border-color: rgba(232, 184, 75, .35); }
.access-internal { color: #c6a6ff; border-color: rgba(160, 120, 255, .35); }
.api-endpoint-body {
    padding: .25rem .9rem 1rem;
    border-top: 1px solid var(--line);
    min-width: 0;
}
.api-description { color: var(--text); font-size: .88rem; }
.api-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    margin: .6rem 0 .9rem;
}
.api-meta-grid > div {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .45rem .6rem;
    min-width: 0;
}
.api-meta-grid span { display: block; color: var(--muted); font-size: .7rem; }
.api-meta-grid strong { font-size: .8rem; overflow-wrap: anywhere; }
.api-subhead { margin: .9rem 0 .35rem; color: var(--gold-2); font-size: .85rem; }
.api-sample-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.api-param-table { font-size: .8rem; }
.api-param-table code { overflow-wrap: anywhere; }
.api-notes { color: var(--muted); font-size: .8rem; padding-inline-start: 1.15rem; }
.api-code-tabs { margin-top: .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.api-code-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem;
    padding: .4rem;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
}
.api-code-tabbar button {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    border-radius: 6px;
    padding: .25rem .6rem;
    font: inherit;
    font-size: .75rem;
    cursor: pointer;
}
.api-code-tabbar button:hover { color: var(--text); background: var(--panel-2); }
.api-code-tabbar button.is-active { color: var(--gold-2); background: var(--panel); border-color: var(--line); }
.api-code-tabbar .api-copy-code { margin-inline-start: auto; color: var(--gold-2); }
.api-code-pane { margin: 0; border: 0; border-radius: 0; }
.api-doc-foot { text-align: center; }

@media (max-width: 1100px) {
    .api-toolbar { grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(120px, .7fr)); }
    .api-stat-grid, .api-info-grid, .api-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .api-code-pair { grid-template-columns: 1fr; }
    .api-toolbar {
        grid-template-columns: 1fr;
        position: static;
    }
    .api-doc-toc { position: static; }
    .api-stat-grid, .api-info-grid, .api-meta-grid { grid-template-columns: 1fr; }
    .api-endpoint > summary { align-items: flex-start; }
    .api-endpoint-title { width: 100%; }
    .api-chevron { margin-inline-start: 0; }
}

/* -------------------------------------------------------------------------
   Advanced & emergency configuration guide
   ------------------------------------------------------------------------- */
.config-guide-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin-top: 1rem;
}
.config-guide-toc {
    flex-direction: column;
    align-items: stretch;
    position: sticky;
    top: .5rem;
}
.config-guide-toc a {
    border-radius: var(--radius-sm);
    padding: .4rem .6rem;
    font-size: .8rem;
    overflow-wrap: anywhere;
}
.config-guide-main { display: grid; gap: 1rem; min-width: 0; }
.config-guide-search { display: grid; gap: .4rem; }
.config-guide-search .field { margin: 0; }
.config-guide-section { scroll-margin-top: 4.5rem; min-width: 0; }
.config-guide-section h4 { margin: 1rem 0 .45rem; color: var(--gold-2); font-size: .9rem; }
.config-guide-list { margin: .2rem 0 .8rem; padding-inline-start: 1.2rem; }
.config-guide-list li { margin-bottom: .35rem; line-height: 1.8; }
.config-guide-steps { margin: .2rem 0 .8rem; }
.config-guide-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    padding: .8rem .9rem;
    margin-top: .7rem;
    min-width: 0;
}
.config-guide-item[hidden] { display: none; }
.config-guide-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}
.config-guide-item-head h4 { margin: 0; }
.config-guide-item > p { color: var(--muted); font-size: .84rem; margin: .35rem 0 .6rem; }
.config-guide-table { font-size: .8rem; }
.config-guide-table th {
    width: 185px;
    color: var(--muted);
    font-weight: 500;
    vertical-align: top;
    white-space: normal;
}
.config-guide-table td { vertical-align: top; }
.config-guide-sample {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: var(--panel-2);
    border-radius: 6px;
    padding: .1rem .4rem;
}
.config-guide-code {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .7rem .85rem;
    background: #060a11;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin: .4rem 0 .6rem;
    min-width: 0;
}
.config-guide-code pre {
    margin: 0;
    flex: 1;
    overflow-x: auto;
    font-size: .78rem;
    line-height: 1.7;
}
.config-guide-code pre code { white-space: pre; }
.text-warn { color: #f0b56a; }

@media (max-width: 1000px) {
    .config-guide-layout { grid-template-columns: 1fr; }
    .config-guide-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 720px) {
    .config-guide-table th { width: auto; }
    .config-guide-table th,
    .config-guide-table td { display: block; width: 100%; }
    .config-guide-table tr { display: block; border-bottom: 1px solid var(--line); padding: .3rem 0; }
    .config-guide-table tr:last-child { border-bottom: 0; }
}

/* Personal API tokens: the raw value is long and must stay readable and
   selectable without stretching the panel. */
.token-reveal { border: 1px solid var(--gold, #d4af37); }
.token-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .78rem;
    letter-spacing: .01em;
}
.token-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: .4rem 0 .9rem; }
.token-reveal .api-code { max-width: 100%; overflow-x: auto; }
@media (max-width: 620px) {
    .token-value { font-size: .7rem; }
    .token-actions { flex-direction: column; align-items: flex-start; }
}

/* ---------- Native select popups ----------
   A styled <select> inherits the dark surface for its closed box, but Chromium
   paints the *popup list* with the platform default background. Because the
   text colour was still inherited as the near-white --text, options appeared
   white-on-white and were unreadable. Options and optgroups must therefore set
   an explicit background and colour of their own. */

select {
    color-scheme: dark;
}

select option,
select optgroup {
    background-color: #101a2b;
    color: #e8eef8;
}

select option:checked,
select option:hover,
select option:focus {
    background-color: #22314a;
    color: #ffffff;
}

select option:disabled {
    color: #6d7a90;
}

/* Force the contrast colours where a browser ignores the inherited scheme. */
.field select option,
.filter-form select option,
.select-field select option,
.users-filter select option,
.inline-form select option {
    background-color: #101a2b;
    color: #e8eef8;
}

/* ---------- Captcha ----------
   The artwork sits on its own card so the glyphs are never squeezed by the
   form's column width, and the input keeps the platform's LTR direction for a
   latin answer. */

.captcha {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(232, 184, 75, .05), rgba(255, 255, 255, .012));
}

.captcha-art {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    background: #0a111d;
    line-height: 0;
}

.captcha-art svg {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
}

.captcha-fields { display: flex; flex-direction: column; gap: .45rem; }

.captcha-fields .field input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .28em;
    text-align: center;
    font-size: 1.05rem;
    text-transform: uppercase;
}

.captcha-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
}

.captcha-hint { margin: 0; color: var(--muted); font-size: .76rem; }

.captcha-refresh {
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, .03);
    color: var(--gold-2);
    border-radius: 999px;
    padding: .3rem .8rem;
    font: inherit;
    font-size: .76rem;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.captcha-refresh:hover:not(:disabled) {
    border-color: rgba(232, 184, 75, .6);
    background: rgba(232, 184, 75, .08);
}

.captcha-refresh:disabled { opacity: .6; cursor: progress; }

@media (min-width: 520px) {
    .captcha { grid-template-columns: 300px minmax(0, 1fr); align-items: center; }
    .captcha-art svg { max-width: none; }
}

/* ---------- Contact inbox with email reply ---------- */

.message-list { display: grid; gap: .8rem; }

.contact-message {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
}

.contact-message-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
    flex-wrap: wrap;
}

.contact-message-head h3 { margin: 0 0 .2rem; font-size: .98rem; }
.contact-message-head p { margin: 0; }
.contact-message-badges { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

.cms-message-body {
    white-space: pre-wrap;
    color: var(--text);
    font-size: .88rem;
    line-height: 1.85;
    padding: .65rem .8rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
    border-inline-start: 3px solid var(--line-2);
}

.contact-reply-sent {
    font-size: .84rem;
    line-height: 1.8;
    padding: .6rem .8rem;
    border-radius: 10px;
    border: 1px dashed rgba(37, 211, 156, .35);
    background: rgba(37, 211, 156, .06);
}

.contact-reply summary {
    cursor: pointer;
    font-size: .82rem;
    color: var(--gold-2);
    list-style: none;
    padding: .25rem 0;
}

.contact-reply summary::-webkit-details-marker { display: none; }
.contact-reply summary::before { content: '✉ '; }
.contact-reply .form { margin-top: .5rem; }

/* ---------- Leaderboard and payout transparency ---------- */

.leaderboard-page { display: flex; flex-direction: column; gap: 1rem; }

.leaderboard-filter {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.leaderboard-filter fieldset.field { display: flex; flex-direction: column; gap: .45rem; }

.segmented {
    display: inline-flex;
    flex-wrap: nowrap;
    padding: .22rem;
    gap: .15rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    max-width: 100%;
    overflow-x: auto;
}

.segmented-wrap { flex-wrap: wrap; overflow: visible; }

.segmented-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .42rem .85rem;
    border-radius: 9px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.segmented-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }

.segmented-item:has(input:checked) {
    background: linear-gradient(180deg, rgba(232, 184, 75, .22), rgba(232, 184, 75, .1));
    color: var(--gold-2);
    box-shadow: inset 0 0 0 1px rgba(232, 184, 75, .35);
}

.segmented-item:has(input:focus-visible) {
    outline: 2px solid rgba(232, 184, 75, .6);
    outline-offset: 1px;
}

.leaderboard-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
    max-width: 460px;
}

.leaderboard-table { display: flex; flex-direction: column; }

.leaderboard-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 84px minmax(120px, 150px) minmax(120px, 150px);
    align-items: center;
    gap: .6rem;
    padding: .58rem .5rem;
    border-bottom: 1px solid var(--line);
    font-size: .86rem;
}

.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row:not(.leaderboard-head):hover { background: rgba(255, 255, 255, .02); }

.leaderboard-head {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .02em;
}

.leaderboard-rank { display: flex; align-items: center; justify-content: center; }
.leaderboard-medal { font-size: 1.15rem; line-height: 1; }
.leaderboard-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    font-size: .74rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.leaderboard-user { display: flex; align-items: center; gap: .55rem; min-width: 0; }

.leaderboard-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line-2);
}

.leaderboard-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(232, 184, 75, .28), rgba(107, 155, 255, .18));
    color: var(--gold-2);
    font-size: .72rem;
    font-weight: 700;
}

.leaderboard-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.leaderboard-primary {
    font-weight: 700;
    color: var(--gold-2);
    font-variant-numeric: tabular-nums;
}

.leaderboard-row .ltr { font-variant-numeric: tabular-nums; }

/* Home-page leaderboard: the same rows, with linked tabs instead of form
   controls so day/month/quarter/year and the two sort orders are shareable
   URLs that also work without JavaScript. */
.segmented-item.is-active {
    background: linear-gradient(180deg, rgba(232, 184, 75, .22), rgba(232, 184, 75, .1));
    color: var(--gold-2);
    box-shadow: inset 0 0 0 1px rgba(232, 184, 75, .35);
}

.home-board-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    margin-bottom: .75rem;
}

.home-board-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.2rem;
    margin-bottom: .85rem;
    color: var(--muted);
    font-size: .8rem;
}

.home-board-meta strong { color: var(--text); }

.home-board-panel { padding: .35rem .7rem; overflow: hidden; }

.home-board-table .leaderboard-row { padding-inline: .25rem; }

.home-board-note { margin-top: .8rem; }

/* The public leaderboard offers the top, loss and breach boards as real tabs;
   each tab is a plain link so the board stays shareable and works without
   JavaScript, and the page shell/filters stay identical between boards. */
.leaderboard-board-tabs { margin: 0; }
.leaderboard-board-tabs .segmented-item { flex: 0 1 auto; }

/* Secondary public boards under the top-users table: biggest realised losses
   and users whose challenge accounts were stopped by a rule breach. */
.leaderboard-extras { display: grid; gap: 2.5rem; margin-top: 2rem; }
.leaderboard-extras .section-head { margin-bottom: 1rem; }
.leaderboard-extras .stat-grid { margin-bottom: 1rem; }
.leaderboard-board > .home-board-panel { padding: .35rem .7rem; }

.leaderboard-loss { color: var(--red); font-weight: 700; }

.leaderboard-row.breach-row {
    grid-template-columns: 52px minmax(0, 1fr) 92px minmax(150px, 1.4fr) 128px;
}

.breach-reason {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: .8rem;
}

.leaderboard-bar-cell { display: block; }

.leaderboard-bar {
    display: block;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(232, 184, 75, .85) var(--fill, 0%), rgba(255, 255, 255, .06) var(--fill, 0%));
}

.payout-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }

.payout-feed-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .6rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .015);
}

.payout-feed-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.payout-feed-main strong { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payout-feed-amount { font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }

/* ---------- Profile ---------- */

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    text-align: center;
}

.profile-card h3 { margin: .2rem 0 0; font-size: 1rem; }
.profile-card p { margin: 0; }

.profile-avatar {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(232, 184, 75, .25), rgba(107, 155, 255, .16));
    border: 2px solid rgba(232, 184, 75, .35);
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-avatar-fallback {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--gold-2);
    letter-spacing: .04em;
}

.form-actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.form-actions .form-hint { margin: 0; }

@media (min-width: 900px) {
    .profile-layout { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (max-width: 720px) {
    .leaderboard-head { display: none; }
    .leaderboard-row {
        grid-template-columns: 46px minmax(0, 1fr) auto;
        grid-template-areas:
            'rank user primary'
            '.    meta meta';
        row-gap: .2rem;
    }
    .leaderboard-rank { grid-area: rank; }
    .leaderboard-user { grid-area: user; }
    .leaderboard-primary { grid-area: primary; justify-self: end; }
    .leaderboard-row > span:nth-child(3) { grid-area: meta; }
    .leaderboard-row > span:nth-child(5) { display: none; }
    .leaderboard-extras #most-losses .leaderboard-row > span:nth-child(4),
    .leaderboard-page #board-loss .leaderboard-row > span:nth-child(4) {
        grid-area: primary;
        justify-self: end;
    }
    .leaderboard-bar-cell { display: none; }
    .leaderboard-range { grid-template-columns: 1fr; }

    .leaderboard-row.breach-row {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        grid-template-areas:
            'rank user count'
            '.    reason reason'
            '.    date   date';
        row-gap: .2rem;
    }
    .breach-row > span:nth-child(1) { grid-area: rank; }
    .breach-row > span:nth-child(2) { grid-area: user; }
    .breach-row > span:nth-child(3) { grid-area: count; justify-self: end; }
    .breach-row > span:nth-child(4) {
        grid-area: reason;
        display: block;
        white-space: normal;
    }
    .breach-row > span:nth-child(5) { grid-area: date; display: block; }
}

/* ---------- Terminal symbol search ----------
   A TradingView-style combobox: typing filters the catalog, arrow keys move the
   highlight and Enter (or a click) switches the chart and the order ticket.
   The tab strip below stays as the no-JavaScript fallback. */

.symbol-picker { position: relative; margin-bottom: .55rem; }

.symbol-picker-field {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .42rem .7rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.symbol-picker-field:focus-within {
    border-color: rgba(232, 184, 75, .55);
    box-shadow: 0 0 0 3px rgba(232, 184, 75, .12);
}

.symbol-picker-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: .88rem;
    outline: none;
    padding: .1rem 0;
}

.symbol-picker-field input::placeholder { color: var(--muted); }

.symbol-picker-clear {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .15rem;
}

.symbol-picker-clear:hover { color: var(--text); }

.symbol-options {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    top: calc(100% + .3rem);
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: .3rem;
    list-style: none;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: #0d1626;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}

.symbol-option {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .55rem;
    border-radius: 9px;
    cursor: pointer;
}

.symbol-option.is-highlighted,
.symbol-option:hover {
    background: rgba(232, 184, 75, .12);
}

.symbol-option-main { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.symbol-option-main strong { font-size: .84rem; }
.symbol-option-main small {
    font-size: .68rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.symbol-option-price { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.symbol-option-empty { justify-content: center; color: var(--muted); font-size: .78rem; cursor: default; }
.symbol-option-empty:hover { background: transparent; }

.symbol-commission {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .5rem .7rem;
    border: 1px dashed rgba(232, 184, 75, .32);
    border-radius: 10px;
    background: rgba(232, 184, 75, .05);
    font-size: .78rem;
}

.symbol-commission div { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.symbol-commission span { color: var(--muted); }
.symbol-commission strong { color: var(--gold-2); font-size: .8rem; }
.symbol-commission small { color: var(--muted); font-size: .7rem; }
.symbol-commission .commission-total strong {
    color: var(--gold-2);
    font-size: .86rem;
    font-variant-numeric: tabular-nums;
}
.symbol-commission .spread-cost-estimate {
    flex: 1 1 100%;
    justify-content: space-between;
    padding-top: .38rem;
    border-top: 1px dashed rgba(232, 184, 75, .18);
}
.symbol-commission .spread-cost-estimate strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.symbol-commission .spread-cost-note {
    flex: 1 1 100%;
    margin-top: -.2rem;
    color: var(--muted);
    font-size: .68rem;
}

/* ---------- First-run installer ---------- */

.setup-page { max-width: 880px; }

.setup-form { display: flex; flex-direction: column; gap: 1rem; }

.setup-mode {
    display: grid;
    grid-template-columns: 1fr;
    gap: .6rem;
}

.setup-mode-card {
    position: relative;
    display: flex;
    gap: .6rem;
    padding: .8rem .85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .015);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.setup-mode-card:hover { border-color: var(--line-2); }

.setup-mode-card input {
    margin-top: .2rem;
    accent-color: #e8b84b;
}

.setup-mode-card:has(input:checked) {
    border-color: rgba(232, 184, 75, .5);
    background: rgba(232, 184, 75, .06);
}

.setup-mode-body { display: flex; flex-direction: column; gap: .2rem; }
.setup-mode-body strong { font-size: .88rem; }
.setup-mode-body small { color: var(--muted); font-size: .76rem; line-height: 1.7; }

@media (min-width: 760px) {
    .setup-mode { grid-template-columns: 1fr 1fr; }
}

/* Service details: copy command / log path next to their values. */
.copy-row { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.copy-row .system-command { flex: 1 1 320px; margin: 0; }
.copy-inline { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.copy-inline strong { margin: 0; }

/* Service details: systemd unit sample blocks. */
.unit-block { margin-top: 1rem; }
.unit-block .panel-title { margin-bottom: .4rem; }
.unit-block .panel-title h4 { margin: 0; }

/* Service details: copyable systemd/journalctl snippets. */
.snippet-list { display: grid; gap: .75rem; }
.snippet-row { align-items: center; }
.snippet-row > div { flex: 1 1 320px; min-width: 0; }
.snippet-row .system-command { margin: .25rem 0 0; }

/* Admin plans: a compact toolbar that collapses every plan card, plus the
   shared .panel.is-collapsed rules used by each card's own toggle. */
.plan-bulk-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .2rem 0 .95rem;
    padding: .65rem .75rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .018);
}
.plan-bulk-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    margin-inline-start: auto;
}
.plan-admin-card.has-collapse > .panel-title { align-items: center; }
.plan-admin-card.is-collapsed > .panel-title { margin-bottom: 0; }
@media (max-width: 620px) {
    .plan-bulk-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin-inline-start: 0;
    }
    .plan-bulk-actions .btn { width: 100%; }
}

/* Audit-mode cancellation lists: dated sessions, expandable order rows and
   their event timeline. */
tr[data-audit-order-row] { cursor: pointer; }
tr[data-audit-order-row]:hover { background: rgba(255, 255, 255, .03); }
tr[data-audit-order-row].is-open { background: rgba(232, 184, 75, .07); }
tr[data-audit-order-row]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.audit-session {
    margin-top: .9rem;
    padding: .8rem .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .012);
}
.audit-session-head {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-start;
    justify-content: space-between;
}
.audit-session-head p { margin: .15rem 0 0; }
.audit-session-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
}
.audit-session .table-wrap { margin-top: .6rem; }
.audit-details-row td { background: rgba(255, 255, 255, .02); }
.audit-order-details { display: grid; gap: .7rem; }
.audit-order-details .system-list { margin: 0; }
.audit-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .35rem;
}
.audit-timeline li {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
    font-size: .8rem;
    border-inline-start: 2px solid rgba(232, 184, 75, .35);
    padding-inline-start: .6rem;
}
.audit-timeline-time { color: var(--muted); }
@media (max-width: 620px) {
    .audit-session-head { flex-direction: column; }
    .audit-session-meta { width: 100%; }
    .audit-session-meta .btn { width: 100%; }
}

/* Installments page: clickable payment and loan-request rows with an inline
   details panel. */
tr[data-loan-row] { cursor: pointer; }
tr[data-loan-row]:hover { background: rgba(255, 255, 255, .03); }
tr[data-loan-row].is-open { background: rgba(232, 184, 75, .07); }
tr[data-loan-row]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.loan-details-row td { background: rgba(255, 255, 255, .02); }
.loan-detail-grid { display: grid; gap: .6rem; }
.loan-detail-grid .system-list { margin: 0; }

/* Comprehensive user report: one expandable details row per summary row. */
tr[data-report-row] { cursor: pointer; }
tr[data-report-row]:hover { background: rgba(255, 255, 255, .03); }
tr[data-report-row].is-open { background: rgba(232, 184, 75, .07); }
tr[data-report-row]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.report-details-row td { background: rgba(255, 255, 255, .02); }
.report-detail-grid { display: grid; gap: .6rem; }
.report-detail-grid .system-list { margin: 0; }
.report-audit-details {
    display: block;
    max-width: 100%;
    padding: .45rem .55rem;
    background: rgba(0, 0, 0, .18);
    border-radius: 8px;
    color: var(--muted);
    font-size: .78rem;
    white-space: pre-wrap;
    word-break: break-word;
    direction: ltr;
    text-align: left;
}

/* Administrator transaction ledger: each transaction expands its own details. */
tr[data-transaction-row] { cursor: pointer; }
tr[data-transaction-row]:hover { background: rgba(255, 255, 255, .03); }
tr[data-transaction-row].is-open { background: rgba(232, 184, 75, .07); }
tr[data-transaction-row]:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.transaction-details-row td { background: rgba(255, 255, 255, .02); }
.transaction-detail-grid { display: grid; gap: .8rem; }
.transaction-detail-grid .system-list { margin: 0; }
.transaction-events { border-top: 1px solid var(--line); padding-top: .7rem; }
.transaction-events h4 { margin: 0 0 .5rem; font-size: .85rem; }
.transaction-event-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.transaction-event-list li { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, .12); }
.transaction-event-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .35rem; }

/* Administrator payments: each row expands its full record. */
.payment-details-hint { margin: -.4rem 0 .8rem; }
.payment-row { cursor: pointer; }
.payment-row:hover > td { background: rgba(232, 184, 75, .05); }
.payment-row.is-open > td { background: rgba(232, 184, 75, .09); }
.payment-row:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.payment-row-hint { display: block; margin-top: .15rem; color: var(--gold-2); }
.payment-details-row > td { background: rgba(255, 255, 255, .02); }
.payment-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .55rem .9rem; }
.payment-detail-grid > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.payment-detail-grid small { color: var(--muted); font-size: .72rem; }
.payment-detail-grid strong { overflow-wrap: anywhere; }

/* Platform accounting: the whole user row opens the user statement. */
.accounting-user-hint { margin: -.4rem 0 .8rem; }
.accounting-user-row { cursor: pointer; }
.accounting-user-row:hover > td { background: rgba(232, 184, 75, .05); }
.accounting-user-row:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.accounting-user-link { color: inherit; text-decoration: none; }
.accounting-user-row:hover .accounting-user-link,
.accounting-user-link:focus-visible { color: var(--gold-2); text-decoration: underline; }

/* Public-display switches in admin settings. */
.settings-toggle { align-items: flex-start; gap: .55rem; padding: .2rem 0; }
.settings-toggle input[type="checkbox"] { margin-top: .2rem; }
