: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;
}

.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-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-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; }

.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; }

/* ---------- 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; }

.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; }

/* ---------- 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; }
.side-label { color: #5f7088; font-size: .68rem; font-weight: 700; padding: .4rem .6rem; }

.side-link {
    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-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; }

.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; }
.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; }

.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; align-items: flex-end; gap: .6rem; }
.payout-form .field { flex: 1; }

/* ---------- 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; }

.symbol-tabs {
    display: flex;
    gap: .45rem;
    overflow-x: auto;
    padding-bottom: .4rem;
    margin-bottom: .7rem;
}

.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-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-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; }

.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; }

.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 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); }

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

@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:fullscreen .chart-shell { height: calc(100vh - 220px); }

.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-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; }
.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; }

.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;
}

.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: calc(100vh - 200px); }
}

@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%; }
    .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; }
    .site-actions .btn-ghost { display: none; }
    .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);
}
.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; }

.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; }

.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; }
}

/* ---- 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; }

/* ---- 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-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; }
    .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)); }
.ajax-toast { 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.is-success { border-color: rgba(37, 211, 156, .45); color: #a9f0d8; }
.ajax-toast.is-error { border-color: rgba(241, 91, 112, .5); color: #ffb9c2; }
@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;
}
.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; }
}
