@font-face {
    font-family: Onest;
    src: url("/onest-latin.woff2") format("woff2");
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212;
}

@font-face {
    font-family: Onest;
    src: url("/onest-cyrillic.woff2") format("woff2");
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
    color-scheme: dark;
    --bg: #12141e;
    --surface: #1a1d2a;
    --input: #161823;
    --line: #323649;
    --ink: #f4f2fa;
    --muted: #aeb0c4;
    --soft: #858a9f;
    --acid: #d9f0ac;
    --acid-ink: #202b16;
    --violet: #c7b9f4;
    --violet-bg: #302942;
    --loss: #ffaba8;
    --radius: 22px;
    font: 15px/1.5 Onest, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
h1, h2, p { margin: 0; }
h1, h2 { letter-spacing: -.04em; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
button svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.positive { color: var(--acid); }
.negative { color: var(--loss); }

.header { border-bottom: 1px solid var(--line); }
.header-inner {
    width: min(1160px, 100%);
    min-height: 76px;
    margin: auto;
    padding: 0 36px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}
.identity { display: flex; gap: 11px; align-items: center; font-size: 1.4rem; font-weight: 750; letter-spacing: -.06em; }
.plan {
    display: inline-flex;
    align-items: center;
    background: var(--violet-bg);
    color: var(--violet);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .08em;
}
.plan { font-size: .78rem; letter-spacing: 0; }
.settings { justify-self: end; }
.nav { display: flex; gap: 4px; }
.nav button, .filters button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-weight: 650;
}
.nav button[aria-current], .filters button[aria-pressed="true"] { color: var(--ink); background: var(--surface); border-color: var(--line); }
.nav button:hover, .filters button:hover { color: var(--ink); }

.shell { max-width: 1160px; margin: auto; padding: 26px 36px 52px; }
.dashboard { display: grid; gap: 36px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.portfolio { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.portfolio-main { padding: 26px 26px 0; }
.portfolio-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.eyebrow { color: var(--muted); font-weight: 650; font-size: .79rem; letter-spacing: .02em; }
.balance { font-size: 3.35rem; line-height: 1.15; font-weight: 720; letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
.portfolio-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: .85rem; }
.profit-label { color: var(--muted); }
.portfolio-meta strong { color: var(--acid); font-variant-numeric: tabular-nums; }
.plot { margin-top: 25px; height: 177px; display: grid; grid-template-columns: minmax(0, 1fr) 47px; grid-template-rows: minmax(0, 1fr); gap: 9px; }
.plot canvas { width: 100%; height: 100%; min-width: 0; min-height: 0; display: block; }
.ticks { display: flex; flex-direction: column; justify-content: space-between; align-items: end; padding: 0 0 1px; color: var(--soft); font-size: .73rem; font-variant-numeric: tabular-nums; }
.plot-legend { margin-top: 8px; padding-right: 56px; display: flex; justify-content: space-between; color: var(--soft); font-size: .74rem; }
.portfolio-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 22px 26px 25px; }
.button { min-height: 46px; padding: 9px 13px; border: 1px solid transparent; border-radius: 10px; font-size: .88rem; font-weight: 720; }
.primary { background: var(--acid); color: var(--acid-ink); }
.primary:hover:not(:disabled) { background: #e8f7c8; }
.primary:disabled { background: #343a35; color: #abb7a7; }
.secondary { background: transparent; border-color: #4a4f65; color: var(--ink); }
.secondary:hover:not(:disabled) { border-color: var(--muted); }
.secondary:disabled { color: var(--soft); border-color: var(--line); }
.text-button { padding-inline: 0; background: transparent; color: var(--violet); text-align: left; }
.text-button:hover { text-decoration: underline; }
.session {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 78px;
    border-top: 1px solid var(--line);
    padding: 14px 26px;
    background: var(--input);
}
.session-symbol { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--violet); font-size: 1.2rem; }
.session-copy h2 { font-size: .91rem; letter-spacing: -.01em; }
.session-copy p { color: var(--muted); font-size: .78rem; }
.session-state { color: var(--muted); font-size: .73rem; font-weight: 700; text-align: right; }
.session-state[data-phase="running"], .session-state[data-phase="finished"] { color: var(--acid); }

.feed, .history { min-width: 0; }
.feed { padding-top: 9px; }
.history { max-width: 740px; margin: 0 auto; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-head h1, .section-head h2 { font-size: 1.75rem; font-weight: 720; line-height: 1.24; }
.section-head p { margin-bottom: 3px; }
.entries { list-style: none; padding: 0; margin: 0; }
.entry { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.entry-icon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 9px;
    background: var(--violet-bg);
    color: var(--violet);
    font-size: .84rem;
    font-weight: 760;
}
.entry-name, .entry-result { font-weight: 710; font-size: .9rem; }
.entry-result { font-variant-numeric: tabular-nums; }
.entry-sub { display: block; color: var(--muted); font-size: .76rem; }
.empty { display: grid; gap: 4px; color: var(--muted); padding: 26px 0; font-size: .88rem; }
.empty strong { color: var(--ink); font-weight: 650; }
.filters { display: flex; gap: 6px; margin: 12px 0 4px; }

dialog {
    width: min(460px, calc(100vw - 28px));
    max-height: calc(100dvh - 36px);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    overflow: auto;
}
dialog::backdrop { background: #0b0c13bf; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: -3px 0 11px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 1.45rem; line-height: 1; }
.icon-button:hover { border-color: var(--muted); }
dialog h2 { font-size: 1.7rem; line-height: 1.2; margin-bottom: 8px; }
dialog p { color: var(--muted); font-size: .9rem; }
dialog .positive { color: var(--acid); }
.form-stack { display: grid; gap: 12px; margin-top: 15px; }
.amount-field, .form-stack label { display: grid; gap: 5px; font-size: .87rem; font-weight: 600; }
.form-stack input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); color: var(--ink); font-size: 16px; }
.form-stack small { margin-top: -6px; color: var(--muted); }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.max-button { border: 1px solid var(--line); border-radius: 8px; background: var(--violet-bg); color: var(--violet); padding: 0 10px; }
.summary { margin: 14px 0; }
.summary div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.summary dt { font-size: .87rem; color: var(--muted); }
.summary dd { font-weight: 700; margin: 0; text-align: right; overflow-wrap: anywhere; }
.dialog-actions { display: grid; gap: 8px; margin-top: 15px; }
.notice { padding: 10px 12px; border: 1px solid #81504e; border-radius: 8px; color: var(--loss); background: #3c292f; margin: 0 0 12px; font-size: .87rem; }
dialog .notice { color: var(--loss); }

@media (max-width: 740px) {
    .header-inner { min-height: 63px; padding: 0 17px; grid-template-columns: 1fr auto; }
    .shell { padding: 16px 16px calc(80px + env(safe-area-inset-bottom)); }
    .nav {
        position: fixed;
        inset: auto 0 0;
        z-index: 2;
        background: var(--bg);
        border-top: 1px solid var(--line);
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 6px 15px calc(6px + env(safe-area-inset-bottom));
    }
    .nav button { min-height: 45px; }
    .dashboard { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .portfolio-main { padding: 17px 15px 0; }
    .balance { font-size: 2.8rem; }
    .plot { margin-top: 18px; height: 119px; }
    .portfolio-actions { padding: 16px 15px; }
    .session { padding: 11px 15px; min-height: 65px; }
    .feed { padding-top: 0; }
    .section-head h1, .section-head h2 { font-size: 1.45rem; }
}

@media (max-width: 360px) {
    .shell { padding-inline: 12px; }
    .balance { font-size: 2.45rem; }
    .portfolio-actions .button { padding-inline: 6px; font-size: .8rem; }
    .session-copy p, .session-state { font-size: .7rem; }
}

#open-withdraw.primary { grid-column: 1 / -1; }

.market {
    border-top: 1px solid var(--line);
    padding: 14px 26px 16px;
}
.market-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.market-head h2 { font-size: .91rem; letter-spacing: -.01em; }
.market-head p, #market-status { color: var(--muted); font-size: .73rem; }
#market-status { text-align: right; }
.market-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.market-grid div { padding: 6px 8px; background: var(--input); border-radius: 8px; }
.market-grid dt { color: var(--muted); font-size: .69rem; font-weight: 650; }
.market-grid dd { margin: 0; font-size: .79rem; font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#admin-accounts h3 { margin: 0; font-size: 1rem; letter-spacing: -.025em; }
#account-success { margin: 9px 0; }
.account-list { display: grid; gap: 6px; list-style: none; margin: 12px 0 0; padding: 0; }
.account-list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; }
.account-list button span:first-child { overflow-wrap: anywhere; }
.account-list button span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.account-section { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.account-actions .button { flex: 1 0 auto; }
.account-section summary { cursor: pointer; font-weight: 700; }
.account-section summary:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
#account-reset .account-actions { margin-top: 8px; }
#reset-description { margin-top: 10px; }
.danger { background: #3c292f; color: var(--loss); border-color: #81504e; }

@media (max-width: 740px) {
    .market { padding: 11px 15px 13px; }
    .market-grid { gap: 5px; }
    .market-grid div { padding-inline: 5px; }
}

:root {
    --bg: #101318;
    --surface: #181e27;
    --input: #121820;
    --line: #2c3747;
    --ink: #f4f6ff;
    --muted: #a6b0c4;
    --soft: #8793ac;
    --acid: #aaefd2;
    --action: #b9bbff;
    --action-ink: #20234a;
    --violet: #ced1ff;
    --violet-bg: #292f50;
    --radius: 16px;
}
body { min-width: 300px; }
.header { position: sticky; top: 0; z-index: 2; background: var(--bg); }
.header-inner { width: min(100%, 482px); grid-template-columns: 1fr auto; gap: 12px; padding: 0 18px; min-height: 65px; }
.identity { min-width: 0; gap: 8px; font-size: 1.28rem; }
#brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#brand-logo, #branding-logo { display: block; flex: 0 0 auto; object-fit: contain; border-radius: 8px; }
.identity .plan { flex: 0 0 auto; }
.identity .plan { margin-left: auto; }
.nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 2;
    width: min(100%, 482px);
    margin: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    border-top: 1px solid var(--line);
    background: #151a22;
    padding: 4px 16px calc(4px + env(safe-area-inset-bottom));
}
.nav button {
    position: relative;
    gap: 7px;
    min-height: 46px;
    padding: 3px 8px 6px;
    font-size: .81rem;
    border: 0;
    background: transparent;
}
.nav button[aria-current] { background: transparent; color: var(--violet); font-weight: 750; }
.nav button[aria-current]::after {
    content: "";
    position: absolute;
    inset: auto 0 2px;
    width: 22px;
    height: 2px;
    margin-inline: auto;
    border-radius: 1px;
    background: var(--action);
}
.nav button .ui-icon { width: 18px; height: 18px; }
.shell { width: min(100%, 482px); padding: 12px 16px calc(88px + env(safe-area-inset-bottom)); }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.wallet-hero { padding: 7px 0 0; text-align: center; }
.balance-head, .balance-display { display: flex; align-items: center; justify-content: center; gap: 7px; }
.balance-head .eyebrow { letter-spacing: .04em; }
.balance { font-size: 2.85rem; letter-spacing: -.065em; overflow-wrap: anywhere; }
.micro-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.26rem; }
.micro-button:hover { background: var(--surface); color: var(--ink); }
.portfolio-meta { justify-content: center; margin: 8px 0 12px; }
.portfolio-meta strong { color: var(--acid); background: #223e3b; border-radius: 7px; padding: 3px 7px; }
.wallet-metrics { color: var(--muted); display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; font-size: .78rem; }
.wallet-metrics b { color: var(--ink); font-weight: 650; }
.wallet-actions { padding: 15px 0 2px; gap: 8px; }
.primary { background: var(--action); color: var(--action-ink); }
.primary:hover:not(:disabled) { background: #d6d7ff; }
.primary:disabled { background: var(--surface); color: var(--muted); }
.wallet-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.wallet-card h2 { font-size: .98rem; letter-spacing: -.025em; }
.wallet-card p { color: var(--muted); font-size: .79rem; }
.asset-card { display: flex; align-items: center; gap: 10px; }
.asset-card strong, .engine-caption .session-state { margin-left: auto; text-align: right; white-space: nowrap; }
.engine > .button { width: 100%; margin-top: 11px; }
.session-state { padding: 3px 7px; background: var(--input); border-radius: 7px; }
.feed .section-head { padding-bottom: 8px; }
.feed .empty { padding: 12px 0 0; }
.wallet-details summary { cursor: pointer; color: var(--ink); font-weight: 720; }
.wallet-details .plot { margin-top: 15px; height: 130px; }
.market { padding: 13px 14px; }
.entry-sub { overflow-wrap: anywhere; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
fieldset legend { color: var(--muted); font-weight: 680; font-size: .79rem; margin-bottom: 7px; }
.form-stack input[type="radio"] { min-height: auto; margin: 0; width: auto; accent-color: var(--action); }

@media (max-width: 360px) {
    .header-inner { padding-inline: 12px; }
    .balance { font-size: 2.35rem; }
}

:root {
    --control: #202936;
    --control-hover: #2a3646;
    --control-line: #344155;
    --action-hover: #cbcfff;
    --action-active: #a8acf5;
    --selection: #282e48;
    --interaction: 140ms cubic-bezier(.2, .75, .24, 1);
}
.ui-icon {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: inherit;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; }
.button .ui-icon { width: 18px; height: 18px; stroke-width: 1.75; }
.button.primary { min-height: 48px; }
.button.secondary { min-height: 44px; background: var(--control); border-color: var(--control-line); }
.button.secondary:disabled { background: transparent; border-color: var(--line); color: var(--soft); }
.button.primary:disabled { color: var(--muted); }
.button.text-button { justify-content: flex-start; }
button:not(:disabled)[aria-busy="true"], button[aria-busy="true"] { opacity: .72; cursor: progress; }
.button, .icon-button, .micro-button, .max-button, .nav button {
    touch-action: manipulation;
    transition: color var(--interaction), background-color var(--interaction), border-color var(--interaction), transform var(--interaction);
}
.button:not(:disabled):active, .icon-button:not(:disabled):active, .micro-button:not(:disabled):active, .max-button:not(:disabled):active {
    transform: translateY(1px);
}
.button.primary:not(:disabled):active { background: var(--action-active); }
.button.secondary:not(:disabled):active { background: var(--control-hover); }
.icon-button { width: 44px; height: 44px; color: var(--ink); background: var(--input); border-color: var(--line); }
.icon-button .ui-icon { width: 20px; height: 20px; }
.micro-button { width: 44px; height: 44px; }
.micro-button .ui-icon { width: 18px; height: 18px; }
.balance-head { gap: 4px; }
.balance-display { gap: 3px; }
.wallet-actions { gap: 10px; }
.wallet-card { border-radius: 16px; }
.asset-coin { display: block; width: 36px; height: 36px; flex: 0 0 auto; object-fit: contain; }
.engine-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--selection);
    color: var(--violet);
}
.session-state { position: relative; }
.session-state::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 5px;
    border-radius: 50%;
    vertical-align: .12em;
    background: currentColor;
}
.entry-icon { width: 34px; height: 34px; }
.entry-icon:has(.coin-logo) { background: var(--input); }
.entry-icon .ui-icon { width: 17px; height: 17px; }
.coin-logo { display: block; width: 23px; height: 23px; object-fit: contain; }
.entry-result { white-space: nowrap; }
.market-grid dt { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.market-grid dt img { display: block; flex: 0 0 auto; object-fit: contain; }
.market-grid dd { white-space: nowrap; }
.wallet-details summary { display: flex; align-items: center; gap: 8px; min-height: 34px; list-style: none; }
.wallet-details summary::-webkit-details-marker { display: none; }
.wallet-details summary .ui-icon { width: 18px; height: 18px; color: var(--muted); }
.wallet-details .disclosure-icon { margin-left: auto; transition: transform var(--interaction); }
.wallet-details[open] .disclosure-icon { transform: rotate(180deg); }
.dialog-head-start { display: flex; align-items: center; gap: 10px; }
.account-list button { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 14px; gap: 8px; }
.account-list button span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.account-list button span:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.account-list button .ui-icon { width: 14px; height: 14px; color: var(--muted); }
.account-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--selection); color: var(--violet); font-weight: 700; }
@media (hover: hover) {
    .button.primary:hover:not(:disabled) { background: var(--action-hover); }
    .button.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) {
        background: var(--control-hover);
        border-color: var(--soft);
    }
}
@media (max-width: 360px) {
    .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .button, .icon-button, .micro-button, .max-button, .nav button, .disclosure-icon { transition: none; }
}

.engine-caption {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    column-gap: 10px;
    row-gap: 3px;
    align-items: center;
}
.engine-caption .engine-mark { grid-column: 1; grid-row: 1 / 3; align-self: start; }
.engine-caption .session-copy { display: contents; }
.engine-caption .session-copy h2 { grid-column: 2; grid-row: 1; }
.engine-caption .session-copy p { grid-column: 2 / -1; }
.engine-caption .session-state { grid-column: 3; grid-row: 1; }
.trade-item { border-bottom: 1px solid var(--line); }
.trade-item:last-child { border-bottom: 0; }
.trade-trigger {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 14px;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 7px 2px;
    list-style: none;
    cursor: pointer;
    border-radius: 9px;
}
.trade-trigger::-webkit-details-marker { display: none; }
.trade-trigger:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; }
.trade-trigger .entry-result { text-align: right; }
.live-pnl { transition: color var(--duration-action) var(--ease-settle); }
.trade-trigger .trade-chevron { width: 14px; height: 14px; color: var(--soft); transition: transform var(--interaction); }
.trade-item details[open] .trade-chevron { transform: rotate(180deg); }
.trade-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 5px; color: var(--muted); font-size: .72rem; }
.trade-side[data-side="long"] { color: var(--acid); }
.trade-side[data-side="short"] { color: var(--loss); }
.trade-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; margin: 0 0 9px; padding: 10px 12px; background: var(--input); border-radius: 9px; }
.trade-data dt { color: var(--muted); font-size: .72rem; }
.trade-data dd { margin: 0; font-size: .81rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.market-grid img[src$="xrp.png"], .coin-logo[src$="xrp.png"] { padding: 3px; border-radius: 50%; background: #eceff5; }
@media (hover: hover) {
    .trade-trigger:hover { background: var(--control); }
}
@media (max-width: 360px) {
    .trade-trigger { gap: 5px; grid-template-columns: 33px minmax(0, 1fr) auto 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .trade-trigger .trade-chevron { transition: none; }
}

#feed-list {
    overflow-anchor: none;
    max-height: min(58svh, 460px);
    overflow-y: auto;
    scrollbar-color: var(--control-line) transparent;
    scrollbar-width: thin;
}
#feed-list:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

:root {
    --ease-settle: cubic-bezier(.2, .75, .25, 1);
    --duration-action: 150ms;
    --duration-content: 220ms;
    --duration-dialog: 285ms;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
[data-wallet-amount] { font-variant-numeric: tabular-nums; }
[data-balance-masked] {
    display: inline-block;
    position: relative;
    min-inline-size: var(--masked-width, 3.3em);
}
[data-balance-masked]::after {
    content: "";
    position: absolute;
    inset-inline: 5%;
    top: 50%;
    height: .48em;
    border-radius: 1em;
    background: repeating-linear-gradient(90deg, currentColor 0 .22em, transparent .28em .38em);
    filter: blur(clamp(2px, .12em, 6px));
    opacity: .65;
    pointer-events: none;
    transform: translateY(-50%) scaleX(.96);
    animation: balance-conceal var(--duration-content) var(--ease-settle);
}
[data-balance-reveal] { animation: balance-reveal var(--duration-content) var(--ease-settle); }
#toggle-balance .ui-icon { transition: color var(--duration-action), transform var(--duration-action) var(--ease-settle); }
#toggle-balance[aria-pressed="true"] .ui-icon { color: var(--violet); transform: scale(.91); }
.chart-private { margin-top: 10px; }
#dashboard:not([hidden]), #history:not([hidden]) { animation: view-enter var(--duration-content) var(--ease-settle); }
dialog[open] { animation: dialog-enter var(--duration-dialog) var(--ease-settle); }
dialog[open]::backdrop { animation: backdrop-enter 190ms var(--ease-settle); }
.trade-arrival { animation: trade-enter var(--duration-content) var(--ease-settle); }
.trade-detail-enter { animation: view-enter var(--duration-action) var(--ease-settle); }

@keyframes balance-conceal {
    from { opacity: .15; transform: translateY(-50%) scaleX(.78); }
    to { opacity: .65; transform: translateY(-50%) scaleX(.96); }
}
@keyframes balance-reveal {
    from { opacity: .45; filter: blur(5px); transform: translateY(1px); }
    to { opacity: 1; filter: none; transform: none; }
}
@keyframes view-enter {
    from { opacity: .68; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
@keyframes dialog-enter {
    from { opacity: .22; transform: translateY(12px) scale(.984); }
    to { opacity: 1; transform: none; }
}
@keyframes backdrop-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes trade-enter {
    from { opacity: .48; transform: translateY(-3px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    #dashboard:not([hidden]), #history:not([hidden]), dialog[open], dialog[open]::backdrop,
    [data-balance-masked]::after, [data-balance-reveal], .trade-arrival, .trade-detail-enter { animation: none; }
    #toggle-balance .ui-icon, .live-pnl { transition: none; }
}

.history-title { display: flex; align-items: center; gap: 8px; margin: 6px 0 15px; }
.history-title h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 740; }
#history-back {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-left: -6px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
}
#history-back:hover { color: var(--ink); background: var(--surface); }
.history .history-filters {
    display: grid;
    grid-template-columns: .88fr .62fr 1.09fr 1.4fr;
    gap: 3px;
    padding: 3px;
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--input);
}
.history-filters button {
    min-width: 0;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 5px 1px;
    font-size: .79rem;
}
.history-filters button[aria-pressed="true"] { background: var(--selection); color: var(--violet); }
.history-filters button:focus-visible { outline-offset: -2px; }
.history-list, .history-empty { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history-list { padding: 1px 11px; overflow-anchor: none; }
.history-list .entry { grid-template-columns: 34px minmax(0, 1fr) auto; padding-inline: 2px; }
.history-list .entry:last-child { border-bottom: 0; }
.history-list .trade-trigger { min-height: 58px; }
.history-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 30px 20px 19px;
    text-align: center;
}
.history-empty-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--selection);
    color: var(--violet);
    margin-bottom: 5px;
}
.history-empty-mark .ui-icon { width: 21px; height: 21px; }
.history-empty h2 { font-size: 1.06rem; letter-spacing: -.025em; }
.history-empty p { color: var(--muted); font-size: .82rem; }
#history-empty-wallet { min-height: 44px; gap: 4px; }
#history-empty-wallet .ui-icon { width: 14px; height: 14px; }
.brand-upload { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: end; gap: 12px; }
#branding-logo { border: 1px solid var(--line); background: var(--input); }
.brand-upload input[type="file"] { padding: 7px; font-size: .79rem; }
.brand-upload input::file-selector-button {
    padding: 5px 7px;
    margin-right: 7px;
    border: 0;
    border-radius: 5px;
    background: var(--control);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
.form-stack .brand-reset { display: flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; }
.brand-reset input { margin: 0; padding: 0; width: 16px; height: 16px; min-height: 0; accent-color: var(--action); }


dialog.action-sheet {
    --sheet-travel: 10px;
    --sheet-top: clamp(18px, 12dvh, 100px);
    --sheet-padding: 20px;
    position: fixed;
    inset: 0;
    width: min(420px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - var(--sheet-top) - 18px);
    margin: var(--sheet-top) auto auto;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 18px 54px #080a1066;
    opacity: 0;
    transform: translateY(var(--sheet-travel));
    transition: opacity 130ms ease, transform 150ms var(--ease-settle), display 150ms allow-discrete, overlay 150ms allow-discrete;
}
dialog.action-sheet[open] {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    animation: none;
    transition-duration: 210ms;
}
dialog.action-sheet::backdrop { background: #080a10b8; opacity: 0; transition: opacity 150ms ease, display 150ms allow-discrete, overlay 150ms allow-discrete; }
dialog.action-sheet[open]::backdrop { opacity: 1; animation: none; transition-duration: 210ms; }
@starting-style {
    dialog.action-sheet[open] { opacity: 0; transform: translateY(var(--sheet-travel)); }
    dialog.action-sheet[open]::backdrop { opacity: 0; }
}
@supports not (transition-behavior: allow-discrete) {
    dialog.action-sheet[open] { animation: sheet-enter 210ms var(--ease-settle); }
    dialog.action-sheet[open]::backdrop { animation: backdrop-enter 210ms ease; }
}
@keyframes sheet-enter {
    from { opacity: 0; transform: translateY(var(--sheet-travel)); }
    to { opacity: 1; transform: translateY(0); }
}
.sheet-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 8px var(--sheet-padding);
}
.sheet-header h2 { margin: 0; font-size: 1.44rem; }
.sheet-header h2:focus { outline: 0; }
.sheet-header .icon-button { flex: 0 0 44px; background: transparent; border-color: transparent; color: var(--muted); }
.sheet-header .icon-button:hover { background: var(--control); color: var(--ink); }
.sheet-body { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; margin: 0; }
.sheet-content { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding-block: 8px; padding: 0 var(--sheet-padding) 12px; }
.sheet-content .notice { margin-bottom: 8px; }
.fund-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0 14px;
}
.fund-amount-label { display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 680; }
.fund-amount p { margin-top: 2px; color: var(--muted); font-size: .74rem; font-weight: 500; }
#fund-amount { font-size: 1.34rem; font-weight: 740; line-height: 1.15; letter-spacing: -.03em; text-align: right; font-variant-numeric: tabular-nums; }
.fund-fields { border: 1px solid var(--line); border-radius: 13px; background: var(--input); }
#fund-network { border-top: 1px solid var(--line); }
.fund-picker-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    touch-action: manipulation;
}
.fund-picker-toggle:focus-visible, .fund-option:focus-visible { outline-offset: -2px; }
.fund-picker-label { margin-right: auto; color: var(--muted); font-size: .85rem; font-weight: 620; }
.fund-picker-value { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; text-align: right; }
.fund-picker-value strong { font-size: .9rem; font-weight: 720; }
.fund-picker-value .coin-logo { width: 20px; height: 20px; }
.fund-fixed-network { color: var(--muted); font-size: .74rem; }
.fund-picker-chevron {
    width: 15px;
    height: 15px;
    color: var(--muted);
    transition: transform 180ms var(--ease-settle), color 150ms ease;
}
.fund-picker-toggle[aria-expanded="true"] .fund-picker-chevron { color: var(--violet); transform: rotate(180deg); }
.fund-reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 170ms var(--ease-settle); }
.fund-reveal:not([inert]) { grid-template-rows: 1fr; transition-duration: 210ms; }
.fund-reveal > div { min-height: 0; overflow: hidden; }
.fund-options {
    display: grid;
    gap: 2px;
    padding: 4px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 140ms ease, transform 180ms var(--ease-settle);
}
.fund-menu[inert] .fund-options { opacity: 0; transform: translateY(-4px); }
.fund-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: .87rem;
    font-weight: 650;
    text-align: left;
    touch-action: manipulation;
}
.fund-option[aria-pressed="true"] { background: var(--selection); color: var(--violet); }
.fund-option span { flex: 1 1 auto; }
.fund-option .ui-icon { width: 16px; height: 16px; }
.fund-copy { flex: none; padding: 4px 10px; border: 0; border-radius: 8px; background: var(--selection); color: var(--violet); font-size: .78rem; font-weight: 660; touch-action: manipulation; }
.fund-copy:disabled { color: var(--muted); }
.fund-qr { display: grid; place-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--input); }
.fund-qr svg { width: min(100%, 190px); height: auto; }
.fund-detail { margin-top: 12px; }
.fund-detail-label { color: var(--muted); font-size: .74rem; font-weight: 620; }
.fund-detail-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.fund-detail-row code { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: .84rem; font-weight: 640; }
.fund-status { margin: 12px 2px 0; color: var(--muted); font-size: .86rem; font-weight: 550; }
.fund-change { width: 100%; margin-top: 12px; }
.sheet-footer { flex: none; padding: 8px var(--sheet-padding) 16px; border-top: 1px solid var(--line); }
.sheet-footer .button { width: 100%; min-height: 48px; }
@media (hover: hover) {
    .fund-picker-toggle:hover { background: var(--surface); }
    .fund-option:hover { background: var(--selection); }
}
@media (max-width: 540px) {
    dialog.action-sheet {
        --sheet-travel: 30px;
        --sheet-padding: 16px;
        --sheet-mobile-height: calc(var(--sheet-visible-height, 100dvh) - max(12px, env(safe-area-inset-top)));
        bottom: var(--sheet-bottom-offset, 0px);
        width: 100%;
        max-height: var(--sheet-mobile-height);
        margin: auto auto 0;
        border-radius: 20px 20px 0 0;
        border-bottom: 0;
    }
    .sheet-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
    dialog.action-sheet, dialog.action-sheet[open], dialog.action-sheet::backdrop, dialog.action-sheet[open]::backdrop,
    .fund-picker-chevron, .fund-reveal, .fund-reveal:not([inert]), .fund-options {
        animation: none;
        transition: none;
    }
}

