.engineering-tools__modal--calendar {
  width: min(1040px, calc(100vw - 32px));
}

.production-calendar {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: var(--weight-body);
  line-height: 1.5;
}

.production-calendar__controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 14px;
}

.production-calendar__context,
.production-calendar__scope {
  margin: var(--space-4) 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-body);
}

.production-calendar__controls--month {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.production-calendar__actions,
.production-calendar__actions-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.production-calendar__actions {
  justify-content: space-between;
  margin: var(--space-4) 0;
}

.production-calendar__summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.production-calendar__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-4) 0;
  color: var(--muted);
  font-size: 11px;
}

.production-calendar__legend span {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}

.production-calendar__legend i {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font: inherit;
}

.production-calendar__legend-work { background: var(--surface-2); border: 1px solid var(--line); }
.production-calendar__legend-off { background: var(--danger-soft); border: 1px solid var(--danger); }
.production-calendar__legend-short { color: var(--warning); }
.production-calendar__legend-transfer { color: var(--success); }

.production-calendar__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}

.production-calendar__grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.production-calendar__month {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-surface);
}

.production-calendar__month-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
}

.production-calendar__month-head > span {
  color: var(--muted);
  font-size: 11px;
}

.production-calendar__month-title {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: var(--weight-body);
  cursor: pointer;
}

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

.production-calendar__weekday,
.production-calendar__week {
  display: grid;
  place-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-body);
}

.production-calendar__weekday { height: 24px; }

.production-calendar__day {
  position: relative;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.production-calendar__day--off { color: var(--danger); }
.production-calendar__day--holiday { background: var(--danger-soft); }
.production-calendar__day--short { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.production-calendar__day--transfer:not(.production-calendar__day--short) { color: var(--success); }
.production-calendar__day--today { border-color: var(--brand-primary); }
.production-calendar__day[aria-pressed="true"] { background: var(--brand-primary-soft); border-color: var(--brand-primary); }
.production-calendar__day:hover { box-shadow: inset 0 0 0 1px var(--line); }
.production-calendar__day:focus-visible,
.production-calendar__month-title:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring); outline-offset: 1px; }
.production-calendar__day sup { position: absolute; top: 1px; right: 1px; font-size: 9px; line-height: 1; }
.production-calendar__grid--single .production-calendar__day { height: 48px; }

.production-calendar__date-title,
.production-calendar__date-description {
  margin: 0 0 var(--space-2);
  font-size: 14px;
  font-weight: var(--weight-body);
}

.production-calendar__date-description { color: var(--muted); }
.production-calendar__norm-caption { position: relative; display: flex; align-items: center; gap: var(--space-2); }
.production-calendar__norm-caption .engineering-tools__field-heading { position: static; }
.production-calendar__norm-caption .c-card__description { margin: 0; }
.production-calendar .production-calendar__norms th { position: static; }
.production-calendar__norms th:first-child { width: 28%; }
.production-calendar__norm-row--total { background: var(--surface); }
.production-calendar__special { margin-bottom: var(--space-4); }
.production-calendar__special summary { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) 0; cursor: pointer; font-size: 12px; font-weight: var(--weight-body); list-style: none; }
.production-calendar__special summary::marker { content: ""; }
.production-calendar__special summary::-webkit-details-marker { display: none; }
.production-calendar__special summary:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring); outline-offset: 2px; }
.production-calendar__chevron { display: inline-flex; flex: 0 0 16px; width: 16px; height: 16px; color: var(--muted); }
.production-calendar__chevron svg { display: block; width: 16px; height: 16px; }
.production-calendar__special[open] .production-calendar__chevron { transform: rotate(90deg); }
.production-calendar__special ul { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.production-calendar__special li { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.production-calendar__special time { color: var(--muted); }

@media (max-width: 980px) {
  .production-calendar__controls--month { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .production-calendar__controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-calendar__grid:not(.production-calendar__grid--single) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-calendar__summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .engineering-tools__modal--calendar { width: calc(100vw - 20px); }
  .production-calendar__controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-calendar__grid:not(.production-calendar__grid--single) { grid-template-columns: minmax(0, 1fr); }
  .production-calendar__day { height: 38px; }
  .production-calendar__summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-3); }
  .production-calendar .c-table td { font-size: 12px; }
  .production-calendar__special li { grid-template-columns: 76px minmax(0, 1fr); gap: var(--space-2); }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body:has(.engineering-tools__modal--calendar[open]) { overflow: visible !important; background: white; }
  body:has(.engineering-tools__modal--calendar[open]) .portal-app-rail,
  body:has(.engineering-tools__modal--calendar[open]) #portalSidebar,
  body:has(.engineering-tools__modal--calendar[open]) .topbar,
  body:has(.engineering-tools__modal--calendar[open]) .engineering-tools__catalog,
  body:has(.engineering-tools__modal--calendar[open]) > :not(#portalShell),
  body:has(.engineering-tools__modal--calendar[open]) .portal-fab,
  body:has(.engineering-tools__modal--calendar[open]) #chatLauncher,
  body:has(.engineering-tools__modal--calendar[open]) .portal-quick-actions,
  .engineering-tools__modal--calendar .production-calendar__controls,
  .engineering-tools__modal--calendar .production-calendar__actions,
  .engineering-tools__modal--calendar .production-calendar__grid ~ .engineering-tools__card:not(:has([data-calendar-norms])),
  .engineering-tools__modal--calendar .production-calendar__special,
  .engineering-tools__modal--calendar .c-modal__close,
  .engineering-tools__modal--calendar .engineering-tools__help-button { display: none !important; }
  body:has(.engineering-tools__modal--calendar[open]) #portalShell,
  body:has(.engineering-tools__modal--calendar[open]) #portalWorkspace,
  body:has(.engineering-tools__modal--calendar[open]) #engineeringToolsView { display: block; width: 100%; min-width: 0; margin: 0; padding: 0; height: auto; overflow: visible; }
  .engineering-tools__modal--calendar { position: static !important; inset: auto !important; width: 100% !important; max-width: none !important; max-height: none !important; height: auto !important; margin: 0 !important; padding: 0; border: 0; box-shadow: none; color-scheme: light; --ink: #182238; --muted: #5b6778; --card-surface: white; --surface: #f5f7fc; --surface-2: #eef2f8; --line: #dce2eb; --danger: #b92121; --danger-soft: #fceaea; --warning: #925d00; --success: #177750; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .engineering-tools__modal--calendar::backdrop { background: transparent; }
  .engineering-tools__modal--calendar .c-modal__content,
  .engineering-tools__modal--calendar .c-modal__body { display: block; overflow: visible; max-height: none; height: auto; padding: 0; }
  .engineering-tools__modal--calendar .c-modal__header { padding: 0 0 12px; }
  .engineering-tools__modal--calendar .production-calendar__grid:not(.production-calendar__grid--single) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .engineering-tools__modal--calendar .production-calendar__month { break-inside: avoid; padding: 8px; }
  .engineering-tools__modal--calendar .production-calendar__days { grid-template-columns: 16px repeat(7, minmax(0, 1fr)); gap: 1px; }
  .engineering-tools__modal--calendar .production-calendar__day { height: 24px; font-size: 12px; }
  .engineering-tools__modal--calendar .production-calendar__summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .engineering-tools__modal--calendar .c-table tr { break-inside: avoid; }
}
