:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --paper: #08111f;
  --card: rgba(15, 23, 42, 0.78);
  --accent: #7dd3fc;
  --accent-strong: #a78bfa;
  --accent-soft: rgba(125, 211, 252, 0.14);
  --line: rgba(148, 163, 184, 0.24);
  --muted: #b6c3d4;
  --field: rgba(15, 23, 42, 0.72);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(125, 211, 252, 0.18), transparent 32%),
    radial-gradient(circle at 86% 12%, rgba(167, 139, 250, 0.22), transparent 30%),
    linear-gradient(135deg, #08111f 0%, #0f172a 58%, #111827 100%);
  font-family:
    "Avenir Next",
    "Hiragino Sans GB",
    "Noto Sans SC",
    "PingFang SC",
    sans-serif;
}

.site-header {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  box-shadow: 0 12px 38px rgba(125, 211, 252, 0.22);
}

.site-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.app-shell {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 16px 36px;
}

.hero h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.sub {
  margin: 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.05fr);
  gap: 16px;
  margin-top: 18px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(18px);
}

h2 {
  margin: 0 0 10px;
  font-size: 1.02rem;
}

textarea,
input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.14);
}

textarea::placeholder,
input::placeholder {
  color: rgba(203, 213, 225, 0.56);
}

#rawInput {
  min-height: 360px;
  resize: vertical;
  font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body > a:first-child {
  z-index: 10;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #06111f;
}

.btn.primary:hover {
  filter: brightness(0.96);
}

.btn.ghost {
  background: rgba(248, 250, 252, 0.08);
  border-color: rgba(248, 250, 252, 0.14);
  color: var(--ink);
}

.seller-settings {
  margin-top: 14px;
  border-top: 1px dashed rgba(148, 163, 184, 0.28);
  padding-top: 12px;
}

.seller-settings summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-grid input,
.form-grid textarea {
  margin-top: 6px;
}

.span-2 {
  grid-column: span 2;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.08);
}

.status.error {
  color: #fecdd3;
  background: rgba(220, 38, 38, 0.16);
}

.status.ok {
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.16);
}

.invoice {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  min-height: 560px;
  padding: 22px;
}

.invoice-head {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 12px;
}

.invoice h3 {
  margin: 0;
  font-size: 1.45rem;
}

.invoice-meta p,
.block p {
  margin: 4px 0;
  font-size: 0.92rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.block {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
}

.block h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #334155;
}

.items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.items th,
.items td {
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  padding: 8px 6px;
  font-size: 0.88rem;
  vertical-align: top;
}

.items th {
  background: #f8fafc;
  font-weight: 700;
}

.num {
  text-align: right;
}

.totals {
  margin-top: 12px;
  margin-left: auto;
  width: min(360px, 100%);
}

.totals .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.92rem;
}

.totals .row strong {
  color: var(--ink);
}

.note {
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #7c2d12;
  font-size: 0.82rem;
}

.empty-state {
  display: grid;
  place-content: center;
  text-align: center;
  color: #64748b;
}

.empty-title {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 700;
}

.empty-desc {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.invoice.official-template {
  border: none;
  box-shadow: none;
  background: #fff;
  border-radius: 12px;
  padding: 0;
  min-height: auto;
}

.invoice-doc {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.template-page {
  width: 100%;
  max-width: 920px;
  height: 1230px;
  margin: 0 auto;
  padding: 0 24px 10px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  color: #23282c;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}

.top-blue-bar {
  height: 14px;
  background: #fff;
  margin: 0 -24px 8px;
}

.template-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.template-header h3 {
  margin: 0;
  font-size: 2.3rem;
  font-weight: 600;
  color: #31363a;
}

.doc-top-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 22px;
  align-items: start;
}

.customer-block {
  margin-top: 116px;
  justify-self: center;
  width: min(78%, 330px);
  font-size: 0.83rem;
  line-height: 1.35;
}

.customer-block p {
  margin: 2px 0;
}

.summary-card {
  background: #e9f1f6;
  border: 1px solid #cad8e2;
  padding: 11px 12px;
  font-size: 0.76rem;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0;
}

.summary-row span {
  color: #2f3438;
}

.summary-row strong {
  font-weight: 600;
  color: #1f2326;
  word-break: break-word;
}

.summary-row .copy-value {
  cursor: pointer;
  border-bottom: 1px dashed rgba(53, 87, 194, 0.58);
  border-radius: 3px;
  padding: 1px 3px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.summary-row .copy-value:hover,
.summary-row .copy-value:focus-visible {
  color: #1d4ed8;
  background: rgba(53, 87, 194, 0.08);
  border-color: #1d4ed8;
  outline: none;
}

.summary-row .copy-value.copied {
  color: #14532d;
  background: #dcfce7;
  border-color: #16a34a;
}

.summary-divider {
  margin: 7px 0;
  border-top: 1px solid #c8d5df;
}

.summary-row.total-row {
  margin-top: 7px;
  font-weight: 700;
}

.vat-declare-box {
  width: 360px;
  margin-left: auto;
  margin-top: 8px;
  border: 1px solid #ccd3da;
  font-size: 0.72rem;
}

.vat-declare-box div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
}

.vat-declare-box div + div {
  border-top: 1px solid #d6dde3;
}

.vat-declare-box strong {
  font-weight: 600;
  word-break: break-word;
}

.support-line {
  margin: 14px 0 6px;
  font-size: 0.7rem;
  color: #2e3337;
}

.support-link {
  color: #3557c2;
  font-weight: 700;
}

.template-separator {
  border-top: 1px solid #cfd6dc;
  margin: 9px 0;
}

.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  font-size: 0.72rem;
}

.address-card h4 {
  margin: 0 0 7px;
  font-size: 1.16rem;
  font-weight: 700;
  color: #262a2d;
}

.address-card p {
  margin: 2px 0;
  line-height: 1.3;
}

.order-info {
  align-self: flex-start;
  width: min(420px, 100%);
  margin-top: 2px;
  font-size: 0.72rem;
  text-align: left;
}

.order-info h4 {
  margin: 0 0 6px;
  font-size: 1.16rem;
  font-weight: 700;
  color: #262a2d;
}

.order-info-table {
  margin-left: 0;
  margin-right: auto;
  max-width: 420px;
  width: 100%;
}

.order-info-table div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  margin: 4px 0;
}

