.calendar-page {
  --weekend-background: #f3f6fa;
  --weekend-background-strong: #edf2f8;
  --weekend-border: #dce4ec;
  --holiday-background: #e1e9f4;
  --holiday-background-strong: #d5e1ef;
  --holiday-border: #abbdd3;
  --holiday-ink: #3d5874;
  min-height: 100vh;
  background: var(--page-background);
}

html[data-theme="dark"] .calendar-page {
  --weekend-background: #202833;
  --weekend-background-strong: #242f3c;
  --weekend-border: #323f4d;
  --holiday-background: #293747;
  --holiday-background-strong: #31445a;
  --holiday-border: #526a84;
  --holiday-ink: #c7dbff;
}

/* Impeccable blue workspace — calendar uses the full application canvas. */
.calendar-page {
  --weekend-background: #f3f7fd;
  --weekend-background-strong: #edf4fc;
  --weekend-border: #dce7f5;
  --holiday-background: #e4edf9;
  --holiday-background-strong: #d8e5f5;
  --holiday-border: #aec3dd;
  --holiday-ink: #3e5f82;
}

html[data-theme="dark"] .calendar-page {
  --weekend-background: #152238;
  --weekend-background-strong: #192944;
  --weekend-border: #2b3c59;
  --holiday-background: #223653;
  --holiday-background-strong: #294260;
  --holiday-border: #4d6789;
  --holiday-ink: #c5d9f5;
}

.calendar-shell {
  width: calc(100% - 32px);
  min-height: calc(100vh - 32px);
  margin: 16px;
  padding: clamp(24px, 2.2vw, 36px);
  border-radius: 24px;
  box-shadow: 0 20px 55px rgba(37, 68, 119, 0.08);
}

