/* ═══════════════════════════════════════════════════════════
   FACTUREMA — MAIN STYLESHEET
   Moroccan Facture & Devis Generator
═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
  /* Moroccan palette */
  --brand-primary: #006B5E;
  --brand-primary-light: #00A896;
  --brand-primary-glow: rgba(0, 168, 150, 0.15);
  --brand-gold: #D4A017;
  --brand-gold-light: #F5C842;

  /* Light theme (default) */
  --bg-base: #F0F4F8;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F7F9FB;
  --bg-surface-hover: #EEF2F7;
  --border-color: #DDE3EC;
  --border-focus: var(--brand-primary);

  --text-primary: #1A2332;
  --text-secondary: #5A6882;
  --text-muted: #8B97AE;
  --text-on-brand: #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --topbar-h: 60px;
  --form-panel-w: 480px;

  /* Status */
  --clr-success: #10B981;
  --clr-warning: #F59E0B;
  --clr-danger: #EF4444;
  --clr-info: #3B82F6;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-base: #0F1623;
  --bg-surface: #19253A;
  --bg-surface-2: #1F2F48;
  --bg-surface-hover: #243554;
  --border-color: #2A3A55;
  --text-primary: #E8EDFB;
  --text-secondary: #8FA3C4;
  --text-muted: #5A7099;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── RESET & BASE ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--brand-primary-light);
  text-decoration: none;
}

/* ── TOP BAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar__logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
}

.topbar__brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-primary);
  letter-spacing: -0.3px;
}

.topbar__badge {
  font-size: 1.1rem;
}

.topbar__tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-left: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 107, 94, 0.3);
}

.tab-btn:hover:not(.active) {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 107, 94, 0.35);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(0, 107, 94, 0.45);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--brand-primary);
  color: var(--brand-primary);
}

.btn--outline:hover {
  background: var(--brand-primary);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

.btn--ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn--dashed {
  background: transparent;
  border: 1.5px dashed var(--border-color);
  color: var(--text-secondary);
  justify-content: center;
  width: 100%;
}

.btn--dashed:hover {
  border-color: var(--brand-primary-light);
  color: var(--brand-primary-light);
  background: var(--brand-primary-glow);
}

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

.btn--full {
  width: 100%;
  justify-content: center;
}

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ── FORM PANEL ──────────────────────────────────────────── */
.form-panel {
  width: var(--form-panel-w);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-base);
  border-right: 1px solid var(--border-color);
}

.form-panel::-webkit-scrollbar {
  width: 5px;
}

.form-panel::-webkit-scrollbar-track {
  background: transparent;
}

.form-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* ── CARDS (collapsible sections) ────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: visible;
  /* Don't clip card body content */
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  min-height: 52px;
  /* prevents ultra-thin collapsed appearance */
}

.card__header:hover {
  background: var(--bg-surface-hover);
}

.card__icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.card__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card__chevron {
  color: var(--text-muted);
  transition: transform 0.25s;
  flex-shrink: 0;
}

.card.collapsed .card__chevron {
  transform: rotate(-90deg);
}

.card.collapsed .card__body {
  display: none;
}

.card__body {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
}

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  /* allow wrapping if panel is too narrow */
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 100px;
  /* prevent groups from collapsing too small */
}

.form-group--full {
  flex: 1 0 100%;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.required {
  color: var(--clr-danger);
}

.form-input {
  padding: 8px 11px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  min-width: 0;
  /* allows flex children to shrink properly */
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Hide browser number spinners */
.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input[type="number"] {
  -moz-appearance: textfield;
}

.form-input--sm {
  width: 80px;
  padding: 5px 8px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6882' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

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

.form-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ── BUSINESS TYPE SELECTOR ──────────────────────────────── */
.biz-type-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.biz-type-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.biz-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.biz-pill:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-glow);
}

#biz-avec-tva.active {
  background: #006B5E;
  border-color: #006B5E;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 107, 94, .3);
}

#biz-sans-tva.active {
  background: #D97706;
  border-color: #D97706;
  color: #fff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, .3);
}

#biz-auto.active {
  background: #7C3AED;
  border-color: #7C3AED;
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, .3);
}

