/* ============ 基础 ============ */
* { box-sizing: border-box; }
:root {
    --navy:   #16335b;
    --navy-2: #1f4b85;
    --gold:   #c8a45c;
    --gold-d: #a9853f;
    --bg:     #eef1f6;
    --card:   #ffffff;
    --line:   #e3e8f0;
    --text:   #1f2733;
    --muted:  #7a8699;
    --ok:     #1f9d55;
    --ok-bg:  #e6f6ec;
    --warn:   #d98a00;
    --warn-bg:#fdf2dd;
    --bad:    #d6453d;
    --bad-bg: #fdecea;
    --off:    #6b7280;
    --off-bg: #eef0f3;
    --radius: 12px;
    --shadow: 0 6px 22px rgba(20,40,80,.08);
}
html, body { margin: 0; padding: 0; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(31,75,133,.10), transparent 60%),
        radial-gradient(900px 400px at -10% 0%, rgba(200,164,92,.10), transparent 55%),
        var(--bg);
    min-height: 100vh;
}

/* ============ 顶栏 ============ */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 64px;
    background: linear-gradient(120deg, rgba(22,51,91,.92), rgba(31,75,133,.88));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(200,164,92,.45);
    color: #fff; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--gold), var(--gold-d));
    color: #2a1d05; font-weight: 800; font-size: 20px;
    box-shadow: 0 4px 12px rgba(200,164,92,.4);
}
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; opacity: .82; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-role { background: rgba(255,255,255,.18); padding: 3px 8px; border-radius: 6px; }
.user-name { font-weight: 600; }

/* ============ 导航 ============ */
.sidenav {
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 64px; z-index: 40;
}
.nav-inner {
    max-width: 1180px; margin: 0 auto; display: flex; gap: 6px; padding: 0 18px;
    overflow-x: auto;
}
.nav-link {
    padding: 13px 16px; color: var(--muted); text-decoration: none; font-size: 14px;
    border-bottom: 3px solid transparent; white-space: nowrap; transition: .15s;
}
.nav-link:hover { color: var(--navy); }
.nav-link.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 700; }

