/* ============ 票券管理系统 · 深色紧凑样式 ============ */
:root {
    --bg: #0d1117;
    --bg-soft: #11161d;
    --panel: #1a2230;
    --panel-2: #212b3a;
    --border: #2b3648;
    --border-soft: #232d3c;
    --text: #e6edf3;
    --text-dim: #9aa7b4;
    --text-faint: #6b7684;
    --accent: #4a9eff;
    --accent-soft: rgba(74, 158, 255, .14);
    --green: #3fb950;
    --orange: #d29922;
    --red: #f85149;
    --blue: #58a6ff;
    --gray: #8b949e;
    --purple: #bc8cff;
    --radius: 10px;
    --shadow: 0 8px 28px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font: 13px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
::selection { background: rgba(74, 158, 255, .3); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2e3a4d; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3b4a61; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 196px; flex: 0 0 196px; background: var(--bg-soft);
    border-right: 1px solid var(--border-soft);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 8px;
    padding: 15px 16px 13px; font-size: 15px; font-weight: 700;
    border-bottom: 1px solid var(--border-soft); letter-spacing: .5px;
}
.brand-icon { font-size: 18px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px; border-radius: 8px; color: var(--text-dim);
    font-size: 13.5px; transition: background .15s, color .15s;
}
.nav a i { font-style: normal; width: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active i { color: var(--accent); }
.sidebar-foot {
    padding: 11px 16px; border-top: 1px solid var(--border-soft);
    color: var(--text-faint); font-size: 11.5px;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 22px; border-bottom: 1px solid var(--border-soft);
    background: rgba(13, 17, 23, .85); backdrop-filter: blur(6px);
    position: sticky; top: 0; z-index: 50;
}
/* 标题 + 统计范围下拉同一行、垂直居中、不换行（窄屏也不被压成两行或撑满） */
.topbar-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; }
/* v1.5.36：标题旁的统计范围下拉 */
.topbar-title .topbar-select { margin-left: 0; vertical-align: middle; font-weight: 400; flex: 0 0 auto; width: auto; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { padding: 18px 22px 40px; flex: 1; }

/* ============ 卡片 ============ */
.card {
    background: var(--panel); border: 1px solid var(--border-soft);
    border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
    font-weight: 600; font-size: 13.5px;
}
.card-head .sub { font-weight: 400; font-size: 12px; color: var(--text-faint); }
.card-body { padding: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }

/* ============ 统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: var(--panel); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 13px 15px; position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--sc, var(--accent));
}
.stat-card .num { font-size: 24px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card .lab { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.stat-card .extra { color: var(--text-faint); font-size: 11.5px; margin-top: 3px; }
.stat-card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.stat-card.clickable:hover { border-color: var(--accent); transform: translateY(-1px); }

.rate-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.rate-box {
    flex: 1; min-width: 200px; background: var(--panel);
    border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 15px;
}
.rate-box .r-lab { font-size: 12.5px; color: var(--text-dim); display: flex; justify-content: space-between; }
.rate-box .r-val { font-size: 19px; font-weight: 700; margin: 3px 0 7px; }
.progress { height: 7px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }

/* ============ v1.5.32 票券流转图 ============ */
.flow-wrap { padding: 14px 10px 8px; }
.flow-svg { width: 100%; height: auto; display: block; }
.flow-svg .flow-line { stroke: #8b949e; stroke-width: 1.6; fill: none; }
.flow-svg .flow-line-back { stroke: #6e7681; stroke-width: 1.4; }
.flow-svg .fn-label { fill: var(--text); font-size: 16px; font-weight: 700; }
.flow-svg .fn-sub { fill: var(--text-dim); font-size: 12.5px; }
.flow-svg .fn-edge { fill: var(--text-dim); font-size: 12px; }
.flow-svg .fn-tip { fill: var(--text-faint); font-size: 11.5px; }
.flow-svg .flow-node { cursor: pointer; }
.flow-svg .flow-node rect { transition: filter .12s; }
.flow-svg .flow-node:hover rect { filter: brightness(1.45); }
.flow-svg .flow-node:active rect { filter: brightness(1.7); }
.flow-svg .flow-node-act .fn-label { fill: var(--text-dim); }
.progress > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--purple)); }

/* ============ 表格 ============ */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12.8px; }
table.tbl th {
    text-align: left; padding: 9px 12px; color: var(--text-dim); font-weight: 600;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; font-size: 12.3px;
}
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tbody tr:hover { background: rgba(74, 158, 255, .05); }
table.tbl tbody tr:last-child td { border-bottom: none; }
td .mono, .mono { font-family: Consolas, "Courier New", monospace; font-size: 12.2px; letter-spacing: .3px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 状态标签 */
.st {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.8px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.st-pending { color: var(--blue); background: rgba(88, 166, 255, .13); border: 1px solid rgba(88, 166, 255, .35); }
.st-claimed { color: var(--orange); background: rgba(210, 153, 34, .13); border: 1px solid rgba(210, 153, 34, .35); }
.st-used { color: var(--green); background: rgba(63, 185, 80, .13); border: 1px solid rgba(63, 185, 80, .35); }
.st-expired { color: var(--gray); background: rgba(139, 148, 158, .13); border: 1px solid rgba(139, 148, 158, .35); }
.st-void { color: var(--red); background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .35); }

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; gap: 5px; justify-content: center;
    padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--text); font-size: 12.8px; font-weight: 500;
    cursor: pointer; transition: filter .12s, border-color .12s; white-space: nowrap;
    font-family: inherit;
}
.btn:hover { filter: brightness(1.18); border-color: #3b4a61; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 650; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-link { background: none; border: none; color: var(--accent); padding: 3px 6px; cursor: pointer; font-size: 12.5px; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }
.btn-link.warn { color: var(--orange); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ 表单 ============ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > label { font-size: 12.3px; color: var(--text-dim); font-weight: 500; }
.field > label .req { color: var(--red); margin-left: 2px; }
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="password"], select, textarea {
    background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit;
    width: 100%; outline: none; transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 60px; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239aa7b4' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px; }
input[type="color"] { padding: 2px; height: 34px; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 4px 0; }
.checkbox-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.8px; color: var(--text); cursor: pointer; }
.checkbox-row input { width: auto; accent-color: var(--accent); }
/* 筛选栏行内复选框（按范围，居字段标签行）与券号范围输入组 */
.chk-inline { display: inline-flex; align-items: center; gap: 6px; margin-top: 0; font-size: 12.3px; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.chk-inline input { width: auto; accent-color: var(--accent); }
/* 字段标签行：标签文字 + 「按范围」复选框同一行、垂直居中 */
.f-head { display: flex; align-items: center; gap: 10px; }
/* label 不再是 .field 的直接子元素，补规则保持与原 .field > label 完全一致的视觉 */
.filter-bar .f-head > label.f-label { font-size: 12.3px; color: var(--text-dim); font-weight: 500; white-space: nowrap; }
.range-box { display: flex; flex-direction: row; gap: 8px; }
.range-box[hidden] { display: none; }
.radio-row { display: flex; gap: 8px; }
.radio-row label {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--border); border-radius: 8px; padding: 7px; cursor: pointer;
    font-size: 12.8px; color: var(--text-dim); transition: all .12s;
}
.radio-row label.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.radio-row input { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    padding: 4px 11px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-soft); color: var(--text-dim); font-size: 12.3px; cursor: pointer;
    transition: all .12s; user-select: none;
}
.chip:hover { border-color: #3b4a61; color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* 筛选栏（v1.5.5：grid 5 列等宽——两行排满、字段框严格对齐；移动端降 2 列） */
.filter-bar {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 12px; align-items: end;
    background: var(--panel); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}
.filter-bar .field { margin-bottom: 0; min-width: 0; }
.filter-bar select { width: 100%; }
/* 控件统高：原生 date 输入比 text/select 高约 2px，固定高度保证标签行/控件行严格齐平 */
.filter-bar input[type="date"] { height: 35px; }
.filter-bar .f-actions { display: flex; gap: 8px; }
.filter-bar .f-actions .btn { flex: 1; }
/* 状态（多选）chips 独占整行 */
.filter-bar .field.span-all { grid-column: 1 / -1; }

/* ============ 批量操作栏 ============ */
.batch-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--accent-soft); border: 1px solid rgba(74, 158, 255, .35);
    border-radius: var(--radius); padding: 9px 14px; margin-bottom: 12px; font-size: 12.8px;
}
.batch-bar .cnt { font-weight: 700; color: var(--accent); }
.batch-bar[hidden] { display: none; }

