/* ==========================================================================
   HaechiBot — mobile-first 9:16 UI
   ========================================================================== */

:root {
    --bg: #05080d;
    --bg-soft: #080d14;
    --surface: #0b111a;
    --surface-2: #101824;
    --surface-3: #141e2b;
    --line: rgba(255, 255, 255, .065);
    --line-strong: rgba(255, 255, 255, .13);
    --text: #e9eff7;
    --muted: #8a98ab;
    --dim: #5d6b7d;
    --gold: #f2c879;
    --gold-2: #e0a93b;
    --gold-soft: rgba(242, 200, 121, .12);
    --green: #38d67f;
    --green-soft: rgba(56, 214, 127, .12);
    --red: #ff5f6d;
    --red-soft: rgba(255, 95, 109, .12);
    --blue: #6bb8ff;
    --violet: #a78bfa;
    --amber: #ffc65c;
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-card: 0 18px 40px rgba(0, 0, 0, .35);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
canvas { display: block; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ ambient */

.ambient {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .5;
}

.orb-gold {
    width: 520px;
    height: 520px;
    top: -220px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(242, 200, 121, .22), transparent 65%);
}

.orb-teal {
    width: 420px;
    height: 420px;
    bottom: -200px;
    right: -140px;
    background: radial-gradient(circle, rgba(56, 214, 127, .12), transparent 65%);
}

.grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 80%);
}

/* ------------------------------------------------------------------- device */

.app-body, .auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    overflow-x: hidden;
}

.device {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    min-width: 0;
    height: 100dvh;
    background:
        radial-gradient(120% 60% at 50% -10%, rgba(242, 200, 121, .06), transparent 55%),
        linear-gradient(180deg, #070b11 0%, #05080d 100%);
    overflow: hidden;
}

@media (min-width: 560px) {
    .app-body, .auth-body { padding: 22px; }
    .device {
        width: 404px;
        height: 718px;
        max-height: calc(100dvh - 40px);
        border-radius: 38px;
        border: 1px solid rgba(255, 255, 255, .08);
        box-shadow:
            0 0 0 7px #0a0e14,
            0 0 0 8px rgba(255, 255, 255, .05),
            0 50px 120px rgba(0, 0, 0, .75),
            0 0 90px rgba(242, 200, 121, .05);
    }
}

/* ------------------------------------------------------------------- header */

.app-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 10px;
}

.wallet-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #1d1405;
    background: linear-gradient(145deg, #f7dda2, #d7a33c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 18px rgba(224, 169, 59, .18);
}

.wallet-meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.wallet-meta strong { font-size: 13.5px; font-weight: 650; letter-spacing: .01em; }
.wallet-meta em {
    font-style: normal;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.mode-chip {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    padding: 6px 9px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    background: rgba(255, 255, 255, .03);
}

.mode-chip.is-live { color: var(--red); border-color: rgba(255, 95, 109, .35); background: var(--red-soft); }
.mode-chip.is-testnet { color: var(--blue); border-color: rgba(107, 184, 255, .3); background: rgba(107, 184, 255, .08); }

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    transition: .18s ease;
}

.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; }

/* --------------------------------------------------------------------- main */

.app-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 16px 26px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.app-main::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ tab bar */

.tabbar {
    flex: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(7, 11, 17, .6), rgba(7, 11, 17, .95));
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0 2px;
    border: 0;
    background: none;
    color: var(--dim);
    transition: color .2s ease;
}

.tab svg { width: 21px; height: 21px; }
.tab span { font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.tab.is-active { color: var(--gold); }

.tab.is-active::before {
    content: '';
    position: absolute;
    top: -9px;
    width: 18px;
    height: 2px;
    border-radius: 99px;
    background: var(--gold);
    box-shadow: 0 0 12px rgba(242, 200, 121, .7);
}

/* ----------------------------------------------------------------- primitives */

.card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 34%),
        linear-gradient(180deg, #0c131d, #0a1018);
    box-shadow: var(--shadow-card);
    padding: 16px;
}

.card + .card { margin-top: 12px; }

.label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
}

