﻿/* =============================================
   Exchange UI v2 — Shared Components
   ============================================= */

/* ═══════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════ */
.main-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); /* bottom-nav height + 手勢列/Home 指示條安全區 */
}

/* FullBleed 頁面(例如 Alpha/Detail)沒有 bottom-nav，但一樣要靠 .main-content 的 flex:1+overflow-y:auto
   撐出獨立捲動區，不然 #app 固定 100% 高度又沒設 overflow，內容一撐高就整頁(含 sticky header)一起跑掉。
   比照舊站 Web/Views/Alpha/Detail.cshtml：.main-content 本身要變成 flex container(不只是 flex item)，
   裡面的 #chartMain 才能用 flex:1 吃掉扣掉 stats-bar/tf-bar/量能圖/MA/交易鈕之後剩下的高度，不然圖表
   固定寫死高度、下面其餘內容自然高度撐不滿螢幕，桌機/高螢幕下面就會空一大塊黑。 */
.main-content.full-bleed {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
}

.page-content {
    animation: fadeIn 0.2s ease;
}

/* page-content 只是 Blazor 這邊多出來的一層包裝(舊站沒有)，FullBleed 時用 display:contents
   讓它在版面上「消失」，@Body 底下的 stats-bar/tf-bar/#chartMain/... 才能直接變成
   .main-content.full-bleed 的 flex 子項目，跟舊站 <div class="chart-page" style="display:contents;"> 同招。 */
.main-content.full-bleed .page-content {
    display: contents;
}

/* 市場頁的內容是由 .main-content 捲動；搜尋開啟後，搜尋列需要留在 App Header 正下方，
   避免使用者一滑商品清單就找不到輸入框。它仍位於市場頁內容內，因此切換頁面時會自然消失。 */
.market-search-panel {
    position: sticky;
    top: 0;
    /* Bootstrap 的 .sticky-top 是 z-index:1020；搜尋列必須在商品欄位標題之上。 */
    z-index: 1030;
    padding: 10px 14px;
    border-bottom: 1px solid var(--b1);
    background: var(--bg-card);
    box-shadow: 0 8px 14px rgba(0, 0, 0, .16);
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.app-header {
    flex-shrink: 0;
    height: 56px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--b1);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 90;
}

    .app-header .logo {
        font-size: 20px;
        font-weight: 800;
        letter-spacing: -0.5px;
        background: var(--logo-gradient);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .app-header .header-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--t1);
        flex: 1;
        text-align: center;
    }

    .app-header .header-left {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .app-header .header-right {
        display: flex;
        align-items: center;
        gap: 14px;
    }

.header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--t2);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

    .header-icon-btn:hover {
        background: var(--bg-hover);
        color: var(--t1);
    }

    .header-icon-btn:active {
        background: var(--bg-active);
    }

/* 返回按鈕 */
.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--t1);
    cursor: pointer;
    border-radius: 8px;
    margin-left: -4px;
}

    .back-btn:active {
        background: var(--bg-hover);
    }

/* ═══════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════ */
.bottom-nav {
    flex-shrink: 0;
    height: 60px;
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    display: flex;
    align-items: stretch;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    z-index: 90;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--t3);
    cursor: pointer;
    padding: 6px 4px 4px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    transition: color 0.15s;
}

    .nav-item .nav-icon {
        transition: transform 0.2s;
    }

    .nav-item span {
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.2px;
    }

    .nav-item.active {
        color: var(--accent);
    }

        .nav-item.active .nav-icon {
            transform: translateY(-1px);
        }

        /* Active 點指示器 */
        .nav-item.active::after {
            content: '';
            position: absolute;
            bottom: 3px;
            left: 50%;
            transform: translateX(-50%);
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: var(--accent);
            opacity: 0.85;
        }

    /* 中間交易按鈕 (加強版) */
    .nav-item.nav-trade-btn {
        flex: 1.2;
    }

.nav-trade-btn .trade-btn-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--logo-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: var(--shadow-accent);
    transition: transform 0.15s, box-shadow 0.15s;
}