/* ============ 票券卡片 ============ */
.ticket-card {
    width: 268px; border-radius: 14px; color: #fff; position: relative;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .5); overflow: hidden;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.ticket-card.size-standard { width: 268px; }
.ticket-card.size-wide { width: 400px; }
.ticket-card.size-square { width: 250px; }
.tc-head { padding: 16px 18px 12px; position: relative; }
.tc-brand { font-size: 11px; opacity: .85; letter-spacing: 2px; min-height: 14px; }
.tc-title { font-size: 21px; font-weight: 800; letter-spacing: 1px; margin-top: 2px; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.tc-sub { font-size: 12.5px; opacity: .92; margin-top: 2px; }
.tc-head .st { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .92); border: none; }
.tc-divider {
    border-top: 2px dashed rgba(255, 255, 255, .45); margin: 0 12px; position: relative;
}
.tc-divider::before, .tc-divider::after {
    content: ''; position: absolute; top: -11px; width: 20px; height: 20px;
    border-radius: 50%; background: var(--panel);
}
.tc-divider::before { left: -21px; }
.tc-divider::after { right: -21px; }
.tc-body { padding: 13px 18px 15px; }
.tc-value { font-size: 34px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tc-value .tc-cur { font-size: 18px; font-weight: 700; margin-right: 2px; vertical-align: 4px; }
.tc-value .tc-unit { font-size: 13px; font-weight: 500; margin-left: 3px; opacity: .9; }
/* v1.5.17：minmax(0,1fr) 锁死轨道宽度 —— 否则长文本的 min-content 会把整列撑宽，
   券面被拉出卡片边界（百分比 max-width 也跟着失效） */
.tc-rows { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.tc-row { display: flex; justify-content: space-between; min-width: 0; font-size: 12px; }
.tc-row .k { opacity: .78; flex: 0 0 auto; }
.tc-row .v { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; }
/* v1.5.17：券类型改显示描述后可能偏长 —— 券面上右对齐截断（title 里有全文），不撑破券面宽度 */
.tc-row.tc-type .v { max-width: 66%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-codebox {
    margin-top: 11px; background: #fff; border-radius: 9px; padding: 8px;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.tc-code { line-height: 0; }
.code-img { line-height: 0; }
.code-img canvas, .code-img img, .code-img svg { display: block; }
/* v1.5.11：码图等比缩放——长条形码不再溢出卡片遮挡券值/日期等内容 */
.tc-codebox .code-img svg { max-width: 100%; height: auto; }
/* v1.5.12：导出明细字段选择弹窗——3 列勾选网格 */
.export-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
.export-fields .chk-inline { display: flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.tc-codetext {
    font-family: Consolas, monospace; font-size: 11.5px; color: #111827;
    letter-spacing: 1.2px; font-weight: 600;
}
.tc-note {
    padding: 0 18px 12px; font-size: 11px; opacity: .85;
}
.ticket-card.size-wide .tc-body { display: flex; align-items: center; gap: 14px; }
.ticket-card.size-wide .tc-left { flex: 1; min-width: 0; }
.ticket-card.size-wide .tc-codebox { margin-top: 0; flex: 0 0 auto; }
/* v1.5.13：Logo 位（券头） */
.tc-logo { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 8px; min-height: 0; }
.tc-logo img { max-height: 42px; max-width: 140px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
/* v1.5.13：条形码移到券面最下方独立页脚 */
.tc-foot { padding: 0 18px 14px; display: flex; justify-content: center; }
.tc-foot .tc-codebox { margin-top: 0; width: 100%; max-width: 232px; }
/* 模板编辑器 Logo 上传控件 */
.logo-edit { display: flex; flex-direction: column; gap: 6px; }.logo-preview { width: 100%; max-width: 220px; min-height: 48px; display: flex; align-items: center; justify-content: flex-start; background: var(--bg-soft); border: 1px dashed var(--border-soft); border-radius: 8px; padding: 6px; }
.logo-preview img { max-height: 56px; max-width: 100%; object-fit: contain; border-radius: 4px; }
.logo-empty { font-size: 12px; color: var(--text-faint); }
.logo-actions { display: flex; gap: 8px; align-items: center; }
/* v1.5.15：生成必填项配置 —— 两列勾选网格，锁定项（券类型）置灰并注明原因 */
.gr-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.gr-item {
    display: flex; align-items: center; gap: 7px; padding: 9px 11px;
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 8px;
    font-size: 13px; cursor: pointer; white-space: nowrap;
}
.gr-item:hover { border-color: var(--accent); }
.gr-lab { font-weight: 600; }
.gr-hint { font-size: 11px; color: var(--text-faint); margin-left: auto; }
/* 锁定项不可点：去掉 hover 高亮并整体降透明度，一眼看出「券类型」改不了 */
.gr-locked { cursor: not-allowed; opacity: .62; }
.gr-locked:hover { border-color: var(--border-soft); }

/* 模板卡片预览 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.tpl-item {
    background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
    transition: border-color .15s;
}
.tpl-item:hover { border-color: var(--accent); }
.tpl-item .tpl-meta { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.tpl-item .tpl-name { font-weight: 650; font-size: 13.5px; }
.tpl-item .tpl-ops { display: flex; gap: 4px; }
.tpl-item .tpl-scale { transform: scale(.82); transform-origin: top center; height: 340px; overflow: hidden; }

/* ============ 图表 ============ */
.chart { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; }
.chart-title { font-weight: 650; font-size: 13px; margin-bottom: 10px; }
.bar-row { display: flex; align-items: center; gap: 9px; padding: 2.5px 0; }
.bar-label { width: 86px; flex: 0 0 86px; text-align: right; color: var(--text-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 16px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; min-width: 2px; transition: width .3s; }
.bar-val { width: 56px; flex: 0 0 56px; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
    width: 132px; height: 132px; border-radius: 50%; flex: 0 0 132px; position: relative;
}
.donut-hole {
    position: absolute; inset: 21px; background: var(--panel); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole b { font-size: 21px; font-variant-numeric: tabular-nums; }
.donut-hole span { font-size: 11px; color: var(--text-faint); }
.legend { display: grid; gap: 5px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.legend-item b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

/* ============ 弹窗 / 抽屉 ============ */
.modal-mask, .drawer-mask {
    position: fixed; inset: 0; background: rgba(4, 8, 14, .66);
    backdrop-filter: blur(2px); display: flex;
    align-items: flex-start; justify-content: center; padding: 6vh 16px 16px;
    overflow-y: auto; animation: fadeIn .15s;
}
/* v1.5.30：层次必须「抽屉(200) < 弹窗(300)」—— 抽屉底部点「领取/核销/作废」弹出的确认框
   要盖在抽屉之上。此前两者都是 200，靠 DOM 顺序决定绘制（drawer-root 在 modal-root 之后），
   结果弹窗被抽屉压住，用户根本看不到。 */
.drawer-mask { z-index: 200; justify-content: flex-end; padding: 0; align-items: stretch; }
.modal-mask { z-index: 300; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    width: 100%; box-shadow: var(--shadow); animation: popIn .18s;
}
@keyframes popIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-danger { border-color: rgba(248, 81, 73, .5); }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 1px solid var(--border-soft); font-weight: 700; font-size: 14px;
}
.modal-x {
    background: none; border: none; color: var(--text-faint); font-size: 18px;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.modal-x:hover { color: var(--text); }
.modal-body { padding: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--border-soft); }
.confirm-text { color: var(--text-dim); line-height: 1.7; }

/* v1.5：数据初始化页签 */
.init-block {
    border: 1px solid var(--border-soft); border-radius: 8px;
    padding: 16px 18px; margin-bottom: 14px; background: var(--bg);
}
.init-block .init-title { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.init-block .init-desc { color: var(--text-dim); font-size: 12.5px; line-height: 1.7; margin: 0 0 12px; }
.init-block.init-danger { border-color: var(--red); }
.init-block.init-danger .init-title { color: var(--red); }

.drawer {
    background: var(--bg-soft); border-left: 1px solid var(--border);
    width: 780px; max-width: 100%; height: 100%; overflow-y: auto;
    box-shadow: var(--shadow); animation: slideIn .2s;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0; background: var(--bg-soft); z-index: 5;
}
.drawer-head .t { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.drawer-body { padding: 12px 14px; }
/* v1.5.6 抽屉紧凑二期：券面横排（值/明细在左、码在右）、信息区自身 2 列网格、间距全面收紧 */
.drawer-cols { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.drawer .tc-head { padding: 9px 12px 7px; }
.drawer .tc-title { font-size: 15px; }
.drawer .tc-sub { font-size: 11.5px; }
.drawer .tc-body { padding: 9px 12px 10px; display: flex; align-items: center; gap: 12px; }
.drawer .tc-left { flex: 1; min-width: 0; }
.drawer .tc-value { font-size: 22px; }
.drawer .tc-rows { margin-top: 5px; gap: 2px; }
/* 横排后左栏变窄：明细行缩字号 + 不换行，避免「发行日期 2026-10-16」折成两行 */
.drawer .tc-row { font-size: 11px; gap: 6px; white-space: nowrap; }
.drawer .tc-row .v { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.drawer .tc-codebox { margin-top: 0; flex: 0 0 auto; padding: 6px; gap: 3px; max-width: 190px; } /* v1.5.11：限宽给左侧明细留空间，条形码等比缩进框内 */
.drawer .tc-codetext { font-size: 10px; letter-spacing: .5px; }
/* v1.5.13：抽屉内条形码落在券面最下方页脚（而非右侧），居中限宽 */
.drawer .tc-foot { padding: 0 12px 12px; }
.drawer .tc-foot .tc-codebox { margin-top: 0; flex: 0 0 auto; max-width: 200px; }
.drawer .tc-logo img { max-height: 32px; max-width: 110px; padding: 2px; }
.drawer-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.drawer-info .card { margin-bottom: 0; }
.drawer-info .span-2 { grid-column: 1 / -1; }
.drawer .card-head { padding: 9px 12px; font-size: 12.8px; }
.drawer .card-body { padding: 10px 12px; }
.drawer .kv { font-size: 12.2px; gap: 3px 10px; grid-template-columns: 76px 1fr; }
.drawer .empty { padding: 10px 0; }
.drawer .tl-item { padding-bottom: 8px; }

/* 信息键值 */
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 5px 12px; font-size: 12.8px; }
.kv .k { color: var(--text-faint); }
.kv .v { color: var(--text); word-break: break-all; }
.kv .v.mono { font-family: Consolas, monospace; letter-spacing: .4px; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 13px; }
.tl-item::before {
    content: ''; position: absolute; left: -17px; top: 5px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-soft);
}
.tl-item .tl-t { font-size: 11.8px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tl-item .tl-d { font-size: 12.8px; margin-top: 1px; }
.tl-item .tl-act { font-weight: 650; margin-right: 6px; }

/* ============ Toast ============ */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; } /* v1.5.30：提示永远在最上层（弹窗 300 / 抽屉 200） */
.toast {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    padding: 9px 18px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow);
    opacity: 0; transform: translateY(-8px); transition: all .25s; max-width: 72vw;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(63, 185, 80, .55); }
.toast-err { border-color: rgba(248, 81, 73, .6); }

/* ============ 分页 / 空态 ============ */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 11px 4px 0; color: var(--text-dim); font-size: 12.5px; flex-wrap: wrap; }
.pager select { width: auto; padding: 4px 24px 4px 8px; font-size: 12.3px; }
.empty { text-align: center; color: var(--text-faint); padding: 44px 0; font-size: 13px; }
.empty .ic { font-size: 30px; display: block; margin-bottom: 8px; opacity: .6; }
.busy { padding: 40px; text-align: center; color: var(--text-faint); }

/* ============ 登录遮罩（v1.3 全局访问口令，已由 v1.4 登录页取代，保留兼容） ============ */
.login-mask {
    position: fixed; inset: 0; z-index: 500; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.login-box {
    width: 320px; background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.login-box h2 { font-size: 17px; margin-bottom: 4px; }
.login-box p { color: var(--text-faint); font-size: 12.3px; margin-bottom: 18px; }
.login-box .btn { width: 100%; margin-top: 6px; }

/* ============ 登录页（v1.4 工号 + 密码） ============ */
.login-wrap { min-height: 62vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.login-card {
    width: 100%; max-width: 348px; background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 26px 26px 24px; box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 700; margin-bottom: 6px; }
.login-brand .brand-icon { font-size: 20px; }
.login-brand .brand-name { color: var(--text); }
.login-sub { color: var(--text-faint); font-size: 12.3px; margin-bottom: 18px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 8px 0; }
.login-err {
    background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .4);
    color: #ff9a94; border-radius: 7px; padding: 7px 10px; font-size: 12.3px; margin-bottom: 10px;
}

/* 操作人只读展示（v1.4：操作人 = 登录人，不可手工选择） */
.actor-readonly {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px;
    background: var(--bg-soft); border: 1px dashed var(--border); border-radius: 6px; color: var(--text);
}
.actor-readonly .ar-code { font-weight: 650; }
.actor-readonly .ar-perm {
    font-size: 11.5px; color: var(--accent); background: var(--accent-soft);
    border-radius: 4px; padding: 1px 6px;
}
/* 顶栏当前操作人 */
.whoami { font-size: 12.3px; color: var(--text-dim); margin-left: 6px; }
.whoami b { color: var(--text); font-weight: 650; }
/* v1.5.35：顶栏时钟（日期 + 时段问候）与统计范围下拉 */
.topbar-clock { font-size: 12.5px; color: var(--text-dim); margin-left: 10px; white-space: nowrap; }
.topbar-select {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: 5px 9px; font-size: 12.5px; cursor: pointer;
}
.topbar-select:hover { border-color: var(--accent); }

/* ============ 移动端票券列表 ============ */
.card-list { display: none; flex-direction: column; gap: 10px; }
.tk-card {
    background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 12px 14px; display: flex; flex-direction: column; gap: 7px;
}
.tk-card .r1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tk-card .code { font-family: Consolas, monospace; font-weight: 650; font-size: 13px; letter-spacing: .4px; }
.tk-card .r2 { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-dim); font-size: 12.3px; }
.tk-card .r3 { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border-soft); padding-top: 8px; }
.tk-card .sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }

/* 操作列 */
.ops { display: flex; gap: 2px; flex-wrap: nowrap; }
/* v1.5.19：详情抽屉底部操作组（业务按钮 + 退出）整体推到最右；退出与右上角 × 等价 */
.ops-wrap { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.ops-exit { padding-left: 12px; color: var(--text-dim); }

.section-title { font-size: 13px; font-weight: 650; color: var(--text-dim); margin: 20px 0 10px; }
.section-title:first-child { margin-top: 0; }

.copy-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.copy-btn:hover { color: var(--accent); }

.result-codes { max-height: 180px; overflow-y: auto; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.result-codes .rc { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-family: Consolas, monospace; font-size: 12.3px; }
/* v1.5.16：生成成功结果提示 —— 绿色成功条 + 券类型/张数 + 引导去票券管理 */
.gen-result { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(56, 189, 148, .38); background: rgba(56, 189, 148, .09); border-radius: 8px; }
.gen-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gen-result-txt { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gen-result-ok { color: var(--green); font-weight: 700; font-size: 13.5px; }
.gen-result-hint { color: var(--text-dim); font-size: 12.3px; }
.gen-result .result-codes { background: rgba(0, 0, 0, .18); }

/* ============ 系统设置 ============ */
.settings-layout { display: grid; grid-template-columns: 176px 1fr; gap: 16px; align-items: start; }
.settings-tabs { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 74px; }
.settings-tabs a { padding: 9px 12px; border-radius: 8px; color: var(--text-dim); font-size: 13px; }
.settings-tabs a:hover { background: var(--panel); color: var(--text); }
.settings-tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.settings-body { min-width: 0; }
.settings-body .card-ops { display: flex; gap: 8px; }
.settings-body .empty-ops { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.perm-yes { color: var(--green); font-weight: 700; }
.perm-no { color: var(--text-faint); }
.select-empty-hint { font-size: 11.5px; color: var(--orange); margin-top: 2px; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.pwd-set { color: var(--green); font-size: 12.3px; cursor: help; }
.text-faint { color: var(--text-faint); }
.import-dialog .checkbox-row label.exists, #import-form .checkbox-row label.exists { color: var(--text-faint); }
#import-form .checkbox-row label.exists input { accent-color: var(--text-faint); }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    /* v1.5.5：抽屉两列断点 1080→900（窄窗口保持两列，避免券面把信息卡顶到底部拉长抽屉） */
}
@media (max-width: 900px) {
    .drawer-cols { grid-template-columns: 1fr; }
}@media (max-width: 960px) {
    .app { flex-direction: column; }
    /* 移动端：品牌名独占一行，功能标签另起一行横向滚动；整块固定在顶部，上下滑动始终可见 */
    .sidebar {
        width: 100%; flex: none; height: auto;
        position: sticky; top: 0; z-index: 60;
        flex-direction: column; align-items: stretch; border-right: none; border-bottom: 1px solid var(--border-soft);
        background: var(--bg-soft);
    }
    .brand { border-bottom: none; padding: 10px 14px; font-size: 14px; white-space: nowrap; }
    .nav {
        flex-direction: row; overflow-x: auto; padding: 6px 8px; gap: 4px;
        border-top: 1px solid var(--border-soft); -webkit-overflow-scrolling: touch;
    }
    .nav a { white-space: nowrap; padding: 7px 10px; }
    .sidebar-foot { display: none; }
    .view { padding: 14px 12px 32px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    /* 侧边栏已固定在顶部，顶栏改为随内容滚动，避免两层 sticky 在 top:0 重叠 */
    .topbar { position: static; }
}
@media (max-width: 900px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .tbl-wrap { display: none; }
    /* 设置页登记册表格无移动端卡片替代：保持可见，靠 .tbl-wrap 横向滚动 */
    .settings-body .tbl-wrap { display: block; }
    .card-list { display: flex; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: repeat(2, 1fr); }
    /* 窄屏：标题区保持一行，空间不够时右侧操作区换到下一行，避免把标题+下拉压成两行 */
    .topbar { padding: 10px 14px; flex-wrap: wrap; }
    .drawer { width: 100%; }
    .drawer-info { grid-template-columns: 1fr; }
}

/* ============ 打印 ============ */
#print-area { display: none; }
@media print {
    body { background: #fff; }
    body > *:not(#print-area) { display: none !important; }
    #print-area { display: block !important; padding: 0; }
    .print-page { display: flex; justify-content: center; padding: 20px; }
    .ticket-card { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
