/* ============================================================
   TronEnergyRent Dashboard — design system
   Single-file styles, isolated from styles.css/custom.css
   ============================================================ */

:root {
    /* Brand palette (from landing page) */
    --brand-cyan: #00e1ff;
    --brand-blue: #007bff;
    --brand-teal: #00bfa6;
    --brand-amber: #ffc107;
    --brand-orange: #ff9800;
    --brand-gradient: linear-gradient(135deg, #ffc107, #ff9800);

    /* Light theme tokens */
    --bg: #f6f7fb;
    --bg-grad-1: #f6f7fb;
    --bg-grad-2: #eef0f7;
    --surface: #ffffff;
    --surface-alt: #f7f9fc;
    --surface-hover: #f0f3f9;
    --border: #e4e7ee;
    --border-strong: #ced3df;
    --text: #0f172a;
    --text-soft: #3f4a60;
    --text-muted: #5b6478;
    --accent: #ff9800;
    --accent-soft: rgba(255, 152, 0, 0.12);
    --accent-strong: #f57c00;
    --accent-glow: #ffc107;
    --on-accent: #1a1a1a;
    --success: #00bfa6;
    --success-soft: rgba(0, 191, 166, 0.12);
    --warning: #ffb300;
    --warning-soft: rgba(255, 179, 0, 0.14);
    --info: #00bfd8;
    --info-soft: rgba(0, 225, 255, 0.14);
    --danger: #e53935;
    --danger-soft: rgba(229, 57, 53, 0.10);

    --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-2: 0 4px 12px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
    --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.10);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --topnav-h: 64px;
    --sidebar-w: 248px;
    --sidebar-w-rail: 72px;

    --ease: cubic-bezier(.4, 0, .2, 1);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0c1220;
    --bg-grad-1: #101820;
    --bg-grad-2: #060b16;
    --surface: #18222f;
    --surface-alt: #1f2a3a;
    --surface-hover: #243144;
    --border: #283449;
    --border-strong: #354260;
    --text: #ecf2fb;
    --text-soft: #b3c0d4;
    --text-muted: #75829a;
    --accent: #ffb300;
    --accent-soft: rgba(255, 179, 0, 0.16);
    --accent-strong: #ffc107;
    --accent-glow: #ffd54f;
    --on-accent: #1a1a1a;
    --success: #1fd4a4;
    --success-soft: rgba(31, 212, 164, 0.16);
    --warning: #ffb547;
    --warning-soft: rgba(255, 181, 71, 0.16);
    --info: #00e1ff;
    --info-soft: rgba(0, 225, 255, 0.16);
    --danger: #ef5b5b;
    --danger-soft: rgba(239, 91, 91, 0.16);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    min-height: 100vh;
}

body.ter-dashboard {
    background:
        radial-gradient(1200px 600px at 80% -200px, var(--accent-soft), transparent 60%),
        linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* hide native bootstrap noise on these dashboard pages */
.ter-dashboard .container-fluid > h1.mt-4 { display: none; }

/* utility classes (Bootstrap-compat without loading the whole framework) */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
@media (min-width: 576px) {
    .d-sm-inline { display: inline !important; }
    .d-sm-block { display: block !important; }
}
@media (min-width: 768px) {
    .d-md-inline { display: inline !important; }
    .d-md-block { display: block !important; }
}

/* ============================================================
   Layout
   ============================================================ */
.ter-app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topnav-h) 1fr;
    grid-template-areas:
        "topnav topnav"
        "sidebar main";
    min-height: 100vh;
}

.ter-topnav { grid-area: topnav; }
.ter-sidebar { grid-area: sidebar; }
.ter-main { grid-area: main; min-width: 0; }

@media (min-width: 768px) and (max-width: 1199px) {
    .ter-app { grid-template-columns: var(--sidebar-w-rail) 1fr; }
    .ter-sidebar .ter-side-label { display: none; }
    .ter-sidebar .ter-side-heading { display: none; }
    .ter-sidebar .ter-side-link {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }
    .ter-sidebar .ter-side-icon { margin-right: 0; }
    .ter-sidebar .ter-side-link.is-active { border-radius: 12px; margin: 0 8px 4px; }
    .ter-sidebar .ter-side-footer { padding: 12px 8px; text-align: center; }
    .ter-sidebar .ter-side-copy { display: none; }
    /* Vertical stack on rail: sun on top, moon below */
    .ter-sidebar .ter-theme-segmented {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        gap: 3px;
        padding: 3px;
        margin: 0 auto;
        max-width: 48px;
    }
    .ter-sidebar .ter-seg-btn {
        padding: 6px 0;
        min-height: 32px;
        border-radius: 8px;
    }
    .ter-sidebar .ter-seg-btn span { display: none; }
    .ter-sidebar .ter-seg-btn i { font-size: 14px; }
}