.nav-trade-btn:active .trade-btn-inner {
    transform: scale(0.94);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

/* trade-btn 沒有 active 點 */
.nav-item.nav-trade-btn::after {
    display: none;
}

.nav-trade-btn span {
    color: var(--t3);
}

.nav-trade-btn.active span {
    color: var(--accent);
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.card-bordered {
    border: 1px solid var(--b1);
}

.card-shadow {
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
}

.card-more {
    font-size: 12px;
    color: var(--t2);
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

    .card-more:hover {
        color: var(--accent);
    }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 42px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

    .btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.btn-primary {
    /* Bootstrap 的 .btn:disabled 規則靠 --bs-btn-disabled-bg 這些 CSS 變數決定停用時的顏色，
       :disabled 偽類讓它的優先度比這條 .btn-primary 高，光蓋 background 蓋不掉停用狀態，
       停用時就會漏出 Bootstrap 自己內建的藍色。這裡連同 disabled 用的變數一起蓋掉。 */
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    --bs-btn-disabled-color: #000;
    background: var(--accent);
    color: #000;
    font-weight: 700;
}

    .btn-primary:not(:disabled):hover {
        filter: brightness(1.08);
        box-shadow: var(--shadow-accent);
    }

    .btn-primary:not(:disabled):active {
        filter: brightness(0.92);
        transform: scale(0.98);
        box-shadow: none;
    }

.btn-buy {
    background: var(--up);
    color: #fff;
}

    .btn-buy:not(:disabled):hover {
        filter: brightness(1.08);
    }

    .btn-buy:not(:disabled):active {
        filter: brightness(0.92);
        transform: scale(0.98);
    }

.btn-sell {
    background: var(--down);
    color: #fff;
}

    .btn-sell:not(:disabled):hover {
        filter: brightness(1.08);
    }

    .btn-sell:not(:disabled):active {
        filter: brightness(0.92);
        transform: scale(0.98);
    }

.btn-ghost {
    background: var(--bg-surface);
    color: var(--t1);
    border: 1px solid var(--b2);
}

    .btn-ghost:not(:disabled):hover {
        background: var(--bg-hover);
    }

    .btn-ghost:not(:disabled):active {
        background: var(--bg-active);
    }

.btn-ghost-up {
    background: var(--up-bg);
    color: var(--up);
    border: 1px solid rgba(14,203,129,0.2);
}

.btn-ghost-down {
    background: var(--down-bg);
    color: var(--down);
    border: 1px solid rgba(246,70,93,0.2);
}

.btn-text {
    background: none;
    color: var(--accent);
    padding: 0;
    height: auto;
}

    .btn-text:hover {
        opacity: 0.8;
    }

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-xs {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 4px;
}

.btn-lg {
    height: 52px;
    font-size: 16px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

/* 圓形按鈕 */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--t2);
    border: 1px solid var(--b1);
    cursor: pointer;
    transition: all 0.15s;
}

    .icon-btn:hover {
        background: var(--bg-hover);
        color: var(--t1);
        border-color: var(--b2);
    }

/* ═══════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════ */
.input-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-label {
    font-size: 13px;
    color: var(--t2);
    font-weight: 500;
}

.input-field {
    position: relative;
    display: flex;
    align-items: center;
}

    .input-field input {
        width: 100%;
        height: 48px;
        background: var(--bg-input);
        border: 1.5px solid var(--b1);
        border-radius: 8px;
        padding: 0 44px 0 14px;
        color: var(--t1);
        font-size: 14px;
        transition: border-color 0.15s, background 0.15s;
    }

        .input-field input:focus {
            border-color: var(--accent);
            background: var(--bg-surface);
        }

        .input-field input::placeholder {
            color: var(--t3);
        }

    .input-field select {
        width: 100%;
        height: 48px;
        background: var(--bg-input);
        border: 1.5px solid var(--b1);
        border-radius: 8px;
        padding: 0 44px 0 14px;
        color: var(--t1);
        font-size: 14px;
        transition: border-color 0.15s, background 0.15s;
    }

    .input-field .input-icon,
    .input-field .input-action {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--t3);
        display: flex;
        align-items: center;
        gap: 8px;
    }

.input-action button {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

.input-field.has-prefix input {
    padding-left: 44px;
}

.input-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--t2);
}

.input-error {
    font-size: 12px;
    color: var(--down);
}

.input-hint {
    font-size: 12px;
    color: var(--t2);
}