/* ============ 内容 ============ */
.content { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.muted { color: var(--muted); font-size: 13px; }

/* ============ 卡片 ============ */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card-title { font-size: 16px; margin: 0 0 14px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }

/* ============ 统计卡 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; text-align: center;
    border-top: 3px solid var(--navy);
}
.stat-card.ok { border-top-color: var(--ok); }
.stat-card.bad { border-top-color: var(--bad); }
.stat-card.off { border-top-color: var(--off); }
.stat-num { font-size: 30px; font-weight: 800; color: var(--navy); }
.stat-card.ok .stat-num { color: var(--ok); }
.stat-card.bad .stat-num { color: var(--bad); }
.stat-card.off .stat-num { color: var(--off); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ============ 闪信 ============ */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: var(--ok-bg); color: #0c6b34; border: 1px solid #bfe6cc; }
.flash-error   { background: var(--bad-bg); color: #a3271f; border: 1px solid #f3c5c0; }
.flash-info    { background: #eef4ff; color: #1f4b85; border: 1px solid #cfe0ff; }

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
    font-size: 14px; cursor: pointer; text-decoration: none; transition: .15s; font-weight: 600;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-danger  { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #b83a32; }
.btn-ghost   { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-link    { background: none; color: var(--navy-2); padding: 4px 6px; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-export  { background: var(--gold); color: #2a1d05; }
.btn-export:hover { background: var(--gold-d); }
.btn-block   { display: flex; width: 100%; }
.btn-lg      { padding: 12px 22px; font-size: 15px; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn-left    { justify-content: flex-start; margin-bottom: 8px; }
.link { color: var(--navy-2); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--bad); }

/* ============ 表单 ============ */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-2col .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: #445; font-weight: 600; }
.req { color: var(--bad); }
.field input, .field select, .field textarea {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(31,75,133,.12);
}
.field small { color: var(--muted); font-size: 12px; }
.hint-box { background: #f6f8fc; border: 1px dashed var(--line); border-radius: 9px; padding: 10px 12px; font-size: 13px; color: #556; }
.form-actions { display: flex; gap: 12px; margin-top: 4px; }
.radio-row { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 4px; }
.radio-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.radio-inline input[type="radio"] { width: 16px; height: 16px; accent-color: var(--navy-2); cursor: pointer; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 只读字段（企微来源的姓名/部门）：灰底、不可编辑观感 */
.field input.readonly-field { background: #f5f7fa; color: #55606f; cursor: default; border-style: dashed; }
.field input.readonly-field:focus { outline: none; border-color: var(--line); box-shadow: none; }

/* 车牌输入：简称下拉 + 号码主体 + 键盘按钮 */
.plate-compose { display: flex; gap: 8px; align-items: stretch; }
.plate-prefix { flex: 0 0 68px; width: 68px; text-align: center; font-weight: 700; font-size: 16px !important; padding: 10px 4px !important; }
.plate-body { flex: 1 1 auto; min-width: 0; letter-spacing: 1px; font-size: 16px !important; font-weight: 600; cursor: pointer; background: #fff; }
.plate-body[readonly]:focus { border-color: var(--navy-2); }
.plate-key-btn { flex: 0 0 48px; width: 48px; border: 1px solid var(--line); border-radius: 9px; background: #f6f8fc; color: var(--navy-2); font-size: 20px; cursor: pointer; }
.plate-key-btn:hover { background: #eef2f9; }

/* 车牌虚拟键盘 */
.plate-keypad { display: none; margin-top: 10px; padding: 10px; background: #f4f6fa; border: 1px solid var(--line); border-radius: 10px; }
.plate-keypad.show { display: block; }
.plate-keypad .pk-letters, .plate-keypad .pk-digits, .plate-keypad .pk-func { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.plate-keypad .pk-func { margin-bottom: 0; }
.plate-keypad .pk-key {
    flex: 1 1 0; min-width: 34px; padding: 9px 4px; border: 1px solid #d9e0ea; border-radius: 7px;
    background: #fff; color: var(--navy); font-size: 15px; font-weight: 600; cursor: pointer; user-select: none;
}
.plate-keypad .pk-key:active { background: var(--navy-2); color: #fff; }
.plate-keypad .pk-digit.disabled { opacity: .35; background: #e6e9ee; color: #9aa1ae; cursor: not-allowed; }
.plate-keypad .pk-digit.disabled:active { background: #e6e9ee; color: #9aa1ae; }
.plate-keypad .pk-fn { flex: 1 1 30%; font-size: 13px; font-weight: 500; background: #eceff5; }
.plate-keypad .pk-done { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }

/* ============ 筛选 / 批量 ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar input, .filter-bar select {
    padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; background:#fff;
}
.batch-bar { display: flex; align-items: center; gap: 14px; padding: 10px 4px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.check-all { font-size: 13px; color: #445; display: flex; align-items: center; gap: 6px; }
.batch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.batch-reason { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; width: 220px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { background: #f5f8fc; color: #445; font-weight: 700; position: sticky; top: 0; }
.data-table tbody tr:hover { background: #f9fbff; }
.data-table .note { white-space: normal; max-width: 320px; color: #556; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th { background: #f5f8fc; text-align: left; padding: 10px 12px; width: 110px; color: #445; border: 1px solid var(--line); }
.info-table td { padding: 10px 12px; border: 1px solid var(--line); }

/* ============ 徽章 ============ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-pending  { background: var(--warn-bg); color: var(--warn); }
.badge-gm       { background: #f6ebcf; color: #8a6318; }
.badge-approved { background: var(--ok-bg); color: var(--ok); }
.badge-rejected { background: var(--bad-bg); color: var(--bad); }
.badge-invalid  { background: var(--off-bg); color: var(--off); }
.badge-resign   { background: #ece8f7; color: #5b3fa0; }
.badge-active   { background: var(--ok-bg); color: var(--ok); }
.badge-disabled { background: var(--off-bg); color: var(--off); }

/* ============ 审批流程进度 ============ */
.flow-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; }
.flow-step { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.flow-step .flow-num {
    width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
    background: #eef1f6; color: var(--muted); font-size: 12px; font-weight: 700;
}
.flow-step.done { color: var(--ok); }
.flow-step.done .flow-num { background: var(--ok-bg); color: var(--ok); }
.flow-step.current { color: var(--gold-d); font-weight: 700; }
.flow-step.current .flow-num { background: var(--gold); color: #2a1d05; }
.flow-arrow { margin: 0 6px; color: #c3ccd8; font-size: 14px; }

/* 待办提示条 */
.todo-hint { background: #f7f9fc; border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #556; margin: 0 0 16px; }

/* ============ 证件图 ============ */
.proof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.proof-grid figure { margin: 0; background: #f6f8fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.proof-grid figcaption { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.proof-img { max-width: 100%; max-height: 200px; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }

/* 证件图片放大灯箱 */
.proof-lightbox { display: none; position: fixed; inset: 0; background: rgba(12, 18, 32, .92); z-index: 9999; align-items: center; justify-content: center; padding: 16px; }
.proof-lightbox.show { display: flex; }
.plb-img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.plb-close { position: absolute; top: 14px; right: 18px; width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.plb-close:hover { background: rgba(255,255,255,.28); }
.plb-caption { position: absolute; top: 20px; left: 0; right: 0; text-align: center; color: #e8ebf2; font-size: 14px; }

/* ============ 登录 ============ */
.login-wrap { max-width: 900px; margin: 40px auto; padding: 0 18px; }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.login-card.focus { border-color: var(--gold); box-shadow: 0 10px 30px rgba(200,164,92,.18); }
.login-title { font-size: 18px; margin: 0 0 6px; }
.login-tip { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }
.action-row { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ============ 页脚 ============ */
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 10px; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
    body { font-size: 14px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .login-grid { grid-template-columns: 1fr; }
    .form-2col { grid-template-columns: 1fr; }
    /* 关键：折叠为单列后，span-2 不得撑出隐式第二列（否则整表横向错位） */
    .form-2col .span-2 { grid-column: auto; }
    .proof-grid { grid-template-columns: 1fr; }
    .nav-inner { flex-wrap: nowrap; }

    /* 信息表：手机上由 4 列改为标签/值堆叠，避免窄列挤压换行 */
    .info-table, .info-table tbody, .info-table tr, .info-table th, .info-table td { display: block; width: auto; }
    .info-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
    .info-table tr { border-bottom: 1px solid var(--line); }
    .info-table tr:last-child { border-bottom: none; }
    .info-table th { width: auto; padding: 7px 12px 1px; font-size: 11.5px; color: var(--muted); background: #fafbfd; border: none; }
    .info-table td { padding: 1px 12px 8px; border: none; font-size: 14px; word-break: break-all; }

    /* 按钮：并排、缩小、文字不换行 */
    .btn { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
    .btn-lg { padding: 9px 14px; font-size: 13.5px; }
    .action-row { flex-direction: row; gap: 10px; }
    .action-row .btn { flex: 1 1 0; width: auto; }
    .form-actions { gap: 10px; }
    .form-actions .btn { flex: 1 1 0; }

    /* 文字整体调小 */
    .page-head h1 { font-size: 18px; }
    .card-title { font-size: 15px; }
    .page-sub, .muted { font-size: 12px; }
    .field label { font-size: 12px; }
    .field input, .field select, .field textarea { font-size: 13px; padding: 8px 10px; }
    .field small { font-size: 11px; }
    .hint-box { font-size: 12px; padding: 8px 10px; }
    .radio-row { gap: 14px; }
    .radio-inline { font-size: 13px; }
    .radio-inline input[type="radio"] { width: 15px; height: 15px; }

    /* 车牌键盘：手机上保证按键足够大、简称/主体不挤压 */
    .plate-prefix { flex-basis: 58px; width: 58px; font-size: 15px !important; padding: 8px 2px !important; }
    .plate-body { font-size: 15px !important; }
    .plate-key-btn { flex-basis: 42px; width: 42px; }
    .plate-keypad { padding: 8px; }
    .plate-keypad .pk-key { min-width: 30px; padding: 10px 2px; font-size: 14px; }

    /* 顶栏收窄，品牌副标题隐藏避免重叠 */
    .topbar { padding: 0 12px; height: 54px; }
    .sidenav { top: 54px; }
    .brand-mark { width: 34px; height: 34px; font-size: 17px; border-radius: 8px; }
    .brand-title { font-size: 14px; }
    .brand-sub { font-size: 11px; }
    .user-chip { font-size: 12px; gap: 6px; }
    .content { padding: 14px 12px 52px; }
    .card { padding: 14px; margin-bottom: 14px; }
    .nav-link { padding: 10px 11px; font-size: 12.5px; }
    .nav-inner { padding: 0 8px; }
    .stat-num { font-size: 22px; }
    .stat-label { font-size: 12px; }
    .stat-card { padding: 12px; }
}

@media (max-width: 600px) {
    .login-wrap { margin: 20px auto; }
    .login-card { padding: 18px; }
    .page-head h1 { font-size: 17px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .table-wrap { margin: 0 -4px; }
    /* 数据表横向滚动已在 .table-wrap 内，这里保证不撑破 */
    .data-table { font-size: 13px; }
    .filter-bar input, .filter-bar select { flex: 1 1 100%; }
    .filter-bar .btn { flex: 1 1 auto; }
    /* 按钮/徽章文字在极窄屏保持单行 */
    .btn { font-size: 12.5px; padding: 8px 10px; }
}

/* 企微扫码容器（桌面 iframe） */
.wechat-qr { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 6px; text-align: center; }
.wechat-qr iframe { border: 0; max-width: 100%; }
