.calendar-v8-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  min-height: 36px;
  margin-bottom: 8px;
}

.calendar-v8-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #1d2939;
  font-size: 12px;
}

.calendar-v8-filter input,
.calendar-v8-filter select {
  min-height: 27px;
  height: 27px;
  padding: 2px 5px;
  font-size: 12px;
}

#calYear { width: 72px; }
#calMonth { width: 112px; }
#calRisk { width: 88px; }
#calStatus { width: 105px; }
#calType { width: 132px; }
#calPendency { width: 126px; }

.calendar-v8-layout {
  display: grid;
  grid-template-columns: minmax(570px, 4fr) minmax(390px, 2fr);
  gap: 8px;
  height: clamp(500px, calc(100vh - 255px), 680px);
  min-height: 0;
}

.tk-group {
  min-width: 0;
  margin: 0;
  padding: 8px;
  background: #f2f2f2;
  border: 1px solid #9e9e9e;
  border-radius: 0;
}

.tk-group > legend {
  padding: 0 5px;
  color: #1f1f1f;
  font-size: 12px;
}

.calendar-v8-month {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.calendar-v8-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  grid-template-rows: 28px repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 2px;
  height: calc(100% - 2px);
}

.calendar-v8-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px;
  font-size: 12px;
  font-weight: 700;
}

.calendar-v8-day {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 3px;
  background: #f6f6f6;
  border: 1px solid #8f8f8f;
}

.calendar-v8-day-label {
  min-height: 18px;
  font-size: 12px;
}

.calendar-v8-count {
  flex: 1;
  margin: 5px 8px;
  color: #1f1f1f;
  background: #f0f0f0;
  border: 1px solid #9b9b9b;
  border-radius: 0;
  box-shadow: none;
  font-size: 12px;
}

.calendar-v8-count:hover {
  background: #e5e5e5;
  border-color: #6f6f6f;
}

.calendar-v8-side {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.calendar-v8-list {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.calendar-v8-table-wrap,
.schedule-table-wrap {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #fff;
  border: 1px solid #8e8e8e;
}

.calendar-v8-table,
.schedule-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  font-size: 11px;
}

.calendar-v8-table th,
.calendar-v8-table td,
.schedule-table th,
.schedule-table td {
  height: 27px;
  padding: 4px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-v8-table-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 5px;
}

.schedule-dialog-heading h2,
.schedule-item-form h2 {
  margin: 0 0 4px;
  color: #1f1f1f;
  font-size: 18px;
  font-weight: 600;
}

.schedule-dialog-heading p {
  margin: 0 0 8px;
  color: #555;
  font-size: 12px;
}

.modal-window.modal-large .modal-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: min(580px, calc(100vh - 120px));
  min-height: 0;
}

.schedule-table-wrap {
  height: 100%;
}

.modal-window.modal-schedule-item {
  width: min(680px, 96vw);
  height: min(520px, 92vh);
}

.schedule-item-form {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  grid-template-rows: auto auto auto auto minmax(120px, 1fr) auto;
  gap: 7px 10px;
  height: 100%;
  align-items: start;
}

.schedule-item-form h2,
.schedule-metadata {
  grid-column: 1 / -1;
}

.schedule-item-form > label {
  padding-top: 7px;
  font-size: 12px;
}

.schedule-item-form input,
.schedule-item-form select,
.schedule-item-form textarea {
  width: 100%;
  border-radius: 0;
}

.schedule-notes,
.schedule-notes textarea {
  height: 100%;
  min-height: 125px;
}

.schedule-metadata {
  color: #555;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .calendar-v8-layout { grid-template-columns: minmax(560px, 3fr) minmax(340px, 2fr); }
}

@media (max-width: 900px) {
  .calendar-v8-layout { grid-template-columns: 1fr; }
  .calendar-v8-layout { height: auto; }
  .calendar-v8-month { height: 570px; min-height: 0; }
  .calendar-v8-side { min-height: 520px; }
}
