/* ============================================================
   Telegram 管理面板 - 样式表
   暗色科技主题 · 手机优先 · 响应式
   ============================================================ */

/* ---------- CSS 变量：颜色主题 ---------- */
:root {
    --bg-base: #0a0a1a;          /* 主背景 */
    --bg-surface: #15152b;       /* 卡片背景 */
    --bg-elevated: #1e1e3a;      /* 升起层 / 输入背景 */
    --bg-deep: #060612;          /* 更深背景（终端） */

    --accent-start: #229ED9;     /* 强调色起点（蓝） */
    --accent-end: #6C5CE7;       /* 强调色终点（紫） */
    --accent-solid: #2B8FCC;     /* 单色强调（hover） */
    --accent-glow: rgba(108, 92, 231, 0.35);

    --text-primary: #f5f5fa;
    --text-secondary: #a8a8c0;
    --text-muted: #6b6b85;

    --success: #2ecc71;
    --danger: #ff5c5c;
    --warning: #f0a93b;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-fab: 0 8px 28px rgba(34, 158, 217, 0.45);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.6);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s var(--ease);

    --bottom-nav-h: 64px;
    --header-h: 76px;

    --font-mono: "SF Mono", "JetBrains Mono", "Consolas", "Monaco", monospace;
}

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    /* 背景光晕氛围 */
    background-image:
        radial-gradient(circle at 15% 10%, rgba(34, 158, 217, 0.12), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(108, 92, 231, 0.12), transparent 40%);
    background-attachment: fixed;
}

#app {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 980px;
    margin: 0 auto;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

input, textarea {
    font-family: inherit;
    color: inherit;
}

/* ---------- 视图切换 ---------- */
.view {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    animation: viewFadeIn 0.35s var(--ease);
}

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

/* ---------- 顶部头部 ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(180deg, rgba(10, 10, 26, 0.92), rgba(10, 10, 26, 0.75));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.header-inner {
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #b8b8d8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    box-shadow: var(--shadow-card);
}

.stat-item {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-value.stat-running {
    color: var(--success);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.05em;
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: var(--border-strong);
}

/* ---------- 内容区 ---------- */
.content {
    padding: 16px 14px 24px;
    position: relative;
}

.list-wrap {
    min-height: 300px;
}

/* ---------- 账号卡片网格 ---------- */
.account-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.account-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    /* 卡片顶部渐变光条 */
    animation: cardEnter 0.4s var(--ease) backwards;
}

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

.account-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
    opacity: 0.6;
}

.account-card:active {
    transform: scale(0.98);
}

@media (hover: hover) {
    .account-card:hover {
        transform: translateY(-3px);
        border-color: var(--border-strong);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow);
    }
}

.card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

.gender-female { color: #ff8fc7; }
.gender-male   { color: #7fc8ff; }

/* ---------- 状态指示灯 ---------- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    position: relative;
}

.status-dot.running {
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6);
    animation: breathe 2s infinite var(--ease);
}

.status-dot.stopped {
    background: var(--danger);
    opacity: 0.7;
}

@keyframes breathe {
    0%   { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* ---------- 浮动添加按钮 (FAB) ---------- */
.fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--bottom-nav-h) + 18px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-fab);
    z-index: 40;
    transition: transform var(--transition), box-shadow var(--transition);
}

.fab:active {
    transform: scale(0.9);
}

@media (hover: hover) {
    .fab:hover {
        transform: translateY(-2px) rotate(90deg);
        box-shadow: 0 12px 36px rgba(108, 92, 231, 0.6);
    }
}

/* ---------- 底部导航 ---------- */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10, 10, 26, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    max-width: 980px;
    margin: 0 auto;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    transition: color var(--transition);
    position: relative;
}

.nav-item.active {
    color: var(--accent-start);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
}

.nav-add-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 2px;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: transform var(--transition);
}

