/* ==========================================================================
   SwiftBillPDF — Executive Navy & Warm Amber Gold Stylesheet
   Zero External Dependencies | Responsive Layout | Crisp A4/Letter Print PDF
   ========================================================================== */

:root {
  /* Brand Palette */
  --navy-950: #0f172a;
  --navy-900: #1e293b;
  --navy-800: #334155;
  --navy-700: #475569;
  --navy-600: #64748b;
  --navy-400: #94a3b8;

  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --amber-50: #fffbeb;

  --paper-bg: #fafaf9;
  --paper-subtle: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --success-bg: #ecfdf5;
  --success-text: #047857;
  --danger-bg: #fef2f2;
  --danger-text: #dc2626;

  /* Dynamic Invoice Sheet Accent (overridden by JS color picker) */
  --invoice-accent: #1e293b;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-sheet: 0 12px 32px rgba(15, 23, 42, 0.09), 0 2px 6px rgba(15, 23, 42, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--navy-900);
  background-color: var(--paper-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy-900);
  text-decoration-color: var(--amber-600);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--amber-700);
}

img,
svg {
  vertical-align: middle;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   SwiftKitHub Global Top Bar / Breadcrumb & Related Tools Mesh
   ========================================================================== */
.skh-topbar {
  background: var(--navy-950);
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.81rem;
  line-height: 1.4;
}

.skh-topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 38px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.skh-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
}

.skh-breadcrumb a {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.skh-breadcrumb a:hover {
  color: var(--amber-500);
}

.skh-breadcrumb span {
  color: #ffffff;
  font-weight: 600;
}

.skh-all-tools {
  color: var(--amber-500);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.skh-all-tools:hover {
  color: #fbbf24;
}

/* Related Calculators & Specialized Templates Section */
.related-section {
  padding: 44px 0 56px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--paper-bg) 0%, var(--paper-subtle) 100%);
}

.related-group-label {
  margin: 24px 0 12px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-600);
}

.related-group-label:first-of-type {
  margin-top: 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.related-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--amber-600);
}

.related-card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-50);
  color: var(--amber-700);
  border: 1px solid var(--amber-100);
  margin-bottom: 8px;
}

.related-card-tag.is-suite {
  background: var(--paper-subtle);
  color: var(--navy-700);
  border-color: var(--border-strong);
}

.related-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--navy-950);
}

.related-card p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--navy-700);
}

/* ==========================================================================
   Sticky Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 249, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  color: var(--navy-900);
}

.brand-logo:hover {
  color: var(--navy-900);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--navy-900);
  color: var(--amber-500);
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.2);
}

.brand-accent {
  color: var(--amber-600);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.main-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy-800);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.main-nav a:hover {
  background-color: var(--paper-subtle);
  color: var(--navy-950);
}

.main-nav .nav-cta {
  background-color: var(--navy-900);
  color: #ffffff;
  margin-left: 4px;
}

.main-nav .nav-cta:hover {
  background-color: var(--amber-600);
  color: #ffffff;
}

/* ==========================================================================
   AdSense Slots (Hidden by default when unconfigured)
   ========================================================================== */
.ad-slot {
  display: none;
  margin: 16px auto;
  max-width: 1240px;
  text-align: center;
}

.ad-slot.is-active {
  display: block;
}

.ad-slot.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--paper-subtle);
  color: var(--navy-600);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ==========================================================================
   Compact Hero Section (Above the Fold)
   ========================================================================== */
.hero-section {
  padding: 28px 0 18px;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.hero-copy {
  max-width: 760px;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-100);
  color: var(--amber-700);
  margin-bottom: 10px;
}

.hero-copy h1 {
  margin: 0 0 8px;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--navy-950);
}

.hero-copy p {
  margin: 0;
  font-size: 1rem;
  color: var(--navy-700);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-800);
  box-shadow: var(--shadow-sm);
}

.feature-chip svg {
  color: var(--amber-600);
  flex-shrink: 0;
}

/* ==========================================================================
   Action Toolbar
   ========================================================================== */
.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: var(--navy-900);
  color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: #cbd5e1;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--amber-600);
  color: #ffffff;
  border-color: var(--amber-600);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
}

.btn-primary:hover {
  background: var(--amber-700);
  border-color: var(--amber-700);
  color: #ffffff;
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--navy-900);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--paper-subtle);
  border-color: var(--navy-600);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

/* ==========================================================================
   Split Workspace: Editor (Left) + Live Invoice Sheet (Right)
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}

/* Editor Column */
.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.editor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--paper-subtle);
}

.editor-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-card-title svg {
  color: var(--amber-600);
}

/* Document Type Segmented Control */
.doc-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--paper-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.doc-type-btn {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-type-btn.is-active {
  background: var(--navy-900);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Logo & Color Row */
.branding-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.logo-upload-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.logo-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  background: var(--paper-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--navy-800);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.logo-upload-label:hover {
  border-color: var(--amber-600);
  background: var(--amber-50);
}

.color-picker-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease;
}

.color-swatch:hover,
.color-swatch.is-selected {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--amber-600);
}

