/* =====================================================
   慧和工作台 · Premium Dark Sidebar Theme
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Sidebar */
    --sidebar-bg: #0D1B2A;
    --sidebar-width: 220px;
    --sidebar-border: rgba(255,255,255,0.06);
    --sidebar-text: rgba(255,255,255,0.65);
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(37,99,235,0.25);
    --sidebar-active-border: #2563EB;

    /* Brand */
    --blue: #2563EB;
    --blue-light: #3B82F6;
    --blue-dim: rgba(37,99,235,0.12);
    --gold: #F59E0B;
    --gold-dim: rgba(245,158,11,0.12);
    --emerald: #10B981;
    --rose: #F43F5E;

    /* Surface */
    --bg: #F0F4F9;
    --card: #FFFFFF;
    --card-border: rgba(0,0,0,0.06);
    --card-shadow: 0 2px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 8px 32px rgba(37,99,235,0.12), 0 2px 8px rgba(0,0,0,0.06);

    /* Text */
    --text: #111827;
    --text-2: #374151;
    --text-3: #6B7280;
    --text-4: #9CA3AF;

    /* Layout：顶部浮动条（语言 + 首页/退出） */
    --chrome-h: 56px;
    --radius: 14px;
    --radius-sm: 8px;
    --touch: 48px;

    --font: 'Inter', "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
    min-height: 100dvh;
    overflow: hidden;
}
body.body-app {
    overscroll-behavior-y: none;
}

/* =====================================================
   顶部浮动：语言切换 + 工作台 / 退出
   ===================================================== */
.top-floating {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: calc(6px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: none;
}

/* 已登录页面：语言设置不再悬浮覆盖内容 */
body.body-app .top-floating {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: 50;
    pointer-events: auto;
}
.top-floating .lang-bar,
.top-floating .chrome-actions {
    pointer-events: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}
.lang-pill.active {
    background: var(--blue);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
}
.lang-pill:active { transform: scale(0.97); }
.chrome-pill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    -webkit-tap-highlight-color: transparent;
}
.chrome-pill:active { transform: scale(0.98); opacity: 0.92; }
.chrome-out { color: var(--text-3); }

/* 兼容保留：旧侧栏布局已弃用 */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.sidebar::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-logo {
    padding: 28px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-logo-mark {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
}
.sidebar-logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--blue) 0%, #7C3AED 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700; color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    flex-shrink: 0;
}
.sidebar-logo-text {
    font-size: 1rem; font-weight: 700;
    color: #fff; letter-spacing: 0.5px;
}
.sidebar-logo-sub {
    font-size: 0.65rem; color: var(--sidebar-text);
    margin-top: 1px; letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 8px 10px 6px;
    margin-top: 8px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 2px solid transparent;
    transition: all 0.18s ease;
    min-height: var(--touch);
    position: relative;
    overflow: hidden;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--sidebar-text-active);
}
.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active-border);
    font-weight: 600;
}
.sidebar-link .nav-icon {
    width: 18px; height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}
.sidebar-link.active .nav-icon { opacity: 1; }
.sidebar-badge {
    margin-left: auto;
    background: var(--blue);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue) 0%, #7C3AED 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.sidebar-username { font-size: 0.8rem; color: var(--sidebar-text-active); font-weight: 600; }
.sidebar-role { font-size: 0.7rem; color: var(--sidebar-text); }
.btn-sidebar-logout {
    width: 100%;
    padding: 9px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: all 0.18s;
}
.btn-sidebar-logout:hover { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.3); color: #F87171; }

/* ---- Top bar（已弃用，保留类名避免误引用时报错） ---- */
.topbar { display: none; }

/* ---- Main：全屏内容区 ---- */
.main-wrap {
    margin-left: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding:
        calc(env(safe-area-inset-top, 0px) + var(--chrome-h) + 8px)
        max(16px, env(safe-area-inset-right, 0px))
        calc(24px + env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}
.main-wrap::-webkit-scrollbar { width: 0; height: 0; }

body.body-app .main-wrap {
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
}
.page-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px;
}
.page-title { font-size: 1.25rem; font-weight: 700; color: var(--text); }

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex; align-items: center; gap: 8px;
}
.card-title-icon {
    width: 28px; height: 28px;
    background: var(--blue-dim);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
}
.card-title-icon svg { width: 15px; height: 15px; color: var(--blue); }

