:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #687386;
  --line: #dfe5ef;
  --blue: #1769e0;
  --blue-dark: #0e55bd;
  --green: #18a058;
  --orange: #f59e0b;
  --shadow: 0 12px 32px rgba(23, 32, 51, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1480px; margin: 0 auto; padding: 24px; }
.topbar, .workspace, .stepper, .hint, .card, .preview-panel {
  width: 100%;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.eyebrow { margin: 0 0 6px; color: var(--blue); font-weight: 700; font-size: 13px; }
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.top-actions, .action-row, .nav-buttons, .nav-right-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.primary, .ghost {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}
.primary { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(23, 105, 224, 0.22); }
.primary:hover { background: var(--blue-dark); }
.ghost { color: var(--text); background: #eef3fb; border: 1px solid var(--line); }
.ghost.danger {
  color: #b42318;
  background: #fff1f1;
  border-color: #fecaca;
}
.ghost.danger:hover { background: #fee2e2; }
.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.usage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}
.usage-badge.soft {
  background: #ecfdf5;
  color: #047857;
}
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(23, 105, 224, 0.12), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(24, 160, 88, 0.10), transparent 26%),
    linear-gradient(135deg, #eef4fb, #f8fbff 58%, #eef6f2);
}
.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.16);
}
.login-panel h2 {
  margin: 0;
  font-size: 28px;
}
.login-panel label,
.login-box label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}
.login-panel input,
.login-box input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
}
.login-panel input:focus,
.login-box input:focus {
  outline: 2px solid rgba(23, 105, 224, 0.18);
  border-color: var(--blue);
}
.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
}
.stepper {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  padding: 4px;
  overflow: hidden;
}
.stepper::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 4px;
  width: var(--progress-pct, 0%);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(24, 160, 88, 0.24), rgba(23, 105, 224, 0.28), rgba(245, 158, 11, 0.18));
  background-size: 180% 100%;
  transition: width 0.45s ease;
  animation: progressGlow 2.4s ease-in-out infinite;
  pointer-events: none;
}
.step {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(23, 32, 51, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.step span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef3fb;
  font-weight: 800;
}
@keyframes stepPulse {
  0% { box-shadow: 0 8px 22px rgba(23, 105, 224, 0.18); }
  50% { box-shadow: 0 8px 30px rgba(23, 105, 224, 0.35); }
  100% { box-shadow: 0 8px 22px rgba(23, 105, 224, 0.18); }
}
@keyframes progressGlow {
  0% { background-position: 0% 50%; filter: saturate(1); }
  50% { background-position: 100% 50%; filter: saturate(1.35); }
  100% { background-position: 0% 50%; filter: saturate(1); }
}
.step.active::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 2px solid rgba(23, 105, 224, 0.28);
  opacity: 0;
  animation: stepRing 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes stepRing {
  0% { transform: scale(.98); opacity: .75; }
  100% { transform: scale(1.08); opacity: 0; }
}
.step.active {
  border-color: var(--blue);
  background: linear-gradient(135deg, #eaf3ff, #f3f8ff);
  transform: scale(1.02);
  animation: stepPulse 2s ease-in-out infinite;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.step.active span {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #18a058);
  box-shadow: 0 0 0 4px rgba(23, 105, 224, 0.12), 0 6px 14px rgba(23, 105, 224, 0.32);
  transition: all 0.3s ease;
}
.step.done {
  border-color: var(--green);
  background: #ecfdf5;
  color: #065f46;
  transition: all 0.3s ease;
}
.step.done span {
  color: #fff;
  background: var(--green);
  transition: all 0.3s ease;
}
.hint {
  margin-bottom: 16px;
  border: 1px solid #b8d2ff;
  border-left: 5px solid var(--blue);
  background: #edf5ff;
  border-radius: 8px;
  padding: 12px 14px;
  color: #17447e;
}
.assistant-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #cfe0f7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.07);
}
.assistant-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}
.assistant-head h2 {
  margin: 0;
  font-size: 22px;
}
.device-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}
.mobile-only { display: none; }
.chat-window {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.chat-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}
.chat-bubble.bot {
  justify-self: start;
  background: #e8f1ff;
  color: #17447e;
}
.chat-bubble.user {
  justify-self: end;
  background: var(--blue);
  color: #fff;
}
.assistant-form {
  display: grid;
  gap: 10px;
}
#credentialInput {
  display: none;
}
.mobile-pdf {
  display: none;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(560px, 1.2fr);
  gap: 18px;
  align-items: start;
}
.flow { display: grid; gap: 12px; }
.card { transition: box-shadow 0.2s ease; }
.card-title {
  width: 100%;
  border: 0;
  background: var(--card);
  padding: 15px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  text-align: left;
}
.card-title span { display: grid; gap: 4px; }
.card-title em { color: var(--muted); font-style: normal; font-size: 13px; }
.card-title i { color: var(--blue); font-style: normal; font-size: 13px; }
.card-body {
  display: none;
  padding: 0 16px 16px;
  transition: opacity 0.2s ease;
}
.card.open .card-body { display: block; }
.upload-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.drop-zone {
  position: relative;
  min-height: 132px;
  border: 2px dashed #b8c7dc;
  background: #f9fbff;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.drop-zone:hover {
  border-color: var(--blue);
  background: #f1f7ff;
  box-shadow: 0 10px 24px rgba(23, 105, 224, 0.12);
}
.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.drop-zone strong { color: var(--blue); font-size: 18px; }
.drop-zone small, .subtle { color: var(--muted); }
.file-list, .records { display: grid; gap: 10px; margin-top: 12px; }
.file-item, .record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill { border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: #e8f1ff; color: var(--blue); white-space: nowrap; }
.record-grid, .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.record h3 { margin: 0 0 10px; font-size: 15px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, select {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}
textarea {
  min-height: 100px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #fff;
  resize: vertical;
}
.choice-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.choice-list > span {
  color: var(--muted);
  font-size: 13px;
}
.form-note {
  margin: 12px 0 0;
}
.choice-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
}
.check-pill input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
}
.check-pill b {
  font-size: 13px;
  font-weight: 700;
}
.wide { grid-column: 1 / -1; }
.segmented {
  display: inline-flex;
  padding: 4px;
  background: #eef3fb;
  border-radius: 8px;
  margin-bottom: 12px;
}
.segmented button {
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}
.segmented .selected { color: var(--blue); background: #fff; box-shadow: 0 4px 10px rgba(23, 32, 51, 0.08); }
.nav-buttons { justify-content: space-between; padding: 2px 0; }
.nav-right-actions { justify-content: flex-end; }
.preview-panel {
  position: sticky;
  top: 18px;
  min-height: 680px;
  max-height: calc(100vh - 36px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
}
.admin-shell {
  max-width: 1320px;
}
.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(23, 105, 224, 0.13), transparent 28%),
    linear-gradient(135deg, #eef4fb, #f8fbff 62%, #eef6f2);
}
.login-box {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.16);
}
.login-box h2 {
  margin: 0;
  font-size: 28px;
}
.login-today,
.login-hint {
  display: none;
}
.admin-grid {
  display: grid;
  gap: 16px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #fff;
}
.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}
.admin-table th {
  color: var(--muted);
  font-size: 13px;
  background: #f8fbff;
}
.admin-table tbody tr:hover { background: #fbfdff; }
code {
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef3fb;
  color: var(--blue);
  font-family: Consolas, monospace;
}
.grant-box {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-actions { min-width: 250px; }
.grant-box input,
.feedback-item input {
  width: 82px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.status-badge.ok {
  color: #047857;
  background: #ecfdf5;
}
.status-badge.danger {
  color: #b42318;
  background: #fff1f1;
}
.feedback-list {
  display: grid;
  gap: 10px;
}
.feedback-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}
.feedback-item > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.feedback-item p {
  margin: 10px 0;
  color: var(--text);
}
.tabs { display: flex; border-bottom: 1px solid var(--line); background: #fbfdff; }
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: 48px;
  color: var(--muted);
  font-weight: 800;
  transition: background .18s ease, color .18s ease;
}
.tab.active { color: var(--blue); background: #fff; box-shadow: inset 0 -3px 0 var(--blue); }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
}
.hidden { display: none !important; }
.preview-scroll { height: calc(100vh - 90px); overflow: auto; padding: 18px; background: #eef3f8; }
.tab-page { display: none; animation: fade .18s ease; }
.tab-page.active { display: block; }
@keyframes fade { from { opacity: .2; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed #b8c7dc;
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  padding: 22px;
}
.voucher {
  --voucher-green: #285d89;
  position: relative;
  left: 50%;
  width: 210mm;
  min-height: 110mm;
  margin: 0 0 -20mm;
  padding: 6mm 8mm 5mm 22mm;
  background: #f8fcff;
  border: 1px solid #d8e2ea;
  color: var(--voucher-green);
  transform-origin: top center;
  transform: translateX(-50%) scale(.7);
  font-family: "Microsoft YaHei", "SimSun", serif;
}
.voucher::before {
  content: "装订区";
  position: absolute;
  left: 5mm;
  top: 8mm;
  bottom: 8mm;
  width: 10mm;
  border-right: 1px dashed #9bb7cb;
  color: #6b8daa;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  letter-spacing: 3px;
  font-size: 12px;
}
.voucher * { box-sizing: border-box; }
.voucher-topline {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8mm;
  color: #6a8c7a;
  font-size: 12px;
  line-height: 1;
  margin-left: 14mm;
}
.voucher-topline strong { font-size: 15px; letter-spacing: 1px; color: var(--voucher-green); }
.voucher-cut { display: none; }
.voucher-head {
  display: grid;
  grid-template-columns: 1fr 52mm;
  align-items: start;
  gap: 5mm;
  margin: 4mm 0 3mm;
}
.voucher-title-block {
  display: none;
}
.voucher-title-block h2 {
  display: inline-block;
  margin: 0;
  padding: 0 2.5mm 1.5mm;
  border-bottom: 2px solid var(--voucher-green);
  border-top: 2px solid var(--voucher-green);
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 5px;
  font-family: "SimSun", "Microsoft YaHei", serif;
  writing-mode: vertical-rl;
  height: 48mm;
  text-align: center;
}
.voucher-date {
  writing-mode: vertical-rl;
  height: 34mm;
  margin: 3mm 0 0;
  display: flex;
  justify-content: center;
  gap: 4mm;
  font-size: 13px;
}
.voucher-number {
  display: none;
}
.voucher-cover-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58mm;
  gap: 3mm;
  color: var(--voucher-green);
  font-size: 14px;
  margin-bottom: 2mm;
  align-items: end;
}
.voucher-cover-meta .company-row {
  grid-column: 1;
}
.voucher-cover-meta .doc-count-row {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  white-space: nowrap;
  font-weight: 600;
  text-align: right;
}
.voucher-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32mm;
  border-bottom: 1px solid var(--voucher-green);
  min-height: 7mm;
  padding: 0 2mm;
}
.voucher-line.long-line {
  min-width: 75mm;
}
.voucher-line.count-line {
  min-width: 28mm;
  font-size: 16px;
  font-weight: 700;
}
.xima-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1.4px solid var(--voucher-green);
  color: var(--voucher-green);
}
.xima-table th,
.xima-table td {
  border: 1px solid var(--voucher-green);
  padding: 0;
  height: 7.6mm;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  vertical-align: middle;
  word-break: break-all;
  background: transparent;
}
.xima-table th {
  font-weight: 600;
  background: rgba(62, 123, 99, 0.06);
}
.xima-table .narrow { width: 15mm; }
.xima-table .project-col { width: 25mm; }
.xima-table .summary-col { width: 60mm; }
.xima-table .money-col { width: 42mm; }
.xima-table .remark-col { width: 23mm; }
.xima-table .left-text {
  padding: 0 3mm;
  text-align: left;
}
.money-head,
.money-cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  height: 100%;
}
.money-head span,
.money-cells span {
  display: grid;
  place-items: center;
  min-height: 8mm;
  border-left: 1px dashed rgba(63, 123, 99, 0.7);
}
.money-head span:first-child,
.money-cells span:first-child { border-left: 0; }
.money-head { font-size: 12px; }
.money-cells { color: #1f4f3c; font-weight: 700; }
.voucher-amount-cn {
  display: grid;
  grid-template-columns: 16mm 1fr 20mm 22mm 24mm 22mm;
  border: 1px solid var(--voucher-green);
  border-top: 0;
  min-height: 10mm;
}
.voucher-amount-cn span,
.voucher-amount-cn b {
  display: flex;
  align-items: center;
  padding: 0 3mm;
  font-size: 12px;
}
.voucher-amount-cn span {
  justify-content: center;
  border-right: 1px solid var(--voucher-green);
  font-weight: 600;
  background: rgba(62, 123, 99, 0.05);
}
.voucher-amount-cn b {
  font-weight: 500;
  border-right: 1px solid var(--voucher-green);
}
.voucher-amount-cn b:last-child { border-right: 0; }
.voucher-sign-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 9mm;
  margin-top: 3mm;
}
.voucher-sign-grid > div {
  padding: 1mm 0;
  font-size: 12px;
}
.voucher-payee-row {
  display: grid;
  grid-template-columns: 30mm 1fr 1fr;
  gap: 3mm;
  margin-top: 1mm;
  font-size: 12px;
}
.voucher-payee-row span {
  border-bottom: 1px solid var(--voucher-green);
  min-height: 7mm;
  display: flex;
  align-items: center;
}
.voucher-file-count-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm;
  margin-top: 1mm;
  font-size: 12px;
  color: var(--voucher-green);
}
.voucher-file-count-row span {
  min-height: 7mm;
  display: flex;
  align-items: center;
}
.voucher-file-count-row span:last-child {
  justify-self: end;
  justify-content: flex-end;
  text-align: right;
}
.total-row td {
  font-weight: 700;
  background: rgba(40, 93, 137, 0.05);
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.2;
}
.voucher-page-gap { height: 10mm; }
.voucher-bottom {
  display: none;
}
.voucher-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}
.voucher-left-area { min-width: 0; }
.voucher-side-note {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 5mm;
  height: 76mm;
  color: var(--voucher-green);
  font-size: 15px;
  writing-mode: vertical-rl;
}
.attachments { display: grid; gap: 18px; }
.combined-print { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.output-render-host { display: none !important; }
.a4 {
  position: relative;
  left: 50%;
  width: 210mm;
  min-height: 148mm;
  margin: 0 0 -42mm;
  background: #fff;
  padding: 7mm;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.12);
  transform-origin: top center;
  transform: translateX(-50%) scale(.86);
}
/* 整套打印预览：去掉阴影/缩放/边框，充满视图 */
.combined-print .a4,
.combined-sheet .a4,
#combinedTab .a4 {
  box-shadow: none;
  transform: none;
  margin: 0 auto 12px;
  left: auto;
}
.combined-print .a5-panel,
.combined-sheet .a5-panel,
#combinedTab .a5-panel {
  border: 1px solid #eef1f5;
}
#combinedTab .a4 { margin-bottom: 8px; }
/* Combined preview screen layout: flexbox ensures panels stack vertically without overlap */
.combined-sheet.a4,
.combined-print .combined-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.combined-sheet .a5-stack {
  display: flex;
  flex-direction: column;
  gap: 4mm;
  align-items: center;
}
.combined-sheet .a5-panel {
  flex: 0 0 auto;
  width: 196mm;
}
.combined-sheet .attachment-list-panel {
  width: 148mm;
  flex: 0 0 auto;
}
.a5-stack {
  display: grid;
  grid-template-rows: 1fr;
  gap: 5mm;
}
.a5-panel {
  width: 196mm;
  height: 134mm;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 5mm;
  overflow: hidden;
  position: relative;
}
.cover-panel {
  border: 0;
  padding: 3mm 0 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.cover-panel .print-voucher {
  left: auto;
  transform: scale(1.02);
  transform-origin: top center;
  margin: 0;
}
.cover-binding-zone {
  display: none;
}
/* 封面独占 A4 页（在 combined 预览中） */
.cover-full-page {
  padding: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.cover-full-page .print-voucher {
  position: static;
  left: auto;
  transform: none;
  margin: 0;
  width: 210mm;
  min-height: 297mm;
  border: 0;
  box-shadow: none;
}
/* 附件清单独占 A4 页 */
.attachment-list-page {
  padding: 5mm;
}
.attachment-list-page .a5-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: auto;
}
/* ── 封面 + 附件清单合并到一页 A4（flex 上下布局） ── */
.cover-with-list-page {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.cover-with-list-page .cover-half {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #f8fcff;
  border-bottom: 1px solid #e2e8f0;
}
.cover-with-list-page .cover-half .voucher {
  position: static;
  left: auto;
  transform: none;
  margin: 0 auto;
  width: 100%;
  min-height: auto;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 3mm 5mm 1mm 16mm;
}
.cover-with-list-page .cover-half .voucher::before {
  display: none;
}
.cover-with-list-page .cover-half .voucher .voucher-topline {
  margin-left: 10mm;
}
.cover-with-list-page .list-half {
  flex: 1;
  overflow: hidden;
  padding: 3mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cover-with-list-page .list-half .attachment-list-panel {
  margin: 0;
  width: 100%;
}
.cover-with-list-page .list-half .attachment-list-panel h2 {
  margin: 0 0 3mm;
  font-size: 16px;
}
/* ── 两张封面放在一页 A4（上下布局，同比例缩放） ── */
.cover-pair-page {
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
}
.cover-pair-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transform-origin: top center;
  width: 100%;
}
.cover-pair-container .cover-half {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #f8fcff;
}
.cover-pair-container .cover-half:first-child {
  border-bottom: 1px solid #e2e8f0;
}
.cover-pair-container .cover-half .voucher {
  position: static;
  left: auto;
  transform: none;
  margin: 0 auto;
  width: 100%;
  min-height: auto;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 3mm 5mm 1mm 16mm;
}
.cover-pair-container .cover-half .voucher::before {
  display: none;
}
.cover-pair-container .cover-half .voucher .voucher-topline {
  margin-left: 10mm;
}
.attachment-list-preview-page .a5-stack {
  display: flex;
  flex-direction: column;
  gap: 4mm;
  align-items: center;
}
.attach-card {
  width: 196mm;
  min-height: 134mm;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5mm;
  margin: 0 auto;
  page-break-inside: avoid;
  background: #fff;
  position: relative;
}
.attach-card::before {
  content: "";
  position: absolute;
  left: -12mm;
  top: 0;
  bottom: 0;
  border-left: 1px dashed #c8d3df;
}
.attach-card h4 {
  margin: 0 0 3mm;
  font-size: 14px;
  color: #334155;
  text-align: center;
}
.attach-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
.attach-pair.one { grid-template-columns: 1fr; }
.attach-grid {
  display: grid;
  gap: 3mm;
  height: 118mm;
}
.invoice-stack,
.payment-stack { grid-template-rows: 1fr; }
.invoice-panel .attach-item { height: 100%; }
.payment-panel-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 2mm;
}
.payment-panel-grid {
  display: grid;
  gap: 3mm;
  height: calc(100% - 8mm);
}
.narrow-payment .payment-panel-grid,
.narrow-invoice .payment-panel-grid {
  grid-template-columns: repeat(3, 1fr);
}
.wide-payment .payment-panel-grid,
.wide-invoice .payment-panel-grid {
  grid-template-columns: 1fr;
}
.wide-invoice .attach-item,
.wide-payment .attach-item {
  height: 100%;
}
.attach-item {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.attach-item.empty-slot { grid-template-rows: 1fr; }
.attach-item .subtle {
  margin: 0 0 1mm;
  font-size: 11px;
}
.thumb {
  min-height: 0;
  border: 1px dashed #94a3b8;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f8fafc;
}
.thumb.invoice {
  min-height: 0;
  background: #fff;
}
.wide-invoice .thumb.invoice,
.wide-payment .thumb.payment {
  width: 100%;
  max-width: none;
}
.wide-invoice .thumb.invoice img,
.wide-payment .thumb.payment img {
  object-fit: contain;
  width: 100%;
  height: 100%;
  max-height: 100%;
}
.wide-invoice .thumb.invoice img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  object-position: center;
}
.thumb.payment {
  min-height: 0;
  width: 100%;
  max-width: 112mm;
  margin: 0 auto;
  background: #fff;
}
.wide-payment .thumb.payment {
  max-width: none;
}
/* A5 面板内所有附件缩略图统一尺寸 */
.a5-panel .thumb.invoice,
.a5-panel .thumb.payment {
  width: 100%;
  max-width: none;
  min-height: 0;
}
.a5-panel .thumb img,
.a5-panel .thumb embed,
.a5-panel .thumb iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  max-height: 180mm;
}
.thumb img,
.thumb embed,
.thumb iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  max-height: 170mm;
  background: #fff;
  border: 0;
}
.thumb.pdf-pages {
  display: flex;
  flex-direction: column;
  gap: 3mm;
  align-items: stretch;
  justify-content: center;
  padding: 2mm;
}
.thumb.pdf-pages img {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
  object-fit: contain;
}
.thumb.invoice img,
.thumb.invoice embed,
.thumb.invoice iframe,
.thumb.payment img,
.thumb.payment embed,
.thumb.payment iframe { max-height: 110mm; background: #fff; }
.railway-ticket-thumb {
  border: 1px solid #b8d7df;
  background: #e8f8fb;
  padding: 5mm;
  place-items: stretch;
  overflow: visible;
}
.railway-ticket-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #e5f7fb 0%, #d4f0f5 100%);
  border: 1px solid #9ccdd8;
  color: #0f172a;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  gap: 3mm;
  padding: 6mm 8mm;
  font-family: "Microsoft YaHei", SimSun, sans-serif;
}
.railway-ticket-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}
.railway-ticket-top,
.railway-ticket-buyer {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  font-size: 13px;
}
.railway-ticket-route {
  display: grid;
  grid-template-columns: 1fr 42mm 1fr;
  align-items: center;
  text-align: center;
}
.railway-ticket-route b {
  display: block;
  font-size: 23px;
  margin-bottom: 2mm;
}
.railway-ticket-route small {
  color: #334155;
  font-size: 13px;
}
.railway-ticket-train strong {
  display: block;
  font-size: 22px;
  margin-bottom: 2mm;
}
.railway-ticket-train i {
  display: block;
  height: 1px;
  background: #0f172a;
  position: relative;
}
.railway-ticket-train i::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border-left: 8px solid #0f172a;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.railway-ticket-amount {
  font-size: 23px;
  font-weight: 800;
}
.railway-ticket-note {
  border: 1px dashed #334155;
  text-align: center;
  padding: 3mm;
  font-size: 16px;
}
.narrow-payment .thumb.payment img,
.narrow-payment .thumb.payment embed,
.narrow-payment .thumb.payment iframe { max-height: 110mm; }
.narrow-invoice .thumb.invoice img,
.narrow-invoice .thumb.invoice embed,
.narrow-invoice .thumb.invoice iframe { max-height: 110mm; }
.attachments.compact-attachments .attach-card {
  width: 190mm;
  min-height: 128mm;
}
.attachments.compact-attachments .attach-grid { height: 112mm; }
.attachments.compact-attachments .thumb.invoice { min-height: 0; }
.attachments.compact-attachments .thumb.payment {
  min-height: 0;
  max-width: 106mm;
}
.paper-a4 .a4 {
  width: 210mm;
  min-height: 297mm;
  padding: 7mm;
  transform: translateX(-50%) scale(.72);
}
.paper-a4 .cover-full-page {
  padding: 0;
  min-height: 297mm;
  transform: translateX(-50%) scale(.72);
}
.paper-a4 .combined-sheet .a5-stack { flex: 1; gap: 4mm; align-items: stretch; }
.paper-a4 .combined-sheet .a5-panel { width: 194mm; height: 142.5mm; flex: 0 0 auto; min-height: 0; margin: 0; }
.paper-a4 .combined-sheet .attachment-list-panel { width: 148mm; flex: 0 0 auto; min-height: 0; }
.paper-a4 .cover-panel .print-voucher { transform: scale(1.02); margin: 0; }
.paper-a4 .attach-card {
  width: 196mm;
  min-height: 136mm;
}
.paper-a4 .attach-grid { height: 120mm; }
.paper-a4 .thumb.invoice img,
.paper-a4 .thumb.invoice embed,
.paper-a4 .thumb.invoice iframe,
.paper-a4 .thumb.payment img,
.paper-a4 .thumb.payment embed,
.paper-a4 .thumb.payment iframe { max-height: 110mm; }
.paper-a4.attachments.compact-attachments .attach-card,
.paper-a4 .attachments.compact-attachments .attach-card {
  width: 190mm;
  min-height: 130mm;
}
.paper-a4.attachments.compact-attachments .attach-grid,
.paper-a4 .attachments.compact-attachments .attach-grid { height: 114mm; }