.color-input-native {
  width: 30px;
  height: 28px;
  padding: 1px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
}

/* Form Fields */
.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--navy-700);
}

.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--navy-950);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--amber-600);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 66px;
}

/* Line Items Editor */
.line-items-header {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 78px 102px 96px 32px;
  gap: 8px;
  padding: 0 2px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy-600);
}

.line-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 78px 102px 96px 32px;
  gap: 8px;
  align-items: center;
  background: var(--paper-bg);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.line-item-row input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.line-item-amount {
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--navy-900);
  padding-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-remove-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--navy-600);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove-item:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #fecaca;
}

/* Totals Adjustment Controls */
.adjustments-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.input-with-addon {
  display: flex;
  align-items: stretch;
}

.input-with-addon .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.addon-select {
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-left: none;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: var(--paper-subtle);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--navy-800);
  cursor: pointer;
}

/* Quick Preset Chips for Payment Details */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.preset-chip {
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--paper-bg);
  color: var(--navy-800);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--amber-600);
  background: var(--amber-50);
  color: var(--amber-700);
}

/* ==========================================================================
   Right Column: Live Print-Ready Invoice Sheet Preview
   ========================================================================== */
.preview-column {
  position: sticky;
  top: 82px;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--navy-600);
  font-weight: 600;
}

.invoice-sheet {
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: 6px solid var(--invoice-accent);
  border-radius: 4px;
  box-shadow: var(--shadow-sheet);
  padding: 40px 42px;
  color: var(--navy-950);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Invoice Header */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.sheet-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 55%;
}

.sheet-logo {
  max-height: 58px;
  max-width: 190px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

.sheet-sender-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy-950);
  letter-spacing: -0.01em;
}

.sheet-doc-meta {
  text-align: right;
}

.sheet-doc-type {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--invoice-accent);
  line-height: 1.1;
}

.sheet-meta-table {
  margin-left: auto;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.sheet-meta-table td {
  padding: 2px 0 2px 14px;
}

.sheet-meta-table td:first-child {
  color: var(--navy-600);
  font-weight: 600;
  padding-left: 0;
}

.sheet-meta-table td:last-child {
  font-weight: 700;
  color: var(--navy-950);
  font-variant-numeric: tabular-nums;
}

/* Parties (From & Bill To) */
.sheet-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-bottom: 28px;
}

.party-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--invoice-accent);
  margin-bottom: 6px;
}

.party-primary {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--navy-950);
  margin-bottom: 2px;
}

.party-details {
  font-size: 0.84rem;
  color: var(--navy-700);
  white-space: pre-line;
  word-break: break-word;
}

/* Sheet Line Items Table */
.sheet-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.sheet-items-table thead th {
  background: var(--invoice-accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  text-align: left;
}

.sheet-items-table thead th.num-col,
.sheet-items-table tbody td.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sheet-items-table thead th:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.sheet-items-table thead th:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.sheet-items-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.86rem;
  color: var(--navy-900);
  vertical-align: top;
}

.sheet-items-table tbody td.desc-col {
  font-weight: 500;
  word-break: break-word;
}

.sheet-items-table tbody td.amount-col {
  font-weight: 700;
}

/* Sheet Totals Summary */
.sheet-summary-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
}

.sheet-totals {
  width: 100%;
  max-width: 290px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.86rem;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

.totals-row.is-total {
  border-top: 1px solid #cbd5e1;
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--navy-950);
}

.totals-row.is-balance {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--paper-subtle);
  border-left: 4px solid var(--invoice-accent);
  border-radius: 4px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--navy-950);
}

/* Sheet Footer Notes & Payment Instructions */
.sheet-footer-blocks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.82rem;
}

.sheet-block-title {
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-800);
  margin-bottom: 4px;
}

.sheet-block-body {
  color: var(--navy-700);
  white-space: pre-line;
  word-break: break-word;
}

/* ==========================================================================
   Contextual Affiliate Partner Cards (#recommended-tools)
   ========================================================================== */
.partner-section {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, var(--paper-bg) 100%);
}

.section-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.section-header-row h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--navy-950);
  letter-spacing: -0.02em;
}

.ftc-inline-note {
  font-size: 0.78rem;
  color: var(--navy-600);
  background: var(--paper-subtle);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.affiliate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.affiliate-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.affiliate-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--amber-500);
}

.affiliate-badge {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--amber-50);
  color: var(--amber-700);
  border: 1px solid var(--amber-100);
  margin-bottom: 12px;
}

.affiliate-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--navy-950);
}

.affiliate-card p {
  margin: 0 0 18px;
  font-size: 0.91rem;
  color: var(--navy-700);
  line-height: 1.55;
}