.nav-item.nav-add:active .nav-add-circle {
    transform: scale(0.88);
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

@media (hover: hover) {
    .btn-primary:hover:not(:disabled) {
        box-shadow: 0 6px 22px rgba(108, 92, 231, 0.55);
    }
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.btn-icon {
    padding: 12px;
    flex-shrink: 0;
}

/* 启动/停止大按钮 */
.btn-toggle {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #1a5e30, #2ecc71);
    color: #fff;
    box-shadow: 0 4px 18px rgba(46, 204, 113, 0.35);
    transition: transform var(--transition), background var(--transition), opacity var(--transition);
}

.btn-toggle.running {
    background: linear-gradient(135deg, #8b2535, #ff5c5c);
    box-shadow: 0 4px 18px rgba(255, 92, 92, 0.35);
}

.btn-toggle:active { transform: scale(0.97); }
.btn-toggle.loading .btn-label { opacity: 0; }
.btn-toggle.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- 输入框 ---------- */
.input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    font-size: 15px;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    border-color: var(--accent-end);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
    background: rgba(30, 30, 58, 0.9);
}

.textarea {
    resize: vertical;
    min-height: 90px;
    font-family: inherit;
    line-height: 1.5;
}

.code-input {
    text-align: center;
    letter-spacing: 8px;
    font-size: 22px;
    font-weight: 600;
}

/* ---------- 详情页头部 ---------- */
.detail-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--header-h);
    padding-top: env(safe-area-inset-top);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top) + 0px) 14px 0;
    background: rgba(10, 10, 26, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: calc(var(--header-h) + env(safe-area-inset-top));
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.icon-btn:active { transform: scale(0.9); }

@media (hover: hover) {
    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
    }
}

.detail-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-spacer {
    width: 40px;
    flex-shrink: 0;
}

.detail-content {
    padding-top: 16px;
}

/* ---------- 状态卡片 ---------- */
.status-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.status-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--accent-glow), transparent 60%);
    pointer-events: none;
}

.status-card-main {
    position: relative;
    z-index: 1;
}

.status-indicator-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.status-indicator-wrap .status-dot {
    width: 10px;
    height: 10px;
}

.status-text {
    font-size: 15px;
    font-weight: 600;
}

.status-meta {
    display: flex;
    gap: 20px;
}

.meta-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.meta-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ---------- 标签页 ---------- */
.tabs {
    margin-top: 18px;
}

.tab-list {
    position: relative;
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 2px;
}

.tab {
    flex: 1;
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 10px;
    transition: color var(--transition);
    z-index: 1;
    position: relative;
}

.tab.active {
    color: #fff;
}

.tab-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    border-radius: 10px;
    transition: transform var(--transition), width var(--transition);
    box-shadow: 0 2px 12px var(--accent-glow);
    z-index: 0;
}

.tab-panels {
    margin-top: 14px;
    min-height: 280px;
}

.tab-panel {
    display: none;
    animation: tabSlide 0.3s var(--ease);
}

.tab-panel.active {
    display: block;
}

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

/* ---------- 群组管理 ---------- */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 60px;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    animation: groupEnter 0.35s var(--ease);
}

@keyframes groupEnter {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.group-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.group-tag.loading-tag {
    background: rgba(240, 169, 59, 0.15);
    color: var(--warning);
    border-color: rgba(240, 169, 59, 0.3);
}

.group-delete {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}

.group-delete:active { transform: scale(0.88); }

@media (hover: hover) {
    .group-delete:hover {
        background: rgba(255, 92, 92, 0.12);
        color: var(--danger);
    }
}

.groups-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 12px;
    font-size: 13px;
}

.group-add-bar {
    display: flex;
    gap: 8px;
    position: sticky;
    bottom: 0;
    padding: 12px 0;
    background: linear-gradient(180deg, transparent, var(--bg-base) 30%);
}

.group-add-bar .input {
    flex: 1;
}

/* ---------- 聊天设置表单 ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.gender-switch {
    display: flex;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
}

.gender-btn {
    flex: 1;
    padding: 11px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
}

.gender-btn.active {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff;
    box-shadow: 0 3px 12px var(--accent-glow);
}

/* ---------- 日志查看器 ---------- */
.logs-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.logs-title {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.logs-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: breathe 2s infinite var(--ease);
}

.logs-viewer {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: #b8f5b8;
    height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    -webkit-overflow-scrolling: touch;
}

.logs-viewer::-webkit-scrollbar {
    width: 6px;
}
.logs-viewer::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.logs-line {
    animation: logIn 0.25s var(--ease);
}

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