.num { font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

.row { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: none;
    background: var(--muted);
}

.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(56, 214, 127, .8); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(255, 95, 109, .8); }
.dot-gold { background: var(--gold); box-shadow: 0 0 8px rgba(242, 200, 121, .8); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .02em;
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.pill-green { color: var(--green); border-color: rgba(56, 214, 127, .28); background: var(--green-soft); }
.pill-red { color: var(--red); border-color: rgba(255, 95, 109, .28); background: var(--red-soft); }
.pill-gold { color: var(--gold); border-color: rgba(242, 200, 121, .3); background: var(--gold-soft); }
.pill-blue { color: var(--blue); border-color: rgba(107, 184, 255, .28); background: rgba(107, 184, 255, .08); }

.delta { font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* -------------------------------------------------------------------- buttons */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 13px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: .01em;
    transition: transform .12s ease, filter .18s ease, background .18s ease;
}

.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-gold {
    background: linear-gradient(180deg, #f7dfa6 0%, #e7b34a 55%, #d79f33 100%);
    color: #1d1405;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 14px 30px rgba(224, 169, 59, .22);
}

.btn-gold:hover { filter: brightness(1.04); }

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

.btn-danger {
    background: rgba(255, 95, 109, .1);
    border-color: rgba(255, 95, 109, .35);
    color: #ff8b95;
}

.btn-sm { padding: 9px 12px; font-size: 12.5px; border-radius: 11px; width: auto; }
.btn-lg { padding: 15px 18px; border-radius: 16px; font-size: 15px; }
.btn-icon { width: 19px; height: 19px; flex: none; }

.link {
    border: 0;
    background: none;
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
    padding: 0;
}

/* --------------------------------------------------------------------- auth */

.device-auth { justify-content: center; }

.auth-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 22px 22px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    scrollbar-width: none;
}

.auth-shell::-webkit-scrollbar { display: none; }

.auth-top { display: flex; align-items: center; justify-content: space-between; }

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #1d1405;
    background: linear-gradient(145deg, #f7dda2, #d7a33c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 24px rgba(224, 169, 59, .2);
}

.brand-mark svg { width: 21px; height: 21px; }

.brand-text { display: flex; align-items: baseline; gap: 6px; letter-spacing: .04em; }
.brand-text strong { font-size: 14px; font-weight: 800; }
.brand-text em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .22em; color: var(--gold); }

.chain-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, .02);
}

.auth-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 26px 0 10px; }

.auth-hero { text-align: center; display: flex; flex-direction: column; align-items: center; }

.hero-mark { position: relative; width: 108px; height: 108px; display: grid; place-items: center; margin-bottom: 22px; }

.hero-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(242, 200, 121, .28);
    background: radial-gradient(circle at 50% 40%, rgba(242, 200, 121, .16), transparent 62%);
}

.hero-ring-2 { inset: 14px; border-color: rgba(255, 255, 255, .06); }

.hero-glyph {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 19px;
    display: grid;
    place-items: center;
    color: #1d1405;
    background: linear-gradient(150deg, #f9e3b1, #d9a53d);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 20px 40px rgba(224, 169, 59, .28);
}

.hero-glyph svg { width: 32px; height: 32px; }

.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .2em; color: var(--gold); margin-bottom: 12px; }

.auth-title {
    font-size: clamp(26px, 7.4vw, 31px);
    line-height: 1.14;
    letter-spacing: -.035em;
    font-weight: 750;
}

.auth-title span { color: var(--muted); font-weight: 600; }

.auth-lede { margin-top: 12px; font-size: 13px; line-height: 1.62; color: var(--muted); max-width: 300px; }

.auth-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }

.btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(29, 20, 5, .25);
    border-top-color: #1d1405;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.auth-status { min-height: 18px; text-align: center; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.auth-status.is-error { color: var(--red); }
.auth-status.is-ok { color: var(--green); }

.auth-points { display: grid; gap: 8px; margin-top: 24px; }
.auth-points li { display: flex; align-items: flex-start; gap: 9px; font-size: 11.5px; color: var(--muted); }

.point-ico {
    flex: none;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 9px;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid rgba(56, 214, 127, .25);
}