/* A5 与西玛均为单面板横向纸张，预览尺寸与实际打印尺寸一致。 */
.paper-a5 .a4 {
  width: 210mm;
  height: 148mm;
  min-height: 148mm;
  padding: 5mm;
  overflow: hidden;
  transform: translateX(-50%) scale(.82);
}
.paper-xima .a4 {
  width: 240mm;
  height: 140mm;
  min-height: 140mm;
  margin-bottom: -35mm;
  padding: 5mm;
  overflow: hidden;
  transform: translateX(-50%) scale(.75);
}
.paper-a5 .combined-sheet .a5-stack,
.paper-xima .combined-sheet .a5-stack { flex: 1; gap: 0; }
.paper-a5 .combined-sheet .a5-panel { width: 194mm; height: 140mm; flex: 0 0 auto; min-height: 0; margin: 0; }
.paper-xima .combined-sheet .a5-panel { width: 224mm; height: 132mm; flex: 0 0 auto; min-height: 0; margin: 0; }
.paper-a5 .combined-sheet .attachment-list-panel { width: 148mm; height: 138mm; flex: 0 0 auto; min-height: 0; }
.paper-xima .combined-sheet .attachment-list-panel { width: 148mm; height: 130mm; flex: 0 0 auto; min-height: 0; }
.paper-a5 .attach-card { width: 200mm; min-height: 138mm; }
.paper-xima .attach-card { width: 230mm; min-height: 130mm; }
.paper-a5 .attach-grid { height: 122mm; }
.paper-xima .attach-grid { height: 114mm; }