@media (max-width: 767px) {
    .ter-app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topnav"
            "main";
    }
    .ter-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform .35s var(--ease);
    }
    .ter-sidebar.is-open { transform: translateX(0); }
    .ter-sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(7, 10, 20, 0.55);
        backdrop-filter: blur(4px);
        z-index: 1090;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s var(--ease);
    }
    .ter-sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* ============================================================
   Top navigation
   ============================================================ */
.ter-topnav {
    position: sticky;
    top: 0;
    z-index: 1050;
    height: var(--topnav-h);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.ter-burger {
    display: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.ter-burger:hover { background: var(--surface-hover); }
@media (max-width: 991px) { .ter-burger { display: inline-flex; } }

.ter-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -0.01em;
    font-size: 1.05rem;
    color: var(--text);
}
.ter-brand-logo {
    width: 32px; height: 32px;
    display: block;
    object-fit: contain;
}
.ter-brand { transition: color .15s var(--ease); color: var(--text); }
.ter-brand:hover { color: #4ea3ff; }
.ter-brand:hover .ter-brand-name { color: #4ea3ff; }
.ter-brand-name {
    font-weight: 800;
    letter-spacing: -0.01em;
    transition: color .15s var(--ease);
}
@media (max-width: 991px) { .ter-brand-name { display: none; } }

.ter-topnav-links {
    display: flex;
    gap: 4px;
    margin-left: 24px;
}
.ter-topnav-links a {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
    transition: background .15s var(--ease), color .15s var(--ease);
}
.ter-topnav-links a:hover {
    background: color-mix(in srgb, var(--brand-blue) 18%, transparent);
    color: #4ea3ff;
}
@media (max-width: 991px) { .ter-topnav-links { display: none; } }

.ter-topnav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ter-icon-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s var(--ease);
}
.ter-icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.ter-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ter-theme-toggle .icon-sun,
.ter-theme-toggle .ter-theme-label-light { display: none; }
.ter-theme-toggle .icon-moon,
.ter-theme-toggle .ter-theme-label-dark { display: inline; }
[data-theme="dark"] .ter-theme-toggle .icon-sun,
[data-theme="dark"] .ter-theme-toggle .ter-theme-label-light { display: inline; }
[data-theme="dark"] .ter-theme-toggle .icon-moon,
[data-theme="dark"] .ter-theme-toggle .ter-theme-label-dark { display: none; }

/* Balance pill */
.ter-balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    transition: all .15s var(--ease);
    line-height: 1.15;
}
.ter-balance-pill:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.ter-balance-pill .ter-bal-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.45);
}
.ter-balance-pill .ter-bal-trx { font-variant-numeric: tabular-nums; }
.ter-balance-pill .ter-bal-usd {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 4px;
}
@media (max-width: 575px) {
    .ter-balance-pill .ter-bal-text { display: none; }
    .ter-balance-pill { padding: 6px; }
}

/* Dropdowns shared */
.ter-dropdown { position: relative; }
.ter-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 6px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .15s var(--ease), transform .15s var(--ease);
    z-index: 1200;
    max-height: 70vh;
    overflow-y: auto;
}
.ter-dropdown.is-open > .ter-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--text);
    font-size: 0.92rem;
    cursor: pointer;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
}
.ter-dropdown-item:hover { background: var(--surface-hover); color: var(--text); }
.ter-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

@media (max-width: 575px) {
    /* Topnav backdrop-filter creates a containing block for position:fixed
       descendants, which breaks the bottom-sheet anchor. Disable on mobile. */
    .ter-topnav {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .ter-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        border-radius: 18px 18px 0 0;
        border-bottom: 0;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }
    .ter-dropdown.is-open > .ter-dropdown-menu { transform: translateY(0); }
    .ter-dropdown.is-open::after {
        content: "";
        position: fixed; inset: 0;
        background: rgba(7, 10, 20, 0.45);
        z-index: 1190;
    }
    .ter-dropdown-menu { z-index: 1200; }
}

/* User menu trigger */
.ter-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    transition: all .15s var(--ease);
}
.ter-user-trigger:hover { background: var(--surface-hover); }
.ter-user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #00e1ff;
    color: #000;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 225, 255, 0.45);
    overflow: hidden;
    flex-shrink: 0;
}
.ter-user-trigger .ter-user-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 575px) { .ter-user-trigger .ter-user-email { display: none; } }

/* Lang picker */
.ter-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: all .15s var(--ease);
    min-height: 40px;
}
.ter-lang-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}
.ter-lang-flag { font-size: 16px; line-height: 1; }
.ter-lang-current { font-size: 0.86rem; font-weight: 700; letter-spacing: 0.04em; }
@media (max-width: 575px) {
    .ter-lang-current { display: none; }
    .ter-lang-trigger { padding: 8px 10px; }
}

/* ============================================================
   Sidebar
   ============================================================ */
.ter-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    overflow-y: auto;
    height: calc(100vh - var(--topnav-h));
    position: sticky;
    top: var(--topnav-h);
}
@media (max-width: 767px) {
    .ter-sidebar {
        position: fixed;
        top: 0;
        height: 100vh;
        padding-top: 24px;
    }
}

