
.back-to-calendar-button {
  align-self: flex-start;
  border: 0;
  border-radius: 999px;
  background: var(--pill-active);
  color: #ffffff;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.12);
}

.back-to-calendar-button:hover {
  background: var(--pill-active-strong);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 248, 251, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}

.calendar-title-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.calendar-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.small-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
}

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

#todayButton,
#closeModal,
#closeTaskModal,
#closeEventModal {
  background: var(--pill-surface);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
}

#todayButton:hover,
#closeModal:hover,
#closeTaskModal:hover,
#closeEventModal:hover {
  background: var(--pill-surface-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#calendarTitle {
  cursor: pointer;
}

.title-pill {
  background: var(--pill-surface);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 9px 14px;
  width: auto;
  min-width: 0;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(31, 41, 55, 0.04);
}

.title-pill:hover {
  background: var(--pill-surface-hover);
}

.calendar-title-input {
  font-family: inherit;
  box-sizing: border-box;
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--pastel-blue-border);
  overflow-wrap: anywhere;
  outline: none;
  padding: 0;
  max-width: 420px;
}


.current-user-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 6px 16px rgba(31, 41, 55, 0.04);
}

.current-user-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.current-user-pill {
  border: 1px solid var(--line);
  background: var(--pill-surface);
  color: #55617a;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.current-user-pill.active {
  background: #5f6fe6;
  border-color: #5f6fe6;
  color: #ffffff;
}

.current-user-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-mini-item.read-only-item,
.event-block.read-only-item {
  cursor: pointer;
}

.view-only-notice {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.calendar-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.calendar-view-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

#addTaskButton:disabled,
#addEventButton:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.calendar-pill {
  background: var(--pill-surface);
  color: #55617a;
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 16px rgba(31, 41, 55, 0.04);
}

.calendar-pill:hover {
  background: var(--pill-surface-hover);
}

.calendar-pill.active,
.calendar-view-pill.active {
  background: var(--pill-active);
  color: white;
  border-color: var(--pill-active-strong);
}

.calendar-view-pill {
  background: var(--pill-surface);
  color: #55617a;
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(31, 41, 55, 0.04);
}

.calendar-view-pill:hover {
  background: var(--pill-surface-hover);
}

.view-separator {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  user-select: none;
}

.undo-button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.undo-button:hover:not(:disabled) {
  background: #f1f4f9;
}

.undo-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: start;
}


/* Analysis mode: the top title becomes a clean page title, so calendar-only controls are hidden. */
.app.analysis-mode #editCalendarNameButton,
.app.analysis-mode .calendar-view-switcher {
  display: none;
}

.app.analysis-mode #calendarTitle {
  cursor: default;
}
