/* Forms */
.task-form,
.event-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.task-form label,
.event-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  color: var(--text);
}

.task-form input,
.task-form select,
.event-form input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  font-size: 16px;
  outline: none;
}

.task-form input:focus,
.task-form select:focus,
.event-form input:focus {
  border-color: var(--pastel-blue-border);
  box-shadow: 0 0 0 4px rgba(207, 232, 255, 0.45);
}

.event-color-field {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-color-field legend {
  padding: 0 6px;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}

.event-color-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.event-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.event-color-option {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(31, 41, 55, 0.14);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
  transition: 0.18s ease;
  position: relative;
  flex-shrink: 0;
}

.event-color-option:hover {
  transform: translateY(-2px);
}

.event-color-option.is-selected {
  border-color: #1f2937;
  box-shadow: 0 0 0 4px rgba(31, 41, 55, 0.10), 0 10px 20px rgba(31, 41, 55, 0.12);
}

.event-color-option.is-selected::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(31, 41, 55, 0.20);
}

.task-owner-field.is-hidden {
  display: none;
}

.task-form select {
  background: white;
  color: var(--text);
}

.save-task-button,
.save-event-button {
  background: #1f2937;
  color: white;
  padding: 15px 20px;
  border-radius: 999px;
  font-size: 16px;
  margin-top: 6px;
}

/* Holiday placement, weekly grid, and final layout helpers */

.holiday-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  overflow: hidden;
}

.holiday-badges .holiday-badge,
.weekly-week-holiday {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card {
  display: flex;
  flex-direction: column;
}

.weekly-timeboard {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.weekly-time-scale {
  padding-top: 66px;
}

.weekly-time-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding-right: 6px;
}

.weekly-time-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.weekly-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #eaf0f7;
}

/* Day header row: day number + holiday badge on same line */
.day-header-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.day-header-row .holiday-badges {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
}

/* Weekly selector: week range + holiday badge on same line */
.weekly-week-header-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.weekly-week-header-row .holiday-badges {
  width: auto;
  flex-shrink: 1;
  min-width: 0;
}

/* Weekly detail column: date + holiday badge on same line */
.weekly-day-date-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.weekly-day-date-row .weekly-day-date {
  flex-shrink: 0;
}

.weekly-day-date-row .holiday-badges {
  width: auto;
  flex-shrink: 1;
  min-width: 0;
}

/* Weekly detail sidebar: subtitle + holiday badges on same line */
.weekly-detail-subtitle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.weekly-detail-subtitle-row .weekly-detail-subtitle {
  flex-shrink: 0;
}

.weekly-detail-subtitle-row .holiday-badges {
  width: auto;
  flex-shrink: 1;
  min-width: 0;
}

/* Year divider in weekly selector grid */
.weekly-year-divider {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  user-select: none;
}

/* Today week highlight (current real week) */
.weekly-week-card.today-week {
  background: var(--pastel-blue);
  border-color: var(--pastel-blue-border);
}

.weekly-week-card.today-week .weekly-week-range {
  color: #17456f;
}

.weekly-week-card.today-week .weekly-week-count {
  color: #2a6ea8;
}

/* Day modal title: date text + holiday badge on same line */
#modalDateTitle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 28px;
}

#modalDateTitle .modal-date-text {
  flex-shrink: 0;
}

#modalDateTitle .holiday-badges {
  width: auto;
  flex-shrink: 1;
  min-width: 0;
}

/* Shared event block in day view */
.event-block[data-item-type="sharedEvent"] {
  cursor: pointer;
}

@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .tasks-panel {
    position: static;
    max-height: none;
  }

  .task-deadline {
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-title-row {
    align-items: flex-start;
  }

  .month-card {
    grid-template-columns: 1fr;
  }

  .weekly-days-grid {
    min-width: 940px;
  }

  .month-title {
    position: static;
  }

  .day-square {
    min-height: 70px;
    border-radius: 14px;
    padding: 7px;
  }

  .calendar-mini-item {
    font-size: 10px;
  }

  h1 {
    font-size: 26px;
  }

  .calendar-title-input {
    font-size: 26px;
    max-width: 100%;
  }

  .weekly-week-holiday,
  .holiday-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .calendar-view-switcher,
  .calendar-switcher {
    width: 100%;
    justify-content: flex-end;
  }

  .calendar-pill {
    max-width: 110px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .calendar-view-pill {
    padding: 8px 14px;
    font-size: 13px;
  }

  .weekly-selector-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .weekly-header-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .weekly-timeboard {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
  }

  .weekly-time-scale {
    padding-top: 62px;
  }

  .modal-content {
    height: 88vh;
  }

  .modal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .day-nav {
    width: 100%;
    justify-content: space-between;
  }

  .day-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hour-row {
    grid-template-columns: 65px 1fr;
  }

  .event-block,
  .event-drag-preview {
    left: 86px;
    right: 24px;
  }
}

/* Event analysis metadata */
.event-tracking-field {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-tracking-field legend {
  padding: 0 6px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

.event-tracking-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.event-tracking-option,
.event-tracking-clear {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  transition: 0.18s ease;
}

.event-tracking-option:hover,
.event-tracking-clear:hover {
  transform: translateY(-1px);
  background: #eef4fb;
}

.event-tracking-option.is-selected {
  background: #1f2937;
  color: #fff;
  border-color: #1f2937;
  box-shadow: 0 10px 20px rgba(31, 41, 55, 0.12);
}

.event-tracking-icon,
.event-tracking-mini-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1f2937;
  font-weight: 900;
  font-size: 14px;
  flex: 0 0 auto;
}

.event-tracking-option.is-selected .event-tracking-icon {
  background: rgba(255, 255, 255, 0.95);
}

.event-tracking-mini-icon {
  width: 18px;
  height: 18px;
  margin-right: 5px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.event-tracking-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: #f7f9fc;
  border: 1px solid #e4ebf5;
  border-radius: 16px;
  padding: 12px;
}

.event-tracking-details.is-hidden {
  display: none;
}

.event-tracking-details label {
  margin: 0;
}

.event-form select,
.finance-entry-form select,
.finance-entry-form input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  font-size: 16px;
  outline: none;
  background: white;
  color: var(--text);
}

.event-form select:focus,
.finance-entry-form select:focus,
.finance-entry-form input:focus {
  border-color: var(--pastel-blue-border);
  box-shadow: 0 0 0 4px rgba(207, 232, 255, 0.45);
}

.event-tracking-note {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .event-tracking-details {
    grid-template-columns: 1fr;
  }
}