.ter-side-heading {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 14px 12px 6px;
}

.ter-side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 10px;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.88rem;
    margin: 0 4px 5px;
    transition: all .15s var(--ease);
    position: relative;
    min-height: 36px;
}
.ter-side-icon { font-size: 15px; }
.ter-side-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.ter-side-link.is-active {
    background: var(--brand-gradient);
    color: var(--on-accent);
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(255, 152, 0, 0.30);
}
.ter-side-link.is-active:hover {
    color: var(--on-accent);
    background: linear-gradient(135deg, #ffd54f, #ffb300);
}
.ter-side-link.is-active .ter-side-icon { color: var(--on-accent); }
.ter-side-icon {
    width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.ter-side-footer {
    margin-top: 18px;
    padding: 14px 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
}
.ter-side-copy { padding: 0 4px; }

.ter-theme-segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 12px;
}
.ter-seg-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 8px 6px;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .15s var(--ease);
    min-height: 36px;
}
.ter-seg-btn:hover { color: var(--text); }
.ter-seg-btn i { font-size: 14px; }

[data-theme="light"] .ter-seg-btn[data-ter-set-theme="light"],
[data-theme="dark"]  .ter-seg-btn[data-ter-set-theme="dark"] {
    background: #00bfa6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 191, 166, 0.35);
}

/* ============================================================
   Main content
   ============================================================ */
.ter-main {
    padding: 24px clamp(16px, 3vw, 32px) 48px;
}

.ter-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}
.ter-page-title {
    font-size: clamp(1.4rem, 2.2vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text);
}
.ter-page-sub {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 4px 0 0;
}

/* ============================================================
   Cards
   ============================================================ */
.ter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 22px;
    position: relative;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.ter-card.is-elevated { box-shadow: var(--shadow-2); }
.ter-card-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.ter-card-h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--text);
}

/* ============================================================
   Hero balance card
   ============================================================ */
.ter-hero-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 18px;
    margin-bottom: 18px;
    align-items: stretch;
}
.ter-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 28px 28px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(600px 280px at 100% 0%, var(--accent-soft), transparent 70%),
        linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
}
.ter-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg, transparent 0 12px, color-mix(in srgb, var(--accent) 5%, transparent) 12px 13px);
    pointer-events: none;
    opacity: 0.5;
    mask-image: radial-gradient(400px 200px at 100% 0%, #000 0%, transparent 70%);
}
.ter-hero-greeting {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 4px;
    font-weight: 500;
}
.ter-hero-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.ter-hero-balance {
    font-size: clamp(2.2rem, 5.5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin: 10px 0 4px;
}
.ter-hero-balance .ter-currency {
    color: var(--text-muted);
    font-size: 0.55em;
    font-weight: 600;
    margin-left: 6px;
    letter-spacing: -0.01em;
}
.ter-hero-balance-usd {
    color: var(--text-soft);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.ter-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 180px;
}

.ter-hero-cta {
    --cta-accent: var(--brand-blue, #007bff);
    --cta-accent-wash: color-mix(in srgb, var(--brand-blue, #007bff) 8%, transparent);
    --cta-edge: color-mix(in srgb, var(--brand-blue, #007bff) 32%, var(--border));
    --cta-edge-strong: color-mix(in srgb, var(--brand-blue, #007bff) 62%, var(--border-strong));

    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 22px 22px 24px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    background:
        radial-gradient(420px 220px at 0% 100%, var(--cta-accent-wash), transparent 60%),
        linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
    border: 1px solid var(--cta-edge);
    box-shadow: var(--shadow-2);
    transition:
        transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.2s ease,
        box-shadow 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ter-hero-cta:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: var(--cta-edge-strong);
    box-shadow:
        0 8px 22px color-mix(in srgb, var(--cta-accent) 12%, transparent),
        0 4px 12px rgba(15, 23, 42, 0.06);
}

.ter-hero-cta:active {
    transform: translateY(0);
    transition-duration: 0.08s;
}

.ter-hero-cta:focus-visible {
    outline: none;
    border-color: var(--cta-accent);
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--cta-accent) 28%, transparent),
        var(--shadow-2);
}

.ter-hero-cta-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.4rem;
    color: #fff;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--cta-accent) 88%, white 12%) 0%,
        var(--cta-accent) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 4px 10px color-mix(in srgb, var(--cta-accent) 30%, transparent);
}

.ter-hero-cta-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ter-hero-cta-title {
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text);
}

.ter-hero-cta-sub {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-muted);
}

.ter-hero-cta-arrow {
    flex: 0 0 auto;
    font-size: 1.05rem;
    color: var(--text-muted);
    transition:
        transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
        color 0.2s ease;
}

.ter-hero-cta:hover .ter-hero-cta-arrow {
    transform: translateX(3px);
    color: var(--cta-accent);
}

@media (prefers-reduced-motion: reduce) {
    .ter-hero-cta,
    .ter-hero-cta-arrow { transition: none; }
    .ter-hero-cta:hover { transform: none; }
}

@media (max-width: 900px) {
    .ter-hero-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .ter-hero {
        grid-template-columns: 1fr;
        padding: 22px 20px;
    }
    .ter-hero-actions { flex-direction: row; min-width: 0; }
    .ter-hero-actions .ter-btn { flex: 1; }
}

/* ============================================================
   API key card
   ============================================================ */
.ter-apikey-card {
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    background:
        radial-gradient(420px 200px at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
        var(--surface);
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent), 0 8px 24px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}
.ter-apikey-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-left: 4px solid var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}
.ter-apikey-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.ter-apikey-iconwrap {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--brand-gradient);
    color: var(--on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.30);
}
.ter-apikey-headtext { min-width: 0; flex: 1; }
.ter-apikey-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}
.ter-apikey-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}
.ter-apikey-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ter-apikey-value {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
}
.ter-apikey-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ter-apikey-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: #4ea3ff;
    font-size: 0.88rem;
    font-weight: 600;
}
.ter-apikey-link:hover { color: var(--brand-blue); text-decoration: underline; }
@media (max-width: 575px) {
    .ter-apikey-value { width: 100%; }
}

