/* ===== 基础重置与变量 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; padding: 24px; max-width: 1200px; }

/* ===== 侧边栏 ===== */
.sidebar {
    width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 20px; font-size: 17px; font-weight: 700; color: white;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: block; padding: 12px 20px; color: var(--sidebar-text);
    text-decoration: none; font-size: 14px; transition: all .2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: white; }
.sidebar-nav a.active { background: var(--sidebar-active); color: white; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { margin-bottom: 12px; font-size: 14px; color: white; }
.role-badge {
    display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 20px;
    font-size: 12px; background: rgba(255,255,255,.15); color: white;
}

/* ===== 登录页 ===== */
.login-body { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); min-height: 100vh; }
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
    background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 24px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--text-light); font-size: 14px; margin-bottom: 24px; }
.login-tip { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 16px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
    border: none; cursor: pointer; text-decoration: none; transition: all .2s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ===== Flash 消息 ===== */
.flash-container { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }

/* ===== 卡片 ===== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-label { font-size: 13px; color: var(--text-light); }
.stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }

/* ===== 新闻列表 ===== */
.news-list { list-style: none; }
.news-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.news-list li:last-child { border-bottom: none; }
.news-list a { color: var(--text); text-decoration: none; flex: 1; }
.news-list a:hover { color: var(--primary); }
.news-date { font-size: 12px; color: var(--text-light); white-space: nowrap; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

/* ===== 表单 ===== */
.form-container { max-width: 600px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 14px; transition: border-color .2s; background: white;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ===== 表格 ===== */
.table-container { overflow-x: auto; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; color: var(--text-light); font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ===== 徽章 ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-staff { background: #f1f5f9; color: #64748b; }

/* ===== 页面标题 ===== */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; }

/* ===== 标签页 ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--card-bg); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; background: none; color: var(--text-light); text-decoration: none; transition: all .2s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: white; }

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: var(--radius); padding: 24px; max-width: 480px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 40px 20px; color: var(--text-light); background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-icon { font-size: 48px; margin-bottom: 8px; }

/* ===== 详情页 ===== */
.detail-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 120px; color: var(--text-light); font-size: 14px; flex-shrink: 0; }
.detail-value { flex: 1; font-size: 14px; }