html[data-theme="dark"] .calendar-shell {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.calendar-brand h1,
.date-navigation h2,
.day-heading strong,
.dialog-heading h2 {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.calendar-brand h1 {
  font-size: 2rem;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.back-link,
.add-event-button,
.dialog-primary,
.today-button,
.icon-button,
.view-switcher button {
  border-radius: 10px;
}

.back-link {
  color: var(--accent-dark);
  background: var(--soft-accent);
  border-color: var(--soft-accent-border);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--on-strong);
  background: var(--accent);
  border-color: var(--accent);
}

.calendar-toolbar {
  margin-top: 22px;
}

.view-switcher button.active::after {
  background: var(--accent);
}

.calendar-stage {
  min-height: calc(100vh - 250px);
  margin-top: 22px;
}

.month-day {
  min-height: clamp(104px, 13vh, 154px);
  padding: 10px;
}

.date-summary {
  font-size: 0.72rem;
  line-height: 1.45;
}

.year-grid {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: clamp(14px, 1.5vw, 22px);
}

.mini-month,
.agenda-section,
.week-day,
.event-draft-card,
.dialog-card,
.calendar-item {
  border-radius: 14px;
}

.week-view {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(6px, 0.7vw, 12px);
  overflow: visible;
  padding-bottom: 0;
}

.week-day {
  min-width: 0;
  min-height: calc(100vh - 276px);
  padding: clamp(8px, 0.8vw, 12px);
}

.week-day-header {
  margin-bottom: 10px;
}

.week-day .calendar-item {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 8px;
}

.week-day .item-symbol {
  display: none;
}

.week-day .item-title {
  font-size: clamp(0.72rem, 0.78vw, 0.84rem);
}

.week-day .item-meta {
  font-size: 0.67rem;
}

.task-dot,
.task-stack-toggle {
  --calendar-role-color: var(--accent);
}

.event-dot {
  background: #8170bd;
}

.calendar-item.event-item {
  border-left-color: #8170bd;
}

.event-item .item-symbol {
  color: #7563b5;
}

.calendar-status-badge {
  color: #b64353;
  background: #fff0f3;
  border-color: #f2aab5;
}

.calendar-label-badge {
  color: #6652a7;
  background: #f1edff;
  border-color: #c8bcf4;
}

html[data-theme="dark"] .calendar-status-badge {
  color: #ffb8c2;
  background: #462630;
  border-color: #78414d;
}

html[data-theme="dark"] .calendar-label-badge {
  color: #d7ceff;
  background: #332d55;
  border-color: #5b4e91;
}

.completed-item {
  background: color-mix(in srgb, var(--paper) 72%, #7e90ab);
  border-left-color: #7e90ab;
}

.completed-item .item-title {
  color: var(--completed);
  text-decoration-color: var(--completed);
}

.task-stack-layer {
  background: color-mix(in srgb, var(--paper) 86%, var(--soft-accent));
  border-color: color-mix(in srgb, var(--line) 76%, var(--accent));
  box-shadow: 0 4px 12px rgba(34, 64, 112, 0.1);
}

.editor-dialog {
  width: min(94vw, 720px);
}

.dialog-card {
  padding: 28px;
  box-shadow: 0 28px 80px rgba(15, 35, 68, 0.22);
}

.dialog-heading h2 {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.entry-tabs {
  border-radius: 12px;
}

.entry-tabs button.active {
  background: var(--accent);
}

.natural-panel textarea:focus,
.event-fields input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.event-draft-card.has-save-error {
  border-color: #ca5061;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ca5061 14%, transparent);
}

.dialog-danger,
.event-draft-remove {
  color: #b64353;
}

.dialog-danger:hover {
  background: #b64353;
  border-color: #b64353;
}

@media (max-width: 1180px) {
  .year-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }

  .week-day .task-stack-icon,
  .week-day .task-stack-hint {
    display: none;
  }
}

@media (max-width: 900px) {
  .calendar-shell {
    width: calc(100% - 20px);
    min-height: calc(100vh - 20px);
    margin: 10px;
  }

  .week-view {
    grid-template-columns: repeat(7, minmax(132px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }
}

@media (max-width: 720px) {
  .calendar-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 24px 18px 40px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .calendar-stage {
    min-height: 0;
  }
}

/* Impeccable final calendar cascade. */
.calendar-shell { width: calc(100% - 32px); min-height: calc(100vh - 32px); margin: 16px; padding: clamp(24px, 2.2vw, 36px); border-radius: 24px; box-shadow: 0 20px 55px rgba(37, 68, 119, 0.08); }
.calendar-brand h1,
.date-navigation h2,
.day-heading strong,
.dialog-heading h2 { font-family: inherit; }
.calendar-brand h1 { font-size: 2rem; font-weight: 760; letter-spacing: -0.04em; }
.back-link { color: var(--accent-dark); background: var(--soft-accent); border-color: var(--soft-accent-border); }
.back-link:hover,
.back-link:focus-visible { color: var(--on-strong); background: var(--accent); border-color: var(--accent); }
.calendar-stage { min-height: calc(100vh - 250px); margin-top: 22px; }
.month-day { min-height: clamp(104px, 13vh, 154px); padding: 10px; }
.year-grid { grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: clamp(14px, 1.5vw, 22px); }
.week-view { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(6px, 0.7vw, 12px); overflow: visible; padding-bottom: 0; }
.week-day { min-width: 0; min-height: calc(100vh - 276px); padding: clamp(8px, 0.8vw, 12px); }
.week-day .calendar-item { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px; }
.week-day .item-symbol { display: none; }
.week-day .item-title { font-size: clamp(0.72rem, 0.78vw, 0.84rem); }
.event-dot { background: #8170bd; }
.calendar-item.event-item { border-left-color: #8170bd; }
.event-item .item-symbol { color: #7563b5; }
.calendar-status-badge { color: #b64353; background: #fff0f3; border-color: #f2aab5; }
.calendar-label-badge { color: #6652a7; background: #f1edff; border-color: #c8bcf4; }
html[data-theme="dark"] .calendar-status-badge { color: #ffb8c2; background: #462630; border-color: #78414d; }
html[data-theme="dark"] .calendar-label-badge { color: #d7ceff; background: #332d55; border-color: #5b4e91; }
.completed-item { background: color-mix(in srgb, var(--paper) 72%, #7e90ab); border-left-color: #7e90ab; }
.editor-dialog { width: min(94vw, 720px); }
.dialog-card { padding: 28px; border-radius: 16px; box-shadow: 0 28px 80px rgba(15, 35, 68, 0.22); }
.dialog-heading h2 { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.025em; }
.entry-tabs button.active { background: var(--accent); }
@media (max-width: 1180px) {
  .year-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
  .week-day .task-stack-icon,
  .week-day .task-stack-hint { display: none; }
}
@media (max-width: 900px) {
  .calendar-shell { width: calc(100% - 20px); min-height: calc(100vh - 20px); margin: 10px; }
  .week-view { grid-template-columns: repeat(7, minmax(132px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .year-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}
@media (max-width: 720px) {
  .calendar-shell { width: 100%; min-height: 100vh; margin: 0; padding: 24px 18px 40px; border: 0; border-radius: 0; box-shadow: none; }
  .calendar-stage { min-height: 0; }
}
@media (max-width: 620px) {
  .year-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 22px 18px; }
}

/* Impeccable cascade lock — intentionally last. */
.calendar-shell { width: calc(100% - 32px); min-height: calc(100vh - 32px); margin: 16px; padding: clamp(24px, 2.2vw, 36px); border-radius: 24px; box-shadow: 0 20px 55px rgba(37, 68, 119, 0.08); }
.calendar-brand h1,
.date-navigation h2,
.day-heading strong,
.dialog-heading h2 { font-family: inherit; }
.calendar-brand h1 { font-size: 2rem; font-weight: 760; letter-spacing: -0.04em; }
.back-link { color: var(--accent-dark); background: var(--soft-accent); border-color: var(--soft-accent-border); }
.back-link:hover,
.back-link:focus-visible { color: var(--on-strong); background: var(--accent); border-color: var(--accent); }
.calendar-stage { min-height: calc(100vh - 250px); margin-top: 22px; }
.month-day { min-height: clamp(104px, 13vh, 154px); padding: 10px; }
.year-grid { grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: clamp(14px, 1.5vw, 22px); }
.week-view { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(6px, 0.7vw, 12px); overflow: visible; padding-bottom: 0; }
.week-day { min-width: 0; min-height: calc(100vh - 276px); padding: clamp(8px, 0.8vw, 12px); }
.week-day .calendar-item { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px; }
.week-day .item-symbol { display: none; }
.week-day .item-title { font-size: clamp(0.72rem, 0.78vw, 0.84rem); }
.event-dot { background: #8170bd; }
.calendar-item.event-item { border-left-color: #8170bd; }
.event-item .item-symbol { color: #7563b5; }
.calendar-status-badge { color: #b64353; background: #fff0f3; border-color: #f2aab5; }
.calendar-label-badge { color: #6652a7; background: #f1edff; border-color: #c8bcf4; }
html[data-theme="dark"] .calendar-status-badge { color: #ffb8c2; background: #462630; border-color: #78414d; }
html[data-theme="dark"] .calendar-label-badge { color: #d7ceff; background: #332d55; border-color: #5b4e91; }
.completed-item { background: color-mix(in srgb, var(--paper) 72%, #7e90ab); border-left-color: #7e90ab; }
.editor-dialog { width: min(94vw, 720px); }
.dialog-card { padding: 28px; border-radius: 16px; box-shadow: 0 28px 80px rgba(15, 35, 68, 0.22); }
.dialog-heading h2 { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.025em; }
.entry-tabs button.active { background: var(--accent); }
@media (max-width: 1180px) {
  .year-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
  .week-day .task-stack-icon,
  .week-day .task-stack-hint { display: none; }
}
@media (max-width: 900px) {
  .calendar-shell { width: calc(100% - 20px); min-height: calc(100vh - 20px); margin: 10px; }
  .week-view { grid-template-columns: repeat(7, minmax(132px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .year-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}
@media (max-width: 720px) {
  .calendar-shell { width: 100%; min-height: 100vh; margin: 0; padding: 24px 18px 40px; border: 0; border-radius: 0; box-shadow: none; }
  .calendar-stage { min-height: 0; }
}
@media (max-width: 620px) {
  .year-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 22px 18px; }
}

/* Final Impeccable cascade: full-canvas blue calendar. */
.calendar-shell {
  width: calc(100% - 32px);
  min-height: calc(100vh - 32px);
  margin: 16px;
  padding: clamp(24px, 2.2vw, 36px);
  border-radius: 24px;
  box-shadow: 0 20px 55px rgba(37, 68, 119, 0.08);
}
.calendar-brand h1,
.date-navigation h2,
.day-heading strong,
.dialog-heading h2 { font-family: inherit; }
.calendar-brand h1 { font-size: 2rem; font-weight: 760; letter-spacing: -0.04em; }
.back-link { color: var(--accent-dark); background: var(--soft-accent); border-color: var(--soft-accent-border); }
.back-link:hover,
.back-link:focus-visible { color: var(--on-strong); background: var(--accent); border-color: var(--accent); }
.calendar-stage { min-height: calc(100vh - 250px); margin-top: 22px; }
.month-day { min-height: clamp(104px, 13vh, 154px); padding: 10px; }
.year-grid { grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: clamp(14px, 1.5vw, 22px); }
.week-view { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(6px, 0.7vw, 12px); overflow: visible; padding-bottom: 0; }
.week-day { min-width: 0; min-height: calc(100vh - 276px); padding: clamp(8px, 0.8vw, 12px); }
.week-day .calendar-item { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px; }
.week-day .item-symbol { display: none; }
.week-day .item-title { font-size: clamp(0.72rem, 0.78vw, 0.84rem); }
.event-dot { background: #8170bd; }
.calendar-item.event-item { border-left-color: #8170bd; }
.event-item .item-symbol { color: #7563b5; }
.calendar-status-badge { color: #b64353; background: #fff0f3; border-color: #f2aab5; }
.calendar-label-badge { color: #6652a7; background: #f1edff; border-color: #c8bcf4; }
html[data-theme="dark"] .calendar-status-badge { color: #ffb8c2; background: #462630; border-color: #78414d; }
html[data-theme="dark"] .calendar-label-badge { color: #d7ceff; background: #332d55; border-color: #5b4e91; }
.completed-item { background: color-mix(in srgb, var(--paper) 72%, #7e90ab); border-left-color: #7e90ab; }
.editor-dialog { width: min(94vw, 720px); }
.dialog-card { padding: 28px; border-radius: 16px; box-shadow: 0 28px 80px rgba(15, 35, 68, 0.22); }
.dialog-heading h2 { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.025em; }
.entry-tabs button.active { background: var(--accent); }

@media (max-width: 1180px) {
  .year-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
  .week-day .task-stack-icon,
  .week-day .task-stack-hint { display: none; }
}
@media (max-width: 900px) {
  .calendar-shell { width: calc(100% - 20px); min-height: calc(100vh - 20px); margin: 10px; }
  .week-view { grid-template-columns: repeat(7, minmax(132px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .year-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}
@media (max-width: 720px) {
  .calendar-shell { width: 100%; min-height: 100vh; margin: 0; padding: 24px 18px 40px; border: 0; border-radius: 0; box-shadow: none; }
  .calendar-stage { min-height: 0; }
}
@media (max-width: 620px) {
  .year-grid { grid-template-columns: 1fr; }
  .dialog-card { padding: 22px 18px; }
}

@media (max-width: 620px) {
  .year-grid {
    grid-template-columns: 1fr;
  }

  .dialog-card {
    padding: 22px 18px;
  }
}

.calendar-shell {
  width: min(1440px, calc(100% - 40px));
  min-height: calc(100vh - 64px);
  margin: 32px auto;
  padding: 34px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--paper-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.calendar-header,
.calendar-toolbar,
.calendar-footer,
.date-navigation,
.calendar-brand,
.back-link,
.view-switcher,
.calendar-legend,
.year-navigation {
  display: flex;
  align-items: center;
}

.calendar-header {
  justify-content: space-between;
  gap: 24px;
}

.calendar-brand {
  gap: 24px;
}

.calendar-brand h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}

.calendar-brand .eyebrow {
  margin-bottom: 7px;
}

.back-link {
  gap: 5px;
  padding: 9px 12px 9px 8px;
  color: var(--accent-dark);
  background: var(--soft-accent);
  border: 1px solid var(--soft-accent-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.back-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--on-strong);
  background: var(--accent-dark);
  outline: none;
}

.add-event-button,
.dialog-primary {
  padding: 10px 16px 11px;
  color: var(--primary-button-text);
  background: var(--primary-button-background);
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.add-event-button:hover,
.dialog-primary:hover:not(:disabled) {
  background: var(--primary-button-hover);
  transform: translateY(-1px);
}

.calendar-toolbar {
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.date-navigation {
  min-width: 0;
  gap: 8px;
}

.year-navigation {
  min-width: 0;
  gap: 7px;
  margin-left: 10px;
}

.date-navigation h2 {
  margin: 0;
  overflow: hidden;
  font-family: "Fraunces", serif;
  font-size: clamp(1.15rem, 2.8vw, 1.65rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.today-button,
.view-switcher button {
  min-height: 36px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}

.year-button {
  flex: 0 0 auto;
  width: 30px;
  min-height: 30px;
  font-size: 1.2rem;
}

.today-button {
  padding: 6px 12px 7px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.icon-button:hover,
.today-button:hover,
.view-switcher button:hover,
.view-switcher button:focus-visible {
  color: var(--accent-dark);
  border-color: var(--accent);
  outline: none;
}

.icon-button:disabled {
  color: var(--muted);
  opacity: 0.38;
  cursor: not-allowed;
}

.icon-button:disabled:hover {
  color: var(--muted);
  border-color: var(--line);
}

.view-switcher {
  flex: 0 0 auto;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.view-switcher button {
  min-height: 30px;
  padding: 4px 11px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.view-switcher button.active {
  color: var(--on-strong);
  background: var(--accent);
}

.calendar-stage {
  min-height: 590px;
  margin-top: 18px;
}

.calendar-notice {
  margin: 14px 0 0;
  padding: 9px 13px;
  color: var(--accent-dark);
  background: var(--soft-accent);
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
}

.weekday-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row span {
  padding: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.month-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.month-day {
  position: relative;
  min-height: 105px;
  padding: 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.month-day:hover,
.month-day:focus-visible,
.mini-day:hover,
.mini-day:focus-visible {
  background: var(--soft-accent);
  outline: none;
}

.month-day.outside-month {
  color: var(--placeholder);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
}

.month-day.weekend-day {
  background: var(--weekend-background);
}

.month-day.weekend-day:hover,
.month-day.weekend-day:focus-visible {
  background: var(--weekend-background-strong);
}

.month-day.outside-month.weekend-day {
  background: color-mix(in srgb, var(--weekend-background) 72%, var(--surface));
}

.month-day.holiday-day {
  background: var(--holiday-background);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--holiday-border) 50%, transparent);
}

.month-day.holiday-day:hover,
.month-day.holiday-day:focus-visible {
  background: var(--holiday-background-strong);
}

.month-day.outside-month.holiday-day {
  color: var(--muted);
  background: var(--holiday-background);
}

.day-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.is-today .day-number,
.mini-day.is-today > span:first-child {
  color: var(--on-strong);
  background: var(--accent);
}

.is-selected:not(.is-today) .day-number {
  color: var(--accent-dark);
  background: var(--soft-accent);
}

.date-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.date-dot,
.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.task-dot {
  background: var(--accent);
}

.event-dot {
  background: #c83b55;
}

.date-summary {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 24px;
}

.mini-month {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.45;
}

.mini-month h3 {
  margin: 0 0 9px;
  color: var(--accent-dark);
  font-size: 0.88rem;
}

.mini-weekdays,
.mini-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-weekdays span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  text-align: center;
}

.mini-day {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  padding: 1px;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.66rem;
}

.mini-day.empty {
  pointer-events: none;
}

.mini-day > span:first-child {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
}

.mini-day.weekend-day {
  background: var(--weekend-background);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--weekend-border) 38%, transparent);
}

.mini-day.holiday-day {
  color: var(--holiday-ink);
  background: var(--holiday-background);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--holiday-border) 45%, transparent);
}

.mini-dots {
  position: absolute;
  bottom: 1px;
  display: flex;
  gap: 2px;
}

.mini-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.day-view,
.week-view {
  display: grid;
  gap: 16px;
}

.day-view {
  grid-template-columns: minmax(0, 1fr);
}

.day-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 2px 12px;
  border-bottom: 1px solid var(--line);
}

.day-heading strong {
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
}

.day-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.agenda-section {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.agenda-section h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.agenda-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-card-stack {
  position: relative;
  isolation: isolate;
  margin: 0;
  transition: margin 230ms cubic-bezier(0.22, 1, 0.36, 1);
}

.task-card-stack:not(.expanded) {
  margin: 25px 10px 14px;
}

.task-stack-layers {
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 49px;
  opacity: 1;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 140ms ease,
    transform 230ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.task-card-stack.expanded .task-stack-layers {
  opacity: 0;
  transform: translate3d(0, 7px, 0);
}

.task-stack-layer {
  position: absolute;
  top: 1px;
  right: var(--stack-inset);
  bottom: 1px;
  left: var(--stack-inset);
  display: block;
  background: color-mix(in srgb, var(--paper) 86%, var(--soft-accent));
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--accent));
  border-radius: 11px 11px 9px 9px;
  box-shadow: 0 4px 10px rgba(23, 33, 38, 0.08);
  transform: translateY(var(--stack-y));
}

.task-stack-toggle {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 13px 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 11px;
  box-shadow: 0 6px 14px rgba(23, 33, 38, 0.07);
  text-align: left;
}

.task-stack-toggle:hover,
.task-stack-toggle:focus-visible {
  background: var(--soft-accent);
  border-color: var(--soft-accent-border);
  border-left-color: var(--accent);
  outline: none;
}

.task-stack-icon,
.task-stack-chevron {
  color: var(--accent-dark);
  font-weight: 800;
}

.task-stack-icon {
  font-size: 1rem;
}

.task-stack-label {
  overflow: hidden;
  padding-bottom: 0.1em;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-stack-hint {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.task-stack-chevron {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  background: var(--soft-accent);
  border-radius: 50%;
  font-size: 0.9rem;
}

.task-stack-items-clip {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  overflow: visible;
  pointer-events: none;
  transform: translate3d(0, -8px, 0);
  transition:
    grid-template-rows 230ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 230ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 150ms ease,
    transform 230ms cubic-bezier(0.22, 1, 0.36, 1);
}

.task-card-stack.expanded .task-stack-items-clip {
  grid-template-rows: 1fr;
  margin-top: 9px;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.task-stack-items-clip-inner {
  min-height: 0;
  overflow: hidden;
}

.task-stack-items {
  display: grid;
  gap: 8px;
}

.task-stack-items .calendar-item {
  opacity: 0;
  transform: translate3d(0, -10px, 0) scale(0.985);
  transform-origin: center top;
  transition:
    opacity 150ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.task-card-stack.expanded .task-stack-items .calendar-item {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition-delay: var(--task-stack-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .task-card-stack,
  .task-stack-layers,
  .task-stack-items-clip,
  .task-stack-items .calendar-item {
    transition-duration: 1ms;
    transition-delay: 0ms;
  }
}

.calendar-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 12px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 11px;
  text-align: left;
}

.calendar-item.event-item {
  border-left-color: #c83b55;
}

.calendar-item.holiday-event-item {
  background: var(--holiday-background);
  border-left-color: var(--holiday-border);
}

.event-item.holiday-event-item .item-symbol {
  color: var(--holiday-ink);
}

.calendar-item:hover,
.calendar-item:focus-visible {
  background: var(--soft-accent);
  outline: none;
}

.item-symbol {
  padding-top: 1px;
  color: var(--accent-dark);
  font-weight: 700;
}

.event-item .item-symbol {
  color: #c83b55;
}

.item-title {
  display: block;
  padding-bottom: 0.08em;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.item-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.calendar-task-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.calendar-status-badge,
.calendar-label-badge {
  max-width: 100%;
  padding: 2px 6px 3px;
  overflow: hidden;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-status-badge {
  color: #a63125;
  background: #fff0ec;
  border-color: #efb2a7;
}

.calendar-label-badge {
  color: #36559a;
  background: #edf2ff;
  border-color: #b9c8ed;
}

html[data-theme="dark"] .calendar-status-badge {
  color: #ffb7aa;
  background: #492923;
  border-color: #78473e;
}

html[data-theme="dark"] .calendar-label-badge {
  color: #c7d6ff;
  background: #273451;
  border-color: #465b8a;
}

.completed-item .item-title {
  color: var(--completed);
  text-decoration: line-through;
}

.empty-agenda {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.week-view {
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-day {
  min-height: 510px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.week-day.selected-day {
  border-color: var(--accent);
  box-shadow: inset 0 3px var(--accent);
}

.week-day.weekend-day {
  background: var(--weekend-background);
  border-color: var(--weekend-border);
}

.week-day.holiday-day {
  background: var(--holiday-background);
  border-color: var(--holiday-border);
}

.day-view.weekend-day {
  padding: 14px;
  background: var(--weekend-background);
  border: 1px solid var(--weekend-border);
  border-radius: 18px;
}

.day-view.holiday-period {
  padding: 14px;
  background: var(--holiday-background);
  border: 1px solid var(--holiday-border);
  border-radius: 18px;
}

.holiday-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  color: var(--holiday-ink);
  background: var(--holiday-background-strong);
  border: 1px solid var(--holiday-border);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.week-day .holiday-banner {
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 7px;
  font-size: 0.66rem;
  overflow-wrap: anywhere;
}

.week-day-header {
  display: block;
  width: 100%;
  margin-bottom: 13px;
  padding: 0 0 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.week-day-header span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.week-day-header strong {
  display: block;
  margin-top: 3px;
  font-size: 1.1rem;
}

.week-group-label {
  margin: 13px 0 7px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.week-day .calendar-item {
  margin-bottom: 7px;
  padding: 8px;
}

.week-task-stack:not(.expanded) {
  margin: 17px 5px 10px;
}

.week-task-stack .task-stack-layers {
  height: 39px;
}

.week-task-stack .task-stack-toggle {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  padding: 8px;
}

.week-task-stack .task-stack-hint {
  display: none;
}

.week-task-stack .task-stack-label {
  font-size: 0.74rem;
}

.week-task-stack .task-stack-chevron {
  width: 19px;
  height: 19px;
  font-size: 0.76rem;
}

.week-task-stack .task-stack-items {
  gap: 7px;
}

.week-task-stack.expanded .task-stack-items-clip {
  margin-top: 8px;
}

.week-task-stack .task-stack-items .calendar-item {
  margin-bottom: 0;
}

.calendar-footer {
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.calendar-legend {
  gap: 18px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-holiday {
  width: 15px;
  height: 9px;
  background: var(--holiday-background);
  border: 1px solid var(--holiday-border);
  border-radius: 3px;
}

.editor-dialog {
  width: min(94vw, 650px);
  max-height: 92vh;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  overflow: visible;
  scrollbar-width: none;
}

.editor-dialog[open] {
  animation: dialog-shell-in 220ms ease both;
}

.editor-dialog::backdrop {
  background: rgba(10, 15, 17, 0.48);
  backdrop-filter: blur(3px);
}

.editor-dialog[open]::backdrop {
  animation: dialog-backdrop-in 240ms ease both;
}

.dialog-card {
  max-height: 92vh;
  padding: 25px;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--paper);
  border: 1px solid var(--paper-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.editor-dialog::-webkit-scrollbar,
.dialog-card::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.editor-dialog[open] .dialog-card {
  animation: dialog-card-in 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.editor-dialog.is-opening .dialog-card {
  overflow-y: hidden;
}

.editor-dialog.is-closing {
  animation: dialog-shell-out 170ms ease both;
}

.editor-dialog.is-closing::backdrop {
  animation: dialog-backdrop-out 170ms ease both;
}

.editor-dialog.is-closing .dialog-card {
  animation: dialog-card-out 170ms ease both;
}

#event-editor {
  view-transition-name: event-entry-content;
}

@keyframes dialog-shell-in {
  from { opacity: 0; }
}

@keyframes dialog-backdrop-in {
  from { opacity: 0; backdrop-filter: blur(0); }
}

@keyframes dialog-card-in {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.975); }
}

@keyframes dialog-shell-out {
  to { opacity: 0; }
}

@keyframes dialog-backdrop-out {
  to { opacity: 0; backdrop-filter: blur(0); }
}

@keyframes dialog-card-out {
  to { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.985); }
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
}

.dialog-heading {
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.55rem;
}

.dialog-close {
  width: 35px;
  height: 35px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.35rem;
}

.entry-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 21px 0 16px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.entry-tabs button {
  padding: 8px 8px 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.entry-tabs button.active {
  color: var(--on-strong);
  background: var(--accent);
}

.natural-panel {
  display: grid;
  gap: 10px;
}

.event-description-help,
.time-help {
  margin: -2px 0 1px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.natural-panel > label,
.event-fields label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.natural-panel textarea,
.event-fields input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--field-background);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  line-height: 1.45;
  text-transform: none;
}

.natural-panel textarea:focus,
.event-fields input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.event-fields input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

html[data-theme="dark"] .event-fields input[type="time"],
html[data-theme="dark"] .event-fields input[type="time"]::-webkit-datetime-edit,
html[data-theme="dark"] .event-fields input[type="time"]::-webkit-datetime-edit-fields-wrapper,
html[data-theme="dark"] .event-fields input[type="time"]::-webkit-datetime-edit-hour-field,
html[data-theme="dark"] .event-fields input[type="time"]::-webkit-datetime-edit-minute-field,
html[data-theme="dark"] .event-fields input[type="time"]::-webkit-datetime-edit-ampm-field {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.natural-panel .dialog-primary {
  justify-self: end;
}

.natural-panel .voice-waveform {
  width: 100%;
  margin: 0;
}

.event-ai-controls,
.event-ai-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-ai-controls,
.event-ai-actions {
  width: 100%;
}

.event-ai-actions .dialog-primary {
  min-height: 42px;
}

.dialog-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.dialog-status.processing::before {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  content: "";
  background: var(--accent);
  border-radius: 50%;
  animation: event-status-pulse 700ms ease-in-out infinite alternate;
}

.dialog-status.error {
  color: var(--accent-dark);
}

@keyframes event-status-pulse {
  to {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

.event-preview {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.event-preview-heading,
.event-draft-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.event-preview-heading .preview-label {
  margin-bottom: 4px;
}

.event-preview-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.compact-button {
  flex: 0 0 auto;
  padding: 8px 12px;
}

.event-draft-list {
  display: grid;
  gap: 14px;
  margin-top: 15px;
}

.event-draft-card {
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(24, 34, 37, 0.05);
}

.event-draft-card.has-save-error {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.event-draft-heading {
  margin-bottom: 12px;
}

.event-draft-heading strong {
  color: var(--ink);
  font-size: 0.85rem;
}

.event-draft-remove {
  padding: 5px 0;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  font-size: 0.74rem;
  font-weight: 700;
}

.draft-clarification {
  margin: 0 0 12px;
}

.event-save-status {
  justify-content: flex-end;
  margin-top: 10px;
  color: var(--accent-dark);
  font-weight: 700;
  text-align: right;
}

.event-draft-fields {
  gap: 11px;
}

.preview-label {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.event-clarification {
  margin-bottom: 15px;
  padding: 12px;
  color: var(--ink);
  background: var(--field-background);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 0.78rem;
}

.event-clarification p {
  margin: 0 0 8px;
  font-weight: 700;
}

.event-clarification label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.draft-clarification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.draft-clarification p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.confirm-event-date {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--accent-dark);
  background: var(--soft-accent);
  border: 0;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
}

.event-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.wide-field,
.all-day-field {
  grid-column: 1 / -1;
}

.event-fields .all-day-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.event-fields .all-day-field input {
  width: auto;
  margin: 0;
}

.holiday-field {
  color: var(--holiday-ink) !important;
}

.holiday-field span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.optional-label {
  color: var(--placeholder);
  font-weight: 500;
  text-transform: none;
}

.dialog-actions {
  gap: 9px;
  margin-top: 21px;
}

.dialog-spacer {
  flex: 1;
}

.dialog-secondary,
.dialog-danger {
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
}

.dialog-secondary {
  color: var(--ink);
}

.dialog-danger {
  color: #c83b55;
}

.dialog-danger:hover {
  color: white;
  background: #c83b55;
  border-color: #c83b55;
}

@media (max-width: 900px) {
  .calendar-shell {
    width: min(100% - 20px, 1000px);
    margin: 10px auto;
    padding: 24px;
    border-radius: 22px;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-switcher {
    align-self: flex-start;
  }

  .month-day {
    min-height: 84px;
  }

  .year-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 620px) {
  .calendar-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 20px 15px;
    border-radius: 0;
  }

  .calendar-header,
  .calendar-brand {
    align-items: flex-start;
  }

  .calendar-brand {
    gap: 12px;
  }

  .back-link span {
    display: none;
  }

  .back-link {
    padding: 8px;
  }

  .add-event-button {
    padding: 9px 11px;
    font-size: 0.8rem;
  }

  .date-navigation {
    flex-wrap: wrap;
  }

  .year-navigation {
    flex-basis: 100%;
    margin: 6px 0 0;
  }

  .date-navigation h2 {
    flex: 1;
    margin: 0;
    text-align: center;
  }

  .view-switcher {
    width: 100%;
  }

  .view-switcher button {
    flex: 1;
  }

  .calendar-stage {
    min-height: 480px;
  }

  .weekday-row span {
    font-size: 0.58rem;
  }

  .month-day {
    min-height: 64px;
    padding: 4px;
  }

  .day-number {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .date-summary {
    display: none;
  }

  .year-grid {
    grid-template-columns: 1fr;
  }

  .calendar-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .appearance-picker {
    justify-content: space-between;
  }

  .event-fields {
    grid-template-columns: 1fr;
  }

  .event-preview-heading {
    align-items: flex-start;
  }

  .event-draft-card {
    padding: 13px;
  }

  .wide-field,
  .all-day-field {
    grid-column: auto;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .event-ai-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .event-ai-actions {
    width: 100%;
  }

  .event-ai-actions .dialog-primary {
    margin-right: auto;
  }
}

/* Editorial workspace refresh — taste-skill seed 1092139704. */
.calendar-shell {
  width: min(1100px, calc(100% - 48px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 32px;
  background: var(--paper);
  border-color: var(--paper-border);
  border-radius: 18px;
  box-shadow: none;
}

.calendar-header {
  align-items: center;
}

.calendar-brand {
  gap: 16px;
}

.calendar-brand h1 {
  font-family: "DM Sans", sans-serif;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.back-link,
.add-event-button,
.dialog-primary,
.today-button,
.icon-button,
.view-switcher,
.view-switcher button {
  border-radius: 8px;
}

.back-link {
  min-height: 40px;
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--ink);
}

.add-event-button,
.dialog-primary {
  min-height: 40px;
  background: var(--primary-button-background);
}

.add-event-button:hover,
.dialog-primary:hover:not(:disabled) {
  background: var(--primary-button-hover);
  transform: none;
}

.calendar-toolbar {
  margin-top: 24px;
  padding: 12px 0;
}

.date-navigation h2 {
  font-family: "DM Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.view-switcher {
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.view-switcher button {
  position: relative;
  padding-inline: 12px;
  color: var(--muted);
  background: transparent;
}

.view-switcher button.active {
  color: var(--ink);
  background: transparent;
}

.view-switcher button.active::after {
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 2px;
  content: "";
  background: var(--accent);
}

.calendar-stage {
  min-height: 0;
  margin-top: 20px;
}

.agenda-section h3,
.week-group-label {
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: none;
}

.day-heading span,
.empty-agenda,
.calendar-legend {
  font-size: 0.82rem;
}

.month-day,
.week-day,
.day-view,
.event-card,
.calendar-task-card {
  box-shadow: none;
}

.weekday-row span,
.preview-label,
.natural-panel > label,
.event-fields label {
  letter-spacing: 0;
  text-transform: none;
}

.calendar-footer {
  margin-top: 28px;
  padding-top: 18px;
}

.editor-dialog .dialog-card {
  border-radius: 14px;
}

@media (max-width: 720px) {
  .calendar-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 24px 18px 40px;
    border: 0;
    border-radius: 0;
  }

  .calendar-header {
    align-items: flex-start;
  }

  .calendar-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-stage {
    min-height: 0;
  }
}