/* ============================================================
   KPI grid
   ============================================================ */
.ter-grid {
    display: grid;
    gap: 14px;
}
.ter-grid-kpi {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}
@media (max-width: 1199px) { .ter-grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px)  { .ter-grid-kpi { grid-template-columns: 1fr; } }

.ter-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.ter-kpi:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}
.ter-kpi-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.ter-kpi.is-info .ter-kpi-icon  { background: var(--info-soft);    color: var(--info); }
.ter-kpi.is-warn .ter-kpi-icon  { background: var(--warning-soft); color: var(--warning); }
.ter-kpi.is-success .ter-kpi-icon { background: var(--success-soft); color: var(--success); }
.ter-kpi.is-purple .ter-kpi-icon { background: rgba(124, 92, 255, 0.16); color: #9d80ff; }

.ter-kpi-body { min-width: 0; flex: 1; overflow: hidden; }
.ter-kpi-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    word-break: break-word;
}
.ter-kpi-value {
    font-size: clamp(1.1rem, 2.2vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
}
.ter-kpi-value > * { white-space: nowrap; }
.ter-kpi-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Savings highlight + Activation small card
   ============================================================ */
.ter-grid-savings {
    grid-template-columns: 2fr 1fr;
    margin-bottom: 18px;
}
@media (max-width: 991px) { .ter-grid-savings { grid-template-columns: 1fr; } }

.ter-savings {
    background:
        radial-gradient(420px 220px at 0% 0%, color-mix(in srgb, var(--success) 20%, transparent), transparent 70%),
        linear-gradient(135deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 26px;
    position: relative;
    overflow: hidden;
}
.ter-savings::before {
    content: "";
    position: absolute;
    top: -40px; right: -40px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--success) 25%, transparent) 0%, transparent 70%);
    pointer-events: none;
}
.ter-savings-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    background: var(--success-soft);
    font-weight: 700;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
}
.ter-savings-amount {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 12px 0 4px;
    font-variant-numeric: tabular-nums;
}
.ter-savings-amount .ter-savings-trx { color: var(--success); }
.ter-savings-amount .ter-savings-usd {
    font-size: 0.6em;
    color: var(--text-soft);
    font-weight: 600;
    margin-left: 8px;
}
.ter-savings-text {
    color: var(--text-soft);
    font-size: 0.96rem;
    margin: 4px 0 0;
}
.ter-savings-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ter-activation {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.ter-activation-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--info-soft);
    color: var(--info);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.ter-activation-value {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.ter-activation-label {
    color: var(--text-muted);
    font-size: 0.86rem;
    margin-top: 4px;
}

/* ============================================================
   Quick actions
   ============================================================ */
.ter-grid-qa {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 22px;
}
@media (max-width: 991px) { .ter-grid-qa { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px)  { .ter-grid-qa { grid-template-columns: 1fr; } }

.ter-qa {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: all .2s var(--ease);
    box-shadow: var(--shadow-1);
    min-height: 76px;
}
.ter-qa:hover {
    transform: translateY(-2px);
    border-color: var(--brand-blue);
    box-shadow: var(--shadow-2);
    color: var(--text);
}
.ter-qa-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(0, 123, 255, 0.14);
    color: #4ea3ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.ter-qa:hover .ter-qa-icon {
    background: var(--brand-blue);
    color: #fff;
}
.ter-qa-body { min-width: 0; flex: 1; }
.ter-qa-title { font-weight: 700; font-size: 0.96rem; line-height: 1.2; display: block; }
.ter-qa-sub { color: var(--text-muted); font-size: 0.78rem; margin-top: 4px; display: block; }
.ter-qa-arrow {
    color: var(--text-muted);
    transition: transform .2s var(--ease), color .2s var(--ease);
    flex-shrink: 0;
}
.ter-qa:hover .ter-qa-arrow { color: var(--brand-blue); transform: translateX(2px); }

/* ============================================================
   Charts
   ============================================================ */
.ter-grid-charts {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 991px) { .ter-grid-charts { grid-template-columns: 1fr; } }

.ter-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-1);
}
.ter-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}
.ter-chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text);
    font-size: 0.96rem;
}
.ter-chart-title i { color: var(--text-muted); }
.ter-chart-canvas {
    width: 100% !important;
    height: 240px !important;
}

