/* Calendar modal: aligned, fluid and safe on narrow mobile screens. */
.ng-calendar {
  width: 100%;
  max-width: 430px;
  min-width: 0;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
  overflow: hidden;
  color: #f4f5f6;
  background: linear-gradient(145deg, #171a1e, #101316);
}

.ng-calendar,
.ng-calendar * { box-sizing: border-box; }

.ng-calendar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ng-calendar-header > div { min-width: 0; }
.ng-calendar-kicker { color: var(--tracker-lime, #b7ff00); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.ng-calendar-header h2 { margin: 7px 0 0; color: #fff; font-size: 28px; letter-spacing: -.04em; line-height: 1.12; }

.ng-calendar-close,
.ng-calendar-monthbar button {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  color: #d9dde1;
  background: rgba(255,255,255,.06);
  cursor: pointer;
}

.ng-calendar-monthbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 26px 0 18px;
}

.ng-calendar-monthbar strong {
  min-width: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
  text-align: center;
  text-transform: capitalize;
  overflow-wrap: anywhere;
}

.ng-calendar-weekdays,
.ng-calendar-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.ng-calendar-weekdays { margin-bottom: 8px; }
.ng-calendar-weekdays span { min-width: 0; color: #8d959d; font-size: 11px; font-weight: 800; text-align: center; text-transform: uppercase; }
.ng-calendar-grid { row-gap: 7px; }
.ng-calendar-empty { min-width: 0; min-height: 44px; }

.ng-calendar-day {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #dce0e4;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.ng-calendar-day span { line-height: 1; }
.ng-calendar-day:hover, .ng-calendar-day:focus-visible { border-color: rgba(183,255,0,.55); background: rgba(183,255,0,.1); outline: none; }
.ng-calendar-day.is-today { border-color: rgba(183,255,0,.52); color: var(--tracker-lime, #b7ff00); font-weight: 900; }
.ng-calendar-day.is-selected { color: #1b1003; background: linear-gradient(135deg, #ffb13b, #ff8a00); border-color: rgba(255,226,183,.7); box-shadow: 0 7px 18px rgba(255,138,0,.22); }
.ng-calendar-day.is-selected.is-today { color: #101408; border-color: var(--tracker-lime, #b7ff00); background: linear-gradient(135deg, #c5ff34, #8fde00); }
.ng-calendar-day i { position: absolute; right: 7px; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--tracker-lime, #b7ff00); }
.ng-calendar-day.is-selected i { background: #261300; }

.ng-calendar-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 20px 0 16px; color: #aeb4bb; font-size: 12px; }
.ng-calendar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ng-calendar-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.legend-today { border: 2px solid var(--tracker-lime, #b7ff00); }
.legend-activity { background: var(--tracker-lime, #b7ff00); }
.ng-calendar-today { width: 100%; min-height: 48px; border: 1px solid rgba(255,216,157,.45); border-radius: 16px; color: #1c1004; background: linear-gradient(135deg, #ffb13b, #ff8a00); font-size: 15px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 22px rgba(255,138,0,.2); }

/* Shared date entry point for nutrition/activity history. */
.history-date-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(190, 231, 235, .14);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(22, 39, 48, .82), rgba(11, 25, 34, .88));
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}

.history-date-control > div { display: grid; gap: 4px; min-width: 0; }
.history-date-kicker { color: rgba(216, 230, 231, .56); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.history-date-control strong { min-width: 0; color: #f5fbfb; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.history-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 11px !important;
  border: 1px solid rgba(255, 173, 50, .36) !important;
  color: #ffd28e !important;
  background: rgba(255, 138, 0, .10) !important;
  font-size: 12px !important;
  white-space: nowrap;
}
.history-date-button:active { transform: translateY(1px); }

/* Selected-day activity history stays compact and uses existing workout records. */
.history-activity-summary { padding: 14px !important; }
.history-activity-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-activity-summary-head > div { display: grid; gap: 4px; min-width: 0; }
.history-activity-summary-head strong { color: #f5fbfb; font-size: 14px; }
.history-activity-count { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(183,255,0,.32); border-radius: 12px; color: #b7ff00; background: rgba(183,255,0,.1); font-size: 14px; font-weight: 900; }
.history-activity-records { display: grid; gap: 7px; margin-top: 12px; }
.history-activity-record { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 8px; min-width: 0; color: #e7eeee; font-size: 13px; }
.history-activity-record i { color: #b7ff00; font-size: 12px; }
.history-activity-record span { min-width: 0; overflow-wrap: anywhere; }
.history-activity-record small { color: #93a1a3; font-size: 11px; white-space: nowrap; }
.history-activity-empty { margin: 10px 0 0; color: #91a0a3; font-size: 12px; line-height: 1.4; }

/* The generic bottom-sheet has its own padding. Keep calendar content inside it. */
.modal-sheet { overflow-x: hidden; }

@media (max-width: 420px) {
  .ng-calendar { padding: 20px 12px; }
  .ng-calendar-header h2 { font-size: 26px; }
  .ng-calendar-monthbar { gap: 8px; margin-top: 22px; }
  .ng-calendar-weekdays, .ng-calendar-grid { gap: 3px; }
  .ng-calendar-day { min-height: 40px; border-radius: 11px; }
  .ng-calendar-empty { min-height: 40px; }
  .ng-calendar-day i { right: 5px; bottom: 5px; }
  .history-date-control { gap: 8px; padding: 11px 12px; }
  .history-date-button { padding-inline: 9px !important; }
}

@media (max-width: 350px) {
  .ng-calendar { padding-left: 8px; padding-right: 8px; }
  .ng-calendar-close, .ng-calendar-monthbar button { flex-basis: 38px; width: 38px; height: 38px; }
  .ng-calendar-monthbar { grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .ng-calendar-day { font-size: 14px; }
  .history-date-button span { display: none; }
  .history-date-button { width: 44px; padding-inline: 0 !important; }
}