.auth-meta {
    margin-top: 26px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.auth-meta div { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.auth-meta span { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.auth-meta strong { font-size: 12px; font-weight: 650; }

.auth-foot { flex: none; text-align: center; padding-top: 14px; }
.auth-foot p { font-size: 10.5px; line-height: 1.55; color: var(--dim); }
.auth-foot .muted { margin-top: 4px; color: var(--dim); opacity: .75; }

/* ------------------------------------------------------------------- screens */

.screen { animation: fadeUp .3s ease both; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-head { padding: 10px 2px 14px; }
.page-head h1 { font-size: 22px; font-weight: 750; letter-spacing: -.03em; }
.page-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }

.section { margin-top: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.section-head h2 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }

/* -------------------------------------------------------------------- equity */

.equity-card {
    overflow: hidden;
    padding: 18px 16px 14px;
    background:
        radial-gradient(90% 80% at 100% 0%, rgba(242, 200, 121, .16), transparent 55%),
        linear-gradient(180deg, #111a26, #0a1019 70%);
    border-color: rgba(242, 200, 121, .16);
}

.equity-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, rgba(242, 200, 121, .42), rgba(255, 255, 255, .02) 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.equity-top { display: flex; align-items: center; justify-content: space-between; }

.equity-num {
    font-size: 34px;
    font-weight: 750;
    letter-spacing: -.045em;
    line-height: 1.1;
    margin-top: 10px;
}

.equity-sub { display: flex; align-items: center; gap: 7px; margin-top: 5px; font-size: 11.5px; }

.spark { width: 100%; height: 46px; margin-top: 10px; opacity: .95; }

.equity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.equity-grid div { display: flex; flex-direction: column; gap: 2px; }
.equity-grid span { font-size: 10px; color: var(--dim); }
.equity-grid strong { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- home blocks */

.onboard {
    border-color: rgba(242, 200, 121, .22);
    background:
        linear-gradient(180deg, rgba(242, 200, 121, .09), rgba(242, 200, 121, .01) 60%),
        #0b111a;
}

.onboard-steps { display: grid; gap: 8px; margin-top: 10px; }

.onboard-step { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.onboard-step .step-no {
    width: 19px;
    height: 19px;
    flex: none;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--gold);
    border: 1px solid rgba(242, 200, 121, .28);
    background: var(--gold-soft);
}

.onboard-step.done { color: var(--text); }
.onboard-step.done .step-no { color: #07130c; background: var(--green); border-color: transparent; }

.bot-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 650;
    color: var(--muted);
}

.bot-status.is-running { color: var(--green); }
.bot-status.is-error { color: var(--red); }

.bot-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.mini-stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mini-stat span { font-size: 10px; color: var(--dim); }
.mini-stat strong { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- coin cards */

.coin-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    margin: 0 -2px;
    scrollbar-width: none;
}

.coin-scroll::-webkit-scrollbar { display: none; }

.coin-mini {
    flex: none;
    width: 152px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 45%),
        #0b111a;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    transition: border-color .18s ease, transform .18s ease;
}

.coin-mini:hover { border-color: rgba(242, 200, 121, .3); transform: translateY(-1px); }

.coin-mini-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.coin-sym { display: flex; align-items: center; gap: 7px; min-width: 0; }

.coin-badge {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 750;
    color: var(--text);
    background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .02));
    border: 1px solid var(--line);
}

.coin-sym b { font-size: 12.5px; font-weight: 650; letter-spacing: .01em; }
.coin-sym small { display: block; font-size: 9.5px; color: var(--dim); font-weight: 500; }

.score-ring {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 9.5px;
    font-weight: 750;
    color: var(--gold);
    background: conic-gradient(var(--gold) calc(var(--score, 0) * 1%), rgba(255, 255, 255, .07) 0);
    position: relative;
}

.score-ring::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #0b111a;
}

.score-ring span { position: relative; z-index: 1; }

.coin-price { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.coin-mini .tags { display: flex; gap: 4px; flex-wrap: wrap; }

.tag {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--muted);
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--line);
}

.tag-gold { color: var(--gold); border-color: rgba(242, 200, 121, .22); background: var(--gold-soft); }
.tag-green { color: var(--green); border-color: rgba(56, 214, 127, .22); background: var(--green-soft); }
.tag-red { color: var(--red); border-color: rgba(255, 95, 109, .22); background: var(--red-soft); }

