.compact-planner-schedule,
.planner-print-report {
  display: none;
}

/* Let day columns absorb extra table width so the frozen columns stay exactly 88 / 300px. */
.detailed-planner-schedule .planner-table {
  min-width: 1624px;
}

.detailed-planner-schedule .schedule-day-col {
  width: auto;
}

.detailed-planner-schedule .planner-table tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.detailed-planner-schedule .planner-table thead tr > :nth-child(2),
.detailed-planner-schedule .planner-table tbody tr:not(.usage-total-row) > :nth-child(2) {
  position: sticky;
  left: 88px;
  z-index: 2;
  box-shadow: 2px 0 0 var(--line-dark), 7px 0 10px -8px #111;
}

.detailed-planner-schedule .planner-table tbody tr:not(.usage-total-row) > :nth-child(2) {
  background: var(--paper);
}

.detailed-planner-schedule .planner-table thead tr > :nth-child(-n + 2) {
  z-index: 3;
}

.compact-schedule-heading,
.compact-promotion-heading,
.compact-promotion-status,
.compact-promotion-actions,
.compact-occasion-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-schedule-heading h2,
.compact-occasions > h2 {
  margin: 0;
  font-size: 18px;
}

.compact-schedule-heading > span,
.compact-schedule-hint,
.compact-promotion-heading p,
.compact-occasion-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.compact-schedule-heading > span {
  white-space: nowrap;
}

.compact-schedule-hint {
  margin: 6px 0 12px;
}

.compact-promotion-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 12px;
  align-items: start;
}

.compact-promotion-card,
.compact-occasion-card,
.compact-week-totals {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.compact-promotion-heading {
  justify-content: flex-start;
  align-items: flex-start;
}

.compact-promotion-heading > div {
  min-width: 0;
}

.compact-priority {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 5px;
  background: #303d36;
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.compact-promotion-heading h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.35;
}

.compact-promotion-heading p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.compact-promotion-status {
  margin: 12px 0;
}

.compact-promotion-status label,
.compact-production-fields label,
.compact-occasion-heading label,
.compact-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.compact-promotion-status label > span,
.compact-production-fields label > span,
.compact-occasion-heading label > span,
.compact-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.compact-promotion-status .status-select {
  width: 134px;
  min-height: 40px;
  border-radius: 5px;
  padding: 6px 8px;
}

.compact-planner-schedule .mini-action {
  min-height: 40px;
  padding: 8px 10px;
}

.compact-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.compact-weekday-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 12px;
}

.compact-day {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 68px;
  padding: 7px 1px;
  border: 1px solid #cbd4cd;
  border-radius: 6px;
  background: #f1f4f1;
  color: #525d55;
  cursor: pointer;
}

.compact-day > span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.compact-day > small {
  font-size: 10px;
}

.compact-day > strong {
  font-size: 12px;
}

.compact-day-air {
  border-color: #abc995;
  background: #e4f5db;
  color: #28511a;
}

.compact-day-hold {
  border-color: #e4c174;
  background: #fff0c9;
  color: #73500a;
}

.compact-day:disabled {
  opacity: 1;
}

.compact-delivery-heading {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.compact-delivery-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.compact-delivery-totals > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px;
}

.compact-delivery-totals dt {
  color: var(--muted);
  font-size: 10px;
}

.compact-delivery-totals dd {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.compact-production-fields,
.compact-occasion-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.compact-production-fields input,
.compact-production-fields select,
.compact-occasion-heading input,
.compact-field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
}

.compact-promotion-actions {
  margin-top: 12px;
}

.compact-week-totals {
  margin: 12px 0 18px;
  background: #f6faf3;
}

.compact-week-totals h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.compact-week-totals .compact-schedule-hint {
  margin-bottom: 0;
}

.compact-occasions {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-occasion-heading {
  margin-top: 0;
}

.compact-field + .compact-field {
  margin-top: 10px;
}

.compact-occasion-footer {
  margin-top: 10px;
  flex-wrap: wrap;
}

.compact-schedule-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 14px;
}