.affiliate-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.affiliate-cta:hover {
  background: var(--amber-600);
  color: #ffffff;
}

/* ==========================================================================
   SEO Guide & Benchmark Content Section (#guide)
   ========================================================================== */
.guide-section {
  padding: 52px 0 40px;
}

.prose-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  box-shadow: var(--shadow-sm);
}

.prose-card h2 {
  margin: 0 0 16px;
  font-size: 1.65rem;
  color: var(--navy-950);
  letter-spacing: -0.02em;
  line-height: 1.28;
}

.prose-card h3 {
  margin: 30px 0 12px;
  font-size: 1.2rem;
  color: var(--navy-900);
}

.prose-card p {
  margin: 0 0 16px;
  color: var(--navy-800);
}

.prose-card ul,
.prose-card ol {
  margin: 0 0 20px;
  padding-left: 22px;
  color: var(--navy-800);
}

.prose-card li {
  margin-bottom: 8px;
}

.formula-callout {
  background: var(--paper-bg);
  border-left: 4px solid var(--amber-600);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--navy-900);
}

.table-responsive {
  overflow-x: auto;
  margin: 20px 0 24px;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.benchmark-table th,
.benchmark-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.benchmark-table th {
  background: var(--navy-900);
  color: #ffffff;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.benchmark-table tr:nth-child(even) td {
  background: var(--paper-bg);
}

/* ==========================================================================
   Interactive FAQ Accordion (#faq)
   ========================================================================== */
.faq-section {
  padding: 20px 0 60px;
}

.section-heading-center {
  text-align: center;
  margin-bottom: 28px;
}

.section-heading-center h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  color: var(--navy-950);
}

.section-heading-center p {
  margin: 0;
  color: var(--navy-600);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-950);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.faq-question:hover {
  background: var(--paper-bg);
}

.faq-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--amber-600);
  transition: transform 0.2s ease;
}

.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 22px 18px;
  color: var(--navy-700);
  font-size: 0.94rem;
  line-height: 1.65;
}

.faq-item.is-open .faq-answer {
  display: block;
}

/* ==========================================================================
   Legal / Static Subpages
   ========================================================================== */
.subpage-main {
  padding: 44px 0 68px;
}

.contact-card-box {
  background: var(--paper-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 22px;
  margin: 20px 0 26px;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
  background: var(--navy-950);
  color: #cbd5e1;
  padding: 44px 0 32px;
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand-name {
  font-size: 1.12rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.footer-disclaimer {
  color: #94a3b8;
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 10px 0 0;
}

.footer-col h4 {
  margin: 0 0 12px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--amber-500);
}

.footer-bottom {
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: #94a3b8;
  font-size: 0.8rem;
}

/* Toast Notification */
.toast-banner {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  background: var(--navy-900);
  color: #ffffff;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--amber-500);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1080px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .preview-column {
    position: static;
  }

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

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 0;
  }

  .field-grid-2,
  .field-grid-3,
  .adjustments-grid,
  .branding-row,
  .sheet-parties,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .line-items-header {
    display: none;
  }

  .line-item-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .line-item-row .item-desc-wrap {
    grid-column: 1 / -1;
  }

  .line-item-row .line-item-amount {
    text-align: left;
    padding-left: 4px;
  }

  .line-item-row .btn-remove-item {
    justify-self: end;
  }

  .invoice-sheet {
    padding: 24px 18px;
  }

  .sheet-header {
    flex-direction: column;
  }

  .sheet-brand {
    max-width: 100%;
  }

  .sheet-doc-meta {
    text-align: left;
  }

  .sheet-meta-table td {
    padding-left: 0;
    padding-right: 14px;
  }

  .prose-card {
    padding: 24px 20px;
  }
}

/* ==========================================================================
   Print / Save-as-PDF Stylesheet (ONLY Crisp A4 / Letter Invoice Prints!)
   ========================================================================== */
@media print {
  @page {
    size: auto;
    margin: 12mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10pt !important;
  }

  .skh-topbar,
  .site-header,
  .hero-section,
  .workspace-toolbar,
  .editor-panel,
  .preview-bar,
  .ad-slot,
  .partner-section,
  .guide-section,
  .faq-section,
  .related-section,
  .site-footer,
  .toast-banner,
  .no-print {
    display: none !important;
  }

  .container,
  main,
  .workspace-grid,
  .preview-column {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
  }

  .invoice-sheet {
    border: none !important;
    border-top: 5px solid var(--invoice-accent) !important;
    box-shadow: none !important;
    padding: 8mm 2mm 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .sheet-parties {
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
  }

  .sheet-header {
    flex-direction: row !important;
  }

  .sheet-doc-meta {
    text-align: right !important;
  }

  .sheet-items-table tr,
  .sheet-summary-wrap,
  .sheet-footer-blocks {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