.logs-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 60px 12px;
    font-size: 13px;
}

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 15, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.25s var(--ease);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-elevated);
    max-height: 92vh;
    overflow-y: auto;
    animation: modalSlideUp 0.35s var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
}

@keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0.3; }
    to   { transform: translateY(0); opacity: 1; }
}

@media (min-width: 600px) {
    .modal-overlay {
        align-items: center;
    }
    .modal {
        border-radius: var(--radius-xl);
        max-height: 88vh;
        animation: modalCenter 0.35s var(--ease);
    }
    @keyframes modalCenter {
        from { transform: scale(0.95) translateY(20px); opacity: 0; }
        to   { transform: scale(1) translateY(0); opacity: 1; }
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    padding: 18px;
}

/* ---------- 步骤指示器 ---------- */
.steps {
    display: flex;
    align-items: center;
    padding: 4px 18px 16px;
    gap: 4px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition);
}

.step.active .step-num {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px var(--accent-glow);
}

.step.done .step-num {
    background: var(--success);
    color: #fff;
    border-color: transparent;
}

.step.done .step-num::after {
    content: '✓';
}

.step.done .step-num > span,
.step.done .step-num { font-size: 0; }
.step.done .step-num::after { font-size: 14px; }

.step-label {
    font-size: 11px;
    color: var(--text-muted);
}

.step.active .step-label,
.step.done .step-label {
    color: var(--text-secondary);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin-bottom: 16px;
    border-radius: 2px;
}

.step-panel {
    display: none;
    animation: stepFade 0.3s var(--ease);
}

.step-panel.active {
    display: block;
}

@keyframes stepFade {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.step-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.step-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0 4px;
    text-align: center;
}

.step-error {
    color: var(--danger);
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
    min-height: 16px;
}

/* ---------- Toast 通知 ---------- */
.toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 420px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    box-shadow: var(--shadow-elevated);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.35s var(--ease);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: auto;
}

.toast.toast-out {
    animation: toastOut 0.3s var(--ease) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-12px); }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-error .toast-icon   { color: var(--danger); }
.toast-info    { border-left: 3px solid var(--accent-start); }
.toast-info .toast-icon    { color: var(--accent-start); }

/* ---------- 骨架屏 ---------- */
.skeleton-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.skeleton-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    height: 90px;
    position: relative;
    overflow: hidden;
    animation: delayIn 0.2s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 0.08s);
}

@keyframes delayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 50%,
        transparent 100%);
    animation: shimmer 1.4s infinite var(--ease);
    transform: translateX(-100%);
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ---------- 加载 Spinner ---------- */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-end);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-ghost.loading::after {
    border-color: rgba(168, 168, 192, 0.3);
    border-top-color: var(--text-secondary);
}

/* ---------- 空状态 / 错误状态 ---------- */
.empty-state, .error-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-icon {
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 16px;
    animation: floatY 3s ease-in-out infinite;
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.empty-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-action {
    margin: 0 auto;
}

.error-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.error-text {
    font-size: 14px;
    color: var(--danger);
    margin-bottom: 16px;
}

/* ---------- 全局加载遮罩 ---------- */
.global-loading {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 下拉刷新 ---------- */
.pull-refresh-hint {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    height: 0;
    overflow: hidden;
    transition: height var(--transition);
}

.pull-refresh-hint.active {
    height: 40px;
}

.pull-refresh-hint.refreshing .pull-icon {
    animation: spin 0.8s linear infinite;
}

/* ============================================================
   响应式：桌面端优化
   ============================================================ */
@media (min-width: 640px) {
    .header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 18px 24px;
    }

    .header-stats {
        padding: 12px 20px;
    }

    .stat-value { font-size: 24px; }

    .account-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .content { padding: 18px 24px 28px; }

    .fab {
        right: 24px;
    }
}

@media (min-width: 900px) {
    .account-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .logs-viewer {
        height: 420px;
    }
}

/* 桌面端隐藏底部导航 + FAB，使用顶部导航替代 */
@media (min-width: 720px) {
    .bottom-nav { display: none; }
    .fab { bottom: 24px; }
    .view { padding-bottom: 24px; }
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- 选中文本 ---------- */
::selection {
    background: rgba(108, 92, 231, 0.35);
    color: #fff;
}