/* 數量輸入（帶後綴） */
.amount-input {
    position: relative;
}

    .amount-input input {
        padding-right: 60px;
        text-align: right;
    }

    .amount-input .amount-unit {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 13px;
        font-weight: 600;
        color: var(--t2);
    }

/* ═══════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--b1);
    padding: 0 16px;
    background: var(--bg-card);
}

.tab-item {
    padding: 12px 0;
    margin-right: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--t2);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.15s;
}

    .tab-item::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--accent);
        transform: scaleX(0);
        transition: transform 0.2s;
        border-radius: 2px;
    }

    .tab-item.active {
        color: var(--t1);
        font-weight: 600;
    }

        .tab-item.active::after {
            transform: scaleX(1);
        }

/* 膠囊 Tabs */
.tabs-pill {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--bg-surface);
    border-radius: 10px;
}

.tab-pill-item {
    flex: 1;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--t2);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

    .tab-pill-item.active {
        background: var(--bg-card);
        color: var(--t1);
        font-weight: 600;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--b2);
    }

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--b2);
    animation: slideDown 0.25s ease;
    pointer-events: auto;
    font-size: 14px;
    font-weight: 500;
    color: var(--t1);
}

    .toast.toast-success {
        border-left: 3px solid var(--up);
    }

    .toast.toast-error {
        border-left: 3px solid var(--down);
    }

    .toast.toast-warning {
        border-left: 3px solid var(--warn);
    }

    .toast.toast-info {
        border-left: 3px solid var(--info);
    }

    .toast .toast-icon {
        flex-shrink: 0;
    }

    .toast.toast-success .toast-icon {
        color: var(--up);
    }

    .toast.toast-error .toast-icon {
        color: var(--down);
    }

    .toast.toast-warning .toast-icon {
        color: var(--warn);
    }

    .toast.toast-info .toast-icon {
        color: var(--info);
    }

.toast-hide {
    animation: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeInScale 0.2s ease;
}

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--b2);
}

.modal-header {
    padding: 20px 20px 0;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--t1);
    text-align: center;
}

.modal-body {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--t2);
    line-height: 1.7;
    text-align: center;
}

.modal-footer {
    display: flex;
    border-top: 1px solid var(--b1);
}

    .modal-footer button {
        flex: 1;
        height: 52px;
        font-size: 15px;
        font-weight: 600;
        color: var(--t2);
        transition: background 0.15s;
    }

        .modal-footer button:first-child {
            border-right: 1px solid var(--b1);
        }

        .modal-footer button.btn-confirm {
            color: var(--accent);
        }

        .modal-footer button.btn-danger-confirm {
            color: var(--down);
        }

        .modal-footer button:hover {
            background: var(--bg-hover);
        }

/* ═══════════════════════════════════════════
   BOTTOM DRAWER / SHEET
   ═══════════════════════════════════════════ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.28s ease;
    will-change: opacity;
}

.drawer-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 540px;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    z-index: 901 !important;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
}

.drawer-handle {
    width: 36px;
    height: 4px;
    background: var(--b2);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    flex-shrink: 0;
}

.drawer-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--t1);
}

.drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--t2);
    cursor: pointer;
    flex-shrink: 0;
}

    .drawer-close:hover {
        background: var(--bg-hover);
        color: var(--t1);
    }

.drawer-body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 12px);
}

.drawer-overlay.open {
    opacity: 1;
}

.drawer-sheet.open {
    transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════
   LIST ROWS
   ═══════════════════════════════════════════ */
.list-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
}

    .list-row:active {
        background: var(--bg-hover);
    }

    .list-row + .list-row::before {
        content: '';
        position: absolute;
        top: 0;
        left: 16px;
        right: 16px;
        height: 1px;
        background: var(--divider);
    }

.list-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-row-content {
    flex: 1;
    min-width: 0;
}

.list-row-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--t1);
}

.list-row-subtitle {
    font-size: 12px;
    color: var(--t2);
    margin-top: 2px;
}

.list-row-right {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--t2);
}

/* ═══════════════════════════════════════════
   QUICK ACTIONS GRID
   ═══════════════════════════════════════════ */
/* 快捷操作包裝區 */
.quick-actions-wrap {
    background: var(--bg-card);
    border-bottom: 1px solid var(--b1);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 16px;
}