/* Legal banners */
.biz-banner {
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.biz-banner--warning {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}

.biz-banner--info {
  background: #EDE9FE;
  color: #5B21B6;
  border-color: #DDD6FE;
}

[data-theme="dark"] .biz-banner {
  background: #14532D;
  color: #86EFAC;
  border-color: #166534;
}

[data-theme="dark"] .biz-banner--warning {
  background: #78350F;
  color: #FCD34D;
  border-color: #92400E;
}

[data-theme="dark"] .biz-banner--info {
  background: #4C1D95;
  color: #C4B5FD;
  border-color: #5B21B6;
}

/* Badge shown in PDF preview header */
.pdf-biz-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pdf-biz-badge--tva {
  background: #DCFCE7;
  color: #166534;
}

.pdf-biz-badge--no-tva {
  background: #FEF3C7;
  color: #92400E;
}

.pdf-biz-badge--ae {
  background: #EDE9FE;
  color: #5B21B6;
}

/* ── LOGO UPLOAD ─────────────────────────────────────────── */
.logo-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}

.logo-upload:hover {
  border-color: var(--brand-primary-light);
  background: var(--brand-primary-glow);
}

#logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

#logo-preview {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
}

/* ── PRODUCTS TABLE ──────────────────────────────────────── */
.products-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}

.products-table th {
  background: var(--bg-surface-2);
  padding: 8px 6px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.products-table td {
  padding: 4px 3px;
  border-top: 1px solid var(--border-color);
  vertical-align: middle;
}

/* Compact inputs inside the table */
.products-table .form-input {
  padding: 6px 6px;
  font-size: 0.8rem;
  border-radius: 5px;
  width: 100%;
}

/* TVA select inside table — compact arrow */
.products-table .form-select {
  padding: 6px 22px 6px 6px;
  background-position: right 4px center;
  font-size: 0.8rem;
}

/* Column widths — use min-width so small values still read clearly */
.col-desc {
  width: 34%;
}

.col-qty {
  width: 9%;
  min-width: 46px;
  text-align: center;
}

.col-unit {
  width: 10%;
  min-width: 46px;
}

.col-pu {
  width: 15%;
  min-width: 60px;
}

.col-tva {
  width: 13%;
  min-width: 52px;
}

.col-total {
  width: 14%;
  min-width: 66px;
  text-align: right;
  font-weight: 600;
  color: var(--brand-primary);
  white-space: nowrap;
  padding-right: 6px;
}

.col-del {
  width: 5%;
  min-width: 28px;
  text-align: center;
}

/* Center-align number columns */
.col-qty input,
.col-pu input {
  text-align: right;
}

.btn-del-row {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0 auto;
}

.btn-del-row:hover {
  color: var(--clr-danger);
  background: #FEE2E2;
}

/* ── TOTALS BLOCK ────────────────────────────────────────── */
.totals-block {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  gap: 12px;
}

.totals-row:first-child {
  border-top: none;
}

.totals-row span:last-child {
  font-weight: 600;
}

.totals-row--grand {
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

.totals-row--net {
  background: var(--brand-gold);
  color: #1a1a0a;
  font-weight: 700;
}

.tva-breakdown {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

.tva-breakdown .tva-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 14px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.remise-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── PREVIEW PANEL ───────────────────────────────────────── */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #C8CDD4;
  overflow: hidden;
}

[data-theme="dark"] .preview-panel {
  background: #0A101C;
}

.preview-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.preview-controls {
  display: flex;
  gap: 8px;
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

.preview-scroll::-webkit-scrollbar {
  width: 6px;
}

.preview-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.preview-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

/* ═══════════════════════════════════════════
   PDF PAGE (the rendered document)
═══════════════════════════════════════════ */
.pdf-page {
  width: 794px;
  /* A4 at 96dpi */
  min-height: 1123px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  padding: 52px 52px 60px;
  color: #1A2332;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  flex-shrink: 0;
  position: relative;
}

/* PDF header */
.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 24px;
}

.pdf-logo {
  max-height: 72px;
  max-width: 200px;
  object-fit: contain;
}

.pdf-logo-placeholder {
  width: 80px;
  height: 80px;
  background: #f0f4f8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #AAB5C9;
  font-size: 10px;
  text-align: center;
}

.pdf-doc-badge {
  text-align: right;
}

.pdf-doc-type {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.pdf-doc-type--devis {
  color: #006B5E;
}

.pdf-doc-type--facture {
  color: #1D4ED8;
}

.pdf-doc-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #5A6882;
}

.pdf-doc-meta strong {
  color: #1A2332;
}

/* Seller & client row */
.pdf-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.pdf-party-box {
  padding: 14px 16px;
  border-radius: 8px;
  background: #F7F9FB;
  border: 1px solid #DDE3EC;
}

.pdf-party-box--client {
  background: #EFF6FF;
  border-color: #BFDBFE;
}

.pdf-party-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #8B97AE;
  margin-bottom: 6px;
}

.pdf-party-name {
  font-size: 14px;
  font-weight: 700;
  color: #1A2332;
  margin-bottom: 4px;
}

.pdf-party-detail {
  font-size: 11.5px;
  color: #5A6882;
  line-height: 1.6;
}

.pdf-party-fiscal {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #DDE3EC;
  font-size: 10.5px;
  color: #8B97AE;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.pdf-party-fiscal span {
  white-space: nowrap;
}

.pdf-party-fiscal strong {
  color: #5A6882;
}

/* Divider */
.pdf-divider {
  height: 3px;
  background: linear-gradient(90deg, #006B5E, #00A896, transparent);
  border-radius: 2px;
  margin-bottom: 20px;
}

/* Items table */
.pdf-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 12px;
}

.pdf-items-table thead tr {
  background: #006B5E;
  color: #fff;
}

.pdf-items-table th {
  padding: 9px 10px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pdf-items-table th:last-child,
.pdf-items-table td:last-child {
  text-align: right;
}

.pdf-items-table th:nth-child(2),
.pdf-items-table td:nth-child(2),
.pdf-items-table th:nth-child(3),
.pdf-items-table td:nth-child(3),
.pdf-items-table th:nth-child(4),
.pdf-items-table td:nth-child(4),
.pdf-items-table th:nth-child(5),
.pdf-items-table td:nth-child(5) {
  text-align: center;
}

.pdf-items-table tbody tr:nth-child(odd) {
  background: #fff;
}

.pdf-items-table tbody tr:nth-child(even) {
  background: #F7F9FB;
}

.pdf-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #EEF2F7;
  color: #2D3748;
}

.pdf-items-table tfoot tr {
  background: #F0F4F8;
}

/* Totals */
.pdf-totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
}