@media screen and (max-width: 900px) {
  .compact-planner-schedule {
    display: block;
  }

  .detailed-planner-schedule,
  .detailed-planner-occasions {
    display: none;
  }
}

@media screen and (max-width: 600px) {
  .detailed-planner-schedule .planner-table {
    min-width: 1468px;
  }

  .detailed-planner-schedule .schedule-priority-col {
    width: 52px;
  }

  .detailed-planner-schedule .schedule-promotion-col {
    width: 180px;
  }

  .detailed-planner-schedule .planner-table thead tr > :nth-child(2),
  .detailed-planner-schedule .planner-table tbody tr:not(.usage-total-row) > :nth-child(2) {
    left: 52px;
  }
}

@media screen {
  .app-shell[data-schedule-view="compact"] .compact-planner-schedule {
    display: block;
  }

  .app-shell[data-schedule-view="compact"] .detailed-planner-schedule,
  .app-shell[data-schedule-view="compact"] .detailed-planner-occasions,
  .app-shell[data-schedule-view="detailed"] .compact-planner-schedule {
    display: none;
  }

  .app-shell[data-schedule-view="detailed"] .detailed-planner-schedule,
  .app-shell[data-schedule-view="detailed"] .detailed-planner-occasions {
    display: block;
  }
}

@page {
  size: landscape;
  margin: 0.4in;
}

@media print {
  html,
  body,
  body.dialog-open {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    overflow: visible !important;
    background: white !important;
  }

  .app-shell {
    width: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    background: white;
  }

  .app-shell > :not(.planner-print-report),
  .app-version-badge {
    display: none !important;
  }

  .app-shell > .planner-print-report {
    display: block !important;
    overflow: visible;
    color: #111;
    font: 8pt/1.3 Arial, sans-serif;
  }

  .planner-print-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #222;
  }

  .planner-print-header > div:last-child {
    text-align: right;
  }

  .planner-print-header h1 {
    margin: 3px 0;
    font-size: 17pt;
  }

  .planner-print-header p,
  .planner-print-section p {
    margin: 3px 0;
  }

  .planner-print-report h2 {
    margin: 12px 0 5px;
    break-after: avoid;
    page-break-after: avoid;
    font-size: 10pt;
  }

  .planner-print-report table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    break-inside: auto;
    page-break-inside: auto;
    font-size: 7.5pt;
  }

  .planner-print-promotions .print-priority-col,
  .planner-print-promotions .print-day-col {
    width: 5%;
  }

  .planner-print-promotions .print-promotion-col {
    width: 22%;
  }

  .planner-print-promotions .print-status-col {
    width: 8%;
  }

  .planner-print-promotions .print-total-col {
    width: 4%;
  }

  .planner-print-promotions .print-production-col {
    width: 12%;
  }

  .planner-print-promotions .print-cut-col {
    width: 6%;
  }

  .planner-print-report thead {
    display: table-header-group;
  }

  .planner-print-report tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .planner-print-report th,
  .planner-print-report td {
    height: auto;
    padding: 5px 4px;
    border: 0.5pt solid #a0a0a0;
    vertical-align: top;
    overflow: visible;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: left;
  }

  .planner-print-report th {
    background: #eee;
    color: #111;
    font-size: 7pt;
    font-weight: bold;
  }

  .planner-print-report small {
    display: block;
    margin-top: 3px;
    font-size: 7pt;
  }

  .planner-print-report .planner-print-total th,
  .planner-print-report .planner-print-total td {
    border-top: 1.5pt solid #222;
    font-weight: bold;
  }

  .planner-print-report .planner-print-copy {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .planner-print-caption {
    margin: 5px 0 !important;
    font-size: 7pt;
  }

  .planner-print-save-note {
    margin: 0 0 10px;
    padding: 6px 8px;
    border: 1pt solid #555;
    font-weight: bold;
  }

  .planner-print-upcoming {
    break-before: page;
    page-break-before: always;
  }

  .planner-print-upcoming > h2 {
    margin-top: 0;
    font-size: 12pt;
  }

  .planner-print-upcoming table th:first-child {
    width: 36%;
  }
}