.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

    .quick-action-item:active {
        background: var(--bg-hover);
    }

.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--b1);
}

.quick-action-label {
    font-size: 11px;
    color: var(--t2);
    font-weight: 500;
    text-align: center;
}

/* ═══════════════════════════════════════════
   COIN AVATAR
   ═══════════════════════════════════════════ */
/* Home 市場區塊 */
.home-market-section {
    background: var(--bg-card);
    border-top: 8px solid var(--bg-page);
}

.home-market-tabs {
    display: flex;
    align-items: center;
    padding: 14px 16px 0;
    gap: 16px;
    border-bottom: 1px solid var(--b1);
}

    .home-market-tabs .tab-item {
        margin-right: 0;
    }

.coin-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   SEGMENT / PERCENTAGE SLIDER
   ═══════════════════════════════════════════ */
.seg-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.seg-btn {
    padding: 5px 0;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--t2);
    background: var(--bg-surface);
    border: 1px solid var(--b1);
    cursor: pointer;
    transition: all 0.12s;
}

    .seg-btn:hover {
        background: var(--bg-hover);
        color: var(--t1);
    }

    .seg-btn.active-buy {
        background: var(--up-bg);
        color: var(--up);
        border-color: transparent;
    }

    .seg-btn.active-sell {
        background: var(--down-bg);
        color: var(--down);
        border-color: transparent;
    }

/* ═══════════════════════════════════════════
   ORDER BOOK ROWS
   ═══════════════════════════════════════════ */
.orderbook-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    font-size: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    transition: opacity 0.1s;
}

    .orderbook-row:hover {
        opacity: 0.8;
    }

.orderbook-depth-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.15;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.orderbook-ask .orderbook-depth-bar {
    background: var(--down);
    right: 0;
}

.orderbook-bid .orderbook-depth-bar {
    background: var(--up);
    right: 0;
}

.orderbook-price {
    flex: 1;
    font-weight: 600;
}

.orderbook-ask .orderbook-price {
    color: var(--down);
}

.orderbook-bid .orderbook-price {
    color: var(--up);
}

.orderbook-qty {
    flex: 1;
    text-align: right;
    color: var(--t2);
}

.orderbook-total {
    flex: 1;
    text-align: right;
    color: var(--t3);
}

/* ═══════════════════════════════════════════
   SWITCH TOGGLE
   ═══════════════════════════════════════════ */
.toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toggle-label {
    font-size: 14px;
    color: var(--t1);
}

.toggle-sub {
    font-size: 12px;
    color: var(--t2);
    margin-top: 2px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

    .toggle input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-active);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

    .toggle-slider::after {
        content: '';
        position: absolute;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        top: 3px;
        left: 3px;
        transition: transform 0.2s;
        box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    }

.toggle input:checked + .toggle-slider {
    background: var(--up);
}

    .toggle input:checked + .toggle-slider::after {
        transform: translateX(20px);
    }

/* ═══════════════════════════════════════════
   NOTICE BAR
   ═══════════════════════════════════════════ */
.notice-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--warn-bg);
    border-left: 3px solid var(--warn);
    font-size: 12px;
    color: var(--warn);
    border-radius: 0 8px 8px 0;
    margin: 8px 16px;
}

/* ═══════════════════════════════════════════
   PAGE SECTION TITLE
   ═══════════════════════════════════════════ */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
}

    .section-title h3 {
        font-size: 15px;
        font-weight: 700;
        color: var(--t1);
    }

    .section-title a {
        font-size: 12px;
        color: var(--t2);
        display: flex;
        align-items: center;
        gap: 2px;
    }

        .section-title a:hover {
            color: var(--accent);
        }

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 12px;
}

.empty-state-icon {
    color: var(--t3);
    opacity: 0.6;
}

.empty-state-text {
    font-size: 14px;
    color: var(--t2);
    text-align: center;
}

.empty-state-sub {
    font-size: 12px;
    color: var(--t3);
    text-align: center;
}

/* ═══════════════════════════════════════════
   KYC LEVEL BADGE
   ═══════════════════════════════════════════ */
.kyc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.kyc-badge-verified {
    background: var(--up-bg);
    color: var(--up);
}

