/* TokenRelay 全局样式 */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --radius: 8px;
    --transition: all .2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ─── 布局 ─── */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-logo span {
    font-size: 12px;
    color: var(--text-secondary);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item .icon { margin-right: 10px; font-size: 16px; width: 20px; text-align: center; }

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ─── 卡片 ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* ─── 统计卡片 ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.stat-card-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.stat-card-clickable:active {
    transform: scale(0.97);
}
.stat-card-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ─── 按钮 ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── 表格 ─── */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

tr:hover { background: var(--primary-light); }

/* ─── 表单 ─── */
.form-group { margin-bottom: 16px; }

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

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

select.form-control { appearance: auto; }

/* ─── 徽章 ─── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ─── 进度条 ─── */
.progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .3s ease;
}

.progress-bar.primary { background: var(--primary); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }



/* ─── 提示框 ─── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn .3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── 模态框 ─── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 { margin-bottom: 16px; }
.modal .form-group { margin-bottom: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─── 分页 ─── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 16px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}

.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* ─── 空状态 ─── */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

﻿/* ??? ??????????? ??? */

@media (max-width: 768px) {
    /* ??CSS?768px????display:none??????????? */
    .sidebar {
        display: flex !important;
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        left: auto !important;
        top: auto !important;
        bottom: auto !important;
        padding: 0 !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        background: var(--card-bg);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        box-shadow: var(--shadow);
        z-index: 50;
    }
    .sidebar::-webkit-scrollbar { display: none; }

    .sidebar-logo {
        display: none !important;
    }

    .sidebar .nav-item {
        flex: 0 0 auto;
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-left: none !important;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
    }

    .sidebar .nav-item.active {
        border-left-color: transparent !important;
        border-bottom-color: var(--primary);
    }

    .sidebar .nav-item .icon {
        margin-right: 4px !important;
        font-size: 14px !important;
    }

    .sidebar > div:first-of-type {
        display: none !important;
    }

    .app-container {
        flex-direction: column !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h2 {
        font-size: 18px;
    }

    .page-header .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-header .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px 10px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .stat-card .stat-label {
        font-size: 12px;
    }

    .card {
        padding: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .table-wrapper {
        overflow-x: auto;
        margin: 0 -14px;
        padding: 0 14px;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .modal {
        width: calc(100vw - 32px);
        max-width: 100%;
        max-height: 85vh;
        padding: 20px;
        margin: 0 16px;
        border-radius: 10px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .pagination button {
        padding: 8px 14px;
        font-size: 14px;
        min-width: 36px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .empty-state {
        padding: 24px 16px;
    }

    .empty-state .icon {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .sidebar .nav-item {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .main-content {
        padding: 12px !important;
    }

    .card {
        padding: 12px;
        border-radius: 6px;
    }

    .login-card {
        padding: 24px 20px;
        max-width: 94vw;
    }

    .login-card h2 {
        font-size: 20px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 16px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
    }

    .btn-sm {
        padding: 6px 10px;
        min-height: auto;
        font-size: 12px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px 8px;
    }

    .card-header h3 {
        font-size: 14px;
    }

    .key-display {
        font-size: 12px;
        padding: 6px 10px;
        word-break: break-all;
    }

    .progress {
        height: 6px;
    }

    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        font-size: 13px;
        padding: 10px 16px;
    }

    .login-container {
        background: linear-gradient(160deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
    }

    .login-card {
        width: 100%;
        padding: 28px 20px;
    }

    .login-card .tabs {
        margin-bottom: 16px;
    }
}

/* ??? ???????? ??? */
.sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
}
