/* ==========================================================================
   PDF / PRINT
   ========================================================================== */

.generated-plan-modal {
  width: min(1120px, 96vw);
}

.generated-plan-document {
  overflow: auto;
  height: min(76vh, 820px);
  padding: 28px;
  background: #eef4f3;
}

.generated-plan-summary-preview {
  display: block;
  width: 273mm;
  min-width: 273mm;
  height: 186mm;
  margin: 28px 0 0;
  border: 1px solid #dbe5ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(28, 52, 66, 0.12);
}

.generated-plan-document > .print-sheet {
  box-sizing: border-box;
  width: 273mm;
  min-width: 273mm;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.print-sheet {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid #dbe5ec;
  border-radius: 10px;
  padding: clamp(20px, 3vw, 34px);
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(28, 52, 66, 0.12);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-sheet .print-sheet-header {
  border-color: color-mix(in srgb, var(--print-accent, #416f62) 28%, #dbe5ec);
}

.print-sheet .eyebrow,
.print-sheet h2 {
  color: var(--print-accent, #416f62);
}

.print-sheet .diet-plan-table thead th {
  color: #ffffff;
  background: var(--print-accent, #416f62) !important;
}

.print-sheet .diet-plan-table tbody th {
  color: #17342b;
  background: var(--print-secondary, #dbeafe) !important;
}

.print-sheet.checker .diet-plan-table td:nth-child(even),
.print-sheet.stripes .diet-plan-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--print-secondary, #dbeafe) 24%, #ffffff);
}

.print-sheet.playful .diet-plan-table td {
  background: color-mix(in srgb, var(--print-secondary, #dbeafe) 18%, #ffffff) !important;
}

.print-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid #dbe5ec;
  padding-bottom: 18px;
}

.print-sheet-header h2 {
  margin: 4px 0;
}

.print-sheet .mark-logo-frame {
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
}

.print-notes {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.generated-pdf-card .file-thumb {
  background: linear-gradient(135deg, #416f62, #4f6f98);
  color: #ffffff;
}

.plan-pdf-export-page {
  position: relative;
  top: 0;
  left: 0;
  z-index: -1;
  box-sizing: border-box;
  width: 1123px;
  height: 794px;
  overflow: hidden;
  padding: 23px;
  background: #ffffff;
}

.plan-pdf-export-sheet {
  box-sizing: border-box;
  width: 1077px;
  max-width: none;
  margin: 0;
  transform-origin: top left;
  overflow: hidden;
}

.plan-pdf-export-sheet .print-sheet-header {
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.plan-pdf-export-sheet .print-sheet-header h2 {
  margin: 2px 0;
  font-size: 22px;
}

.plan-pdf-export-sheet .mark-logo-frame {
  width: 50px;
  height: 50px;
  overflow: visible;
}

.plan-pdf-export-sheet .mark-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.plan-pdf-export-sheet .print-sheet-header {
  border-color: #b4c9c2 !important;
}

.plan-pdf-export-sheet.checker .diet-plan-table td:nth-child(even),
.plan-pdf-export-sheet.stripes .diet-plan-table tbody tr:nth-child(even),
.plan-pdf-export-sheet.playful .diet-plan-table td {
  background: #f4f8fb !important;
}

.plan-pdf-export-sheet .print-notes {
  margin-bottom: 7px;
  font-size: 9px;
  line-height: 1.25;
}

.plan-pdf-export-sheet .diet-table-wrap {
  overflow: visible;
}

.plan-pdf-export-sheet .diet-plan-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 10px;
}

.plan-pdf-export-sheet .diet-plan-table th,
.plan-pdf-export-sheet .diet-plan-table td {
  padding: 5px;
}

.plan-pdf-export-sheet .diet-plan-table tbody th {
  width: 88px;
}

.plan-pdf-export-sheet .diet-food-chip {
  gap: 2px;
  margin-bottom: 1px;
  padding: 2px 3px;
  font-size: 9px;
  line-height: 1.12;
}

.plan-pdf-export-sheet .diet-empty-cell {
  min-height: 12px;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }

  html,
  body {
    width: 285mm !important;
    height: 198mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  body > *:not(#app):not(.plan-print-page) {
    display: none !important;
  }

  .plan-print-page,
  #app,
  #app > * {
    display: block !important;
    min-height: 0 !important;
    background: #ffffff !important;
  }

  .plan-print-page {
    box-sizing: border-box !important;
    width: 285mm !important;
    height: 198mm !important;
    overflow: hidden !important;
    padding: 0 !important;
  }

  .app-shell,
  .modal-backdrop,
  .generated-plan-modal,
  .generated-plan-document {
    position: static !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .topbar,
  .workspace,
  .sidebar-card,
  .client-sidebar,
  .admin-sidebar,
  .viewer-tools,
  .no-print,
  .app-shell > *:not(.modal-backdrop),
  .file-modal header,
  .generated-plan-backdrop > *:not(.generated-plan-modal) {
    display: none !important;
  }

  .print-sheet {
    box-sizing: border-box !important;
    width: 285mm !important;
    max-width: none;
    margin: 0 !important;
    border: 0;
    box-shadow: none;
    padding: 0 !important;
    overflow: hidden !important;
    page-break-before: avoid;
    page-break-after: avoid;
    break-inside: avoid;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .diet-table-wrap {
    overflow: visible !important;
  }

  .diet-plan-table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
    font-size: 9px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .diet-plan-table th,
  .diet-plan-table td {
    padding: 4px;
  }

  .diet-plan-table tbody th {
    width: 22mm;
  }

  .print-sheet-header {
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .print-sheet-header h2 {
    margin: 1px 0;
    font-size: 16px;
  }

  .print-sheet-header p,
  .print-sheet .eyebrow {
    margin: 0;
    font-size: 8px;
  }

  .print-sheet .mark-logo-frame {
    width: 10mm;
    height: 10mm;
    overflow: visible;
  }

  .print-sheet .mark-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .print-notes {
    margin: 0 0 5px;
    font-size: 8px;
    line-height: 1.2;
  }

  .diet-food-chip {
    gap: 2px;
    margin-bottom: 1px;
    padding: 2px 3px;
    font-size: 7px;
    line-height: 1.1;
    break-inside: avoid;
  }

  .diet-empty-cell {
    min-height: 10px;
  }
}

