:root {
    --primary: #4f7cff;
    --primary-dark: #3a63d8;
    --grad: linear-gradient(135deg, #4f7cff 0%, #6a5cff 50%, #9b5cff 100%);
    --bg: #eef1f7;
    --card-bg: #ffffff;
    --text: #1f2430;
    --muted: #8a94a6;
    --border: #e8ecf3;
    --success: #16a34a;
    --danger: #e5484d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }

/* ===== 布局 ===== */
.container { max-width: 1040px; margin: 0 auto; padding: 20px 16px; }

/* ===== 卡片 ===== */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(30, 42, 90, 0.06);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
    transition: background .18s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn.green { background: #22c55e; }
.btn.green:hover { background: #16a34a; }
.btn.red { background: #ef4444; }
.btn.red:hover { background: #dc2626; }
.btn.gray { background: #94a3b8; }
.btn.gray:hover { background: #64748b; }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { display: block; width: 100%; }

/* ===== 表单 ===== */
input, select {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    width: 100%;
    background: #fff;
    color: var(--text);
    transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}
.form-row { margin-bottom: 16px; }
label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 14px; }

.row-form { display: flex; gap: 10px; align-items: center; }
.row-form input { flex: 1; min-width: 0; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f6f8fc; font-weight: 600; font-size: 13px; color: #5b6472; white-space: nowrap; }
td { font-size: 14px; }
tr:hover td { background: #fafbfe; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.open { background: #dcfce7; color: #15803d; }
.tag.closed { background: #fee2e2; color: #b91c1c; }

/* ===== 后台头部 ===== */
.header { background: var(--grad); color: #fff; padding: 16px 24px; box-shadow: 0 2px 12px rgba(79,124,255,.25); }
.header a { color: #fff; }
.topbar { display: flex; justify-content: space-between; align-items: center; }

/* ===== 登录页 ===== */
.login-box { max-width: 400px; margin: 80px auto; padding: 0 16px; }

/* ===== 提示 ===== */
.error-msg { color: var(--danger); margin-bottom: 10px; font-size: 14px; }
.success-msg { color: var(--success); margin-bottom: 10px; }
.empty { color: #aab2c0; text-align: center; padding: 30px; }
.total-badge { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ================= 学生签到页 ================= */
.sign-body { background: var(--bg); }

.sign-hero {
    background: var(--grad);
    color: #fff;
    padding: 34px 20px 52px;
    border-radius: 0 0 28px 28px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(79, 124, 255, 0.25);
}
.sign-brand {
    display: inline-block;
    font-size: 13px;
    letter-spacing: 2px;
    opacity: .85;
    margin-bottom: 8px;
}
.sign-title { font-size: 26px; font-weight: 700; margin: 0 0 14px; }
.sign-status { margin-top: 4px; }
.sign-status .tag { background: rgba(255,255,255,.18); color: #fff; padding: 5px 14px; }
.sign-status .tag.open { background: rgba(34,197,94,.35); }
.sign-status .tag.closed { background: rgba(0,0,0,.25); }

.sign-container { max-width: 1080px; margin: -28px auto 40px; padding: 0 16px; }

.form-title { font-size: 18px; }
.sign-card { padding: 26px; }

/* 签到成功提示 */
.success-card {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    border-radius: 16px;
    padding: 22px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.3);
    animation: pop .4s ease;
}
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.success-icon {
    width: 44px; height: 44px; line-height: 44px;
    background: rgba(255,255,255,.25);
    border-radius: 50%;
    font-size: 22px;
    margin: 0 auto 10px;
}
.success-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.success-info { font-size: 14px; opacity: .95; }

.summary-bar {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(30,42,90,.05);
}
.summary-bar b { color: var(--primary); font-size: 20px; }

/* 班级区块 */
.class-card { padding: 20px; }
.class-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.class-head h3 { margin: 0; font-size: 17px; }

/* 签到格子：桌面 8 列（每块 6 行 = 48 人） */
.grid-cells {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
}
.cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 6px;
    min-height: 76px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(30,42,90,.05);
}
.cell-name { font-size: 15px; font-weight: 600; color: var(--text); }
.cell-no {
    font-size: 12px;
    color: #6b7280;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    margin-top: 5px;
    width: 100%;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
}

/* ===== 响应式 ===== */
@media (max-width: 860px) {
    .grid-cells { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .sign-title { font-size: 22px; }
}
@media (max-width: 480px) {
    .grid-cells { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .cell { min-height: 68px; padding: 10px 4px; }
    .cell-name { font-size: 14px; }
    .cell-no { font-size: 11px; }
    .sign-hero { padding: 28px 16px 44px; }
    .sign-title { font-size: 20px; }
    .container { padding: 14px 12px; }
    .card { padding: 16px; }
    .row-form { flex-direction: column; align-items: stretch; }
}
