/* =============================================
   授权管理系统 - 蓝白极简风格
   灵感: 小米MiMo控制台设计语言
   ============================================= */

/* --- CSS Variables --- */
:root {
    --primary: #2563EB;
    --primary-light: #3B82F6;
    --primary-lighter: #DBEAFE;
    --primary-dark: #1D4ED8;
    --primary-gradient: linear-gradient(135deg, #2563EB 0%, #3B82F6 50%, #60A5FA 100%);
    --accent: #06B6D4;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #6366F1;

    --bg: #F5F7FA;
    --bg-white: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F0F4FF;

    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;

    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 16px rgba(37,99,235,0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --sidebar-width: 240px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    --font-sans: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
input, button, select, textarea { font-family: inherit; font-size: inherit; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* =============================================
   Layout: Sidebar + Topbar + Main
   ============================================= */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: var(--transition);
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-item span {
    display: none;
}
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .nav-item {
    justify-content: center;
}
.sidebar.collapsed ~ .topbar,
.sidebar.collapsed ~ .main-content {
    left: var(--sidebar-collapsed);
}
.sidebar-header {
    height: var(--topbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem; font-weight: 700;
    color: var(--primary);
}
.sidebar-logo i { font-size: 1.5rem; }
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.2rem;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--primary); }

.sidebar-nav {
    flex: 1; padding: 12px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.nav-item i { font-size: 1.25rem; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--primary); }
.nav-item.active {
    background: var(--primary-lighter);
    color: var(--primary);
    font-weight: 600;
}
.sidebar-footer {
    padding: 12px; border-top: 1px solid var(--border-light);
    display: flex; flex-direction: column; gap: 2px;
}

/* Topbar */
.topbar {
    position: fixed; top: 0;
    left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    z-index: 90;
    transition: var(--transition);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-btn {
    display: none; background: none; border: none;
    font-size: 1.3rem; color: var(--text-secondary);
    cursor: pointer; width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--bg-hover); color: var(--primary); }
.page-title { font-size: 1.15rem; font-weight: 600; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: var(--radius-full);
    background: var(--bg);
    font-size: 0.9rem; color: var(--text-secondary);
}
.topbar-user i { font-size: 1.1rem; color: var(--primary); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px 28px;
    min-height: calc(100vh - var(--topbar-height));
    transition: var(--transition);
}

/* =============================================
   Cards & Containers
   ============================================= */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title {
    font-size: 1.05rem; font-weight: 600;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); font-size: 1.2rem; }
.card-body { padding: 22px; }
.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px;
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

/* 功能卡片网格布局 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 22px;
    display: flex; align-items: flex-start; gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.06;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:nth-child(1)::after { background: var(--primary); }
.stat-card:nth-child(2)::after { background: var(--success); }
.stat-card:nth-child(3)::after { background: var(--warning); }
.stat-card:nth-child(4)::after { background: var(--danger); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-lighter); color: var(--primary); }
.stat-icon.green { background: #D1FAE5; color: var(--success); }
.stat-icon.orange { background: #FEF3C7; color: var(--warning); }
.stat-icon.red { background: #FEE2E2; color: var(--danger); }
.stat-info { flex: 1; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }

/* =============================================
   Tables
   ============================================= */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.92rem;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem; font-weight: 600;
    line-height: 1.6;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: var(--primary-lighter); color: var(--primary); }
.badge-default { background: var(--bg); color: var(--text-muted); }

/* =============================================
   Forms
   ============================================= */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
    font-size: 0.92rem;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394A3B8'%3E%3Cpath d='M12 16l-6-6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Search bar */
.search-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 18px; flex-wrap: wrap;
}
.search-bar .form-input { max-width: 300px; }
.search-bar .form-select { max-width: 160px; }

/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px;
    border: none; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn i { font-size: 1.1rem; }
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-dark); color: var(--text-white); box-shadow: 0 6px 20px rgba(37,99,235,0.35); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon {
    width: 36px; height: 36px; padding: 0;
    border-radius: var(--radius-sm);
}

/* =============================================
   Modals
   ============================================= */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%; max-width: 560px;
    max-height: 85vh;
    display: flex !important; 
    flex-direction: column !important;
    transform: translateY(20px) scale(0.97);
    transition: var(--transition);
    overflow: hidden !important;
    position: relative;
}
.modal form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 0 !important;
    margin: 0 !important;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none; border: none;
    font-size: 1.3rem; color: var(--text-muted);
    cursor: pointer; width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    flex-shrink: 0;
}

/* =============================================
   Pagination
   ============================================= */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; margin-top: 20px;
}
.pagination a, .pagination span {
    min-width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}
.pagination a:hover { background: var(--bg-hover); color: var(--primary); }
.pagination .active {
    background: var(--primary); color: white;
    box-shadow: var(--shadow-primary);
}
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* =============================================
   Toast / Alerts
   ============================================= */
.toast-container {
    position: fixed; top: 80px; right: 24px;
    z-index: 300;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px 20px;
    display: flex; align-items: center; gap: 12px;
    min-width: 280px; max-width: 420px;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 1.3rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-msg { flex: 1; font-size: 0.9rem; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { transform: translateX(100%); opacity: 0; }
}

/* =============================================
   Login Page
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%; right: -30%;
    width: 800px; height: 800px;
    background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: -40%; left: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(6,182,212,0.05) 0%, transparent 70%);
    border-radius: 50%;
}
.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%; max-width: 400px;
    position: relative; z-index: 1;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i {
    font-size: 2.8rem;
    color: var(--primary);
    display: block;
    margin-bottom: 12px;
}
.login-logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}
.login-logo p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card .form-input {
    padding: 12px 16px;
    border-radius: var(--radius-md);
}
.login-card .btn {
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* =============================================
   Action Toolbar
   ============================================= */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* =============================================
   Copy button
   ============================================= */
.copy-text {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 4px;
}
.copy-text:hover { background: var(--primary-lighter); }
.copy-text .ri-file-copy-line { font-size: 0.85rem; color: var(--text-muted); }

/* =============================================
   Mobile Bottom Nav (Agent panel)
   ============================================= */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-around;
    height: 60px;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 6px 0;
    transition: var(--transition);
}
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a:hover { color: var(--primary); }