/* ------------------------------------------------------------------ positions */

.pos-list { display: grid; gap: 9px; }

.pos-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #0b111a;
    padding: 11px 12px;
}

.pos-row .coin-badge { width: 30px; height: 30px; border-radius: 10px; font-size: 10.5px; }
.pos-main { flex: 1; min-width: 0; }
.pos-main b { display: block; font-size: 12.5px; font-weight: 650; }
.pos-main span { font-size: 10.5px; color: var(--dim); }
.pos-pnl { text-align: right; }
.pos-pnl b { display: block; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pos-pnl span { font-size: 10px; color: var(--dim); }

/* --------------------------------------------------------------------- market */

.search {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .025);
    border-radius: 13px;
    padding: 0 12px;
    height: 44px;
}

.search svg { width: 17px; height: 17px; color: var(--dim); flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 13px; }
.search input::placeholder { color: var(--dim); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }

.filter {
    flex: none;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 11px;
    font-weight: 600;
    transition: .16s ease;
}

.filter.is-active { color: #1d1405; background: var(--gold); border-color: var(--gold); }

.market-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); padding: 8px 2px 10px; }

.coin-list { display: grid; gap: 7px; }

.coin-row {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    text-align: left;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #0b111a;
    transition: border-color .16s ease;
}

.coin-row:hover { border-color: rgba(242, 200, 121, .25); }
.coin-row .coin-badge { width: 34px; height: 34px; border-radius: 11px; font-size: 11px; }

.coin-name { display: flex; align-items: center; gap: 6px; }
.coin-name b { font-size: 13px; font-weight: 650; }
.coin-sub { font-size: 10px; color: var(--dim); margin-top: 1px; display: flex; gap: 6px; align-items: center; }

.coin-right { text-align: right; }
.coin-right b { display: block; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.coin-right .delta { font-size: 11px; margin-top: 1px; }

.score-bar { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .06); overflow: hidden; margin-top: 6px; }
.score-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, rgba(242, 200, 121, .45), var(--gold)); }

/* ------------------------------------------------------------------ strategy */

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 3px;
    padding: 3px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.segmented button {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    padding: 8px 4px;
    border-radius: 9px;
    transition: .16s ease;
}

.segmented button.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }

.strat-list { display: grid; gap: 10px; margin-top: 12px; }

.strat-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 40%),
        #0b111a;
    padding: 14px;
    transition: border-color .18s ease, box-shadow .18s ease;
    cursor: pointer;
}

.strat-card:hover { border-color: var(--line-strong); }
.strat-card.is-selected { border-color: rgba(242, 200, 121, .55); box-shadow: 0 0 0 1px rgba(242, 200, 121, .18), 0 18px 40px rgba(0, 0, 0, .4); }

.strat-top { display: flex; align-items: flex-start; gap: 11px; }

.strat-icon {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--gold);
}

.strat-icon svg { width: 19px; height: 19px; }
.strat-icon.emerald { color: var(--green); background: var(--green-soft); border-color: rgba(56, 214, 127, .22); }
.strat-icon.sky { color: var(--blue); background: rgba(107, 184, 255, .1); border-color: rgba(107, 184, 255, .22); }
.strat-icon.amber { color: var(--amber); background: rgba(255, 198, 92, .1); border-color: rgba(255, 198, 92, .22); }
.strat-icon.violet { color: var(--violet); background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .22); }