/* ============================================================
   Buttons
   ============================================================ */
.ter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.94rem;
    line-height: 1;
    cursor: pointer;
    transition: all .15s var(--ease);
    white-space: nowrap;
    min-height: 44px;
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    text-decoration: none;
}
.ter-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.ter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ter-btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.ter-btn-primary {
    background: var(--brand-gradient);
    color: var(--on-accent);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(255, 152, 0, 0.28);
    transition: filter .15s var(--ease), box-shadow .15s var(--ease);
}
.ter-btn-primary:hover {
    background: var(--brand-gradient);
    color: var(--on-accent);
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(255, 152, 0, 0.38);
}
.ter-btn-primary:active {
    filter: brightness(0.96);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.24);
}

.ter-btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.ter-btn-success:hover { filter: brightness(1.05); color: #fff; }

.ter-btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-soft);
}
.ter-btn-ghost:hover { color: var(--text); background: var(--surface-hover); }

.ter-btn-sm { padding: 6px 12px; font-size: 0.85rem; min-height: 36px; }
.ter-btn-block { width: 100%; }

/* ============================================================
   Form fields
   ============================================================ */
.ter-field { margin-bottom: 14px; }
.ter-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 6px;
}
.ter-input, .ter-select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text);
    font-size: 0.96rem;
    line-height: 1.3;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
    font-family: inherit;
    min-height: 44px;
}
.ter-input:focus, .ter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.ter-input::placeholder { color: var(--text-muted); }
.ter-input.is-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.ter-input-group {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.ter-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.ter-input-group .ter-input {
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}
.ter-input-group .ter-input:focus { box-shadow: none; }
.ter-input-group .ter-input-suffix {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.86rem;
    background: var(--surface-alt);
    border-left: 1px solid var(--border);
}

/* alerts */
.ter-alert {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}
.ter-alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.ter-alert-success { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); }
.ter-alert-info { background: var(--info-soft); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }

/* ============================================================
   Tables (modern)
   ============================================================ */
.ter-table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.ter-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.ter-table-wrap { overflow-x: auto; }

/* Double scrollbar (top + bottom) for wide tables */
.ter-scroll-top {
    overflow-x: scroll;
    overflow-y: hidden;
    height: 16px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    scrollbar-color: var(--text-muted) var(--surface-alt);
    scrollbar-width: auto;
}
.ter-scroll-top::-webkit-scrollbar {
    height: 14px;
    -webkit-appearance: none;
    background: var(--surface-alt);
}
.ter-scroll-top::-webkit-scrollbar-track {
    background: var(--surface-alt);
}
.ter-scroll-top::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 75%, transparent);
    border-radius: 7px;
    border: 2px solid var(--surface-alt);
}
.ter-scroll-top::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}
.ter-scroll-top-spacer { height: 1px; }
.ter-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.ter-table th, .ter-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.ter-table th {
    background: var(--surface-alt);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    position: sticky; top: 0;
    z-index: 2;
}
.ter-table tbody tr:hover { background: var(--surface-hover); }
.ter-table tbody tr:last-child td { border-bottom: 0; }
.ter-table .ter-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.86rem; }
.ter-table .ter-num { font-variant-numeric: tabular-nums; }
.ter-table .ter-truncate {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* status pills */
.ter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.ter-pill .ter-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ter-pill-success { background: var(--success-soft); color: var(--success); }
.ter-pill-warn { background: var(--warning-soft); color: var(--warning); }
.ter-pill-danger { background: var(--danger-soft); color: var(--danger); }
.ter-pill-info { background: var(--info-soft); color: var(--info); }
.ter-pill-neutral { background: var(--surface-alt); color: var(--text-soft); border: 1px solid var(--border); }

/* copy chip */
.ter-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    transition: all .15s var(--ease);
    margin-left: 6px;
}
.ter-copy:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ter-copy.is-copied { color: var(--success); border-color: var(--success); background: var(--success-soft); }

