/* Production override for the diary page: neutral white theme and compact calendar. */
:root {
  --accent: #202936;
  --accent-soft: #f4f6f8;
  --green: #475569;
  --text-strong: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --line: rgba(17, 24, 39, 0.1);
  --shadow: 0 16px 42px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.05);
}

body {
  background: #ffffff;
}

.diary-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 251, 252, 0.96) 52%, rgba(244, 246, 248, 0.94) 100%),
    #ffffff;
}

.diary-header h1 {
  color: #111827;
}

.diary-header p:not(.section-kicker),
.storage-status,
.appointment-card p {
  color: #6b7280;
}

.storage-setup-notice,
.storage-choice-button,
.storage-choice-button.is-active,
.storage-choice-button:hover,
.storage-choice-button:focus-visible,
.diary-shell .icon-button,
.diary-shell .secondary-button,
.diary-shell .form-card > button,
.diary-shell .primary-button,
.appointment-card,
.appointment-card.is-active,
.linked-record-draft-card,
.medication-row,
.lab-test-row,
.diary-shell .agenda-item,
.diary-shell .agenda-item:hover,
.diary-shell .agenda-item:focus-visible {
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.storage-setup-notice strong,
.storage-choice-button,
.storage-choice-button.is-active,
.diary-shell .icon-button,
.diary-shell .secondary-button,
.appointment-icon-button,
.appointment-edit-button,
.medication-section-title,
.lab-test-section-title {
  color: #202936;
}

.storage-setup-notice p,
.medication-row span,
.medication-row small,
.medication-empty,
.lab-test-row span,
.lab-test-row small {
  color: #6b7280;
}

.storage-choice-button:hover,
.storage-choice-button:focus-visible,
.diary-shell .form-card > button:not(:disabled):hover,
.diary-shell .primary-button:not(:disabled):hover,
.diary-shell .agenda-item:hover,
.diary-shell .agenda-item:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(17, 24, 39, 0.1), inset 0 0 0 1px rgba(17, 24, 39, 0.1);
}

.diary-shell .form-card > button,
.diary-shell .primary-button {
  color: #ffffff;
  background: linear-gradient(180deg, #202936 0%, #111827 100%);
}

.diary-shell .form-card > button:disabled {
  color: #8b949e;
  background: linear-gradient(180deg, #f5f6f7 0%, #eceff2 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.appointment-done-toggle {
  color: #202936;
  background: #f5f6f8;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.appointment-done-toggle input {
  accent-color: #202936;
}

.appointment-icon-button,
.appointment-edit-button {
  color: #202936;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.08), inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.storage-choice-panel {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  display: block;
}

.storage-choice-panel:has(.storage-choice-button.is-active)::after {
  content: none;
  display: none;
}

.storage-choice-button,
.storage-choice-button:hover,
.storage-choice-button:focus-visible,
.storage-choice-button.is-active {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: transparent;
  font-size: 0;
  line-height: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23202936' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z'/%3E%3C/svg%3E") center / 18px 18px no-repeat,
    linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(17, 24, 39, 0.08);
  transform: none;
}

.storage-choice-button::before,
.storage-choice-button::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  display: none;
}

.storage-choice-button::before {
  left: 10px;
  top: 16px;
  width: 25px;
  height: 17px;
  border: 2.2px solid #202936;
  border-radius: 4px 4px 6px 6px;
  background: #ffffff;
}

.storage-choice-button::after {
  left: 12px;
  top: 11px;
  width: 13px;
  height: 8px;
  border: 2.2px solid #202936;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #ffffff;
}

.storage-choice-button:hover,
.storage-choice-button:focus-visible {
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.12), inset 0 0 0 1px rgba(17, 24, 39, 0.12);
}

.storage-status {
  display: none;
}

.diary-top-row {
  align-items: stretch;
}

.diary-top-row > .form-card,
.diary-top-row > .health-calendar {
  align-self: stretch;
}

.diary-top-row > .health-calendar {
  height: 100%;
}

.calendar-layout {
  grid-template-columns: max-content minmax(230px, 1fr);
  gap: 28px;
}

.diary-shell .calendar-grid {
  grid-template-columns: repeat(7, 56px);
  justify-content: start;
  gap: 8px;
}

.calendar-weekday {
  width: 56px;
  justify-self: center;
  text-align: center;
  font-size: 14px;
}

.diary-shell .calendar-day {
  position: relative;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  display: block;
  color: #24313d;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.09);
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
}

.diary-shell .calendar-day > span {
  position: absolute;
  inset: 0;
  display: flex;
  width: auto;
  height: auto;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.diary-shell .calendar-day.is-muted {
  color: #6b7280;
  background: #fafbfc;
}

.diary-shell .calendar-day.has-visits {
  color: #111827;
  background: linear-gradient(180deg, #ffffff 0%, #f3f5f7 100%);
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.1), inset 0 0 0 1px rgba(17, 24, 39, 0.1);
}

.calendar-day-events {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.calendar-event-count {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 999px;
  color: #ffffff;
  background: #202936;
  box-shadow: 0 4px 8px rgba(17, 24, 39, 0.12);
  font-size: 10px;
  pointer-events: auto;
}

@media (max-width: 1180px) {
  .calendar-layout {
    grid-template-columns: max-content minmax(220px, 1fr);
    gap: 24px;
  }

  .diary-shell .calendar-grid {
    grid-template-columns: repeat(7, 52px);
    gap: 7px;
  }

  .calendar-weekday,
  .diary-shell .calendar-day {
    width: 52px;
  }

  .diary-shell .calendar-day {
    height: 52px;
    min-height: 52px;
    font-size: 17px;
  }
}

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

  .diary-top-row > .health-calendar {
    height: auto;
  }

  .storage-choice-panel {
    flex: 0 0 44px;
    width: 44px;
  }

  .storage-choice-panel:has(.storage-choice-button.is-active)::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .diary-shell .calendar-grid {
    grid-template-columns: repeat(7, 38px);
    gap: 5px;
  }

  .calendar-weekday,
  .diary-shell .calendar-day {
    width: 38px;
  }

  .diary-shell .calendar-day {
    height: 38px;
    min-height: 38px;
    border-radius: 9px;
    font-size: 14px;
  }
}