.order-info-table strong {
  font-weight: 600;
}

.invoice-details-block h4 {
  margin: 0 0 6px;
  font-size: 1.38rem;
  font-weight: 700;
  color: #262a2d;
}

.template-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.66rem;
}

.template-lines th {
  text-align: left;
  font-weight: 700;
  padding: 7px 6px;
  border-top: 1px solid #d7dde2;
  border-bottom: 1px solid #d7dde2;
  background: #f4f5f6;
}

.template-lines td {
  padding: 6px 6px;
  border-bottom: 1px solid #e6eaee;
  vertical-align: top;
}

.template-lines .desc-cell {
  line-height: 1.35;
}

.template-lines .minor-row td {
  padding-top: 5px;
  padding-bottom: 5px;
  border-bottom: none;
}

.template-lines th:nth-child(1) {
  width: 45%;
}

.num-cell {
  text-align: right;
  white-space: nowrap;
}

.grand-total {
  margin-top: 8px;
  border-top: 1px solid #d1d7dc;
  padding-top: 7px;
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 34px;
}

.grand-total.no-extra-rows {
  border-top: none;
  padding-top: 0;
  margin-top: 6px;
}

.grand-total span {
  font-size: 1.9rem;
  font-weight: 700;
  color: #32373b;
}

.grand-total strong {
  font-size: 2rem;
  font-weight: 700;
  color: #2a2f33;
}

.vat-breakdown {
  margin-top: 7px;
  margin-left: auto;
  width: 52%;
}

.vat-breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.66rem;
}

.vat-breakdown th,
.vat-breakdown td {
  text-align: right;
  padding: 6px 6px;
  border-bottom: 1px solid #e1e6ea;
}

.vat-breakdown th:first-child,
.vat-breakdown td:first-child {
  text-align: left;
}

.vat-breakdown tfoot td {
  font-weight: 700;
}

.page-footer {
  margin-top: auto;
  border-top: 1px solid #cfd6dc;
  padding-top: 7px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
}

.footer-note {
  max-width: 68%;
  font-size: 0.56rem;
  color: #7a7f84;
  line-height: 1.35;
}