/* pagination */
.ter-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
    font-size: 0.86rem;
    color: var(--text-muted);
}
.ter-pagination ul { display: inline-flex; gap: 4px; padding: 0; margin: 0; list-style: none; }
.ter-pagination li button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    border-radius: 8px;
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s var(--ease);
    font-weight: 600;
}
.ter-pagination li button:hover { background: var(--surface-hover); color: var(--text); }
.ter-pagination li.is-active button { background: var(--accent); color: #fff; border-color: var(--accent); }
.ter-pagination li.is-disabled button { opacity: 0.4; pointer-events: none; }

/* mobile stacked cards for tables */
@media (max-width: 767px) {
    .ter-table-mobile { display: block; }
    .ter-table-mobile thead { display: none; }
    .ter-table-mobile tbody, .ter-table-mobile tr { display: block; }
    .ter-table-mobile tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 10px 14px;
        margin: 12px 14px;
    }
    .ter-table-mobile td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border: 0;
        border-bottom: 1px dashed var(--border);
    }
    .ter-table-mobile td:last-child { border-bottom: 0; }
    .ter-table-mobile td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.76rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    .ter-table-mobile .ter-truncate { max-width: 60vw; }
}

/* ============================================================
   QR / Deposit / Withdraw page
   ============================================================ */
.ter-grid-2 {
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 991px) { .ter-grid-2 { grid-template-columns: 1fr; } }

.ter-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.ter-qr {
    background: #fff;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 220px; height: 220px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.ter-qr img { max-width: 100%; height: auto; display: block; }

.ter-tip-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ter-tip-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 0.86rem;
    line-height: 1.4;
}
.ter-tip-list li i {
    color: var(--brand-blue);
    font-size: 16px;
    margin-top: 1px;
    flex-shrink: 0;
}

.ter-instructions { display: flex; flex-direction: column; gap: 12px; }
.ter-instruction {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.ter-instruction i {
    color: var(--accent);
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}
.ter-instruction-body { font-size: 0.92rem; color: var(--text-soft); }
.ter-instruction-body b { color: var(--text); }

/* ============================================================
   Order manual — two-column layout
   ============================================================ */
.ter-order-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.85fr);
    gap: 20px;
    align-items: flex-start;
}
@media (max-width: 991px) {
    .ter-order-shell { grid-template-columns: 1fr; }
}

.ter-order-form {
    padding: 26px 28px 28px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-2);
}

/* Light-theme calculator boost */
[data-theme="light"] .ter-order-form {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 4px 12px rgba(15, 23, 42, 0.06),
        0 12px 32px rgba(15, 23, 42, 0.08);
    border-color: #d6dbe6;
}
[data-theme="light"] .ter-summary-card {
    box-shadow:
        0 4px 14px rgba(15, 23, 42, 0.07),
        0 14px 36px rgba(255, 152, 0, 0.10);
    border-color: #d6dbe6;
}

.ter-order-summary { position: sticky; top: calc(var(--topnav-h) + 16px); }
@media (max-width: 991px) { .ter-order-summary { position: static; } }