.strat-title { display: flex; align-items: center; gap: 6px; }
.strat-title b { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.strat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

.strat-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.strat-stats div { display: flex; flex-direction: column; gap: 1px; }
.strat-stats span { font-size: 9px; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; }
.strat-stats strong { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

.strat-rules {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    display: none;
    gap: 5px;
}

.strat-card.is-open .strat-rules { display: grid; }
.strat-rules li { font-size: 10.5px; color: var(--muted); display: flex; gap: 7px; line-height: 1.5; }
.strat-rules li::before { content: '·'; color: var(--gold); font-weight: 800; }

.strat-cta { display: flex; gap: 8px; margin-top: 12px; }
.strat-note { font-size: 10.5px; color: var(--dim); margin-top: 10px; line-height: 1.5; }

/* ----------------------------------------------------------------------- bot */

.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 12px; }

.mode-switch button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    border-radius: 11px;
    padding: 9px 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mode-switch button small { font-size: 8.5px; font-weight: 500; letter-spacing: 0; color: var(--dim); }
.mode-switch button.is-active { color: var(--text); border-color: rgba(242, 200, 121, .4); background: var(--gold-soft); }
.mode-switch button.is-live.is-active { color: var(--red); border-color: rgba(255, 95, 109, .4); background: var(--red-soft); }
.mode-switch button:disabled { opacity: .45; cursor: not-allowed; }

.btn.is-loading { pointer-events: none; opacity: .7; }

.bot-hero { padding: 16px; }
.bot-hero-status { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 650; }

.bot-equity { font-size: 27px; font-weight: 750; letter-spacing: -.04em; margin-top: 6px; font-variant-numeric: tabular-nums; }

.bot-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.bot-kpi { text-align: left; }
.bot-kpi span { display: block; font-size: 9.5px; color: var(--dim); }
.bot-kpi strong { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }

.input, .select {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #080d14;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.input:focus, .select:focus { border-color: rgba(242, 200, 121, .5); box-shadow: 0 0 0 3px rgba(242, 200, 121, .1); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a98ab' stroke-width='1.6'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.quick-amounts { display: flex; gap: 6px; margin-top: 6px; }
.quick-amounts button {
    flex: 1;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 650;
    padding: 5px 0;
}
.quick-amounts button.is-active { color: var(--gold); border-color: rgba(242, 200, 121, .35); background: var(--gold-soft); }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--text);
    font-size: 16px;
}
.stepper output { flex: 1; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }

.safety { display: grid; gap: 6px; margin-top: 12px; }
.safety-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.safety-row .dot { width: 7px; height: 7px; }
.safety-row.ok { color: var(--text); }
.safety-row.bad { color: var(--red); }

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin: 18px 2px 12px; }
.tabs button {
    border: 0;
    background: none;
    color: var(--dim);
    font-size: 12px;
    font-weight: 650;
    padding: 0 0 9px;
    position: relative;
}
.tabs button.is-active { color: var(--text); }
.tabs button.is-active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--gold);
}

.tab-panel { min-height: 120px; }

.pos-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #0b111a;
    padding: 13px;
    margin-bottom: 9px;
}

.pos-card-top { display: flex; align-items: center; gap: 9px; }
.pos-card-top .coin-badge { width: 32px; height: 32px; border-radius: 10px; }
.pos-card-top .grow b { font-size: 13px; font-weight: 650; display: block; }
.pos-card-top .grow span { font-size: 10px; color: var(--dim); }
.pos-pnl-big { text-align: right; }
.pos-pnl-big b { display: block; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-pnl-big span { font-size: 10.5px; }

.pos-detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 11px; }
.pos-detail span { display: block; font-size: 9px; color: var(--dim); }
.pos-detail strong { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

.progress { position: relative; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .07); margin: 12px 0 7px; }
.progress i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, rgba(255, 95, 109, .6), var(--gold), var(--green)); }
.progress .marker { position: absolute; top: -2px; width: 2px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, .8); transform: translateX(-1px); }

.progress-legend { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--dim); }
.progress-legend b { color: var(--muted); font-weight: 600; }

.pos-actions { display: flex; gap: 7px; margin-top: 11px; }

.log-list { display: grid; gap: 1px; }
.log-row { display: flex; gap: 9px; padding: 9px 2px; border-bottom: 1px solid rgba(255, 255, 255, .04); font-size: 11px; line-height: 1.5; }
.log-row .log-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--dim); }
.log-row.info .log-dot { background: var(--blue); }
.log-row.success .log-dot { background: var(--green); }
.log-row.warn .log-dot { background: var(--amber); }
.log-row.error .log-dot { background: var(--red); }
.log-row time { display: block; font-size: 9px; color: var(--dim); margin-top: 2px; font-variant-numeric: tabular-nums; }

.hist-row { display: flex; align-items: center; gap: 9px; padding: 10px 2px; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .coin-badge { width: 28px; height: 28px; border-radius: 9px; font-size: 9.5px; }

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 34px 16px;
    text-align: center;
    color: var(--dim);
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
}