.footer-page {
  font-size: 1rem;
  color: #63686d;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  #rawInput {
    min-height: 280px;
  }

  .template-page {
    height: auto;
    padding: 0 14px 12px;
    overflow: visible;
  }

  .top-blue-bar {
    margin: 0 -14px 10px;
  }

  .doc-top-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .customer-block {
    margin-top: 0;
    justify-self: start;
    width: auto;
  }

  .summary-card,
  .vat-declare-box {
    width: 100%;
  }

  .address-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .grand-total {
    justify-content: space-between;
    gap: 8px;
  }

  .grand-total span,
  .grand-total strong {
    font-size: 1.2rem;
  }

  .vat-breakdown {
    width: 100%;
  }

  .page-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-note {
    max-width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .hero,
  .input-panel,
  .preview-toolbar,
  .status {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .preview-panel {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .invoice {
    border: none;
    box-shadow: none;
    border-radius: 0;
    min-height: auto;
    padding: 0;
  }

  .invoice.official-template {
    border: none;
  }

  .invoice-doc {
    gap: 0;
  }

  .template-page {
    max-width: none;
    width: 210mm;
    height: 297mm;
    margin: 0 auto;
    padding: 0 10mm 8mm;
    page-break-after: auto;
    border: none;
    overflow: hidden;
  }

  .top-blue-bar {
    margin: 0 -10mm 7px;
  }
}

/* ══════════════════════════════════════════════════════════
   发票工具 v2（移植自 dashboard 工作台 InvoiceTool）
   全部规则作用域限定在 .inv-layout 内，不影响 format.html
   ══════════════════════════════════════════════════════════ */
:root {
  --inv-border: var(--line);
  --inv-text: var(--ink);
  --inv-text-muted: var(--muted);
  --inv-field: var(--field);
  --inv-primary: var(--accent);
  --inv-success: #4ade80;
  --inv-error: #f87171;
}

.inv-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.15fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .inv-layout { grid-template-columns: 1fr; }
}

.inv-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.inv-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 22px 0;
}
.inv-card-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.inv-card-desc { font-size: 12px; color: var(--muted); margin-top: 4px; transition: color 0.15s; }
.inv-card-body { padding: 16px 22px 22px; }
.inv-input-body, .inv-preview-body { display: flex; flex-direction: column; gap: 14px; }
.invoice-preview-card { min-width: 0; }
.invoice-preview-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 输入区 */
.inv-layout .invoice-raw-wrap { width: 100%; }
.inv-layout .invoice-raw {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--inv-field);
  border: 1px solid var(--inv-border);
  border-radius: 8px;
  color: var(--inv-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inv-layout .invoice-raw:focus {
  border-color: var(--inv-primary);
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.12);
}
.inv-layout .invoice-raw::placeholder { color: var(--inv-text-muted); opacity: 0.7; }
.inv-layout .invoice-action-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* 按钮 */
.inv-layout .btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  background: rgba(30, 41, 59, 0.6);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.inv-layout .btn:hover { border-color: rgba(125, 211, 252, 0.5); transform: translateY(-1px); }
.inv-layout .btn-primary {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(167, 139, 250, 0.26));
  border-color: rgba(125, 211, 252, 0.45);
}
.inv-layout .btn-clear {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.inv-layout .btn-clear:hover { color: var(--accent); background: rgba(125, 211, 252, 0.08); }

/* 表单字段 */
.inv-layout .param-label { font-size: 12px; color: var(--inv-text-muted); }
.inv-layout .param-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--inv-text);
  background: var(--inv-field);
  border: 1px solid var(--inv-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.inv-layout .param-input:focus { border-color: var(--inv-primary); }
.inv-layout .invoice-mini-select { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.inv-layout .invoice-mini-select .param-input { width: auto; min-width: 96px; padding: 5px 26px 5px 9px; font-size: 12px; }
.inv-layout .invoice-settings { border-top: 1px solid var(--inv-border); padding-top: 12px; }
.inv-layout .invoice-settings > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--inv-text);
  margin-bottom: 10px;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-layout .invoice-settings > summary::-webkit-details-marker { display: none; }
.inv-layout .invoice-settings > summary::before {
  content: '▾';
  display: inline-block;
  font-size: 11px;
  color: var(--inv-text-muted);
  transition: transform 0.15s;
}
.inv-layout .invoice-settings:not([open]) > summary::before { transform: rotate(-90deg); }
.inv-layout .invoice-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-layout .invoice-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--inv-text-muted);
}
.inv-layout .invoice-field--span2 { grid-column: span 2; }
.inv-layout .invoice-field textarea.param-input { resize: vertical; }

#inv-status.ok { color: var(--inv-success) !important; }
#inv-status.error { color: var(--inv-error) !important; }

