/* =====================================================================
   考试管理系统 · 设计系统
   移动优先，无外部依赖（4Mbps 出口经不起框架体积），中文字体栈优先
   ===================================================================== */

:root {
    --brand: #1a5fb4;
    --brand-dark: #14498c;
    --brand-light: #e8f0fb;
    --ink: #1f2733;
    --ink-2: #4b5563;
    --ink-3: #7b8494;
    --line: #e4e8ef;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --ok: #15803d;
    --ok-bg: #e7f6ec;
    --warn: #a16207;
    --warn-bg: #fdf4e3;
    --danger: #b91c1c;
    --danger-bg: #fdeaea;
    --info: #1a5fb4;
    --info-bg: #e8f0fb;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .05);
    --shadow-lg: 0 8px 32px rgba(16, 24, 40, .10);
    --sidebar-w: 236px;
    --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .6em; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 .8em; }
small { font-size: 12px; }

/* ------------------------------ 布局 ------------------------------ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--line);
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.nav { padding: 12px 10px; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group > .nav-title {
    font-size: 11px;
    color: var(--ink-3);
    letter-spacing: .08em;
    padding: 6px 10px 4px;
    text-transform: uppercase;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 13.5px;
    margin-bottom: 1px;
}
.nav a:hover { background: #f2f5fa; text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.nav a .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }

.content { padding: 22px 24px 48px; max-width: 1400px; width: 100%; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: -4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ 卡片 ------------------------------ */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-head {
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; }
.card-head .hint { font-size: 12.5px; color: var(--ink-3); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 17px;
    box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--ink-3); }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 12px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }

/* ------------------------------ 表格 ------------------------------ */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 620px;
}
table.data th {
    text-align: left;
    font-weight: 600;
    color: var(--ink-2);
    background: #fafbfd;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-size: 12.5px;
    letter-spacing: .01em;
}
table.data td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f2f7;
    vertical-align: middle;
}
table.data tbody tr:hover { background: #fafcff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--ink-3); }
table.data .nowrap { white-space: nowrap; }

.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }

/* ------------------------------ 徽标 ------------------------------ */

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    line-height: 1.7;
    font-weight: 500;
    white-space: nowrap;
}
.badge-gray { background: #f1f3f7; color: #566072; }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-dark { background: #eceff4; color: #39424f; }

.tag {
    display: inline-block;
    padding: 0 6px;
    border-radius: 4px;
    background: #f1f3f7;
    font-size: 11.5px;
    color: var(--ink-2);
    margin-right: 4px;
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.5;
    transition: background .12s, border-color .12s, box-shadow .12s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: #f7f9fc; text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-soft { background: var(--brand-light); border-color: transparent; color: var(--brand-dark); }
.btn-soft:hover { background: #dce8f8; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f2f5fa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; }

/* ------------------------------ 表单 ------------------------------ */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }

.field label {
    display: block;
    font-size: 12.5px;
    color: var(--ink-2);
    margin-bottom: 5px;
    font-weight: 500;
}
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="search"], input[type="file"], select, textarea {
    width: 100%;
    padding: 7px 11px;
    border: 1px solid #d6dbe5;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26, 95, 180, .12);
}
input[disabled], select[disabled] { background: #f5f7fa; color: var(--ink-3); }
textarea { min-height: 78px; resize: vertical; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 140px; }
.inline-form input[type="search"] { min-width: 200px; }

.checkline { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
.checkline input { width: auto; }

/* ------------------------------ 提示 ------------------------------ */

.alert {
    display: flex;
    gap: 9px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid transparent;
}
.alert-success { background: var(--ok-bg); color: #14612f; border-color: #c9ebd5; }
.alert-error { background: var(--danger-bg); color: #901c1c; border-color: #f6cfcf; }
.alert-warning { background: var(--warn-bg); color: #85510a; border-color: #f3e0b8; }
.alert-info { background: var(--info-bg); color: var(--brand-dark); border-color: #cfe0f6; }

.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13.5px;
}
.empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }

.hint-box {
    background: #f8fafd;
    border: 1px dashed #d8e0ec;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 12.5px;
    color: var(--ink-2);
    line-height: 1.7;
}
.hint-box code { font-family: var(--mono); background: #eef2f8; padding: 1px 5px; border-radius: 3px; }

/* ------------------------------ 分页 ------------------------------ */

.pagination { display: flex; gap: 5px; align-items: center; padding: 12px 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-2);
    background: #fff;
}
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .info { border: 0; color: var(--ink-3); background: transparent; }

/* ------------------------------ 座位图 ------------------------------ */

.seatmap {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
    max-width: 720px;
}
.seat {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 5px;
    text-align: center;
    font-size: 11.5px;
    line-height: 1.4;
    background: #fbfcfe;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.seat .no { font-weight: 600; font-size: 10.5px; color: var(--ink-3); }
.seat .who { font-size: 11.5px; color: var(--ink); }
.seat.empty { background: #fff; border-style: dashed; color: #c2c9d4; }

.desk-label {
    text-align: center;
    font-size: 11.5px;
    color: var(--ink-3);
    padding: 6px 0 10px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 12px;
    letter-spacing: .1em;
}

/* ------------------------------ 编排矩阵 ------------------------------ */

.matrix { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.matrix th { background: #fafbfd; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.matrix .slot { min-height: 34px; }
.matrix .person { display: inline-flex; align-items: center; gap: 5px; margin: 1px 0; }
.matrix .person .x {
    border: 0; background: transparent; color: #b9c0cc; cursor: pointer; padding: 0 2px; font-size: 13px;
}
.matrix .person .x:hover { color: var(--danger); }

/* ------------------------------ 登录 / 查询端 ------------------------------ */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
    background:
        radial-gradient(900px 420px at 12% -10%, #e3edfb 0%, rgba(227, 237, 251, 0) 62%),
        radial-gradient(760px 380px at 92% 108%, #e9f2ff 0%, rgba(233, 242, 255, 0) 58%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 396px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 30px 30px 26px;
}
.auth-card .logo { font-size: 12px; color: var(--brand); font-weight: 600; letter-spacing: .12em; }
.auth-card h1 { font-size: 21px; margin: 6px 0 4px; }
.auth-card .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 20px; }

.query-shell { min-height: 100vh; background: var(--bg); }
.query-nav {
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(1.4) blur(6px);
    position: sticky;
    top: 0;
    z-index: 30;
}
.query-nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.query-nav .brand { padding: 0; border: 0; }
.query-nav .links { display: flex; gap: 4px; flex-wrap: wrap; }
.query-nav .links a {
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--ink-2);
}
.query-nav .links a:hover { background: #f2f5fa; text-decoration: none; }
.query-nav .links a.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }

.query-main { max-width: 1080px; margin: 0 auto; padding: 30px 20px 60px; }

.hero {
    text-align: center;
    padding: 20px 0 26px;
}
.hero h1 { font-size: 26px; letter-spacing: -.02em; }
.hero p { color: var(--ink-3); font-size: 14px; max-width: 560px; margin: 0 auto; }

.entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.entry {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    transition: transform .14s, box-shadow .14s, border-color .14s;
    color: inherit;
}
.entry:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #cfdcee; text-decoration: none; }
.entry .icon {
    width: 38px; height: 38px; border-radius: 9px;
    background: var(--brand-light); color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; margin-bottom: 12px;
}
.entry h3 { font-size: 15.5px; margin-bottom: 3px; }
.entry p { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.result-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 18px;
}

.id-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #f6f9fe 0%, #eef4fd 100%);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.id-card .who { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.id-card .meta { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.id-card .seat-box { text-align: right; }
.id-card .seat-box .big { font-size: 28px; font-weight: 700; color: var(--brand-dark); letter-spacing: -.02em; line-height: 1.15; }
.id-card .seat-box .lbl { font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); font-size: 12.5px; }
.kv dd { margin: 0; }

.session-list { list-style: none; margin: 0; padding: 0; }
.session-list li {
    display: flex;
    gap: 16px;
    padding: 11px 18px;
    border-bottom: 1px solid #f0f2f7;
    align-items: center;
    flex-wrap: wrap;
}
.session-list li:last-child { border-bottom: 0; }
.session-list .when { min-width: 168px; font-variant-numeric: tabular-nums; font-size: 13px; }
.session-list .what { font-weight: 500; }

.query-form { display: grid; gap: 14px; max-width: 420px; }
.query-form .field { margin: 0; }
.query-form .btn { width: 100%; padding: 10px; font-size: 14px; }

.privacy-note {
    margin-top: 18px;
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.75;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}

/* ------------------------------ 打印 ------------------------------ */

@media print {
    body { background: #fff; font-size: 12px; }
    .sidebar, .topbar, .page-actions, .no-print, .pagination, .alert { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; page-break-inside: avoid; }
    .card-head { background: #f5f5f5; }
    table.data { min-width: 0; font-size: 11.5px; }
    table.data th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: #000; text-decoration: none; }
    .seat { min-height: 40px; }
}

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .brand { border-bottom: 0; padding: 12px 16px; flex: 1 1 auto; }
    .nav { display: flex; gap: 2px; overflow-x: auto; padding: 6px 12px 8px; flex: 1 1 100%; }
    .nav-group { margin: 0; }
    .nav-group > .nav-title { display: none; }
    .nav a { white-space: nowrap; }
    .content { padding: 16px 14px 40px; }
    .topbar { padding: 0 14px; height: 54px; }
    .topbar h1 { font-size: 15.5px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .entry-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 84px 1fr; }
}

@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat .value { font-size: 22px; }
    .hero h1 { font-size: 21px; }
    .id-card .seat-box { text-align: left; }
    .query-nav-inner { height: auto; padding: 8px 14px; flex-wrap: wrap; }
    .query-nav .links { width: 100%; overflow-x: auto; padding-bottom: 2px; }
}