#withdraw-dialog { height: min(496px, calc(100dvh - var(--sheet-top) - 18px)); }
.withdrawal-footer { display: grid; gap: 4px; }
.withdrawal-footer .text-button { min-height: 44px; justify-content: center; }
.withdraw-stage { display: grid; gap: 12px; }
.withdraw-stage > p { font-size: .86rem; }
#withdraw-form { margin: 0; }
#withdraw-form .amount-field input { min-height: 48px; }
#use-max { min-width: 52px; }
.withdraw-stage .summary {
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--input);
}
.withdraw-stage .summary div { padding: 10px 0; }
.withdraw-stage .summary div:last-child { border-bottom: 0; }
.withdraw-stage .summary dd { font-size: .87rem; font-variant-numeric: tabular-nums; }
.aml-stage { justify-items: center; row-gap: 10px; padding: 16px 4px 8px; text-align: center; }
.aml-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--violet-bg); color: var(--violet); }
.aml-icon .ui-icon { width: 26px; height: 26px; }
.aml-heading { font-size: .98rem; font-weight: 680; }
.aml-text { color: var(--muted); }
.aml-handle { font-weight: 700; }
.plan-choices { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--input); }
.plan-options label {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: .87rem;
    transition: background-color var(--interaction), color var(--interaction);
}
.plan-options label + label { border-top: 1px solid var(--line); }
.plan-options label:has(input:checked) { background: var(--selection); color: var(--violet); }
.plan-options input[type="radio"] { width: 15px; height: 15px; flex: 0 0 15px; margin: 0; accent-color: var(--action); }
.plan-options label strong { margin-left: auto; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
    .plan-options label:hover { background: var(--surface); }
    .plan-options label:has(input:checked):hover { background: var(--selection); }
}
@media (max-width: 540px) {
    html:has(dialog.action-sheet[open]) { overflow: hidden; }
    #withdraw-dialog { height: fit-content; }
    #withdraw-title { font-size: 1.32rem; }
}
@media (prefers-reduced-motion: no-preference) {
    #withdraw-dialog[open] .withdraw-stage { animation: withdraw-stage-enter 155ms var(--ease-settle); }
}
@keyframes withdraw-stage-enter {
    from { opacity: .6; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .plan-options label { transition: none; }
}

dialog.settings-sheet {
    width: min(468px, calc(100% - 32px));
    height: min(610px, calc(100dvh - var(--sheet-top) - 18px));
}
.settings-tabs {
    flex: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    margin: 0 var(--sheet-padding) 12px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--input);
}
.settings-tabs button { min-width: 0; min-height: 44px; padding: 4px; border: 0; border-radius: 8px; font-size: .8rem; }
.settings-tabs button[aria-pressed="true"] { color: var(--violet); background: var(--selection); }
.settings-tabs button:focus-visible { outline-offset: -2px; }
.settings-footer { display: grid; gap: 4px; }
.settings-footer .text-button { min-height: 44px; justify-content: center; }
.settings-panel, .settings-group { display: grid; gap: 10px; }
.settings-group h3, .settings-section-head h3 { margin: 0; font-size: .93rem; letter-spacing: -.02em; }
.profile-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--input);
}
.profile-identity { display: flex; align-items: center; gap: 8px; }
.profile-avatar, .settings-row-icon {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--selection);
    color: var(--violet);
    font-weight: 740;
}
.profile-identity > div { min-width: 0; flex: 1; }
.profile-identity strong { display: block; overflow-wrap: anywhere; font-size: .88rem; }
.profile-identity p { font-size: .74rem; }
.profile-identity .plan { flex: 0 0 auto; }
.profile-balance-label { margin: 14px 0 2px; font-size: .8rem; }
.profile-total { display: inline-block; font-size: 1.95rem; line-height: 1.17; letter-spacing: -.04em; overflow-wrap: anywhere; max-width: 100%; }
.profile-metrics, .profile-activity-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 10px 0 0; }
.profile-metrics div, .profile-activity-totals div { min-width: 0; padding: 8px; border-radius: 8px; background: var(--surface); }
.profile-metrics dt, .profile-activity-totals dt { color: var(--muted); font-size: .74rem; }
.profile-metrics dd, .profile-activity-totals dd { margin: 1px 0 0; font-size: .86rem; font-weight: 720; overflow-wrap: anywhere; }
.profile-activity-totals { margin-top: 0; }
.profile-activity-totals div { background: var(--input); border: 1px solid var(--line); margin-right: 2px; }
.profile-activity-totals div:last-child { margin-right: 0; margin-left: 2px; }
.settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--input);
    font-size: .85rem;
}
.settings-row > :last-child:not(div) { margin-left: auto; }
.settings-row p, .setting-detail { display: block; color: var(--muted); font-size: .74rem; }
.settings-row-icon .ui-icon { width: 17px; height: 17px; }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.settings-section-head .button { min-height: 44px; gap: 4px; white-space: nowrap; font-size: .78rem; }
.settings-section-head .ui-icon { width: 14px; height: 14px; }
#profile-operations { padding-inline: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); }
#profile-operations .entry { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 6px; }
#profile-operations .entry:last-child { border-bottom: 0; }
#profile-operations .entry-result { font-size: .79rem; }
.profile-empty { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); }
.profile-switch { cursor: pointer; }
.profile-switch input {
    appearance: none;
    position: relative;
    flex: 0 0 36px;
    height: 22px;
    margin: 0;
    border: 1px solid var(--soft);
    border-radius: 12px;
    background: var(--control);
    cursor: pointer;
    transition: background-color var(--interaction);
}
.profile-switch input::after {
    content: "";
    position: absolute;
    inset: 3px auto auto 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ink);
    transition: transform var(--interaction);
}
.profile-switch input:checked { background: var(--action); border-color: var(--action); }
.profile-switch input:checked::after { background: var(--action-ink); transform: translateX(14px); }
#profile-error, #profile-status { margin: 0; }
#admin-scroll .form-stack { margin-top: 10px; }
#admin-prices .form-stack { gap: 8px; }
#admin-prices .form-stack label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(78px, 96px);
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--input);
    font-size: .84rem;
}
#admin-prices input { text-align: right; }
#admin-prices p, #admin-branding p { margin: 0; }
#admin-accounts .summary { margin-block: 8px; padding-inline: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); }
#admin-accounts .summary div:last-child { border-bottom: 0; }
#admin-accounts .account-list { margin-top: 10px; }
#back-to-accounts { min-height: 44px; margin-bottom: 4px; }
@media (max-width: 540px) {
    dialog.settings-sheet {
        width: 100%;
        height: min(642px, var(--sheet-mobile-height));
    }
}
@media (prefers-reduced-motion: no-preference) {
    .settings-panel:not([hidden]), #admin-prices:not([hidden]), #admin-branding:not([hidden]),
    #account-directory:not([hidden]), #account-detail:not([hidden]) { animation: withdraw-stage-enter 155ms var(--ease-settle); }
}
@media (prefers-reduced-motion: reduce) {
    .profile-switch input, .profile-switch input::after { transition: none; }
}

@media (max-width: 420px) {
    .wallet-actions .button {
        min-width: 0;
        min-height: 60px;
        padding: 6px;
        gap: 6px;
        font-size: .79rem;
        line-height: 1.24;
    }
}
