/* 日程颜色在月历下方、当天时间轴与放大列表中保持一致。 */
.agenda-item,
.event-card,
.calendar-event,
.calendar-focus-event {
  --event-color: #328ccd;
  --event-time-background: #236fae;
  --event-time-foreground: #ffffff;
  --event-surface: color-mix(in srgb, var(--event-color) 18%, var(--theme-surface, #fafdff));
}

.agenda-item.navy, .event-card.navy, .calendar-event.navy, .calendar-focus-event.navy { --event-color: #3266a7; --event-time-background: #315d96; }
.agenda-item.cyan, .event-card.cyan, .calendar-event.cyan, .calendar-focus-event.cyan { --event-color: #2db3d6; --event-time-background: #167d9b; }
.agenda-item.mint, .event-card.mint, .calendar-event.mint, .calendar-focus-event.mint { --event-color: #42aaa4; --event-time-background: #287d78; }
.agenda-item.purple, .event-card.purple, .calendar-event.purple, .calendar-focus-event.purple { --event-color: #8a64c7; --event-time-background: #67469d; }
.agenda-item.pink, .event-card.pink, .calendar-event.pink, .calendar-focus-event.pink { --event-color: #d96696; --event-time-background: #ab4873; }
.agenda-item.coral, .event-card.coral, .calendar-event.coral, .calendar-focus-event.coral { --event-color: #dc795d; --event-time-background: #ae543d; }
.agenda-item.yellow, .event-card.yellow, .calendar-event.yellow, .calendar-focus-event.yellow { --event-color: #c79424; --event-time-background: #8e6513; }
.agenda-item.green, .event-card.green, .calendar-event.green, .calendar-focus-event.green { --event-color: #4d9b63; --event-time-background: #357545; }

/* 日历下方：时间块与左侧标记都直接使用该日程的颜色。 */
.calendar-agenda-section .agenda-item {
  border-left-color: var(--event-color) !important;
}

.calendar-agenda-section .agenda-item .agenda-time {
  background: var(--event-time-background) !important;
  color: var(--event-time-foreground) !important;
  font-variant-numeric: tabular-nums;
}

/* 当天时间轴：整张卡片用克制的同色底，时间以同色强调，标题始终清晰。 */
.event-card {
  border-left-color: var(--event-color) !important;
  background: var(--event-surface) !important;
}

.event-card > .event-time-label {
  color: var(--event-time-background) !important;
  font-variant-numeric: tabular-nums;
}

.event-card strong {
  color: var(--theme-text, #18324f) !important;
}

/* 放大日历里的“有安排的日子”也使用同一套颜色。 */
.calendar-focus-event {
  border-left-color: var(--event-color) !important;
  background: var(--event-surface) !important;
}

.calendar-focus-event time {
  color: var(--event-time-background) !important;
}

body[data-app-theme="night"] .event-card strong,
body[data-app-theme="night"] .calendar-focus-event span {
  color: #f3f8ff !important;
}

/* 夜间主题不能用通用边框色覆盖日程自身的颜色；时间统一保持纯白。 */
body[data-app-theme="night"] .calendar-agenda-section .agenda-item,
body[data-app-theme="night"] .event-card,
body[data-app-theme="night"] .calendar-focus-event {
  border-left-color: var(--event-color) !important;
}

body[data-app-theme="night"] .event-card > .event-time-label,
body[data-app-theme="night"] .calendar-focus-event time {
  color: #ffffff !important;
}

/* 日程和待办共用同一套三列布局，让单时间与时间段严格对齐。 */
.calendar-agenda-section .agenda-list {
  grid-auto-rows: max-content;
  align-content: start;
}

.calendar-agenda-section .agenda-item[data-event-id] {
  display: grid;
  grid-template-columns: 24px 100px minmax(0, 1fr);
  align-items: start;
  column-gap: 9px;
  height: auto;
  min-height: 62px;
  overflow: visible;
}

.calendar-agenda-section .agenda-item[data-event-id] > .todo-check {
  grid-column: 1;
  align-self: start;
  margin-top: 5px;
}

.calendar-agenda-section .agenda-item[data-event-id] > .agenda-time {
  grid-column: 2;
  align-self: start;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.calendar-agenda-section .agenda-item[data-event-id] > div {
  display: grid;
  grid-column: 3;
  align-content: start;
  row-gap: 3px;
  min-width: 0;
}

.calendar-agenda-section .agenda-item[data-event-id] .agenda-title {
  display: block;
  overflow: visible;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.calendar-agenda-section .agenda-item[data-event-id] .event-note-preview {
  display: block;
  overflow: visible;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  -webkit-line-clamp: unset;
}

@media (max-width: 380px) {
  .calendar-agenda-section .agenda-item[data-event-id] {
    grid-template-columns: 22px 86px minmax(0, 1fr);
    column-gap: 7px;
  }

  .calendar-agenda-section .agenda-item[data-event-id] > .agenda-time {
    padding-inline: 5px;
    font-size: 11px;
  }
}
