body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
  overflow: hidden;
}

.toast-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast[data-tone="error"] {
  background: #7f1d1d;
  color: #fff7ed;
}

#toast[data-tone="error"] svg {
  color: #fecaca;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

.live-header {
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
  position: sticky;
  top: 0;
}

.live-header-left {
  display: flex;
  align-items: center;
}

.live-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.live-brand-logo {
  display: block;
  width: auto;
  height: 28px;
}

.live-header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currency-select {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.currency-select:focus { border-color: #111827; }

.live-doc-layout {
  display: flex;
  min-height: 100%;
  position: relative;
}

.live-doc-surface {
  flex: 1;
  padding: 40px 24px 80px;
  display: flex;
  justify-content: center;
  min-height: 100%;
}

.guide-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  height: calc(100vh - 56px);
  overflow-y: auto;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
  z-index: 10;
}

.guide-sidebar.is-instant {
  transition: none;
}

.guide-sidebar.is-collapsed {
  margin-left: -240px;
  opacity: 0;
  pointer-events: none;
}

.guide-sidebar-inner {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9ca3af;
}

.guide-collapse-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #9ca3af;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.guide-collapse-btn:hover {
  color: #374151;
  background: #f3f4f6;
}

.guide-expand-btn {
  position: sticky;
  top: 16px;
  left: 0;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin: 16px 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #9ca3af;
  border-radius: 8px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.guide-expand-btn:hover {
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.guide-expand-btn.hidden {
  display: none;
}

.guide-nudge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #0c4a6e;
}

.guide-nudge.hidden {
  display: none;
}

.guide-nudge-icon {
  flex-shrink: 0;
  color: #0284c7;
  margin-top: 1px;
}

.guide-nudge-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #7dd3fc;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: auto;
}

.guide-nudge-dismiss:hover {
  color: #0284c7;
}

.guide-sections {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.guide-section {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  width: 100%;
}

.guide-section:hover {
  background: #f9fafb;
}

.guide-section-status {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.guide-section-status.is-done {
  border-color: #22c55e;
  background: #22c55e;
}

.guide-section-status.is-done::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

.guide-section-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guide-section-label {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.guide-section-hint {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.3;
}

.guide-section-hint.is-filled {
  color: #22c55e;
}

.guide-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.guide-progress-bar {
  height: 4px;
  background: #f3f4f6;
  border-radius: 2px;
  overflow: hidden;
}

.guide-progress-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.guide-progress-fill[data-progress="0"] { width: 0%; }
.guide-progress-fill[data-progress="1"] { width: 16.6667%; }
.guide-progress-fill[data-progress="2"] { width: 33.3334%; }
.guide-progress-fill[data-progress="3"] { width: 50%; }
.guide-progress-fill[data-progress="4"] { width: 66.6667%; }
.guide-progress-fill[data-progress="5"] { width: 83.3334%; }
.guide-progress-fill[data-progress="6"] { width: 100%; }

.guide-progress-text {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
}

#pdf-preview {
  width: 794px;
  min-height: 1123px;
  background: white;
  flex-shrink: 0;
  box-sizing: border-box;
  transform-origin: top center;
}

.shadow-paper {
  box-shadow:
    0 1px 3px rgba(0,0,0,0.04),
    0 8px 24px rgba(0,0,0,0.08),
    0 24px 48px rgba(0,0,0,0.04);
  border-radius: 2px;
}

#preview-wrapper {
  width: 794px;
  max-width: none;
  transform-origin: top center;
  zoom: 1;
}

#preview-wrapper.preview-scale-25 { zoom: 0.25; }
#preview-wrapper.preview-scale-30 { zoom: 0.30; }
#preview-wrapper.preview-scale-35 { zoom: 0.35; }
#preview-wrapper.preview-scale-40 { zoom: 0.40; }
#preview-wrapper.preview-scale-45 { zoom: 0.45; }
#preview-wrapper.preview-scale-50 { zoom: 0.50; }
#preview-wrapper.preview-scale-55 { zoom: 0.55; }
#preview-wrapper.preview-scale-60 { zoom: 0.60; }
#preview-wrapper.preview-scale-65 { zoom: 0.65; }
#preview-wrapper.preview-scale-70 { zoom: 0.70; }
#preview-wrapper.preview-scale-75 { zoom: 0.75; }
#preview-wrapper.preview-scale-80 { zoom: 0.80; }
#preview-wrapper.preview-scale-85 { zoom: 0.85; }
#preview-wrapper.preview-scale-90 { zoom: 0.90; }
#preview-wrapper.preview-scale-95 { zoom: 0.95; }
#preview-wrapper.preview-scale-100 { zoom: 1; }

@supports not (zoom: 1) {
  #preview-wrapper {
    width: min(794px, 100%);
  }
}