.empty b { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.empty span { font-size: 11px; }

/* -------------------------------------------------------------------- account */

.acct-wallet { display: flex; align-items: center; gap: 12px; }

.acct-addr {
    font-family: 'SFMono-Regular', ui-monospace, 'Cascadia Code', monospace;
    font-size: 11px;
    color: var(--muted);
    word-break: break-all;
    line-height: 1.5;
}

.key-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: rgba(255, 255, 255, .018); }
.key-card + .key-card { margin-top: 8px; }

.key-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.key-env { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); }
.key-mask { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text); margin-top: 4px; }
.key-detail { font-size: 10.5px; color: var(--dim); margin-top: 6px; line-height: 1.5; }

.check-list { display: grid; gap: 5px; margin-top: 10px; }
.check-row { display: flex; gap: 7px; align-items: flex-start; font-size: 11px; color: var(--muted); line-height: 1.45; }
.check-row .dot { margin-top: 5px; }
.check-row b { color: var(--text); font-weight: 600; }
.check-row.ok .dot { background: var(--green); box-shadow: 0 0 8px rgba(56, 214, 127, .7); }
.check-row.bad .dot { background: var(--red); box-shadow: 0 0 8px rgba(255, 95, 109, .7); }

.inline-actions { display: flex; gap: 7px; margin-top: 10px; }

.notice {
    border-radius: 13px;
    border: 1px solid rgba(242, 200, 121, .2);
    background: rgba(242, 200, 121, .06);
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.55;
    color: #e7d7b4;
}

.notice.red { border-color: rgba(255, 95, 109, .25); background: var(--red-soft); color: #ffb9bf; }
.notice.blue { border-color: rgba(107, 184, 255, .22); background: rgba(107, 184, 255, .07); color: #b9daff; }

/* --------------------------------------------------------------------- sheet */

.sheet-root { position: absolute; inset: 0; z-index: 50; display: flex; align-items: flex-end; }

.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 5, 9, .66);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .2s ease both;
}

.sheet {
    position: relative;
    width: 100%;
    max-height: 88%;
    background: linear-gradient(180deg, #101823, #0a1018 55%);
    border-top: 1px solid var(--line-strong);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -30px 80px rgba(0, 0, 0, .6);
    animation: sheetUp .26s cubic-bezier(.22, .9, .3, 1) both;
    display: flex;
    flex-direction: column;
}

@keyframes sheetUp { from { transform: translateY(28px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .16); margin: 9px auto 2px; flex: none; }

.sheet-body { padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }

.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.sheet-title h2 { font-size: 17px; font-weight: 750; letter-spacing: -.02em; }

.sheet-close {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 15px;
}

/* -------------------------------------------------------------------- toasts */

.toast-stack {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 86px;
    z-index: 70;
    display: grid;
    gap: 7px;
    pointer-events: none;
}

.auth-body .toast-stack { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; width: min(380px, calc(100% - 32px)); }

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(16, 24, 35, .95);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
    font-size: 12px;
    line-height: 1.45;
    animation: toastIn .22s ease both;
}

.toast::before { content: ''; width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--gold); }
.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }
.toast.warn::before { background: var(--amber); }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ skeleton */

.boot-skeleton { padding-top: 12px; display: grid; gap: 10px; }

.sk {
    border-radius: 16px;
    background: linear-gradient(100deg, rgba(255, 255, 255, .04) 20%, rgba(255, 255, 255, .075) 40%, rgba(255, 255, 255, .04) 60%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer { to { background-position: -200% 0; } }

.sk-hero { height: 168px; }
.sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sk-card { height: 84px; }
.sk-line { height: 54px; }
.sk-line.short { width: 72%; }

/* ------------------------------------------------------------------ utilities */

.mono { font-family: ui-monospace, 'Cascadia Code', 'SFMono-Regular', monospace; }
.center { text-align: center; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.w-full { width: 100%; }
.hide { display: none !important; }
.scroll-x { overflow-x: auto; }

.fade-in { animation: fadeUp .28s ease both; }

@media (max-width: 359px) {
    .equity-num { font-size: 29px; }
    .app-main { padding-left: 12px; padding-right: 12px; }
    .coin-mini { width: 140px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