/* 预览：发票纸张保持白底便于阅读/导出；空状态跟随深色主题 */
.inv-layout .invoice {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-height: 480px;
  padding: 0;
  color: #23282c;
  overflow: hidden;
}
.inv-layout .invoice.empty-state {
  display: grid;
  place-content: center;
  text-align: center;
  min-height: 420px;
  padding: 40px;
  background: var(--field);
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
}
.inv-layout .empty-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.inv-layout .empty-desc { margin: 6px 0 0; font-size: 13px; }
.inv-layout .invoice.official-template {
  border: none;
  box-shadow: none;
  background: transparent;
  min-height: auto;
}
.inv-layout .invoice-doc { display: flex; flex-direction: column; }
.inv-layout .template-page {
  width: 100%;
  max-width: 820px;
  height: 1160px;
  margin: 0 auto;
  padding: 0 22px 10px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #dbe3ea;
  color: #23282c;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
.inv-layout .top-blue-bar { height: 13px; background: #333b41; margin: 0 -22px 8px; }
.inv-layout .template-header { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.inv-layout .template-header h3 { margin: 0; font-size: 2.1rem; font-weight: 600; color: #31363a; }
.inv-layout .doc-top-grid { margin-top: 6px; display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.inv-layout .customer-block { margin-top: 110px; justify-self: center; width: min(78%, 300px); font-size: 12px; line-height: 1.35; }
.inv-layout .customer-block p { margin: 2px 0; }
.inv-layout .summary-card { background: #e9f1f6; border: 1px solid #cad8e2; padding: 11px 12px; font-size: 12px; }
.inv-layout .summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0; }
.inv-layout .summary-row span { color: #2f3438; }
.inv-layout .summary-row strong { font-weight: 600; color: #1f2326; word-break: break-word; }
.inv-layout .summary-row .copy-value {
  cursor: pointer;
  border-bottom: 1px dashed rgba(53, 87, 194, 0.58);
  border-radius: 3px;
  padding: 1px 3px;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.inv-layout .summary-row .copy-value:hover,
.inv-layout .summary-row .copy-value:focus-visible { color: #1d4ed8; background: rgba(53, 87, 194, 0.08); border-color: #1d4ed8; outline: none; }
.inv-layout .summary-row .copy-value.copied { color: #14532d; background: #dcfce7; border-color: #16a34a; }
.inv-layout .summary-divider { margin: 7px 0; border-top: 1px solid #c8d5df; }
.inv-layout .summary-row.total-row { margin-top: 7px; font-weight: 700; }
.inv-layout .support-line { margin: 14px 0 6px; font-size: 11px; color: #2e3337; }
.inv-layout .support-link { color: #3557c2; font-weight: 700; }
.inv-layout .template-separator { border-top: 1px solid #cfd6dc; margin: 9px 0; }
.inv-layout .address-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; font-size: 11px; }
.inv-layout .address-card h4 { margin: 0 0 7px; font-size: 1.1rem; font-weight: 700; color: #262a2d; }
.inv-layout .address-card p { margin: 2px 0; line-height: 1.3; }
.inv-layout .order-info { align-self: flex-start; width: min(400px, 100%); margin-top: 2px; font-size: 11px; text-align: left; }
.inv-layout .order-info h4 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 700; color: #262a2d; }
.inv-layout .order-info-table { margin-right: auto; max-width: 400px; width: 100%; }
.inv-layout .order-info-table div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; margin: 4px 0; }
.inv-layout .order-info-table strong { font-weight: 600; }
.inv-layout .invoice-details-block h4 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 700; color: #262a2d; }
.inv-layout .template-lines { width: 100%; border-collapse: collapse; font-size: 10px; }
.inv-layout .template-lines th { text-align: left; font-weight: 700; padding: 7px 6px; border-top: 1px solid #d7dde2; border-bottom: 1px solid #d7dde2; background: #f4f5f6; }
.inv-layout .template-lines td { padding: 6px 6px; border-bottom: 1px solid #e6eaee; vertical-align: top; }
.inv-layout .template-lines .desc-cell { line-height: 1.35; }
.inv-layout .template-lines .minor-row td { padding-top: 5px; padding-bottom: 5px; border-bottom: none; }
.inv-layout .template-lines th:nth-child(1) { width: 45%; }
.inv-layout .num-cell { text-align: right; white-space: nowrap; }
.inv-layout .grand-total {
  margin-top: 8px; border-top: 1px solid #d1d7dc; padding-top: 7px;
  display: flex; justify-content: flex-end; align-items: baseline; gap: 34px;
}
.inv-layout .grand-total.no-extra-rows { border-top: none; padding-top: 0; margin-top: 6px; }
.inv-layout .grand-total span { font-size: 1.7rem; font-weight: 700; color: #32373b; }
.inv-layout .grand-total strong { font-size: 1.8rem; font-weight: 700; color: #2a2f33; }
.inv-layout .vat-breakdown { margin-top: 7px; margin-left: auto; width: 52%; }
.inv-layout .vat-breakdown table { width: 100%; border-collapse: collapse; font-size: 10px; }
.inv-layout .vat-breakdown th, .inv-layout .vat-breakdown td { text-align: right; padding: 6px; border-bottom: 1px solid #e1e6ea; }
.inv-layout .vat-breakdown th:first-child, .inv-layout .vat-breakdown td:first-child { text-align: left; }
.inv-layout .vat-breakdown tfoot td { font-weight: 700; }
.inv-layout .page-footer {
  margin-top: auto; border-top: 1px solid #cfd6dc; padding-top: 7px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 14px;
}
.inv-layout .footer-note { max-width: 68%; font-size: 9px; color: #7a7f84; line-height: 1.35; }
.inv-layout .footer-page { font-size: 1rem; color: #63686d; white-space: nowrap; }

/* 提示浮层 */
#inv-notice {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(125, 211, 252, 0.35);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}
#inv-notice.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#inv-notice.error { border-color: rgba(248, 113, 113, 0.5); }