.ter-summary-card {
    background:
        radial-gradient(420px 200px at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px 20px;
    box-shadow: var(--shadow-2);
    overflow: hidden;
}
.ter-summary-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ter-summary-amount {
    font-size: clamp(2.2rem, 4.5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin: 12px 0 6px;
}
.ter-summary-amount #estimate-amount { color: var(--accent); }
.ter-summary-currency {
    color: var(--text-muted);
    font-size: 0.45em;
    font-weight: 700;
    margin-left: 6px;
    letter-spacing: 0;
}
.ter-summary-amount-usd {
    color: var(--text-soft);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}
.ter-summary-divider {
    height: 1px;
    background: var(--border);
    margin: 18px 0 14px;
}
.ter-summary-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ter-summary-meta li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
}
.ter-summary-meta-label {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ter-summary-meta-value {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ter-summary-meta-value.ter-pos { color: var(--success); }
.ter-summary-meta-value.ter-zero { color: var(--text-muted); font-weight: 500; }
.ter-summary-fineprint {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
}
.ter-summary-fineprint i { color: var(--success); margin-right: 4px; }

/* Period grid (large pickable cards) */
.ter-period-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
@media (max-width: 575px) { .ter-period-grid { grid-template-columns: repeat(2, 1fr); } }
.ter-period {
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all .15s var(--ease);
    min-height: 56px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    line-height: 1;
}
.ter-period:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    background: color-mix(in srgb, var(--brand-blue) 6%, var(--surface));
}
.ter-period.is-active {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 123, 255, 0.32);
}
.ter-period-label { font-weight: 700; font-size: 0.94rem; }
.ter-period-hint { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ter-period.is-active .ter-period-hint { color: #4ea3ff; }

/* Quick chips active state */
.ter-chip.is-active {
    background: color-mix(in srgb, var(--brand-blue) 14%, var(--surface));
    border-color: var(--brand-blue);
    color: #4ea3ff;
}

/* Toggle (replaces checkbox) */
.ter-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    margin-top: 4px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color .15s var(--ease);
}
.ter-toggle:hover { border-color: var(--brand-blue); }
.ter-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ter-toggle-track {
    width: 40px;
    height: 22px;
    background: var(--border-strong);
    border-radius: 999px;
    position: relative;
    transition: background .2s var(--ease);
    flex-shrink: 0;
}
.ter-toggle-thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .25s var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.ter-toggle input:checked + .ter-toggle-track { background: var(--brand-blue); }
.ter-toggle input:checked + .ter-toggle-track .ter-toggle-thumb { transform: translateX(18px); }
.ter-toggle-label { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.ter-toggle-label strong { color: var(--text); font-size: 0.92rem; font-weight: 700; }
.ter-toggle-label small { color: var(--text-muted); font-size: 0.78rem; }

/* keep the old order-card class for legacy */
.ter-order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    padding: 28px;
    max-width: 720px;
    margin: 0 auto;
}
.ter-segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 22px;
}
.ter-segmented button {
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-weight: 600;
    border-radius: 9px;
    padding: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    transition: all .15s var(--ease);
}
.ter-segmented button:hover { color: var(--text); }
.ter-segmented button.is-active {
    background: var(--surface);
    color: #008c91;
    box-shadow: var(--shadow-1);
}
.ter-segmented button.is-active i { color: #008c91; }
[data-theme="dark"] .ter-segmented button.is-active { color: #14b8b8; }
[data-theme="dark"] .ter-segmented button.is-active i { color: #14b8b8; }

.ter-quick-amounts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.ter-chip {
    border: 1.5px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all .15s var(--ease);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ter-chip:hover {
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    background: color-mix(in srgb, var(--brand-blue) 6%, var(--surface));
}
.ter-chip.is-active {
    background: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.30);
}

.ter-duration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
@media (max-width: 575px) { .ter-duration-grid { grid-template-columns: repeat(2, 1fr); } }

.ter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text);
    user-select: none;
}
.ter-checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

.ter-estimate {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
    font-weight: 600;
    color: var(--text);
}
.ter-estimate-amount {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Spinner inside button
   ============================================================ */
.ter-spinner {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: ter-spin .7s linear infinite;
    display: inline-block;
}
@keyframes ter-spin { to { transform: rotate(360deg); } }

.ter-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
    color: var(--text-muted);
    gap: 10px;
}

/* ============================================================
   Footer
   ============================================================ */
.ter-footer {
    padding: 18px 24px 28px;
    color: var(--text-muted);
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================================
   Charts library overrides (Chart.js v2)
   ============================================================ */
.ter-chart-card canvas { max-width: 100%; }

/* ============================================================
   Auth pages (split-screen)
   ============================================================ */
.ter-auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
    max-width: 100vw;
}
.ter-auth-form-wrap { order: 1; }
.ter-auth-brand { order: 2; }

.ter-auth-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(700px 320px at 18% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
        radial-gradient(900px 500px at 100% 100%, rgba(0, 0, 0, 0.20), transparent 60%),
        linear-gradient(135deg, #007bff 0%, #00bfa6 60%, #00e1ff 100%);
}
.ter-auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: 0.35;
    mix-blend-mode: overlay;
}
.ter-auth-brand-top { position: relative; z-index: 1; }
.ter-auth-brand-mid { position: relative; z-index: 1; max-width: 460px; }
.ter-auth-brand-bot { position: relative; z-index: 1; opacity: 0.85; font-size: 0.84rem; }

.ter-auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}
.ter-auth-brand-logo img { width: 44px; height: 44px; display: block; }
.ter-auth-brand-name { font-weight: 800; font-size: 1.4rem; letter-spacing: -0.01em; }

.ter-auth-tagline {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 22px;
}
.ter-auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ter-auth-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.98rem;
    opacity: 0.94;
}
.ter-auth-features li i {
    width: 24px; height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 12px;
    flex-shrink: 0;
}

.ter-auth-form-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(90px, 14vh, 160px) 24px 48px;
    position: relative;
    background: var(--bg);
}
.ter-auth-card { margin: 0; }

/* Larger inputs on auth forms */
.ter-auth-card .ter-input,
.ter-auth-card .ter-select {
    padding: 16px 18px;
    min-height: 56px;
    font-size: 1rem;
    border-radius: 10px;
    border-width: 1px;
}
.ter-auth-card .ter-field { margin-bottom: 18px; }
.ter-auth-card .ter-label {
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.ter-auth-card {
    width: 100%;
    max-width: 420px;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
.ter-auth-formhead {
    position: absolute;
    top: 24px;
    left: 28px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    z-index: 5;
}
.ter-auth-formhead img { width: 32px; height: 32px; display: block; }
.ter-auth-formhead-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--text); }
.ter-auth-formhead:hover .ter-auth-formhead-name { color: var(--brand-blue); }

.ter-auth-title {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    color: var(--text);
    text-align: center;
}
.ter-auth-sub {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin: 0 0 28px;
    text-align: center;
    line-height: 1.5;
}

.ter-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.ter-auth-divider::before,
.ter-auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.ter-google-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
}
.ter-google-wrap iframe { max-width: 100%; }