.kyc-badge-unverified {
    background: var(--warn-bg);
    color: var(--warn);
}

.kyc-badge.lv1 {
    background: var(--icon-green-bg);
    color: var(--icon-green);
}

.kyc-badge.lv2 {
    background: var(--icon-blue-bg);
    color: var(--icon-blue);
}

.kyc-badge.lv3 {
    background: var(--icon-gold-bg);
    color: var(--icon-gold);
}

.kyc-badge.xs {
    font-size: 10px;
    padding: 2px 6px;
}

/* ═══════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 0 14px;
    height: 42px;
    border: 1.5px solid transparent;
    transition: border-color 0.15s;
}

    .search-bar:focus-within {
        border-color: var(--accent);
    }

    .search-bar svg {
        color: var(--t3);
        flex-shrink: 0;
    }

    .search-bar input {
        flex: 1;
        background: none;
        color: var(--t1);
        font-size: 14px;
    }

        .search-bar input::placeholder {
            color: var(--t3);
        }

/* Theme toggle button */
.theme-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--b1);
    color: var(--t2);
    cursor: pointer;
    transition: all 0.15s;
}

    .theme-toggle-btn:hover {
        background: var(--bg-hover);
        color: var(--accent);
        border-color: var(--accent);
    }

/* ═══════════════════════════════════════════
   交易協議 Modal (TxAgmt)
   ═══════════════════════════════════════════ */
#tradeAgreementOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
}

    #tradeAgreementOverlay.open {
        display: flex;
    }

#tradeAgreementModal {
    background: var(--bg-card);
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.28s cubic-bezier(0.34,1.1,0.64,1);
}

/* 純檢視用的協議彈窗(Member/List.razor「交易協議」)：跟上面 #tradeAgreementOverlay/Modal 同一顆彈窗的
   視覺規格(疊層/滑入動畫)，但那組是特定 id 選擇器只給 TxAgmtModal 元件用，這裡拉成共用 class 給其他
   單純顯示用的彈窗(不是選方案簽署流程)重用，不用整段複製 CSS。 */
.ta-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
}

    .ta-overlay.open {
        display: flex;
    }

.ta-modal {
    background: var(--bg-card);
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: 540px;
    height: 80vh;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.28s cubic-bezier(0.34,1.1,0.64,1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.ta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--b1);
    flex-shrink: 0;
}

    .ta-header h3 {
        margin: 0;
        font-size: 17px;
        font-weight: 700;
        color: var(--t1);
    }

.ta-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--t3);
    padding: 4px;
    line-height: 1;
}

.ta-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

/* 配合 .ta-terms-box.full：讓 .ta-body 自己變成 flex column，這樣底下唯一的內容(.ta-terms-box.full)
   才能吃到 flex:1 撐滿剩餘高度，而不是維持預設的 shrink-to-fit(那樣 flex:1 在非 flex 容器裡不會有效果)。 */
.ta-body.stretch {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
}

.ta-plan-label {
    font-size: 13px;
    color: var(--t2);
    margin-bottom: 10px;
}

.ta-plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.ta-plan-card {
    border: 1.5px solid var(--b1);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
}

    .ta-plan-card:hover {
        border-color: var(--up);
    }

    .ta-plan-card.selected {
        border-color: var(--up);
        background: var(--up-bg);
    }

    .ta-plan-card .plan-name {
        font-size: 11px;
        color: var(--t3);
        margin-bottom: 4px;
    }

    .ta-plan-card .plan-amount {
        font-size: 18px;
        font-weight: 700;
        color: var(--t1);
    }

    .ta-plan-card .plan-unit {
        font-size: 11px;
        color: var(--t3);
        margin-top: 2px;
    }

    .ta-plan-card.selected .plan-amount {
        color: var(--up);
    }

.ta-balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
}

    .ta-balance-row .bal-label {
        color: var(--t3);
    }

    .ta-balance-row .bal-val {
        font-weight: 600;
        color: var(--t1);
    }

.ta-terms-box {
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--t2);
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 14px;
}

/* 純檢視協議(Member/List.razor「交易協議」)的 .ta-terms-box 是 .ta-body 裡唯一的內容，不像簽署流程
   下面還有方案卡片/餘額列要一起塞進同一個 180px 的小框裡——那個 180px 上限對純檢視來說完全不夠，
   讓文字被關在一個小捲軸裡、外面卻是一大片空白。這裡讓它吃滿 .ta-body 剩下的高度，自己捲動。 */