/* 西玛纸只有 130mm 可用高度：移除重复卡片占位，并让发票完整等比缩放。 */
.paper-a4 .attach-page,
.paper-a5 .attach-page,
.paper-xima .attach-page {
  padding: 4mm 4mm 4mm 12mm;
}
.paper-a4 .attach-page > .attach-card,
.paper-a5 .attach-page > .attach-card,
.paper-xima .attach-page > .attach-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}
.paper-a4 .attach-page > .attach-card::before,
.paper-a5 .attach-page > .attach-card::before,
.paper-xima .attach-page > .attach-card::before,
.paper-a4 .attach-page > .attach-card > h4,
.paper-a5 .attach-page > .attach-card > h4,
.paper-xima .attach-page > .attach-card > h4 { display: none; }
.paper-a4 .attach-page > .attach-card > .a5-stack,
.paper-a5 .attach-page > .attach-card > .a5-stack,
.paper-xima .attach-page > .attach-card > .a5-stack {
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}
.paper-a4 .attach-page > .attach-card > .a5-stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4mm;
}
.paper-a5 .attach-page > .attach-card > .a5-stack,
.paper-xima .attach-page > .attach-card > .a5-stack {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}
.paper-a4 .attach-page .a5-panel,
.paper-a5 .attach-page .a5-panel,
.paper-xima .attach-page .a5-panel {
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 3mm;
  overflow: hidden;
}
.paper-a4 .attach-page .attach-item,
.paper-a5 .attach-page .attach-item,
.paper-xima .attach-page .attach-item,
.paper-a4 .attach-page .thumb.invoice,
.paper-a5 .attach-page .thumb.invoice,
.paper-xima .attach-page .thumb.invoice,
.paper-a4 .attach-page .thumb.payment,
.paper-a5 .attach-page .thumb.payment,
.paper-xima .attach-page .thumb.payment {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.paper-a4 .attach-page .thumb.invoice,
.paper-a5 .attach-page .thumb.invoice,
.paper-xima .attach-page .thumb.invoice,
.paper-a4 .attach-page .thumb.payment,
.paper-a5 .attach-page .thumb.payment,
.paper-xima .attach-page .thumb.payment {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.paper-a4 .attach-page .thumb.invoice img,
.paper-a5 .attach-page .thumb.invoice img,
.paper-xima .attach-page .thumb.invoice img,
.paper-a4 .attach-page .thumb.invoice embed,
.paper-a5 .attach-page .thumb.invoice embed,
.paper-xima .attach-page .thumb.invoice embed,
.paper-a4 .attach-page .thumb.invoice iframe,
.paper-a5 .attach-page .thumb.invoice iframe,
.paper-xima .attach-page .thumb.invoice iframe,
.paper-a4 .attach-page .thumb.payment img,
.paper-a5 .attach-page .thumb.payment img,
.paper-xima .attach-page .thumb.payment img,
.paper-a4 .attach-page .thumb.payment embed,
.paper-a5 .attach-page .thumb.payment embed,
.paper-xima .attach-page .thumb.payment embed,
.paper-a4 .attach-page .thumb.payment iframe,
.paper-a5 .attach-page .thumb.payment iframe,
.paper-xima .attach-page .thumb.payment iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100% !important;
  object-fit: contain;
  object-position: right center;
}
.paper-a4 .attach-page .thumb.pdf-pages img,
.paper-a5 .attach-page .thumb.pdf-pages img,
.paper-xima .attach-page .thumb.pdf-pages img {
  width: 100%;
  height: 0;
  min-height: 0;
  flex: 1 1 0;
  max-height: 100% !important;
  object-fit: contain;
  object-position: right center;
}
.combined-print.paper-a5 { width: 210mm; }
.combined-print.paper-xima { width: 240mm; }
.combined-print.paper-a5 .a4,
.combined-print.paper-xima .a4 { transform: none; margin-left: auto; margin-right: auto; }
.paper-a5 .cover-full-page,
.paper-xima .cover-full-page { justify-content: center; }
.paper-a5 .cover-full-page .print-voucher,
.paper-xima .cover-full-page .print-voucher { width: 210mm; min-height: 110mm; }

.toast-stack { position: fixed; right: 18px; top: 18px; z-index: 50; display: grid; gap: 10px; }
.toast {
  min-width: 260px;
  max-width: 360px;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  animation: slide .2s ease;
}
@keyframes slide { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-panel { position: static; max-height: none; }
  .preview-scroll { height: auto; }
}
@media (max-width: 720px) {
  .app-shell { padding: 14px; }
  body { overflow-x: hidden; }
  .topbar, .top-actions { align-items: stretch; flex-direction: column; }
  .upload-grid, .record-grid, .form-grid { grid-template-columns: 1fr; }
  /* 触控目标与防 iOS 自动缩放 */
  input, select, textarea { font-size: 16px; }
  input, select { height: 44px; }
  .primary, .ghost { min-height: 44px; }
  .tab { min-height: 44px; }
  img, embed, iframe { max-width: 100%; }
  /* 步骤导航窄屏精简为 4 列紧凑条 */
  .stepper { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .step {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    padding: 8px 4px;
    text-align: center;
  }
  .step span { width: 22px; height: 22px; font-size: 12px; }
  .step strong { font-size: 12px; }
  .step.active { transform: none; }
  .desktop-only { display: none; }
  .mobile-only { display: inline-flex; }
  .assistant-panel { padding: 14px; }
  .assistant-head { align-items: center; }
  .assistant-head h2 { font-size: 20px; }
  .chat-window { max-height: 260px; }
  .chat-bubble { max-width: 92%; }
  .preview-panel { display: none; }
  .hint { display: none; }
  .mobile-pdf { display: inline-flex; }
  .voucher, .a4 { transform: translateX(-50%) scale(.48); }
}
/* 手机竖屏（360px–430px）补充适配 */
@media (max-width: 480px) {
  .app-shell { padding: 10px; }
  h1 { font-size: 22px; }
  .eyebrow { font-size: 12px; }
  /* 顶部操作按钮两列换行排列，避免一长串全宽按钮 */
  .top-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .top-actions > * {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 登录面板收紧内边距 */
  .login-gate { padding: 14px; }
  .login-panel { padding: 22px; gap: 14px; }
  .login-panel h2 { font-size: 24px; }
  .login-panel input, .login-box input { min-height: 48px; }
  /* 卡片与上传区 */
  .card-title { padding: 12px; }
  .card-body { padding: 0 12px 12px; }
  .drop-zone { min-height: 110px; padding: 14px; }
  .drop-zone strong { font-size: 16px; }
  /* 纸张切换按钮允许换行、缩小字号 */
  .segmented { display: flex; flex-wrap: wrap; width: 100%; }
  .segmented button { flex: 1 1 auto; min-height: 40px; padding: 0 8px; font-size: 12px; }
  /* 底部上一步/下一步平分宽度 */
  .nav-buttons { gap: 8px; }
  .nav-buttons button { flex: 1; }
  /* 文件条目在窄屏先整行显示文件名 */
  .file-item > span:first-child { min-width: 0; flex-basis: 100%; }
  /* 页签文字缩小避免挤压 */
  .tab { font-size: 13px; padding: 0 4px; }
  /* 空状态占位高度收紧 */
  .empty { min-height: 220px; padding: 14px; }
  /* 提示浮层限制在屏内 */
  .toast-stack { left: 12px; right: 12px; top: 12px; }
  .toast { min-width: 0; max-width: none; }
  /* 发票/报销封面等 mm 级预览进一步缩小，防止横向溢出 */
  .voucher, .a4 { transform: translateX(-50%) scale(.4); }
  .attachments, .preview-scroll { overflow-x: auto; }
}
@media print {
  html, body { margin: 0; overflow: visible; }
  body.print-a4, body.print-a5 { width: 210mm; }
  body.print-xima { width: 240mm; }
  body { background: #fff; }
  .topbar, .stepper, .hint, .flow, .tabs, .empty, .toast-stack { display: none !important; }
  .app-shell, .workspace, .preview-panel, .preview-scroll { display: block; padding: 0; margin: 0; border: 0; box-shadow: none; max-height: none; overflow: visible; }
  .tab-page { display: none !important; }
  .tab-page.printing { display: block !important; }
  .output-render-host.printing { display: block !important; }
  .combined-print, .attachments { margin: 0; padding: 0; gap: 0; align-items: center; justify-items: center; }
  body.print-a4 .combined-print, body.print-a4 .attachments,
  body.print-a5 .combined-print, body.print-a5 .attachments { width: 210mm; }
  body.print-xima .combined-print, body.print-xima .attachments { width: 240mm; }
  .voucher, .a4 { position: relative !important; left: 0 !important; right: auto !important; transform: none !important; margin: 0 auto; box-shadow: none; page-break-after: auto; break-after: auto; }
  .a4, .a5-panel, .combined-sheet { border: 0 !important; box-shadow: none !important; }
  .a4 { overflow: hidden; }
  .print-actions { display: none !important; }
  body.print-a5 .a4 { width: 210mm !important; max-width: 210mm !important; height: 148mm; min-height: 148mm; padding: 4mm 4mm 4mm 12mm; }
  body.print-a4 .a4 { width: 210mm !important; max-width: 210mm !important; height: 297mm; min-height: 297mm; padding: 4mm 4mm 4mm 12mm; }
  body.print-xima .a4 { width: 240mm !important; max-width: 240mm !important; height: 140mm; min-height: 140mm; padding: 4mm 4mm 4mm 12mm; }
  body.print-a4 .a5-panel,
  body.print-a5 .a5-panel,
  body.print-xima .a5-panel { width: 100%; height: auto; min-height: 0; page-break-inside: avoid; margin: 0; }
  body.print-a4 .combined-sheet .a5-panel { width: 194mm; height: 142.5mm; flex: 0 0 auto; }
  body.print-a5 .combined-sheet .a5-panel { width: 194mm; height: 140mm; flex: 0 0 auto; }
  body.print-xima .combined-sheet .a5-panel { width: 224mm; height: 132mm; flex: 0 0 auto; }
  body.print-a4 .attach-page > .attach-card,
  body.print-a5 .attach-page > .attach-card,
  body.print-xima .attach-page > .attach-card { width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; overflow: hidden; }
  body.print-a4 .attach-page > .attach-card::before,
  body.print-a5 .attach-page > .attach-card::before,
  body.print-xima .attach-page > .attach-card::before,
  body.print-a4 .attach-page > .attach-card > h4,
  body.print-a5 .attach-page > .attach-card > h4,
  body.print-xima .attach-page > .attach-card > h4 { display: none; }
  body.print-a4 .attach-page > .attach-card > .a5-stack { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 4mm; width: 100%; height: 100%; }
  body.print-a5 .attach-page > .attach-card > .a5-stack,
  body.print-xima .attach-page > .attach-card > .a5-stack { display: grid; grid-template-rows: minmax(0, 1fr); gap: 0; width: 100%; height: 100%; }
  body.print-a4 .thumb.invoice img,
  body.print-a5 .thumb.invoice img,
  body.print-xima .thumb.invoice img,
  body.print-a4 .thumb.invoice embed,
  body.print-a5 .thumb.invoice embed,
  body.print-xima .thumb.invoice embed,
  body.print-a4 .thumb.invoice iframe,
  body.print-a5 .thumb.invoice iframe,
  body.print-xima .thumb.invoice iframe,
  body.print-a4 .thumb.payment img,
  body.print-a5 .thumb.payment img,
  body.print-xima .thumb.payment img,
  body.print-a4 .thumb.payment embed,
  body.print-a5 .thumb.payment embed,
  body.print-xima .thumb.payment embed,
  body.print-a4 .thumb.payment iframe,
  body.print-a5 .thumb.payment iframe,
  body.print-xima .thumb.payment iframe { width: 100%; height: 100%; max-width: 100%; max-height: 100% !important; object-fit: contain; object-position: right center; }
  .attachment-list-page { padding: 4mm 5mm !important; }
  .attachment-list-page .a5-stack { height: auto; }
  /* 附件单据清单使用 A5 portrait 宽度 */
  body.print-a4 .attachment-list-panel { width: 148mm; height: 134mm; padding: 5mm; }
  body.print-a5 .attachment-list-panel { width: 148mm; height: 134mm; padding: 5mm; }
  body.print-xima .attachment-list-panel { width: 148mm; height: 130mm; padding: 5mm; }
  body.print-a4 .cover-full-page,
  body.print-a5 .cover-full-page,
  body.print-xima .cover-full-page { padding: 0 !important; }
  body.print-a5 .cover-full-page,
  body.print-xima .cover-full-page { justify-content: center; }
  body.print-a5 .cover-full-page .print-voucher,
  body.print-xima .cover-full-page .print-voucher { width: 210mm; min-height: 110mm; }
  /* 封面+附件清单合并页 */
  .cover-with-list-page { padding: 0 !important; }
  .cover-with-list-page .cover-half { flex: 1; overflow: hidden; background: #f8fcff; border-bottom: 1px solid #e2e8f0; }
  .cover-with-list-page .cover-half .voucher { position: static !important; left: auto !important; transform: none !important; margin: 0 auto !important; width: 100%; min-height: auto; border: 0 !important; box-shadow: none !important; padding: 3mm 5mm 1mm 16mm; }
  .cover-with-list-page .cover-half .voucher::before { display: none !important; }
  .cover-with-list-page .cover-half .voucher .voucher-topline { margin-left: 10mm; }
  .cover-with-list-page .list-half { flex: 1; overflow: hidden; padding: 2mm; }
  /* 两张封面一页 A4 打印样式 */
  .cover-pair-page { padding: 0 !important; display: flex; flex-direction: column; }
  .cover-pair-container { display: flex; flex-direction: column; align-items: center; width: 100%; transform-origin: top center; }
  .cover-pair-container .cover-half { width: 100%; flex-shrink: 0; display: flex; align-items: stretch; justify-content: center; background: #f8fcff; }
  .cover-pair-container .cover-half:first-child { border-bottom: 1px solid #e2e8f0; }
  .cover-pair-container .cover-half .voucher { position: static !important; left: auto !important; transform: none !important; margin: 0 auto !important; width: 100%; min-height: auto; border: 0 !important; box-shadow: none !important; padding: 3mm 5mm 1mm 16mm; }
  .cover-pair-container .cover-half .voucher::before { display: none !important; }
  .cover-pair-container .cover-half .voucher .voucher-topline { margin-left: 10mm; }
  .thumb.pdf-pages { gap: 2mm; padding: 1mm; }
  .thumb img,
  .thumb embed,
  .thumb iframe {
    max-height: 180mm;
    object-fit: contain;
  }
  .combined-print .a4:not(:last-child),
  .attachments .a4:not(:last-child) { break-after: page; page-break-after: always; }
  .combined-print .a4:last-child,
  .attachments .a4:last-child { break-after: auto; page-break-after: auto; }
  .combined-print .a5-panel { page-break-inside: avoid; }
  .combined-sheet .a5-stack { display: flex; flex-direction: column; gap: 4mm; height: 100%; align-items: stretch; }
  .combined-sheet .a5-panel { flex: 0 0 auto; min-height: 0; }
}

.record-info {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: normal;
}
.multi-invoice-warning {
  display: block;
  margin: 8px 0 4px;
  padding: 6px 10px;
  background: #fff7ed;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  color: #b45309;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
/* 附件项内的多页发票警告（窄面板内较小） */
.multi-invoice-warning-sm {
  margin: 4px 0 0;
  padding: 3px 6px;
  font-size: 10px;
  line-height: 1.3;
}
.multi-invoice-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  background: #f59e0b;
  color: #fff;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.primary.recognizing {
  background: var(--blue);
  opacity: 0.85;
  min-width: 240px;
  transition: all 0.3s ease;
}
.primary.done {
  background: var(--green);
  min-width: 240px;
  transition: all 0.3s ease;
}

/* 单选框样式 */
.single-choice .check-pill input[type="radio"] {
  appearance: auto;
  width: auto;
  height: auto;
  margin-right: 4px;
}

.top-actions .hidden {
  display: none !important;
}

.stepper::before {
  box-shadow: 0 0 22px rgba(23, 105, 224, 0.32);
  transition: width .35s ease;
}
.step.done,
.step.active {
  background: linear-gradient(135deg, #1769e0, #2d8cff);
  color: #fff;
}
.step.done span,
.step.active span {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.file-item {
  flex-wrap: wrap;
}
.file-item > span:first-child {
  min-width: 180px;
  flex: 1;
}
.file-warning {
  border-color: #fecaca;
  background: #fff7f7;
}
.tiny {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.attachment-list-panel {
  padding: 5mm;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 4mm;
  color: #111827;
  background: #fff;
  border-color: #111827;
  /* A5 portrait 尺寸：两张上下排列在一页 A4 内 */
  width: 148mm;
  height: auto;
}
.attachment-list-panel h2 {
  margin: 0;
  text-align: center;
  font-family: "SimSun", "Microsoft YaHei", serif;
  font-size: 24px;
  letter-spacing: 4px;
  font-weight: 500;
}
.attachment-list-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 0;
  border-bottom: 1px solid #111827;
  min-height: 14mm;
  align-items: stretch;
  padding-top: 4mm;
}
.attachment-list-meta span {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 3mm;
  border: 0;
  font-size: 16px;
}
.attachment-list-meta span:last-child {
  justify-self: end;
  justify-content: flex-end;
  text-align: right;
}
.attachment-list-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: "SimSun", "Microsoft YaHei", serif;
}
.attachment-list-table th,
.attachment-list-table td {
  border: 1px solid #111827;
  text-align: center;
  vertical-align: middle;
  padding: 1mm 2mm;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: break-word;
  overflow: hidden;
}
.attachment-list-table th {
  height: 12mm;
  font-weight: 500;
  font-size: 15px;
}
.attachment-list-table td {
  height: 13mm;
}
.attachment-list-table th:first-child,
.attachment-list-table td:first-child {
  width: 8mm;
}
.attachment-list-table th:nth-child(2),
.attachment-list-table td:nth-child(2) {
  width: 36mm;
}
.attachment-list-table th:nth-child(3),
.attachment-list-table td:nth-child(3) {
  width: 24mm;
}
.attachment-list-table th:nth-child(4),
.attachment-list-table td:nth-child(4) {
  width: 44mm;
}
.attachment-list-table th:nth-child(5),
.attachment-list-table td:nth-child(5) {
  width: 26mm;
}

.admin-shell .card .card-body {
  display: block !important;
}
.admin-shell .card-title i {
  display: none;
}
.admin-shell .card {
  border-radius: 10px;
  overflow: hidden;
}
.admin-shell .topbar {
  align-items: center;
}
.admin-shell {
  max-width: 1560px;
}
.admin-shell .topbar {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f4f8ff);
  box-shadow: var(--shadow);
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.admin-stats > div {
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.08);
  display: grid;
  gap: 10px;
}
.admin-stats span {
  color: var(--muted);
  font-weight: 700;
}
.admin-stats b {
  font-size: 34px;
  line-height: 1;
  color: var(--text);
}
.admin-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.admin-actions {
  justify-content: flex-start;
}
.admin-actions button {
  min-height: 38px;
}
.admin-actions .danger {
  color: #b42318;
  border-color: #fecaca;
  background: #fff7f7;
}
.add-license-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid #dbe6f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff, #f4f8ff);
}
.add-license-form label {
  display: grid;
  gap: 6px;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}
.add-license-form input {
  width: 100%;
  height: 42px;
  border: 1px solid #d7e1ef;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
}
.add-license-form .primary {
  min-width: 120px;
  height: 42px;
  white-space: nowrap;
}
.new-license-result {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.new-license-result code,
.new-license-result span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 900px) {
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .add-license-form {
    grid-template-columns: 1fr 1fr;
  }
  .add-license-form .primary {
    grid-column: 1 / -1;
  }
}