/* 默认隐藏底部导航（PC端） */
@media (min-width: 769px) {
    .bottom-nav { display: none; }
}

.mobile-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: center;
    z-index: 90;
}
.mobile-header h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}
.mobile-content {
    padding: 72px 16px 80px;
    min-height: 100vh;
}

/* Agent login */
.agent-login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 20px;
}

/* =============================================
   Tab导航
   ============================================= */
.tab-nav {
    display: flex; background: #fff; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 20px;
    border: 1px solid var(--border);
}
.tab-btn {
    flex: 1; text-align: center; padding: 12px 16px; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--text-secondary);
    transition: var(--transition); border-bottom: 2px solid transparent;
}
.tab-btn.active {
    color: var(--primary); border-bottom-color: var(--primary);
    background: var(--primary-lighter); font-weight: 600;
}
.tab-btn:hover { background: var(--bg-hover); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

/* =============================================
   Responsive - Mobile APP Style
   ============================================= */
@media (max-width: 768px) {
    /* 仪表板双列布局改为单列 */
    div[style*="1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open ~ .sidebar-overlay { display: block; }

    /* 顶栏 - 移动端适配 */
    .topbar {
        left: 0;
        height: 56px;
        padding: 0 12px;
        backdrop-filter: blur(20px);
        background: rgba(255,255,255,0.92);
    }
    .menu-btn { display: flex; }
    .topbar-right .admin-user span { display: none; }

    /* 内容区 */
    .main-content {
        margin-left: 0;
        padding: 12px;
        padding-bottom: 80px;
    }
    .content-header { margin-bottom: 16px; }
    .content-header h1 { font-size: 1.25rem; }
    .content-header p { display: none; }

    /* 卡片 */
    .card { border-radius: var(--radius-md); }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 14px 16px; }

    /* 统计网格 */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card { padding: 12px; border-radius: var(--radius-md); }
    .stat-value { font-size: 1.2rem; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; }

    /* 工具栏 */
    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .toolbar-left, .toolbar-right { justify-content: flex-start; flex-wrap: wrap; }
    .search-bar { flex-direction: column; }
    .search-bar .form-input,
    .search-bar .form-select { max-width: 100%; }

    /* 表格 - 横向滚动 */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrapper table { min-width: 700px; }
    table th, table td { padding: 10px 12px; font-size: 13px; }
    
    /* 表格 - 移动端隐藏次要列(域名、到期时间) */
    .table-wrapper td:nth-child(2),
    .table-wrapper th:nth-child(2),
    .table-wrapper td:nth-child(4),
    .table-wrapper th:nth-child(4) { display: none; }

    /* 表单 */
    .form-row { grid-template-columns: 1fr; }
    .form-input, .form-select, .form-textarea {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 10px 14px;
    }

    /* 弹窗 - 底部滑出 */
    .modal-overlay {
        align-items: flex-end;
    }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 85vh;
        animation: slideUp 0.3s ease;
    }
    .modal-header { padding: 16px 20px 12px; }
    .modal-body { padding: 16px 20px; min-height: 0; -webkit-overflow-scrolling: touch; }
    .modal-footer { padding: 12px 20px 24px; flex-shrink: 0; }

    /* Tab导航 - 移动端 */
    .tab-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { white-space: nowrap; padding: 10px 14px; font-size: 13px; }

    /* 登录页 */
    .login-card { padding: 24px 18px; margin: 0 12px; }
    .login-logo h1 { font-size: 1.3rem; }

    /* Toast提示 */
    .toast { left: 12px; right: 12px; min-width: auto; }

    /* 分页 */
    .pagination { gap: 4px; }
    .pagination a { min-width: 36px; height: 36px; font-size: 13px; }

    /* 按钮 - 触摸友好 */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; padding: 6px 12px; }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 99;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { gap: 8px; padding: 10px; }
    .stat-icon { width: 32px; height: 32px; font-size: 0.9rem; }
    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: 0.75rem; }

    .pub-header { padding: 28px 16px 50px; }
    .pub-tabs { margin: -24px 12px 0; }
    .pub-tab { padding: 10px 4px; font-size: 12px; }
    .pub-tab i { font-size: 18px; }
}

/* =============================================
   Utility Classes
   ============================================= */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.78rem; }
.font-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* Checkbox custom */
.checkbox-wrap {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.checkbox-wrap input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
}

/* Tag input area */
.tag-area {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    min-height: 60px;
    background: var(--bg-white);
    transition: var(--transition);
}
.tag-area:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Loading spinner */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Install page */
.install-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 20px;
}
.install-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px;
    padding: 36px;
}
.install-steps {
    display: flex; gap: 8px; margin-bottom: 28px;
}
.install-step {
    flex: 1; height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: var(--transition);
}
.install-step.active { background: var(--primary); }
.install-step.done { background: var(--success); }

/* Result card */
.result-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.result-label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 4px; }
.result-value { font-weight: 600; color: var(--text-primary); word-break: break-all; }

/* Code block */
.code-block {
    background: #1E293B;
    color: #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    line-height: 1.8;
}