.ter-auth-foot {
    margin-top: 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.ter-auth-foot a {
    color: var(--brand-blue);
    font-weight: 600;
}
.ter-auth-foot a:hover { color: #4ea3ff; }

.ter-auth-row-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.ter-auth-row-links a {
    color: var(--brand-blue);
    font-weight: 600;
    font-size: 0.86rem;
}
.ter-auth-foot {
    margin-top: 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.ter-auth-bottom {
    margin-top: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.ter-auth-bottom a { color: var(--text-muted); }
.ter-auth-bottom a:hover { color: var(--brand-blue); }

/* Cyan CTA — matches landing page .btn-glow */
.ter-btn-blue {
    background-color: #00e1ff;
    color: #000;
    border: none;
    box-shadow: 0 0 20px rgba(0, 225, 255, 0.7);
    transition: transform .2s var(--ease), background-color .2s var(--ease), box-shadow .25s var(--ease);
    border-radius: 8px;
    padding: 13px 22px;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.ter-btn-blue:hover {
    background-color: #00c2e3;
    color: #000;
    box-shadow: 0 0 30px rgba(0, 225, 255, 1);
    transform: translateY(-2px);
}
.ter-btn-blue:active { transform: translateY(0); filter: brightness(0.96); }

/* Solid royal-blue CTA (deposit / "Show address" / payment-in actions) */
.ter-btn-deposit {
    background: #1d52ff;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 13px 22px;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(29, 82, 255, 0.30);
    transition: background .15s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
.ter-btn-deposit:hover {
    background: #1842d6;
    color: #fff;
    box-shadow: 0 6px 20px rgba(29, 82, 255, 0.45);
    transform: translateY(-1px);
}
.ter-btn-deposit:active { transform: translateY(0); filter: brightness(0.96); }

/* Solid teal CTA (withdraw / outgoing actions) */
.ter-btn-withdraw {
    background: #00bfa6;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 13px 22px;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 191, 166, 0.30);
    transition: background .15s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
.ter-btn-withdraw:hover {
    background: #00a892;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 191, 166, 0.45);
    transform: translateY(-1px);
}
.ter-btn-withdraw:active { transform: translateY(0); filter: brightness(0.96); }

/* Google button wrapper — let widget render at its native size, just center it */
.ter-google-wrap { width: 100%; }
.ter-google-wrap iframe { display: block; margin: 0 auto !important; }

/* Outline cyan (secondary CTA "Sign up" matches landing .btn-glow) */
.ter-btn-blue-outline {
    background: transparent;
    color: #000;
    border: 2px solid #00e1ff;
    border-radius: 8px;
    padding: 11px 22px;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 225, 255, 0.35);
    transition: background .2s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
}
.ter-btn-blue-outline:hover {
    background: rgba(0, 225, 255, 0.18);
    color: #000;
    border-color: #00c2e3;
    box-shadow: 0 0 22px rgba(0, 225, 255, 0.6);
    transform: translateY(-2px);
}

/* 2-button row */
.ter-auth-actions {
    display: flex;
    gap: 10px;
}
.ter-auth-actions .ter-btn { flex: 1; min-width: 0; }

/* Theme toggle in auth corner */
.ter-auth-theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

/* Step indicator (password-code) */
.ter-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}
.ter-step-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
}
.ter-step-dot.is-active {
    background: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
}
.ter-step-dot.is-done {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 40%, transparent);
}
.ter-step-line {
    width: 32px;
    height: 2px;
    background: var(--border);
}
.ter-step-line.is-done { background: var(--success); }

/* Tablet: shrink padding, narrower form */
@media (max-width: 1199px) {
    .ter-auth-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ter-auth-brand { padding: 40px 32px; }
    .ter-auth-tagline { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
    .ter-auth-form-wrap { padding: clamp(72px, 10vh, 110px) 20px 36px; }
    .ter-auth-formhead { top: 18px; left: 22px; }
    .ter-auth-formhead-name { font-size: 1rem; }
}

/* Mobile: stack vertically — form on top, brand becomes compact footer */
@media (max-width: 767px) {
    .ter-auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .ter-auth-form-wrap {
        order: 1;
        padding: 70px 18px 32px;
        min-height: auto;
        align-items: stretch;
    }
    .ter-auth-brand { display: none; }
    .ter-auth-formhead { top: 16px; left: 16px; }
    .ter-auth-card { max-width: 100%; min-width: 0; }
    .ter-auth-title { font-size: 1.35rem; word-break: break-word; hyphens: auto; }
    .ter-auth-sub { font-size: 0.88rem; margin-bottom: 22px; }
    .ter-auth-theme-toggle { top: 12px; right: 12px; }
    .ter-google-wrap > div > div { max-width: 100% !important; }
}

/* Extra-small: tighten more */
@media (max-width: 380px) {
    .ter-auth-form-wrap { padding-top: 64px; }
    .ter-auth-formhead-name { display: none; }
    .ter-auth-title { font-size: 1.4rem; }
    .ter-btn-blue { font-size: 0.92rem; padding: 12px 18px; }
}