.ta-terms-box.full {
    max-height: none;
    flex: 1;
}

    .ta-terms-box h4 {
        margin: 0 0 8px;
        font-size: 13px;
        font-weight: 700;
        color: var(--t1);
        text-align: center;
    }

    .ta-terms-box p {
        margin: 0 0 6px;
    }

    .ta-terms-box strong {
        color: var(--t1);
    }

.ta-footer {
    padding: 12px 18px 20px;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    border-top: 1px solid var(--b1);
}

.ta-cancel-btn {
    flex: 1;
    padding: 13px;
    border-radius: 10px;
    border: 1.5px solid var(--b2);
    background: none;
    color: var(--t2);
    font-size: 15px;
    cursor: pointer;
}

.ta-confirm-btn {
    flex: 2;
    padding: 13px;
    border-radius: 10px;
    border: none;
    background: var(--up);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

    .ta-confirm-btn:disabled {
        opacity: 0.38;
        cursor: not-allowed;
    }

/* ═══════════════════════════════════════════
   App 更新下載進度覆蓋層 (UpdateOverlay.razor)
   ═══════════════════════════════════════════ */
.po-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.po-card {
    width: min(560px, 92vw);
    background: var(--bg-card);
    border: 1px solid var(--b1);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,.6);
    color: var(--t1);
}

.po-title {
    font: 700 20px/1.2 ui-sans-serif, system-ui, "Segoe UI", Roboto, Arial;
    letter-spacing: .02em;
    margin-bottom: 18px;
}

.po-bar-wrap {
    margin-top: 6px;
}

.po-bar {
    width: 100%;
    height: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--b1);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 0 6px rgba(0,0,0,.5);
}

.po-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg,#FF4D6D,#4DD0FF,#7CFC00,#FFD93D,#B983FF);
    background-size: 200% 100%;
    animation: po-flow 2.2s linear infinite;
    box-shadow: 0 0 12px rgba(77,208,255,.5), 0 0 22px rgba(185,131,255,.35);
    transition: width .2s ease;
}

@keyframes po-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.po-bar-text {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font: 600 14px/1.3 ui-sans-serif, system-ui, "Segoe UI", Roboto, Arial;
    color: var(--t1);
    letter-spacing: .03em;
}

.po-status {
    opacity: .85;
}

/* Router 最外層的錯誤狀態沒有 MainLayout；使用完整品牌畫面，避免只剩一行文字與裸按鈕。 */
.app-status-screen { min-height:100dvh; padding:96px 32px 48px; display:flex; flex-direction:column; align-items:center; text-align:center; color:var(--t1); background:radial-gradient(circle at 76% 20%,rgba(255,193,7,.10),transparent 30%),radial-gradient(circle at 18% 72%,rgba(39,102,217,.15),transparent 35%),var(--bg); }
.status-orb { width:84px; height:84px; display:flex; align-items:center; justify-content:center; border-radius:28px; border:1px solid rgba(255,193,7,.34); background:linear-gradient(145deg,rgba(255,193,7,.18),rgba(23,29,39,.9)); box-shadow:0 16px 38px rgba(0,0,0,.28),inset 0 1px rgba(255,255,255,.09); }
.status-icon { font-size:46px; line-height:1; color:var(--accent); transform:rotate(-15deg); }
.status-eyebrow { margin-top:28px; color:var(--accent); font-size:11px; font-weight:800; letter-spacing:1.8px; }
.app-status-screen h1 { margin:10px 0 12px; font-size:24px; font-weight:750; }
.app-status-screen p { max-width:300px; margin:0; color:var(--t2); font-size:14px; line-height:1.75; }
.status-retry { margin-top:30px; min-width:172px; height:46px; border:0; border-radius:14px; color:#17120a; background:var(--accent); font-weight:800; font-size:14px; box-shadow:0 10px 24px rgba(255,193,7,.18); }
.status-retry:active { transform:scale(.97); filter:brightness(.92); }
.status-retry span { font-size:19px; vertical-align:-1px; margin-right:5px; }