.template-preview-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 24px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #991b1b;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

[data-field].live-hover,
[data-item-index].live-hover,
[data-field]:focus-visible,
[data-item-index]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: pointer;
  background: rgba(59, 130, 246, 0.03);
}

.tpl-midnight [data-field].live-hover,
.tpl-midnight [data-item-index].live-hover,
.tpl-midnight [data-field]:focus-visible,
.tpl-midnight [data-item-index]:focus-visible {
  outline-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.06);
}

[data-field].is-empty {
  color: rgba(0, 0, 0, 0.25) !important;
  font-style: italic;
  cursor: pointer;
  min-height: 1.2em;
}

.tpl-midnight [data-field].is-empty {
  color: rgba(255, 255, 255, 0.25) !important;
}

img[data-field="logo"].is-empty {
  display: block !important;
  width: 120px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  object-fit: contain;
}

.tpl-midnight img[data-field="logo"].is-empty {
  filter: grayscale(0.2) brightness(1.05);
}

[data-field].is-editing {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-radius: 2px;
  background: rgba(59, 130, 246, 0.04);
}

.tpl-midnight [data-field].is-editing {
  background: rgba(59, 130, 246, 0.08);
}

.live-field-editor {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  line-height: inherit;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.live-field-editor::placeholder {
  color: rgba(0, 0, 0, 0.25);
  font-style: italic;
}

.tpl-midnight .live-field-editor {
  color: #fff;
}

.tpl-midnight .live-field-editor::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.live-field-textarea {
  resize: none;
  white-space: pre-wrap;
  overflow: hidden;
  min-height: 2em;
}

.live-field-date {
  cursor: pointer;
  text-align: inherit;
}

.live-field-number {
  width: 3em;
  text-align: center;
}

.live-field-editor-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.live-field-suffix {
  opacity: 0.5;
  font-size: 0.85em;
}

[data-item-index] {
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

[data-item-index].is-editing {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-radius: 2px;
  background: rgba(59, 130, 246, 0.04);
  cursor: default;
}

.tpl-midnight [data-item-index].is-editing {
  background: rgba(59, 130, 246, 0.08);
}

.live-item-editor {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.live-item-editor::placeholder {
  color: rgba(0, 0, 0, 0.25);
  font-style: italic;
}

.tpl-midnight .live-item-editor {
  color: #fff;
}

.live-item-delete {
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.live-item-delete:hover {
  color: #ef4444;
  border-color: #fecaca;
}

.live-add-item-row {
  padding: 6px 0;
}

.live-add-item-btn {
  display: block;
  width: 100%;
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.25);
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.live-add-item-btn:hover {
  color: rgba(0, 0, 0, 0.5);
  border-color: rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.02);
}

[data-field].is-invalid,
#prev-items.is-invalid,
.live-items-empty.is-invalid {
  outline: 2px solid #dc2626;
  outline-offset: 3px;
  border-radius: 6px;
}

.live-field-error {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #b91c1c;
  font-weight: 600;
}

.tpl-midnight .live-field-error {
  color: #fca5a5;
}

.guide-section:focus-visible,
.live-item-delete:focus-visible,
.live-add-item-btn:focus-visible,
.floating-total:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 3px;
}

.tpl-midnight .live-add-item-btn {
  color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

.tpl-midnight .live-add-item-btn:hover {
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.live-items-empty {
  padding: 16px 0;
  text-align: center;
  cursor: pointer;
}

.live-items-empty .is-empty {
  color: rgba(0, 0, 0, 0.25);
  font-style: italic;
  font-size: 13px;
}

.floating-total {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 30;
  transition: opacity 0.2s, transform 0.2s;
}

.floating-total.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.floating-total-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
}

.floating-total-amount {
  font-size: 1.1rem;
}

.dialog-modal {
  position: fixed;
  top: 5rem;
  right: 1.25rem;
  z-index: 110;
  width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}

.dialog-card {
  width: 100%;
  border-radius: 1.25rem;
  background: #ffffff;
  padding: 1.4rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.dialog-modal[data-tone="warning"] .dialog-card {
  border: 1px solid #fed7aa;
  box-shadow: 0 24px 60px rgba(180, 83, 9, 0.12);
}

.dialog-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dialog-close {
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  color: #0f172a;
  border-color: #cbd5e1;
  background: #f8fafc;
  outline: none;
}

.dialog-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.dialog-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #475569;
}

.dialog-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: #475569;
  display: grid;
  gap: 0.45rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.dialog-button {
  border-radius: 0.85rem;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
  font-weight: 650;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dialog-button-secondary {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.dialog-button-primary {
  background: #0f172a;
  color: #fff;
  border: 1px solid #0f172a;
}

.dialog-button-primary:hover,
.dialog-button-primary:focus-visible,
.dialog-button-secondary:hover,
.dialog-button-secondary:focus-visible {
  outline: none;
  filter: brightness(0.98);
}

.btn-loading {
  opacity: 0.7;
  pointer-events: none;
}

.logo-cropper-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.logo-cropper-modal.hidden {
  display: none;
}

.logo-cropper-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.66);
}

.logo-cropper-card {
  position: relative;
  width: min(52rem, calc(100vw - 2rem));
  border-radius: 1.4rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.logo-cropper-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.logo-cropper-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.logo-cropper-desc {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #475569;
}

.logo-cropper-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  line-height: 1;
}

.logo-cropper-close svg {
  display: block;
}

.logo-cropper-canvas-wrap {
  border-radius: 1rem;
  border: 1px solid #cbd5e1;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  overflow: hidden;
}

.logo-cropper-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.logo-cropper-canvas.is-dragging {
  cursor: grabbing;
}

.logo-cropper-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.logo-cropper-zoom-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 700;
}

.logo-cropper-zoom {
  width: 100%;
}

.logo-cropper-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.template-shell {
  width: 100%;
  min-height: 1123px;
  box-sizing: border-box;
  padding: 56px;
  padding-bottom: 84px;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 22px;
}

.template-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: #000;
}

.template-accent-thick {
  height: 14px;
}

.template-head {
  display: flex;
  gap: 20px;
}

.template-head-split {
  justify-content: space-between;
  align-items: flex-start;
}

.template-head-modern {
  justify-content: space-between;
  align-items: center;
}

.template-head-left,
.template-head-right {
  width: 48%;
}

.template-head-right {
  text-align: right;
}

.template-logo {
  max-height: 62px;
  max-width: 210px;
  object-fit: contain;
  margin-bottom: 12px;
}

.template-title {
  margin: 0 0 14px;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.template-from-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.template-to-name {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.template-subline {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.template-pre {
  white-space: pre-wrap;
}

.template-meta-row {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  font-size: 11px;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: 700;
}

.template-meta-row span:last-child {
  min-width: 82px;
  text-align: right;
  text-transform: none;
  font-size: 14px;
  font-weight: 800;
}

.template-billto {
  margin-top: 6px;
}

.template-section-title {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 2px solid #000;
  padding-bottom: 3px;
  margin-bottom: 10px;
}

.template-items-block {
  margin-top: 2px;
}

.template-items-head {
  display: flex;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
  font-size: 10px;
}

.template-items-head .col-desc {
  flex: 1;
}

.template-items-head .col-qty {
  width: 12%;
  text-align: center;
}

.template-items-head .col-rate {
  width: 18%;
  text-align: right;
}

.template-items-head .col-amt {
  width: 22%;
  text-align: right;
}

.template-totals-wrap {
  display: flex;
  justify-content: flex-end;
}

.template-center {
  justify-content: center;
}

.template-totals-box {
  width: 300px;
  border: 1px solid #000;
  padding: 12px 14px;
}

.template-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #000;
  padding: 7px 0;
  font-size: 14px;
  font-weight: 700;
}

.template-total-row:last-child {
  border-bottom: 0;
}

.template-total-final {
  margin-top: 10px;
  border-top: 2px solid #000;
  padding-top: 10px;
  font-size: 24px;
  font-weight: 900;
  text-transform: uppercase;
}

.template-total-final span:first-child {
  font-size: 13px;
}

.template-pay-block,
.template-notes {
  border-top: 1px solid #000;
  padding-top: 10px;
}

.template-notes-body {
  min-height: 52px;
}

.template-brandline {
  position: absolute;
  right: 56px;
  bottom: 24px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-item-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  border-bottom: 1px solid #000;
  padding: 8px 0;
}

.preview-item-row:last-of-type {
  border-bottom: 0;
}

.preview-item-desc {
  flex: 1;
  padding-right: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-item-qty {
  width: 12%;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.preview-item-rate {
  width: 18%;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.preview-item-amt {
  width: 22%;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
}

.tpl-modern .template-meta-cards {
  display: flex;
  gap: 8px;
}

.tpl-modern .template-meta-card {
  border: 1px solid #000;
  padding: 8px 10px;
  min-width: 96px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
}

.tpl-modern .template-meta-card div:last-child {
  font-size: 13px;
  margin-top: 2px;
}

.tpl-modern .template-card {
  border: 1px solid #000;
  padding: 14px;
}

.tpl-modern .template-dual-cards {
  display: flex;
  gap: 12px;
}

.tpl-modern .template-dual-cards .template-card {
  flex: 1;
}

.tpl-modern .template-bottom-split {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.tpl-modern .template-bottom-notes {
  flex: 1;
}

.tpl-agency .template-band {
  border-bottom: 2px solid #000;
  padding-bottom: 14px;
}

.tpl-agency .template-pad-x {
  padding-left: 8px;
  padding-right: 8px;
}

.tpl-editorial .template-shell,
.tpl-editorial.template-shell {
  font-family: "Times New Roman", Georgia, serif;
}

.tpl-editorial .template-center-head {
  text-align: center;
  padding-top: 6px;
}

.tpl-editorial .template-center-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.tpl-editorial .template-editorial-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 16px 0;
}

.tpl-editorial .template-center-text {
  text-align: center;
}

.tpl-studio .template-studio-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 4px solid #000;
  padding-bottom: 8px;
}

.tpl-studio .template-title {
  font-size: 68px;
}

.tpl-studio .template-studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  border-bottom: 4px solid #000;
  padding-bottom: 12px;
}

.tpl-studio .template-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}

.tpl-studio .template-totals-box {
  border-width: 4px;
}

.tpl-tech.template-shell {
  font-family: "Courier New", Consolas, monospace;
}

.tpl-tech .template-title {
  font-size: 40px;
  letter-spacing: -0.01em;
}

.tpl-tech .template-chip {
  border: 1px solid #000;
  padding: 5px 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.tpl-tech .template-tech-to {
  border-left: 2px solid #000;
  padding-left: 12px;
}

.tpl-tech .preview-item-row {
  border-bottom-style: dashed;
}

.template-item-modern .preview-item-desc {
  font-weight: 600;
}

.template-item-agency .preview-item-desc,
.template-item-studio .preview-item-desc {
  text-transform: uppercase;
  font-weight: 800;
}

.template-item-editorial .preview-item-desc {
  font-family: "Times New Roman", Georgia, serif;
  font-weight: 600;
}

.template-item-tech .preview-item-desc,
.template-item-tech .preview-item-qty,
.template-item-tech .preview-item-rate,
.template-item-tech .preview-item-amt {
  font-family: "Courier New", Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.template-bottom-split {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.template-bottom-notes {
  flex: 1;
}

.tpl-midnight.template-shell {
  background: #0f0f10;
  color: #fff;
}

.tpl-midnight .template-section-title,
.tpl-midnight .template-items-head,
.tpl-midnight .template-total-row,
.tpl-midnight .template-subline,
.tpl-midnight .template-to-name,
.tpl-midnight .template-from-name,
.tpl-midnight .template-title,
.tpl-midnight .template-meta-row,
.tpl-midnight .template-brandline {
  color: #fff;
  border-color: #2a2a2c;
}

.tpl-midnight .template-totals-box,
.tpl-midnight .template-pay-block,
.tpl-midnight .template-notes,
.tpl-midnight .preview-item-row {
  border-color: #2a2a2c;
}

.tpl-vintage.template-shell {
  background: #fdfbf7;
  font-family: "Playfair Display", Georgia, serif;
}

.tpl-vintage .template-subline,
.tpl-vintage .template-meta-row {
  color: #6b6259;
}

.tpl-vintage .template-items-head,
.tpl-vintage .preview-item-row,
.tpl-vintage .template-total-row,
.tpl-vintage .template-pay-block,
.tpl-vintage .template-notes {
  border-color: #d0c6b8;
}

.tpl-saas.template-shell {
  background: #ffffff;
}

.tpl-saas .template-accent-gradient {
  background: linear-gradient(90deg, #7c3aed, #d946ef);
}

.tpl-saas .template-meta-cardline {
  display: inline-flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tpl-saas .template-meta-cardline > div > div:first-child {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  font-weight: 700;
}

.tpl-saas .template-meta-cardline > div > div:last-child {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
}

.tpl-saas .template-billto-card {
  width: 62%;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
}

.tpl-saas .template-items-head {
  border-bottom: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #f8fafc;
}

.tpl-saas .preview-item-row {
  border-bottom-color: #e2e8f0;
  padding: 9px 10px;
}

.tpl-saas .template-totals-box,
.tpl-saas .template-pay-block,
.tpl-saas .template-notes {
  border-color: #e2e8f0;
}

.tpl-saas .template-total-final span:first-child {
  color: #7c3aed;
}

.tpl-brutalist.template-shell {
  padding: 42px;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.tpl-brutalist .template-brandline {
  position: static;
  margin-top: 12px;
  text-align: right;
}

.tpl-brutalist .template-brutal-frame {
  border: 2px solid #000;
  min-height: calc(1123px - 84px);
  display: flex;
  flex-direction: column;
}

.tpl-brutalist .template-brutal-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 2px solid #000;
}

.tpl-brutalist .template-brutal-left {
  padding: 16px;
  border-right: 2px solid #000;
}

.tpl-brutalist .template-brutal-left .template-title {
  font-size: 52px;
  margin-top: 32px;
}

.tpl-brutalist .template-brutal-right {
  display: flex;
  flex-direction: column;
}

.tpl-brutalist .template-brutal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 2px solid #000;
}

.tpl-brutalist .template-brutal-meta > div {
  padding: 10px 12px;
  border-right: 2px solid #000;
}

.tpl-brutalist .template-brutal-meta > div:last-child {
  border-right: 0;
}

.tpl-brutalist .template-brutal-meta span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
  font-weight: 700;
}

.tpl-brutalist .template-brutal-meta strong {
  font-size: 12px;
}

.tpl-brutalist .template-brutal-issuer {
  padding: 12px;
}

.tpl-brutalist .template-brutal-client {
  padding: 12px 16px;
  border-bottom: 2px solid #000;
}

.tpl-brutalist .template-brutal-items {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tpl-brutalist .template-items-head {
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 2px solid #000;
  margin-bottom: 0;
  padding: 0;
}

.tpl-brutalist .template-items-head > div {
  padding: 10px;
  border-right: 2px solid #000;
}

.tpl-brutalist .template-items-head > div:last-child {
  border-right: 0;
}

.tpl-brutalist .preview-item-row {
  border-bottom: 2px solid #000;
  padding: 0;
}

.tpl-brutalist .preview-item-desc,
.tpl-brutalist .preview-item-qty,
.tpl-brutalist .preview-item-rate,
.tpl-brutalist .preview-item-amt {
  padding: 10px;
  border-right: 2px solid #000;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.tpl-brutalist .preview-item-amt {
  border-right: 0;
}

.tpl-brutalist .template-brutal-bottom {
  display: grid;
  grid-template-columns: 1fr 320px;
  border-top: 2px solid #000;
}

.tpl-brutalist .template-brutal-bottom > div:first-child {
  border-right: 2px solid #000;
  padding: 12px;
}

.tpl-brutalist .template-pay-block,
.tpl-brutalist .template-notes {
  border-top: 0;
  padding-top: 0;
}

.tpl-brutalist .template-pay-block:not(.hidden) + .template-notes {
  margin-top: 8px;
}

.tpl-brutalist .template-totals-box {
  border: 0;
  padding: 0;
}

.tpl-brutalist .template-total-row {
  border-bottom: 2px solid #000;
  padding: 12px;
}

.tpl-brutalist .template-total-final {
  margin-top: 0;
  border-top: 0;
  background: #000;
  color: #fff;
  padding: 14px 12px;
}

.template-item-midnight .preview-item-desc,
.template-item-midnight .preview-item-qty,
.template-item-midnight .preview-item-rate,
.template-item-midnight .preview-item-amt {
  color: #fff !important;
}

.template-item-midnight.preview-item-row {
  border-bottom-color: #2a2a2c;
}

.template-item-vintage .preview-item-desc {
  font-family: "Playfair Display", Georgia, serif;
}

.template-item-vintage.preview-item-row {
  border-bottom-color: #d0c6b8;
}

.template-item-saas.preview-item-row {
  border-bottom-color: #e2e8f0;
}

.template-item-brutalist.preview-item-row {
  border-bottom-width: 2px;
}

.live-footer {
  flex-shrink: 0;
}

.seo-rail {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #111827;
  line-height: 1.65;
}

.seo-rail-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

.seo-section {
  padding: 72px 0;
  border-bottom: 1px solid #e5e7eb;
}

.seo-section:last-child {
  border-bottom: 0;
}

.seo-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
  margin-bottom: 12px;
}

.seo-rail h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 20px;
  color: #111827;
}

.seo-rail h2 {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 16px;
  color: #111827;
}

.seo-rail p {
  font-size: 1.02rem;
  line-height: 1.7;
  color: #374151;
  margin: 0 0 14px;
  max-width: 640px;
}

.seo-rail p:last-child {
  margin-bottom: 0;
}

.seo-rail a {
  color: #111827;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #d1d5db;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

.seo-rail a:hover {
  text-decoration-color: #111827;
}

.seo-steps {
  list-style: none;
  padding: 0;
  margin: 24px 0 20px;
  counter-reset: step-counter;
  display: grid;
  gap: 0;
}

.seo-steps li {
  counter-increment: step-counter;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 1.02rem;
  line-height: 1.6;
  color: #374151;
}

.seo-steps li:last-child {
  border-bottom: 0;
}

.seo-steps li::before {
  content: counter(step-counter);
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #9ca3af;
  width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.seo-audience-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 24px 0 0;
}

.seo-audience-item {
  padding: 18px 0;
  border-bottom: 1px solid #f3f4f6;
}

.seo-audience-item:nth-child(odd) {
  padding-right: 32px;
  border-right: 1px solid #f3f4f6;
}

.seo-audience-item:nth-child(even) {
  padding-left: 32px;
}

.seo-audience-item:nth-last-child(-n+2) {
  border-bottom: 0;
}

.seo-audience-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.seo-audience-title a {
  text-decoration: none;
}

.seo-audience-title a:hover {
  text-decoration: underline;
  text-decoration-color: #d1d5db;
  text-underline-offset: 3px;
}

.seo-audience-desc {
  font-size: 0.88rem;
  color: #6b7280;
  line-height: 1.5;
}

.seo-template-list {
  margin: 24px 0 0;
  display: grid;
  gap: 0;
}

.seo-template-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
}

.seo-template-item:last-child {
  border-bottom: 0;
}

.seo-template-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.seo-template-name a {
  text-decoration: none;
}

.seo-template-name a:hover {
  text-decoration: underline;
  text-decoration-color: #d1d5db;
  text-underline-offset: 3px;
}

.seo-template-use {
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: right;
  flex-shrink: 0;
}

.seo-privacy-block {
  border-left: 2px solid #e5e7eb;
  padding-left: 24px;
  margin: 8px 0 0;
}

.seo-faq-list {
  margin: 20px 0 0;
}

.seo-faq-list details {
  border-bottom: 1px solid #f3f4f6;
}

.seo-faq-list details:last-child {
  border-bottom: 0;
}

.seo-faq-list summary {
  padding: 16px 0;
  font-size: 1rem;
  font-weight: 650;
  color: #111827;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.45;
}

.seo-faq-list summary::-webkit-details-marker {
  display: none;
}

.seo-faq-list summary::after {
  content: '+';
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 400;
  color: #9ca3af;
  transition: transform 0.2s;
}

.seo-faq-list details[open] summary::after {
  content: '\2212';
}

.seo-faq-list .seo-faq-answer {
  padding: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #4b5563;
  max-width: 640px;
}

.seo-faq-list .seo-faq-answer a {
  color: #111827;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #d1d5db;
  text-underline-offset: 3px;
}

.seo-section-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.9rem;
  font-weight: 650;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.15s;
}

.seo-section-link:hover {
  color: #111827;
  text-decoration: none;
}

.seo-section-link::after {
  content: ' \2192';
}

.seo-cta-block {
  text-align: center;
  padding: 56px 0;
}

.seo-cta-block p {
  margin: 0 auto 20px;
  text-align: center;
  max-width: 480px;
  font-size: 1.05rem;
  color: #6b7280;
}

.seo-cta-link {
  display: inline-block;
  padding: 12px 32px;
  background: #111827;
  color: #fff !important;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none !important;
  transition: background 0.15s;
}

.seo-cta-link:hover {
  background: #000;
}

@media (max-width: 767px) {
  .seo-rail-inner {
    padding: 0 16px;
  }

  .seo-section {
    padding: 48px 0;
  }

  .seo-rail h1 {
    font-size: 1.75rem;
  }

  .seo-rail h2 {
    font-size: 1.2rem;
  }

  .seo-audience-grid {
    grid-template-columns: 1fr;
  }

  .seo-audience-item:nth-child(odd) {
    padding-right: 0;
    border-right: 0;
  }

  .seo-audience-item:nth-child(even) {
    padding-left: 0;
  }

  .seo-template-item {
    flex-direction: column;
    gap: 4px;
  }

  .seo-template-use {
    text-align: left;
  }
}

.seo-page .wrap {
  max-width: 860px;
}

.seo-page .seo-breadcrumb {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 20px;
}

.seo-page .seo-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
}

.seo-page .seo-breadcrumb a:hover {
  color: #111827;
}

.seo-page .seo-breadcrumb .sep {
  margin: 0 6px;
  color: #d1d5db;
}

.seo-page .seo-page-cta {
  display: inline-block;
  margin-top: 28px;
  padding: 12px 28px;
  background: #111827;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}

.seo-page .seo-page-cta:hover {
  background: #000;
}

.seo-page details {
  border-bottom: 1px solid #f3f4f6;
}

.seo-page details:last-of-type {
  border-bottom: 0;
}

.seo-page summary {
  padding: 14px 0;
  font-size: 0.98rem;
  font-weight: 650;
  color: #111827;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.45;
}

.seo-page summary::-webkit-details-marker {
  display: none;
}

.seo-page summary::after {
  content: '+';
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 400;
  color: #9ca3af;
}

.seo-page details[open] summary::after {
  content: '\2212';
}

.seo-page .faq-answer {
  padding: 0 0 16px;
  font-size: 0.93rem;
  line-height: 1.7;
  color: #4b5563;
}

.seo-page .example-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0;
  font-size: 0.93rem;
  line-height: 1.65;
}

.seo-page .example-block strong {
  color: #111827;
}

@media print {
  body > *:not(#pdf-preview) { display: none !important; }
  #pdf-preview { box-shadow: none !important; transform: none !important; }
}
