/* ════════════════════════════════════════════
   Captcha API - 管理后台样式
   ════════════════════════════════════════════ */
:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --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);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── 侧边栏 ── */
.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-700);
}
.sidebar-brand h1 { font-size: 1.1em; font-weight: 700; }
.sidebar-brand h1 span { color: var(--primary-light); }
.sidebar-brand small { font-size: 0.75em; color: var(--gray-400); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-300);
    font-size: 0.9em;
    transition: all .15s;
}
.sidebar-nav a:hover { background: var(--gray-800); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 1.1em; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--gray-700); font-size: 0.85em; color: var(--gray-500); }

/* ── 主内容区 ── */
.main { flex: 1; margin-left: 240px; padding: 0; }
.topbar {
    background: #fff;
    padding: 16px 32px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h2 { font-size: 1.3em; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 0.9em; color: var(--gray-500); }
.topbar-right .user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85em; font-weight: 600;
}
.content { padding: 32px; }

/* ── 卡片网格 ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 0.85em; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .value { font-size: 2em; font-weight: 700; }
.stat-card .sub { font-size: 0.85em; color: var(--gray-400); margin-top: 4px; }
.stat-card .value.green { color: var(--success); }
.stat-card .value.blue { color: var(--primary); }
.stat-card .value.red { color: var(--danger); }
.stat-card .value.amber { color: var(--warning); }

/* ── 卡片 ── */
.card {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 24px;
}
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 1em; font-weight: 600; }
.card-body { padding: 20px 24px; }
.card-body:empty { display: none; }

/* ── 表格 ── */
table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
th { font-weight: 600; color: var(--gray-500); font-size: 0.8em; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ── 标签 ── */
.tag {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 0.8em; font-weight: 500;
}
.tag-green { background: #d1fae5; color: #065f46; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-blue { background: var(--primary-bg); color: var(--primary); }
.tag-amber { background: #fef3c7; color: #92400e; }

/* ── 按钮 ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: none;
    font-size: 0.9em; font-weight: 500; cursor: pointer;
    transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 4px 10px; font-size: 0.8em; }

/* ── 模态框 ── */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff; border-radius: var(--radius);
    padding: 32px; min-width: 400px; max-width: 90vw;
    box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 1.1em; margin-bottom: 16px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; font-size: 0.85em; color: var(--gray-500); margin-bottom: 4px; }
.modal .form-group input, .modal .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 0.9em; outline: none;
}
.modal .form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── 消息提示 ── */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
    font-size: 0.9em;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--primary-bg); color: var(--primary); border: 1px solid #c7d2fe; }

/* ── 空状态 ── */
.empty { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty .empty-icon { font-size: 3em; margin-bottom: 12px; }
.empty p { font-size: 0.9em; }

/* ── 登录页 ── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, #312e81 100%);
}
.login-card {
    background: #fff; border-radius: var(--radius);
    padding: 40px; width: 400px; max-width: 90vw;
    box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 1.5em; text-align: center; margin-bottom: 4px; }
.login-card p { text-align: center; color: var(--gray-500); font-size: 0.9em; margin-bottom: 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label { display: block; font-size: 0.85em; color: var(--gray-500); margin-bottom: 4px; }
.login-card .form-group input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 0.95em; outline: none;
}
.login-card .form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.login-card .btn { width: 100%; padding: 12px; justify-content: center; margin-top: 8px; }
.login-card .switch-link { text-align: center; margin-top: 16px; font-size: 0.85em; color: var(--gray-500); }
.login-card .switch-link a { color: var(--primary); cursor: pointer; }
.login-card .alert { margin-bottom: 16px; }

/* ── 响应式 ── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand h1, .sidebar-brand small, .sidebar-nav a span, .sidebar-footer { display: none; }
    .sidebar-nav a { justify-content: center; padding: 12px; }
    .main { margin-left: 60px; }
    .content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 12px 16px; flex-direction: column; gap: 8px; text-align: center; }
}

/* ── 工具类 ── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--gray-500); font-size: 0.85em; }
.text-center { text-align: center; }
