:root {
  color-scheme: light;
  --bg: #faf9f6;
  --bg-soft: rgba(244, 237, 227, 0.75);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-muted: rgba(247, 243, 236, 0.82);
  --ink: #245a73;
  --body: #434f56;
  --accent: #2f80c3;
  --mint: #8fd3b6;
  --teal: #83c5be;
  --coral: #e8a598;
  --sand: #e8d9c8;
  --line: rgba(36, 90, 115, 0.09);
  --line-strong: rgba(36, 90, 115, 0.14);
  --shadow: 0 18px 50px rgba(36, 90, 115, 0.14);
  --shadow-soft: 0 10px 28px rgba(36, 90, 115, 0.10);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 15px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(131, 197, 190, 0.18), transparent 24rem),
    radial-gradient(circle at bottom left, rgba(232, 217, 200, 0.32), transparent 28rem),
    linear-gradient(135deg, var(--bg), #f8f4ed 55%, #fbfaf7);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 1.2rem 1rem 8.4rem;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(8px);
}

.orb-one {
  width: 18rem;
  height: 18rem;
  background: rgba(131, 197, 190, 0.14);
  top: -5rem;
  right: -5rem;
}

.orb-two {
  width: 20rem;
  height: 20rem;
  background: rgba(232, 217, 200, 0.24);
  left: -8rem;
  bottom: 3rem;
}

.app-main {
  position: relative;
  z-index: 1;
  width: min(40rem, 100%);
  margin: 0 auto;
}

.screen-section {
  display: grid;
  gap: 1rem;
}

.screen-header {
  padding: 0.35rem 0 0.1rem;
}

.screen-header h1 {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.card h2,
.section-heading h2,
.modal-head h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.detail-stack h3,
.suggestion-card h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.screen-subtitle,
.card p,
.support-copy,
.empty-state p,
.detail-stack p,
.message-bubble p {
  margin: 0;
  color: var(--body);
  line-height: 1.6;
}

.today-header .screen-subtitle {
  font-size: 0.98rem;
}

.hero-copy {
  display: grid;
  gap: 0.28rem;
}

.centered-actions {
  justify-content: center;
}

.screen-subsection {
  display: grid;
  gap: 0.8rem;
}

.section-heading p {
  margin: 0.22rem 0 0;
  color: var(--body);
}

.surface-card,
.session-card,
.calendar-entry,
.launch-card,
.muscle-card,
.routine-day,
.launch-instruction-card,
.archive-row,
.suggestion-card,
.day-plan-card,
.occasion-surface {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.surface-card {
  padding: 1rem;
}

.surface-card .card-body,
.surface-card .card-footer {
  margin-top: 0.7rem;
}

.card-header h2 {
  font-size: 1.12rem;
}

.card-header p,
.stack-card-copy p,
.rabbit-modal-heading p,
.status-surface p {
  margin: 0;
}

.stack-card-copy {
  display: grid;
  gap: 0.28rem;
}

.stack-card-copy h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.button,
.tab-button,
.launch-card,
.session-card,
.calendar-entry,
.muscle-card,
.stack-card-button {
  border: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.68rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.button-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(47, 128, 195, 0.22);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border-color: var(--line);
}

.button-tertiary {
  background: transparent;
  color: var(--body);
  border-color: transparent;
  box-shadow: none;
}

.button-danger {
  background: rgba(232, 165, 152, 0.14);
  color: #8f4036;
  border-color: rgba(163, 63, 55, 0.1);
}

.button-row,
.meta-row,
.toggle-grid,
.hero-actions,
.day-chip-grid {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.meta-row,
.session-meta {
  color: var(--body);
  font-size: 0.82rem;
}

.button-row.split .button {
  flex: 1 1 0;
}

.button-row.wrap .button {
  flex: 0 0 auto;
}

.notes-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.55rem;
}

.notes-actions-grid .button {
  justify-content: flex-start;
  text-align: left;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.form-field {
  display: grid;
  gap: 0.32rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.form-field small,
.support-copy {
  font-weight: 500;
  color: var(--body);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

.checkbox-field,
.day-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--ink);
}

.checkbox-field input {
  width: auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  background: rgba(232, 217, 200, 0.7);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
}

.pill.green {
  background: rgba(143, 211, 182, 0.28);
}

.pill.blue {
  background: rgba(47, 128, 195, 0.16);
}

.pill.warm {
  background: rgba(232, 165, 152, 0.22);
}

.rabbit-surface,
.occasion-card,
.status-surface,
.detail-stack,
.day-plan-card,
.suggestion-card {
  display: grid;
  gap: 0.65rem;
}

.rabbit-card {
  gap: 0.7rem;
  max-width: 31rem;
  margin-inline: auto;
  justify-items: center;
  text-align: center;
}

.rabbit-card-copy {
  display: grid;
  gap: 0.38rem;
  justify-items: center;
}

.rabbit-card .button-primary {
  min-width: 9.5rem;
}

.rabbit-mark-wrap {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(131, 197, 190, 0.16);
}

.rabbit-mark {
  width: 1.7rem;
  height: 1.7rem;
  object-fit: contain;
}

.launch-card,
.session-card,
.calendar-entry,
.muscle-card,
.stack-card-button {
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.95rem;
  color: inherit;
}

.quick-launch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  max-width: 31rem;
  margin-inline: auto;
}

.routine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.8rem, 1fr));
  gap: 0.6rem;
}

