/* ---------------------------------------------------------------------------
   Day planner uplift

   Keep Tempered dark, but move utility surfaces from midnight/navy toward a
   brighter dusk/teal palette. Calm should mean readable and inviting, not dim.
   --------------------------------------------------------------------------- */

.screen--today-calm {
  --calm-surface: var(--surface-2);
  --calm-surface-raised: var(--surface-2);
  --calm-line: var(--surface-2);
  --calm-text-2: var(--surface-2);
  --calm-text-3: var(--surface-2);
  --calm-accent: var(--chart);
  --planner-work: var(--chart);
  --planner-personal: var(--chart);
  gap: 12px;
}

/* Give Today a brighter atmospheric field without changing Character/Battle. */
body:has(.screen--today-calm) {
  background: var(--surface-1);
}
body:has(.screen--today-calm)::before {
  opacity: 0.18;
  filter: none;
}

.today-summary {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 18px;
  border-color: var(--text-2);
  background: var(--surface-1);
  box-shadow: none;
}
.today-summary__top {
  align-items: center;
  gap: 9px;
}
.today-summary__copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.today-summary__eyebrow {
  margin: 0;
  white-space: nowrap;
}
.today-summary__headline {
  font-size: 17px;
  line-height: 1;
  white-space: nowrap;
}
.today-summary__percent {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 680;
}
.today-summary__recap {
  appearance: none;
  min-height: 44px;
  margin-left: auto;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}
.today-summary__bar {
  height: 4px;
}
.today-summary__eyebrow { color: var(--text-2); }
.today-summary__bar { background: var(--surface-1); }
.today-summary__fill {
  background: var(--surface-1);
  box-shadow: none;
}
.today-summary__xp { color: var(--text-2); }

/* ---- Week/date rail ------------------------------------------------------ */
.today-calendar {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 18px 39px 7px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-1);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.today-calendar__head {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}
.today-calendar__month {
  position: absolute;
  top: 5px;
  right: 48px;
  left: 48px;
  text-align: center;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 670;
  line-height: 1;
}
.today-calendar__nav,
.today-calendar__back {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}
.today-calendar__nav {
  position: absolute;
  top: 10px;
  width: 44px;
  height: 44px;
  pointer-events: auto;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
}
.today-calendar__nav:first-child { left: 2px; }
.today-calendar__nav:last-child { right: 2px; }
.today-calendar__nav:active { background: var(--surface-1); }
.today-calendar__days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.today-calendar__day {
  appearance: none;
  position: relative;
  min-width: 0;
  min-height: 42px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 5px 2px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}
.today-calendar__day[data-selected='true'] {
  border-color: var(--text-2);
  background: var(--surface-1);
  color: var(--text-2);
  box-shadow: none;
}
.today-calendar__dow {
  font-size: 12px;
  font-weight: 720;
  
}
.today-calendar__num {
  font-size: 15px;
  font-weight: 680;
  line-height: 1;
}
.today-calendar__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--calm-accent);
}
.today-calendar__back {
  justify-self: center;
  min-height: 32px;
  margin-bottom: -3px;
  padding: 2px 10px 0;
  color: var(--calm-accent);
  font-size: 12px;
  font-weight: 650;
}