.pdf-totals {
  width: 280px;
}

.pdf-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 14px;
  font-size: 12px;
  border-bottom: 1px solid #EEF2F7;
}

.pdf-totals-row span:last-child {
  font-weight: 600;
}

.pdf-totals-row--grand {
  background: #006B5E;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 0 0 6px 6px;
  padding: 10px 14px;
}

.pdf-totals-row--net {
  background: #D4A017;
  color: #fff;
  font-weight: 700;
  border-radius: 0 0 6px 6px;
  padding: 10px 14px;
}

/* Payment & notes */
.pdf-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  font-size: 12px;
}

.pdf-footer-box {
  padding: 12px 14px;
  background: #F7F9FB;
  border-radius: 8px;
  border: 1px solid #DDE3EC;
}

.pdf-footer-box-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8B97AE;
  margin-bottom: 6px;
}

.pdf-footer-box p {
  color: #5A6882;
  line-height: 1.6;
}

/* Signature zone */
.pdf-signature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
  font-size: 11px;
  color: #8B97AE;
}

.pdf-sig-box {
  border-top: 1.5px solid #DDE3EC;
  padding-top: 8px;
}

/* Bottom strip */
.pdf-bottom-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #006B5E, #00A896, #D4A017);
  border-radius: 0 0 4px 4px;
}

/* ── PRINT STYLES ────────────────────────────────────────── */
@media print {

  .topbar,
  .form-panel,
  .preview-panel__header,
  .preview-controls {
    display: none !important;
  }

  .app-layout {
    margin-top: 0;
    height: auto;
  }

  .preview-panel {
    background: #fff;
  }

  .preview-scroll {
    padding: 0;
  }

  .pdf-page {
    box-shadow: none;
    border-radius: 0;
    width: 100%;
  }
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --form-panel-w: 100%;
  }

  .app-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .form-panel {
    width: 100%;
    height: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .preview-panel {
    height: 600px;
  }

  .topbar__tabs {
    margin-left: 0;
  }

  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    gap: 10px;
  }

  .topbar__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.25s ease both;
}

.card:nth-child(2) {
  animation-delay: 0.05s;
}

.card:nth-child(3) {
  animation-delay: 0.10s;
}

.card:nth-child(4) {
  animation-delay: 0.15s;
}

.card:nth-child(5) {
  animation-delay: 0.20s;
}

/* ── TOAST NOTIFICATION ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1A2332;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s ease;
}

.toast--success {
  background: var(--clr-success);
}

.toast--error {
  background: var(--clr-danger);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}