.launch-card {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  min-height: 0;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.66);
  text-align: center;
}

.launch-card strong {
  font-size: 0.98rem;
}

.session-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9rem;
}

.launch-card span,
.calendar-entry span,
.session-card p,
.muscle-card span {
  display: block;
  color: var(--body);
  margin-top: 0.3rem;
}

.launch-instruction-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.launch-instruction {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
}

.calendar-stack,
.rabbit-messages {
  display: grid;
  gap: 0.65rem;
}

.week-strip {
  display: flex;
  gap: 0.55rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  margin-inline: -0.1rem;
  scroll-snap-type: x proximity;
}

.day-button {
  min-width: 3.75rem;
  min-height: 4.35rem;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.65rem 0.55rem;
  color: var(--ink);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.18rem;
  scroll-snap-align: start;
  border: 1px solid var(--line);
}

.day-button.is-selected {
  background: var(--accent);
  color: white;
}

.day-button span,
.day-button strong {
  display: block;
}

.routine-day {
  min-width: 9.5rem;
  padding: 0.72rem 0.8rem;
  border-radius: 16px;
  background: var(--panel-muted);
}

.calendar-entry {
  display: grid;
  gap: 0.22rem;
}

.day-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.today-screen {
  --today-shell-width: min(100%, 34rem);
  justify-items: center;
  text-align: center;
  gap: 1.6rem;
}

.today-screen > .screen-header,
.today-screen > .surface-card,
.today-screen > .screen-subsection,
.today-screen > .card,
.today-screen > .empty-state-card {
  width: var(--today-shell-width);
}

.today-screen > .card > * {
  width: 100%;
  max-width: none;
}

.today-screen .section-heading,
.today-screen .empty-state {
  width: 100%;
}

.today-screen .surface-card .card-header,
.today-screen .surface-card .card-body,
.today-screen .surface-card .card-footer,
.today-screen .section-heading,
.today-screen .support-copy,
.today-screen .empty-state,
.today-screen .calendar-entry,
.today-screen .stack-card-copy,
.today-screen .meta-row {
  text-align: center;
}

.today-screen .surface-card .card-header,
.today-screen .surface-card .card-body,
.today-screen .surface-card .card-footer {
  display: grid;
  justify-items: center;
  width: 100%;
}

.today-screen .calendar-stack,
.today-screen .week-strip {
  justify-content: center;
  width: 100%;
}

.today-screen .stack-card-button {
  text-align: center;
}