/* ---- Daily recap ------------------------------------------------------- */
.today-recap-overlay {
  position: fixed;
  z-index: 1300;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: grid;
  align-items: end;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  background: var(--surface-1);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body[data-daily-recap-open='true'] { overflow: hidden; }
.prior-day-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 13px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-1);
}
.prior-day-review > div { min-width: 0; display: grid; gap: 3px; }
.prior-day-review strong { color: var(--text-2); font-size: 12px; }
.prior-day-review span { color: var(--text-2); font-size: 12px; line-height: 1.35; }
.prior-day-review__button {
  flex: none;
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-1);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 820;
}
.today-recap {
  width: min(100%, 560px);
  max-height: min(82vh, 720px);
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 0;
  border-radius: 26px;
  background: var(--surface-1);
  box-shadow: none;
}
.today-recap__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.today-recap__head > div { min-width: 0; display: grid; gap: 3px; }
.today-recap__eyebrow {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  
}
.today-recap__title { margin: 0; font-size: 24px; letter-spacing: 0; }
.today-recap__detail { margin: 0; color: var(--text-2); font-size: 12px; }
.today-recap__close {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text-2);
  font: 400 27px/1 system-ui;
}
.today-recap__training {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.today-recap__stat {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 7px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
  text-align: center;
}
.today-recap__stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.today-recap__stat span { color: var(--text-2); font-size: 12px; font-weight: 730; letter-spacing: 0; }
.today-recap__lifestyle { display: grid; gap: 8px; }

/* ---- Foldable section headers ------------------------------------------ */
.today-section__head--fold { align-items: center; }
.today-section__fold {
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.today-section__fold-copy { min-width: 0; display: grid; }
.today-section__fold-chevron {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--calm-text-3);
}
.today-section__fold-chevron .icon { width: 13px; height: 13px; }
.today-section__add,
.today-section__start {
  appearance: none;
  flex: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-1);
  color: var(--calm-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.today-section__add .icon,
.today-section__start .icon { width: 12px; height: 12px; }
.today-section__start {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Planner ------------------------------------------------------------ */
.today-section--planner {
  padding: 13px 14px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--surface-1);
}
.today-plan { display: grid; gap: 10px; padding-top: 8px; }
.today-plan-list {
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  background: var(--surface-1);
}
.today-plan-item {
  min-height: 53px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--calm-line);
}
.today-plan-item:last-child { border-bottom: 0; }
.today-plan-item__check {
  appearance: none;
  flex: none;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--text-2);
  cursor: pointer;
}
.today-plan-item__check .icon { width: 14px; height: 14px; }
.today-plan-item[data-done='true'] .today-plan-item__check {
  border-color: var(--text-2);
  background: var(--surface-1);
}
.today-plan-item__main {
  appearance: none;
  min-width: 0;
  min-height: 44px;
  flex: 1;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.today-plan-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 610;
}
.today-plan-item[data-done='true'] .today-plan-item__title {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-color: var(--text-2);
}
.today-plan-item__kind {
  width: max-content;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  color: var(--planner-personal);
  background: var(--surface-1);
}
.today-plan-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.today-plan-item__rolled,
.today-plan-item__due {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 620;
}
.today-plan-item__due { color: var(--text-2); }
.today-plan-item[data-kind='work'] .today-plan-item__kind {
  color: var(--planner-work);
  background: var(--surface-1);
}
.today-plan-item__remove {
  appearance: none;
  flex: none;
  width: 29px;
  height: 29px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}
.today-plan-empty {
  appearance: none;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--calm-text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.today-plan-compose {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
}
.today-plan-compose__input {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 12px;
  outline: none;
}
.today-plan-compose__input:focus { border-color: var(--text-2); }
.today-plan-compose__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.today-plan-kind {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface-1);
}
.today-plan-kind__button,
.today-plan-compose__add {
  appearance: none;
  min-height: 31px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--calm-text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 670;
  padding: 0 9px;
  cursor: pointer;
}

.task-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface-1);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.task-detail-card {
  width: min(100%, 540px);
  max-height: calc(100dvh - max(28px, env(safe-area-inset-top)) - 18px);
  overflow-y: auto;
  display: grid;
  gap: 15px;
  padding: 20px;
  border: 0;
  border-radius: 24px;
  background: var(--surface-1);
  box-shadow: none;
}
.task-detail-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.task-detail-card__eyebrow {
  color: var(--calm-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.task-detail-card__heading { margin: 3px 0 0; font-size: 25px; line-height: 1.05; }
.task-detail-card__close {
  appearance: none;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 25px;
}
.task-detail__field { display: grid; gap: 7px; color: var(--calm-text-2); font-size: 12px; font-weight: 720; }
.task-detail__title,
.task-detail__notes,
.task-detail__due {
  width: 100%;
  min-height: 48px;
  resize: vertical;
  padding: 12px;
  border: 0;
  border-radius: 13px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  outline: none;
}
.task-detail__notes { min-height: 118px; font-size: 14px; }
.task-detail__due { resize: none; color-scheme: dark; }
.task-detail__title:focus,
.task-detail__notes:focus,
.task-detail__due:focus { border-color: var(--text-2); box-shadow: none; }
.task-detail__title[aria-invalid='true'] { border-color: var(--text-2); }
.task-detail__kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.task-detail__kind {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-1);
  color: var(--calm-text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
}
.task-detail__kind[data-active='true'] { border-color: var(--text-2); background: var(--surface-1); color: var(--text-2); }
.task-detail__rollover { margin: 0; color: var(--calm-text-2); font-size: 12px; line-height: 1.45; }
.task-detail__actions { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; }
.task-detail__actions .button { min-height: 48px; min-width: 0; padding-inline: 11px; }
.task-detail__delete { color: var(--text-2); }
.task-detail__save { border-color: var(--text-2); background: var(--surface-1); color: var(--text-2); }

/* ---- Train library sub-screen ----------------------------------------- */
.train-library-link {
  appearance: none;
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-1);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.train-library-link__icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--calm-accent);
}
.train-library-link__icon .icon { width: 21px; height: 21px; }
.train-library-link__main { min-width: 0; flex: 1; display: grid; gap: 4px; }
.train-library-link__title { font-size: 17px; font-weight: 720; }
.train-library-link__meta { color: var(--calm-text-2); font-size: 12px; line-height: 1.35; }
.train-library-link__arrow { flex: none; color: var(--calm-accent); font-size: 30px; line-height: 1; }
.train-library-header { display: flex; align-items: center; gap: 13px; padding-right: 52px; }
.train-library-header__back {
  appearance: none;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 31px;
  line-height: 1;
}
.train-library-header__eyebrow { display: block; margin-bottom: 3px; color: var(--calm-accent); font-size: 12px; font-weight: 800; letter-spacing: 0; }
.train-library-header .screen__title { font-size: 27px; }
.train-library-screen { gap: 12px; }
.today-plan-kind__button[data-active='true'] {
  background: var(--surface-1);
  color: var(--text-2);
}
.today-plan-compose__add {
  background: var(--surface-1);
  color: var(--calm-accent);
  padding-inline: 12px;
}