/* =====================================================
   DASHBOARD
   ===================================================== */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 var(--radius) 0 80px;
    opacity: 0.08;
}
.stat-card.blue::after { background: var(--blue); }
.stat-card.gold::after { background: var(--gold); }
.stat-card.emerald::after { background: var(--emerald); }
.stat-card.rose::after { background: var(--rose); }

.stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-card.blue .stat-icon { background: var(--blue-dim); color: var(--blue); }
.stat-card.gold .stat-icon { background: var(--gold-dim); color: var(--gold); }
.stat-card.emerald .stat-icon { background: rgba(16,185,129,0.1); color: var(--emerald); }
.stat-card.rose .stat-icon { background: rgba(244,63,94,0.1); color: var(--rose); }

.stat-value {
    font-size: 2rem; font-weight: 800;
    line-height: 1; margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-2) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }

.dash-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.action-card {
    display: flex; flex-direction: column; align-items: flex-start;
    padding: 22px 20px;
    background: var(--card);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius);
    text-decoration: none; color: var(--text);
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.action-card::before {
    content: '';
    position: absolute;
    bottom: -40px; right: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}
.action-card:hover::before { opacity: 0.08; }
.action-card.ac-blue::before { background: var(--blue); }
.action-card.ac-gold::before { background: var(--gold); }
.action-card.ac-emerald::before { background: var(--emerald); }
.action-card.ac-purple::before { background: #7C3AED; }

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(37,99,235,0.15);
}
.action-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.action-icon svg { width: 22px; height: 22px; }
.ac-blue .action-icon { background: var(--blue-dim); color: var(--blue); }
.ac-gold .action-icon { background: var(--gold-dim); color: var(--gold); }
.ac-emerald .action-icon { background: rgba(16,185,129,0.1); color: var(--emerald); }
.ac-purple .action-icon { background: rgba(124,58,237,0.1); color: #7C3AED; }

.action-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.action-desc { font-size: 0.75rem; color: var(--text-3); line-height: 1.4; }
.action-arrow {
    margin-top: auto; align-self: flex-end;
    color: var(--text-4); font-size: 1.1rem;
    transition: transform 0.2s;
}
.action-card:hover .action-arrow { transform: translateX(4px); color: var(--blue); }

/* =====================================================
   FORMS
   ===================================================== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.form-group { margin-bottom: 18px; }

.form-label-pad {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.form-input-pad {
    width: 100%;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: var(--font);
    background: #FAFBFC;
    color: var(--text);
    min-height: var(--touch);
    outline: none;
    transition: all 0.18s ease;
}
.form-input-pad:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-input-pad::placeholder { color: var(--text-4); }
.form-select-pad {
    width: 100%;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: var(--font);
    background: #FAFBFC;
    color: var(--text);
    min-height: var(--touch);
    outline: none;
    cursor: pointer;
    transition: border-color 0.18s;
}
.form-select-pad:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Buttons */
.btn-pad {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 13px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    min-height: var(--touch);
    text-decoration: none;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.btn-primary-pad {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}
.btn-primary-pad:hover { background: #1D4ED8; box-shadow: 0 4px 16px rgba(37,99,235,0.4); transform: translateY(-1px); }
.btn-primary-pad:active { transform: translateY(0); }

.btn-outline-pad {
    background: transparent;
    color: var(--blue);
    border: 1.5px solid rgba(37,99,235,0.3);
}
.btn-outline-pad:hover { background: var(--blue-dim); border-color: var(--blue); }

.btn-ghost-pad {
    background: rgba(0,0,0,0.04);
    color: var(--text-2);
    border: 1.5px solid transparent;
}
.btn-ghost-pad:hover { background: rgba(0,0,0,0.08); }

.btn-danger-pad {
    background: rgba(244,63,94,0.08);
    color: var(--rose);
    border: 1.5px solid rgba(244,63,94,0.2);
}
.btn-danger-pad:hover { background: var(--rose); color: #fff; }

.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 15px 28px; font-size: 1rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 7px 14px; font-size: 0.78rem; min-height: 32px; }

/* =====================================================
   SEARCH
   ===================================================== */
.search-bar {
    display: flex; gap: 12px; margin-bottom: 24px;
    background: var(--card);
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}
.search-bar .form-input-pad {
    flex: 1; border: none; background: transparent;
    box-shadow: none; padding-left: 0;
}
.search-bar .form-input-pad:focus { box-shadow: none; }

/* =====================================================
   TABLE
   ===================================================== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0,0,0,0.06);
}
.table-pad {
    width: 100%; border-collapse: collapse;
    font-size: 0.875rem;
}
.table-pad thead th {
    background: #F8FAFC;
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    white-space: nowrap;
}
.table-pad td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    color: var(--text-2);
    vertical-align: middle;
}
.table-pad tbody tr:last-child td { border-bottom: none; }
.table-pad tbody tr:hover { background: #F8FAFC; }
.table-pad .td-action { display: flex; gap: 6px; }
.table-pad .td-action a,
.table-pad .td-action button {
    font-size: 0.78rem; font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    border: none; cursor: pointer;
    transition: all 0.15s;
}
.td-act-view { background: var(--blue-dim); color: var(--blue); }
.td-act-view:hover { background: var(--blue); color: #fff; }

/* =====================================================
   DETAIL / INFO GRID
   ===================================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.info-item {
    background: #F8FAFC;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,0.05);
}
.info-item-label {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.info-item-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.section-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }

/* =====================================================
   FINANCIAL DATA
   ===================================================== */
.amount-large {
    font-size: 1.8rem; font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}
.amount-medium { font-size: 1.1rem; font-weight: 700; }
.text-profit { color: var(--rose); }
.text-gain { color: var(--emerald); }
.text-neutral { color: var(--text-3); }

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600;
}
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-gold { background: var(--gold-dim); color: #B45309; }
.badge-emerald { background: rgba(16,185,129,0.1); color: #065F46; }
.badge-rose { background: rgba(244,63,94,0.1); color: #BE123C; }
.badge-gray { background: rgba(0,0,0,0.06); color: var(--text-3); }

/* =====================================================
   PRODUCT / CUSTOMER CARDS (List select)
   ===================================================== */
.select-card {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 18px;
    background: var(--card);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 10px;
    text-decoration: none; color: var(--text);
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: var(--card-shadow);
}
.select-card:hover {
    border-color: var(--blue);
    transform: translateX(3px);
    box-shadow: 0 4px 20px rgba(37,99,235,0.1);
}
.select-card-avatar {
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--blue-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 700; color: var(--blue);
    flex-shrink: 0;
}
.select-card-info { flex: 1; }
.select-card-name { font-size: 0.95rem; font-weight: 700; }
.select-card-sub { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }
.select-card-arrow { color: var(--text-4); transition: transform 0.18s; font-size: 1.1rem; }
.select-card:hover .select-card-arrow { transform: translateX(4px); color: var(--blue); }

/* Holding card */
.holding-card {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 18px;
    background: var(--card);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: var(--card-shadow);
    text-decoration: none; color: var(--text);
}
.holding-card:hover { border-color: var(--blue); transform: translateX(3px); }
.holding-tag {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue) 0%, #7C3AED 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 800; color: #fff;
    flex-shrink: 0;
}
.holding-info { flex: 1; }
.holding-name { font-size: 0.9rem; font-weight: 700; }
.holding-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.holding-value { text-align: right; }
.holding-market { font-size: 1rem; font-weight: 700; }
.holding-profit { font-size: 0.75rem; margin-top: 2px; }

/* =====================================================
   SIGNATURE
   ===================================================== */
.sig-container {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.sig-label {
    font-size: 0.78rem; font-weight: 700;
    color: var(--text-3); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 12px;
}
.sig-wrapper {
    border: 2px dashed rgba(37,99,235,0.25);
    border-radius: var(--radius-sm);
    background: #FAFBFF;
    position: relative;
    touch-action: none;
    overflow: hidden;
}
.sig-wrapper canvas {
    display: block; width: 100%;
    border-radius: var(--radius-sm);
}
.sig-placeholder {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-4); font-size: 0.85rem;
    pointer-events: none;
    transition: opacity 0.2s;
}
.sig-actions { display: flex; gap: 10px; margin-top: 12px; }

/* =====================================================
   KYC OPTION BUTTONS
   ===================================================== */
.option-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.option-btn {
    padding: 10px 18px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
    font-size: 0.875rem; font-family: var(--font);
    cursor: pointer; background: var(--card);
    color: var(--text-2);
    min-height: var(--touch);
    display: flex; align-items: center;
    transition: all 0.18s ease;
    font-weight: 500;
}
.option-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.option-btn.selected {
    background: var(--blue); color: #fff;
    border-color: var(--blue);
    box-shadow: 0 2px 10px rgba(37,99,235,0.3);
}
.option-btn input { display: none; }

/* =====================================================
   PROCESS STEPS (Subscribe / Redeem wizard)
   ===================================================== */
.steps-bar {
    display: flex; align-items: center;
    gap: 0; margin-bottom: 28px;
}
.step-item {
    display: flex; align-items: center; flex: 1;
}
.step-item:last-child { flex: 0; }
.step-circle {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s;
}
.step-circle.done { background: var(--emerald); color: #fff; }
.step-circle.active { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }
.step-circle.pending { background: rgba(0,0,0,0.08); color: var(--text-3); }
.step-label {
    font-size: 0.75rem; font-weight: 600; margin-left: 8px;
    color: var(--text-3);
    white-space: nowrap;
}
.step-label.active { color: var(--blue); }
.step-line {
    flex: 1; height: 2px;
    background: rgba(0,0,0,0.08);
    margin: 0 12px;
}
.step-line.done { background: var(--emerald); }

/* Confirm summary */
.confirm-summary {
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    border: 1px solid rgba(37,99,235,0.1);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.confirm-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.confirm-row:last-child { border-bottom: none; padding-bottom: 0; }
.confirm-key { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }
.confirm-val { font-size: 0.9rem; font-weight: 700; color: var(--text); }

/* =====================================================
   LOGIN PAGE — Video BG + Glassmorphism Card
   ===================================================== */
.login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.login-page::-webkit-scrollbar { width: 0; height: 0; }

/* 背景图 */
.lp-bg {
    position: absolute;
    inset: 0;
    background: url('/static/img/loginbg.jpg') center center / cover no-repeat;
    z-index: 0;
}

/* 特效视频层 —— screen 混合让光晕叠加在背景上 */
.lp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: screen;
    opacity: 0.75;
    z-index: 1;
    pointer-events: none;
}

/* 深色渐变遮罩，保证文字可读 */
.lp-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg,
            rgba(5,8,30,0.82) 0%,
            rgba(15,10,45,0.65) 50%,
            rgba(5,8,30,0.78) 100%);
    z-index: 2;
}

/* 顶层内容布局 */
.lp-body {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 60px)
             max(32px, env(safe-area-inset-right, 0px))
             max(32px, env(safe-area-inset-bottom, 0px))
             max(32px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.lp-body::-webkit-scrollbar { width: 0; height: 0; }

/* ——— 左侧文案 ——— */
.lp-left {
    flex: 1 1 0;
    min-width: 0;
    max-width: 520px;
    padding-right: 48px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lp-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}
.lp-logo-img {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 0 24px rgba(124,58,237,0.5), 0 4px 12px rgba(0,0,0,0.4);
    display: block;
}
.lp-logo-name {
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: 0.01em;
}
.lp-logo-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    margin-top: 3px;
    letter-spacing: 0.03em;
}

.lp-headline {
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    font-weight: 900;
    color: #fff;
    line-height: 1.35;
    margin: 0 0 16px;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 16px rgba(0,0,0,0.5);
}
.lp-headline-accent {
    background: linear-gradient(90deg, #60A5FA, #C084FC, #F0ABFC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lp-desc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.65;
    margin: 0 0 28px;
}

.lp-feats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.lp-feats li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}
.lp-feat-icon {
    color: #C084FC;
    font-size: 0.7rem;
    flex-shrink: 0;
    text-shadow: 0 0 8px rgba(192,132,252,0.8);
}

/* ——— 右侧登录卡 ——— */
.lp-right {
    flex: 0 0 400px;
    width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-card {
    width: 100%;
    background: rgba(20, 10, 50, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    padding: 36px 32px;
    box-sizing: border-box;
    box-shadow:
        0 0 0 1px rgba(124,58,237,0.08),
        0 8px 32px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

/* 卡片内 Logo */
.lp-card-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}
.lp-card-logo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 18px;
    box-shadow: 0 0 28px rgba(124,58,237,0.55), 0 4px 16px rgba(0,0,0,0.4);
    display: block;
}

.lp-card-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.lp-card-hint {
    text-align: center;
    font-size: 0.83rem;
    color: rgba(255,255,255,0.38);
    margin-bottom: 28px;
}

.lp-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 7px;
}
.lp-input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 0.95rem;
    font-family: var(--font);
    color: #fff;
    min-height: var(--touch);
    outline: none;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
}
.lp-input::placeholder { color: rgba(255,255,255,0.28); }
.lp-input:focus {
    border-color: rgba(124,58,237,0.7);
    background: rgba(124,58,237,0.12);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.lp-field { margin-bottom: 18px; }

.lp-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    min-height: var(--touch);
    font-family: var(--font);
    letter-spacing: 0.02em;
    box-shadow: 0 0 24px rgba(124,58,237,0.45), 0 4px 16px rgba(0,0,0,0.3);
    transition: all 0.2s;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}
.lp-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s;
}
.lp-btn:hover { transform: translateY(-2px); box-shadow: 0 0 32px rgba(124,58,237,0.65), 0 8px 24px rgba(0,0,0,0.35); }
.lp-btn:hover::before { opacity: 1; }
.lp-btn:active { transform: translateY(0); }

.lp-error {
    background: rgba(244,63,94,0.12);
    border: 1px solid rgba(244,63,94,0.25);
    color: #FCA5A5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
}

/* 旧类名兼容（其他模板可能仍引用） */
.login-error {
    background: rgba(244,63,94,0.15); border: 1px solid rgba(244,63,94,0.25);
    color: #FCA5A5; border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 0.85rem;
    margin-bottom: 16px;
}

/* =====================================================
   TOAST
   ===================================================== */
#toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + var(--chrome-h) + 12px);
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 9999; display: flex; flex-direction: column;
    gap: 8px; pointer-events: none;
    max-width: 340px;
}
.toast-msg {
    display: flex; align-items: center; gap: 10px;
    background: #1A2332;
    border: 1px solid rgba(255,255,255,0.08);
    color: #F1F5F9;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    opacity: 0; transform: translateX(20px);
    animation: tIn 0.3s forwards, tOut 0.3s 2.7s forwards;
    pointer-events: auto;
    backdrop-filter: blur(12px);
}
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast-msg.error .toast-dot { background: var(--rose); }
.toast-msg.success .toast-dot { background: var(--emerald); }
.toast-msg .toast-dot { background: var(--blue-light); }
@keyframes tIn { to { opacity:1; transform:translateX(0); } }
@keyframes tOut { to { opacity:0; transform:translateX(20px); } }

/* =====================================================
   MISC
   ===================================================== */
.empty-state {
    text-align: center; padding: 56px 20px;
    color: var(--text-4);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; }
.empty-text { font-size: 0.9rem; }

.divider { height: 1px; background: rgba(0,0,0,0.05); margin: 20px 0; }

/* Breadcrumb nav back */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-3); font-size: 0.85rem; text-decoration: none;
    margin-bottom: 16px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--blue); }

/* =====================================================
   RESPONSIVE – iPad portrait / mobile
   ===================================================== */
@media (max-width: 900px) {
    .action-desc { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .dash-actions {
        grid-template-columns: 1fr 1fr;
    }
}
/* 登录页响应式 */
@media (max-width: 860px) {
    .lp-left { display: none; }
    .lp-right { flex: 0 0 100%; max-width: 400px; width: 100%; }
    .lp-body { justify-content: center; padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 440px) {
    .lp-right { flex: 0 0 100%; width: 100%; max-width: 100%; }
    .lp-card { padding: 28px 20px; border-radius: 18px; }
}
@media (max-width: 600px) {
    .main-wrap {
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(14px, env(safe-area-inset-right, 0px));
    }
    .dash-actions { grid-template-columns: 1fr; }
}