.today-screen .rabbit-card,
.today-screen .quick-launch-grid,
.today-screen .occasion-card,
.today-screen .today-notes-section {
  max-width: none;
}

.today-screen .quick-add-form,
.today-screen .surface-card .card-body > .stack-form {
  width: 100%;
}

.today-screen .quick-add-form textarea {
  width: 100%;
  min-height: 9rem;
}

.today-screen .quick-add-actions {
  justify-content: center;
}

.today-screen .quick-add-actions .button {
  min-height: 2.35rem;
  min-width: 7.4rem;
  padding: 0.56rem 0.9rem;
}

.today-screen .stack-card-button,
.today-screen .calendar-entry {
  width: 100%;
}

.today-screen > .screen-header {
  margin-bottom: -0.15rem;
}

.today-screen > .card,
.today-screen > .surface-card,
.today-screen > .screen-subsection,
.today-screen > .empty-state-card {
  margin-top: 0.1rem;
}

.today-screen .quick-launch-grid {
  row-gap: 0.95rem;
}

.today-screen .surface-card {
  padding-top: 1.15rem;
  padding-bottom: 1.15rem;
}

.today-screen .calendar-stack {
  gap: 0.85rem;
}

.today-screen .today-notes-section {
  padding-top: 0.1rem;
}

.today-screen .today-notes-section .section-heading {
  margin-bottom: 0.15rem;
}

.app-shell.is-modal-open .tab-bar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(1rem);
}

.app-shell.is-modal-open .app-main {
  pointer-events: none;
}

.quick-add-form textarea {
  min-height: 8.25rem;
}

.muscle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.7rem;
}

.muscle-card.is-selected {
  background: rgba(47, 128, 195, 0.14);
}

.empty-state {
  text-align: center;
  padding: 0.7rem;
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 1.15rem;
  transform: translateX(-50%);
  width: min(38rem, calc(100% - 1.1rem));
  display: flex;
  gap: 0.38rem;
  padding: 0.45rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(36, 90, 115, 0.16);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.tab-button {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 16px;
  min-height: 3.45rem;
  padding: 0.55rem 0.45rem;
  background: transparent;
  color: var(--ink);
  display: grid;
  gap: 0.18rem;
  justify-items: center;
  font-size: 0.79rem;
  font-weight: 700;
}

.tab-button.is-active {
  background: var(--accent);
  color: white;
}

.tab-icon {
  width: 1.3rem;
  height: 1.3rem;
  display: grid;
  place-items: center;
}

.tab-icon svg {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
}

.tab-label {
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 44, 52, 0.36);
  display: grid;
  place-items: center;
  padding:
    max(0.8rem, env(safe-area-inset-top))
    max(0.8rem, env(safe-area-inset-right))
    max(0.8rem, calc(env(safe-area-inset-bottom) + 0.45rem))
    max(0.8rem, env(safe-area-inset-left));
  z-index: 40;
}