/* ---- Tracker rows and custom one-tap amounts --------------------------- */
.today-list {
  border-color: var(--text-2);
  background: var(--surface-1);
  box-shadow: none;
}
.today-item-wrap { border-color: var(--text-2); }
.today-item.today-item--number { gap: 6px; padding-right: 9px; }
.today-item__body {
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: stretch;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.today-item__body:disabled { cursor: default; }
.today-item__quick {
  appearance: none;
  flex: none;
  min-width: 48px;
  min-height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-1);
  color: var(--calm-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}
.today-item__expand {
  appearance: none;
  flex: none;
  width: 28px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--calm-text-3);
  cursor: pointer;
}
.today-item__expand .icon { width: 12px; height: 12px; }
.today-item__icon[data-attribute='wind'] { background: var(--surface-1); color: var(--text-2); }
.today-item__icon[data-attribute='vitality'] { background: var(--surface-1); color: var(--text-2); }
.today-item__icon[data-attribute='mind'] { background: var(--surface-1); color: var(--text-2); }
.today-item__icon[data-attribute='might'] { background: var(--surface-1); color: var(--text-2); }
.today-item__icon[data-complete='true'] { background: var(--surface-1); color: var(--text-2); }

.today-editor { background: var(--surface-1); }
.today-editor__preset {
  display: grid;
  grid-template-columns: auto 64px auto 1fr;
  align-items: center;
  gap: 7px;
}
.today-editor__preset-label,
.today-editor__preset-unit { color: var(--calm-text-2); font-size: 12px; }
.today-editor__preset-input {
  width: 64px;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 0 8px;
}
.today-editor__preset-save {
  appearance: none;
  justify-self: end;
  min-height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--calm-text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 0 9px;
  cursor: pointer;
}

/* ---- Flexible training ------------------------------------------------- */
.today-section--training {
  padding: 13px 14px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--surface-1);
}
.today-training { display: grid; gap: 10px; padding-top: 8px; }
.today-training__hint {
  margin: 0 4px;
  color: var(--calm-text-3);
  font-size: 12px;
  line-height: 1.45;
}
.today-training__completed-toggle { justify-self: start; }
.today-item--exercise .today-item__cta { color: var(--text-2); }

.today-empty {
  border-color: var(--text-2);
  background: var(--surface-1);
}


.today-firstweek { display: grid; gap: 9px; padding: 16px; border: 0; border-radius: 20px; background: var(--surface-1); box-shadow: none; }
.today-firstweek__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-firstweek__eyebrow,.first-week-guide__eyebrow { color: var(--acid); font-size: 12px; font-weight: 850; letter-spacing: 0; }
.today-firstweek h2 { margin: 3px 0 0; font-size: 20px; line-height: 1.05; }
.today-firstweek__badge { flex: none; padding: 5px 8px; border: 0; border-radius: 999px; color: var(--acid); font-size: 12px; font-weight: 850; letter-spacing: 0; }
.today-firstweek__copy,.today-firstweek__hint { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.today-firstweek__hint { color: var(--text-3); font-size: 12px; }
.today-firstweek__start { min-height: 44px; border: 0; border-radius: 12px; background: var(--acid); color: var(--canopy); font: inherit; font-size: 12px; font-weight: 900; letter-spacing: 0; }
.first-week-guide { display: grid; gap: 7px; margin: 12px 0; padding: 13px; border: 0; border-radius: 16px; background: var(--surface-1); }
.first-week-guide strong { font-size: 17px; }
.first-week-guide p { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.settings-access {
  border-color: var(--text-2);
  background: var(--surface-1);
}

@media (max-width: 390px) {
  .today-calendar { padding-inline: 39px; }
  .today-calendar__days { gap: 3px; }
  .today-calendar__day { min-height: 42px; border-radius: 11px; }
  .today-section--planner,
  .today-section--training { padding-inline: 12px; }
  .today-item__quick { min-width: 44px; padding-inline: 7px; }
  .today-editor__preset { grid-template-columns: auto 56px auto 1fr; }
  .today-editor__preset-input { width: 56px; }
}

@media (prefers-reduced-transparency: reduce) {
  .today-calendar,
  .today-recap-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
