.vg-generator {
  container-type: inline-size;
  color: #263c4b;
  --vg-line: #dce5ec;
  --vg-muted: #566c79;
}
.vg-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
  gap: 18px;
}
.vg-card { min-width: 0; padding: 20px; border: 1px solid var(--vg-line); border-radius: 8px; background: white; }
.vg-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.vg-form fieldset + fieldset { margin-top: 20px; }
.vg-form legend, .vg-preview h2 { padding: 0; margin: 0 0 14px; color: #243c4b; font-size: 16px; font-weight: 600; }
.vg-fields, .vg-accounts { display: grid; gap: 12px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vg-accounts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 0.85fr); gap: 10px; }
.vg-full { grid-column: 1 / -1; }
.vg-card label { display: grid; gap: 6px; min-width: 0; font-size: 13px; }
.vg-card :is(input, select, textarea) {
  min-width: 0; width: 100%; min-height: 34px; padding: 6px 9px;
  border: 1px solid #cfdbe4; border-radius: 4px; background-color: white; color: inherit;
}
.vg-card textarea { resize: vertical; line-height: 1.5; }
.vg-card :is(input, select, textarea):focus { outline: 2px solid #26979e; outline-offset: 1px; }
.vg-direction {
  display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px;
  padding: 8px 12px; border-radius: 4px; background: #eff8f8; color: #285660;
}
.vg-direction span { display: inline-flex; align-items: center; gap: 8px; }
.vg-direction b { color: #176772; }
.vg-form-actions, .vg-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.vg-form-actions [type="submit"] { margin-left: auto; }
.vg-card .btn { min-height: 34px; }
.vg-card .btn-primary { background: #197b82; border-color: #197b82; }
.vg-card .btn-primary:hover:not(:disabled) { background: #12636a; }
.vg-status { margin: 10px 0 0; line-height: 1.6; color: var(--vg-muted); }
.vg-status:empty { margin: 0; }
.vg-copy-fallback { margin-top: 12px; }
.vg-preview { position: sticky; top: 70px; }
.vg-preview h2 { scroll-margin-top: 72px; }
.vg-paper { padding: 22px 20px 16px; border: 1px solid #cad7de; color: #253b49; background: white; overflow-wrap: anywhere; }
.vg-paper-heading { text-align: center; }
.vg-paper-heading h3 { margin: 0 0 8px; font: 600 24px/1.3 SimSun, "Songti SC", serif; letter-spacing: 0.14em; }
.vg-paper-heading > div { font-size: 13px; color: var(--vg-muted); }
.vg-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin: 20px 0 8px; color: var(--vg-muted); font-size: 12px; }
.vg-paper table { width: 100%; border-collapse: collapse; table-layout: fixed; white-space: normal; font-size: 13px; }
.vg-summary-col { width: 26%; }
.vg-subject-col { width: 34%; }
.vg-paper th, .vg-paper td { padding: 10px 8px; border: 1px solid #cbd8df; text-align: left; color: inherit; }
.vg-paper thead th { background: #eef3f5; color: #304956; }
.vg-paper tbody tr { height: 45px; }
.vg-paper tbody td:nth-child(n+3), .vg-paper tfoot td, .vg-paper thead th:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.vg-paper tfoot :is(td, th) { background: #f0f8f7; font-weight: 600; }
.vg-paper .vg-empty { height: 90px; text-align: center; color: var(--vg-muted); }

@container (max-width: 920px) {
  .vg-layout { grid-template-columns: minmax(0, 1fr); }
  .vg-preview { position: static; }
}
@container (max-width: 470px) {
  .vg-card { padding: 14px; }
  .vg-accounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vg-accounts label:nth-child(2) { grid-column: span 2; grid-row: 2; }
  .vg-fields { gap: 10px; }
  .vg-paper { padding: 16px 8px; }
  .vg-paper th, .vg-paper td { padding: 7px 4px; font-size: 12px; }
  .vg-meta { column-gap: 8px; }
}
@media print {
  body:has(.vg-preview[data-generated]) :is(.topbar, .sidebar, .sales-heading, .vg-form, .vg-preview h2, .vg-preview-actions, .vg-status, .vg-copy-fallback) { display: none !important; }
  body:has(.vg-preview[data-generated]) :is(.layout, .workspace, .sales-workspace, .vg-layout, .vg-card) {
    display: block; padding: 0; margin: 0; border: 0; position: static;
  }
  .vg-paper { break-inside: avoid; }
}