.modal-shell {
  width: min(38rem, calc(100vw - 1.6rem));
  max-height: min(90dvh, 52rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  overscroll-behavior: contain;
  isolation: isolate;
  background: rgba(250, 249, 246, 0.98);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(36, 90, 115, 0.18);
  padding: 0.95rem 1rem 1rem;
}

.rabbit-shell {
  width: min(32rem, 100%);
}

.rabbit-panel {
  display: grid;
  gap: 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 0;
  padding-bottom: 0.75rem;
  background: linear-gradient(180deg, rgba(250, 249, 246, 0.98), rgba(250, 249, 246, 0.94));
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-head .button {
  min-height: 2.35rem;
  padding: 0.5rem 0.8rem;
}

.modal-content,
.rabbit-body,
.archive-panel {
  display: grid;
  gap: 0.85rem;
  min-height: 0;
}

.modal-content,
.rabbit-body {
  overflow: auto;
  padding-top: 0.9rem;
  padding-bottom: 0.35rem;
  padding-right: 0.08rem;
}

.modal-content .stack-form {
  gap: 0.72rem;
}

.modal-content .form-field {
  gap: 0.26rem;
  font-size: 0.9rem;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  padding: 0.72rem 0.82rem;
  border-radius: 15px;
}

.modal-content textarea {
  min-height: 6rem;
}

.modal-content .toggle-grid,
.modal-content .three-col {
  gap: 0.6rem;
}

.modal-content .checkbox-field {
  min-height: 2.6rem;
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.78);
}

.modal-content .button-row {
  justify-content: center;
}

.quick-launch-modal {
  display: grid;
  gap: 1rem;
}

.day-picker {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.55rem;
}

.day-picker legend {
  padding: 0;
  font-weight: 700;
  color: var(--ink);
}

.day-chip-grid {
  align-items: stretch;
}

.day-chip {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.day-chip input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.day-chip span {
  font-size: 0.88rem;
  line-height: 1;
}

.rabbit-modal-heading {
  display: grid;
  gap: 0.3rem;
  justify-items: center;
}

.rabbit-modal-controls {
  justify-content: center;
}

.rabbit-modal-controls .button {
  min-height: 2.15rem;
  padding: 0.42rem 0.72rem;
  font-size: 0.88rem;
}

.message-bubble {
  max-width: 21rem;
  padding: 0.8rem 0.9rem;
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(36, 90, 115, 0.06);
  text-align: center;
}

.message-bubble.from-user {
  justify-self: end;
  background: rgba(47, 128, 195, 0.14);
}

.message-bubble.from-rabbit {
  justify-self: start;
  background: rgba(255, 255, 255, 0.92);
}

.archive-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.archive-row button {
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.danger-link {
  color: #a33f37;
  font-weight: 700;
}

.rabbit-composer textarea {
  min-height: 6.25rem;
}

.rabbit-send-row .button {
  min-width: 6.9rem;
}

.modal-content form.stack-form {
  min-height: 100%;
  align-content: start;
}

.modal-content form.stack-form > .button-row:last-child {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.55rem;
  align-items: stretch;
  padding-top: 0.75rem;
  padding-bottom: 0.15rem;
  background: linear-gradient(180deg, rgba(250, 249, 246, 0), rgba(250, 249, 246, 0.98) 36%);
  z-index: 1;
}

.modal-content form.stack-form > .button-row:last-child .button {
  width: 100%;
  min-height: 2.45rem;
  padding: 0.56rem 0.8rem;
}

@media (max-width: 720px) {
  .app-shell {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .tab-bar {
    width: calc(100% - 1rem);
    overflow-x: auto;
  }

  .tab-button {
    min-width: 4.65rem;
  }

  .modal-shell {
    width: min(100%, calc(100vw - 1rem));
    max-height: min(92dvh, 100%);
    padding: 0.85rem 0.9rem 0.9rem;
  }

  .modal-head {
    flex-direction: column;
    align-items: center;
  }

  .button-row.split {
    display: grid;
    grid-template-columns: 1fr;
  }

  .notes-actions-grid {
    grid-template-columns: 1fr;
  }

  .quick-launch-grid {
    grid-template-columns: 1fr;
  }

  .session-card {
    align-items: start;
    flex-direction: column;
  }

  .today-screen .surface-card,
  .today-screen .section-heading,
  .rabbit-card,
  .quick-launch-grid {
    width: 100%;
  }

  .rabbit-modal-controls {
    width: 100%;
    justify-content: center;
  }

  .modal-content .stack-form {
    gap: 0.65rem;
  }

  .modal-content .form-field {
    font-size: 0.88rem;
  }

  .modal-content input,
  .modal-content textarea,
  .modal-content select {
    padding: 0.68rem 0.78rem;
  }

  .modal-content .toggle-grid,
  .modal-content .three-col {
    grid-template-columns: 1fr;
  }

  .modal-content form.stack-form > .button-row:last-child {
    grid-template-columns: 1fr;
  }
}
