/* ============ 晚自习辅导管理系统 · 全局样式（桌面 + 手机端自适应） ============ */
:root {
    --primary: #4f6ef7;
    --primary-dark: #3b5bdb;
    --primary-light: #eef1fe;
    --primary-grad: linear-gradient(135deg, #5b8def, #4f6ef7);
    --bg: #f3f5fb;
    --card: #ffffff;
    --border: #e6e9f2;
    --text: #1f2937;
    --muted: #6b7280;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(31, 42, 68, .06), 0 6px 20px rgba(31, 42, 68, .05);
    --shadow-hover: 0 4px 10px rgba(31, 42, 68, .10), 0 12px 28px rgba(31, 42, 68, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 216px; background: linear-gradient(180deg, #1c2541, #141b34); color: #b7c1d8; flex-shrink: 0;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
    padding: 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08); letter-spacing: 1px;
    background: rgba(255,255,255,.04);
}
.sidebar nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 11px 18px; color: #b7c1d8;
    font-size: 14px; border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(95,116,255,.22); color: #fff; border-left-color: #7c93ff; font-weight: 600; }
.nav-ico { font-size: 15px; width: 20px; text-align: center; }

.main { flex: 1; padding: 20px 26px; min-width: 0; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px;
    flex-wrap: wrap; gap: 8px;
}
.page-title { font-size: 20px; font-weight: 700; color: #111827; }
.user-box { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.user-chip {
    background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 5px 14px;
    box-shadow: var(--shadow);
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 12px; color: #111827; }
.card h3::before { content: ''; display: inline-block; width: 4px; height: 14px; background: var(--primary); border-radius: 2px; margin-right: 8px; vertical-align: -2px; }

/* ---------- 统计卡片 ---------- */
.grid { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-card {
    flex: 1 1 150px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; min-width: 0; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; right: -18px; top: -18px; width: 72px; height: 72px;
    background: var(--primary-light); border-radius: 50%;
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--primary-dark); position: relative; }
.stat-card .label { color: var(--muted); font-size: 12px; margin-top: 2px; position: relative; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: middle; }
.tbl th {
    background: #f7f9fd; font-weight: 600; color: #374151; white-space: nowrap;
    position: sticky; top: 0; z-index: 1;
}
.tbl tr:nth-child(even) td { background: #fafbfe; }
.tbl tr:hover td { background: #eef2fe; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.stat-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.badge-swap { background: #fae8ff; color: #86198f; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 16px; border-radius: 10px; background: var(--primary-grad);
    color: #fff; border: none; cursor: pointer; font-size: 13px; line-height: 1.4;
    box-shadow: 0 2px 6px rgba(79,110,247,.25); transition: all .15s; min-height: 34px;
}
.btn:hover { opacity: .92; box-shadow: 0 4px 10px rgba(79,110,247,.35); transform: translateY(-1px); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; min-height: 30px; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: #f4f6fb; box-shadow: none; }
.btn-green { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 2px 6px rgba(22,163,74,.25); }
.btn-orange { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 2px 6px rgba(217,119,6,.25); }
.btn-red { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 2px 6px rgba(220,38,38,.25); }
.btn-warn { background: #fff; color: var(--danger); border: 1px solid #fca5a5; box-shadow: none; }
.btn-warn:hover { background: #fef2f2; }

/* ---------- 提示条 ---------- */
.alert { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- 表单 ---------- */
form.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { font-size: 13px; color: #374151; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=file], select, textarea {
    padding: 8px 11px; border: 1px solid #d4d9e6; border-radius: 9px; font-size: 13px;
    font-family: inherit; background: #fff; color: var(--text); min-height: 34px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,.14); }
textarea { width: 100%; min-height: 60px; resize: vertical; }

/* ---------- 排班表 ---------- */
table.sched { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.sched th, .sched td { border: 1px solid var(--border); padding: 7px 9px; text-align: center; }
.sched th { background: #f7f9fd; font-weight: 600; color: #374151; }
.sched td { background: #fff; }
.sched tr:hover td { background: #fafbfe; }
.sched .bld-cell { background: linear-gradient(180deg, #eef2ff, #e6ecff); font-weight: 700; width: 78px; color: #1e3a8a; }
.sched .rooms-cell { text-align: left; font-size: 12px; color: #374151; min-width: 160px; }
.sched select { font-size: 12px; padding: 4px 6px; max-width: 112px; border-radius: 7px; }
.sched .swap-tag { color: #a21caf; font-weight: 700; margin-left: 4px; }

/* ---------- 勾选网格 ---------- */
.check-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.check-grid label {
    display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border);
    border-radius: 10px; padding: 7px 12px; cursor: pointer; background: #fff; font-size: 13px;
    transition: all .12s;
}
.check-grid label:hover { border-color: var(--primary); }
.check-grid label.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 500; }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
    padding: 8px 18px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
    color: var(--text); font-size: 13px; cursor: pointer; transition: all .12s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary-grad); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(79,110,247,.3); }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: linear-gradient(135deg, #dbe4ff 0%, #f3f5fb 55%, #eef1fe 100%);
}
.login-card { background: #fff; border-radius: 18px; padding: 38px 40px; width: 380px; max-width: 100%; box-shadow: 0 10px 40px rgba(31,42,68,.12); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; color: #111827; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card input[type=text], .login-card input[type=password] { width: 100%; padding: 11px 13px; margin-bottom: 13px; font-size: 14px; min-height: 44px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 15px; min-height: 44px; }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; height: 320px; }

/* ---------- 教师端快捷入口（手机友好大按钮） ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.quick-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 12px;
    box-shadow: var(--shadow); transition: all .15s; color: var(--text); text-align: center; min-height: 96px;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--primary); color: var(--primary-dark); }
.quick-card .q-ico { font-size: 26px; }
.quick-card .q-name { font-size: 14px; font-weight: 600; }
.quick-card .q-desc { font-size: 11px; color: var(--muted); }

/* ---------- 通用工具类 ---------- */
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- 手机端适配（企业微信内置浏览器同样生效） ---------- */
@media (max-width: 900px) {
    .main { padding: 14px 14px 40px; }
    .card { padding: 14px 14px; }
    .table-wrap { margin: 0 -2px; }
    .tbl th, .tbl td { padding: 7px 8px; font-size: 12px; }
}
@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%; height: auto; position: sticky; top: 0; z-index: 20;
        background: linear-gradient(90deg, #1c2541, #232f52);
        border-bottom: 1px solid rgba(255,255,255,.08);
    }
    .brand { padding: 12px 16px; font-size: 15px; }
    .sidebar nav { display: flex; overflow-x: auto; padding: 6px 8px; gap: 4px; -webkit-overflow-scrolling: touch; }
    .nav-item {
        padding: 9px 12px; border-left: none; border-bottom: 2px solid transparent;
        white-space: nowrap; flex-shrink: 0; font-size: 13px;
    }
    .nav-item.active { border-bottom-color: #7c93ff; }
    .nav-ico { font-size: 14px; }
    .page-title { font-size: 17px; }
    .user-chip { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stat-card { flex: 1 1 44%; }
    .chart-box { height: 240px; }
    .btn { min-height: 40px; }
    .btn-sm { min-height: 34px; }
    input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], select {
        min-height: 40px; font-size: 15px;
    }
    .check-grid label { padding: 9px 12px; font-size: 14px; }
    .sched select { min-height: 34px; }
    .login-card { padding: 30px 24px; }
    .quick-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
