/* ============ 共享样式 ============ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-dark: #15803d;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

h1.title {
    text-align: center;
    font-size: 20px;
    margin: 12px 0 4px;
    color: var(--text);
}

.subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 16px;
}

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .05s;
    text-decoration: none;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover:not(:disabled) { background: #eff6ff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: 8px 12px; font-size: 14px; width: auto; }

/* 提示条 */
.msg { display: none; padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.msg.show { display: block; }
.msg-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.msg-success { background: #f0fdf4; color: var(--success-dark); border: 1px solid #bbf7d0; }
.msg-info { background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* 二维码卡片 */
.qr-box { text-align: center; padding: 16px; }
.qr-box img { max-width: 240px; width: 100%; image-rendering: pixelated; border-radius: 8px; }
.qr-code-text {
    font-family: Consolas, monospace;
    background: #f8fafc;
    border: 1px dashed var(--border);
    padding: 8px;
    border-radius: 8px;
    margin: 10px auto;
    font-size: 15px;
    letter-spacing: 1px;
    user-select: all;
    display: inline-block;
}

/* 信息展示行 */
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); }
.info-row .v { font-weight: 500; text-align: right; word-break: break-all; }

/* 状态徽标 */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-checked { background: #dcfce7; color: var(--success-dark); }
.badge-pending { background: #fef3c7; color: var(--warning); }

/* 扫码区 */
.scan-region { width: 100%; overflow: hidden; border-radius: 12px; }
#qr-reader video { border-radius: 12px; }

/* 扫码枪输入框 */
.gun-input {
    font-family: Consolas, monospace;
    letter-spacing: 2px;
}

/* 标签页 */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    transition: all .15s;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 搜索框 */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

/* 名单列表 */
.person-item {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 10px;
}
.person-item .row1 { display: flex; align-items: center; justify-content: space-between; }
.person-item .name { font-size: 16px; font-weight: 600; }
.person-item .meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.person-item .meta span { display: inline-block; margin-right: 12px; }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.stats { display: flex; gap: 8px; margin-bottom: 14px; }
.stat {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 12px;
    text-align: center;
}
.stat .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 12px; color: var(--muted); }

/* 底部导航 */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    max-width: 560px;
    margin: 0 auto;
}
.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 0 12px;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav .icon { font-size: 20px; display: block; line-height: 1.2; }

/* 表格（后台） */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { background: #f8fafc; font-weight: 600; color: var(--muted); }

/* 后台布局 */
.admin-body { background: #f8fafc; }
.admin-header {
    background: #0f172a;
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-header .brand { font-size: 16px; font-weight: 700; }
.admin-header .user { font-size: 13px; color: #cbd5e1; }
.admin-header .logout { font-size: 13px; color: #fca5a5; text-decoration: none; margin-left: 12px; }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }

/* 模态框 */
.modal-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    padding: 20px;
}
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal .btn-row { display: flex; gap: 10px; margin-top: 16px; }

/* 登录页 */
.login-box { max-width: 380px; margin: 60px auto; }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo .icon { font-size: 42px; }

/* 打印友好 */
@media print {
    .bottom-nav, .btn, .no-print { display: none !important; }
    body { background: #fff; }
}

/* 移动端提示安全区 */
body { padding-bottom: env(safe-area-inset-bottom); }
