/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Outfit:wght@300;400;500;600&family=Nunito:wght@400;700;900&display=swap');

/* ── Design Tokens ── */
:root {
  --bg:           #F5F2ED;
  --white:        #FFFEF6;
  --card-bg:      #EAE4D9;
  --green-dark:   #B7D65B;
  --green-light:  #DAEABA;
  --green-text:   #6a8a2a;
  --red-dark:     #E66A57;
  --red-light:    #F1B4AB;
  --ink:          #594A42;
  --muted:        #9a8f88;
  --border:       #e0ddd8;
  --radius:       30px;
  --font-main:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-logo:    'Nunito', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  background: rgba(245, 242, 237, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header-logo-img {
  height: 28px;
  width: auto;
  margin-top: .04rem;
  margin-left: 1.5rem;
}

.avatar-wrap {
  position: relative;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
}

.avatar-dropdown {
  display: none;
  position: absolute;
  top: 52px;
  left: 0;
  background: var(--white);
  border-radius: 10px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  min-width: 220px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.avatar-dropdown a {
  display: block;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: var(--ink);
  border-bottom: 1px solid var(--bg);
}

.avatar-dropdown a.active,
.avatar-dropdown .dropdown-plan.active {
  background: #634A42;
  color: #E3DCD1 !important;
}

.avatar-dropdown a:last-child {
  border-bottom: none;
}

.avatar-dropdown a:hover {
  opacity: 0.85;
}

.avatar-dropdown.open {
  display: block;
}

.header-date {
  font-size: 0.9rem;
  color: var(--ink);
  padding-top: 0.6rem;
  font-family: var(--font-main);
  letter-spacing: 0.15em;
}

/* ── Flash messages ── */
.flash {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  text-align: center;
}

.flash-notice { background: var(--green-light); color: var(--ink); }
.flash-alert  { background: var(--red-light); color: var(--ink); }

/* ── Dashboard ── */
.dashboard {
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.dashboard-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-left: 1.18rem;
}

.btn-new {
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  color: var(--ink);
  cursor: pointer;
}

.btn-new:hover {
  border-color: var(--green-dark);
  color: var(--green-dark);
}

/* ── Plan cards ── */
.plan-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.plan-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: block;
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.plan-card.on-track:hover {
  border-color: var(--green-dark);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}

.plan-card.behind:hover {
  border-color: var(--red-dark);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.plan-card-top-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan-card-top-right {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  padding-right: 3.5rem;
}

.plan-card-name {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 500;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
}

.plan-card-currency {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
}

.plan-card-total {
  font-family: var(--font-main);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.1em;
  -webkit-text-stroke: 1px var(--ink);
}

/* ── Dashboard day strip ── */
.plan-card-strip {
  display: flex;
  gap: 6px;
  align-items: center;
}

.strip-cell {
  width: calc((100% - 36px) / 7);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.026em;
  flex-shrink: 0;
}

.strip-cell.completed       { background: var(--green-light); color: var(--green-text); }
.strip-cell.today           { background: var(--red-light); color: var(--red-dark); border: 5px solid var(--red-dark); }
.strip-cell.missed          { background: var(--red-light); color: var(--red-dark); }
.strip-cell.upcoming        { background: var(--white); color: var(--muted); border: 1.5px solid var(--border); }
.strip-cell.completed.current { background: var(--green-light); color: var(--green-text); border: 5px solid var(--green-dark); }
.strip-cell.current.missed  { background: var(--red-light); color: var(--red-dark); border: 5px solid var(--red-dark); }

/* ── Badges ── */
.badges-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
}

.badge-emoji { font-size: 1rem; }
.badge-label { font-size: 0.78rem; }

.dashboard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.btn-primary {
  display: inline-block;
  background: var(--green-dark);
  color: var(--white);
  border-radius: 10px;
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Plan page ── */
.plan-page {
  position: relative;
  padding: 1.5rem 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.plan-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.plan-top-left {
  display: flex;
  align-items: center;
}

.plan-top-right {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-right: 3.5rem;
}

.plan-top-centre {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.plan-name-pill {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-family: var(--font-main);
}

.plan-name-pill:hover { border-color: var(--ink); }

.plan-currency-pill {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
}

.plan-running-total {
  font-family: var(--font-main);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.1em;
  -webkit-text-stroke: 1px var(--ink);
}

.plan-start-date {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-main);
  letter-spacing: 0.05em;
}

.plan-suspended-date {
  font-size: 0.8rem;
  color: var(--red-dark);
  font-family: var(--font-main);
  letter-spacing: 0.05em;
}

.suspended-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
}

/* ── Plan dropdown ── */
.plan-name-wrap { position: relative; }

.plan-dropdown {
  display: none;
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--white);
  border-radius: 10px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  min-width: 180px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.plan-dropdown.open { display: block; }

.plan-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-family: var(--font-main);
  color: var(--ink);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--bg);
}

.plan-dropdown-item:last-child { border-bottom: none; }
.plan-dropdown-item:hover { background: var(--bg); }

.delete-item { color: var(--red-dark); }
.delete-item:hover { background: var(--red-light); }

.undo-item { color: var(--muted); }
.undo-item:hover { background: var(--bg); color: var(--ink); }

/* ── Day header ── */
.plan-day-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border-radius: 16px 16px 0 0;
  padding: 0.75rem 1.5rem;
}

.day-header-centre {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.day-label {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.day-number,
.day-target {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.2rem 0.6rem;
}

.day-arrow {
  font-size: 0.9rem;
  color: var(--ink);
}

/* ── Main card ── */
.main-card {
  background: var(--white);
  border-radius: 0;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  position: relative;
  border: 2px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}

.main-card.saved { background: var(--green-dark); }
.main-card.invalid { border-color: var(--red-dark); }

.card-amount {
  width: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.amount-input {
  font-family: var(--font-main);
  font-size: 8rem;
  font-weight: 300;
  color: var(--green-dark);
  border: none;
  outline: none;
  text-align: center;
  width: 100%;
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
  -webkit-text-stroke: 5px var(--green-dark);
  letter-spacing: 0.026em;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.amount-input.invalid {
  color: var(--red-dark);
  -webkit-text-stroke: 5px var(--red-dark);
}

.saved-amount {
  font-family: var(--font-main);
  font-size: 8rem;
  font-weight: 300;
  color: var(--green-light);
  text-align: center;
  width: 100%;
  -webkit-text-stroke: 5px var(--green-light);
  letter-spacing: 0.026em;
}

/* ── Save button ── */
.save-btn-wrap { margin-top: 0; }

.save-btn {
  width: 100%;
  padding: 1.1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--green-light);
  color: var(--green-dark);
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  border: none;
  cursor: pointer;
  display: block;
  text-align: center;
  -webkit-text-stroke: 3px var(--green-dark);
  transition: background 0.2s;
}

.save-btn .cross { display: none; }
.save-btn .tick  { display: block; }

.save-btn.invalid {
  background: var(--red-light);
  color: var(--red-dark);
  -webkit-text-stroke: 3px var(--red-dark);
  cursor: not-allowed;
}

.save-btn.invalid .cross { display: block; }
.save-btn.invalid .tick  { display: none; }

.saved-btn {
  width: 100%;
  padding: 1.1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--green-light);
  color: var(--green-dark);
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-align: center;
  -webkit-text-stroke: 3px var(--green-dark);
}

.future-btn {
  width: 100%;
  padding: 1.1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--border);
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-align: center;
  cursor: default;
}

/* ── Plan day strip ── */
.day-strip-wrap {
  margin-top: 0.75rem;
  padding: 0 0.25rem;
}

.day-strip {
  display: flex;
  gap: 6px;
  align-items: center;
}

.day-strip-cell {
  flex: 1;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.026em;
  min-width: 0;
  cursor: pointer;
}

a.day-strip-cell {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-strip-cell.completed         { background: var(--green-light); color: var(--green-text); }
.day-strip-cell.today             { background: var(--red-light); color: var(--red-dark); border: 5px solid var(--red-dark); }
.day-strip-cell.missed            { background: var(--red-light); color: var(--red-dark); }
.day-strip-cell.upcoming          { background: var(--white); color: var(--muted); border: 1.5px solid var(--border); }
.day-strip-cell.completed.current { background: var(--green-light); color: var(--green-text); border: 5px solid var(--green-dark); }
.day-strip-cell.missed.current    { background: var(--red-light); color: var(--red-dark); border: 5px solid var(--red-dark); }

/* ── Stats panel ── */
.stats-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.5rem 1.5rem;
  margin-top: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--bg);
}

.stat-row:last-child { border-bottom: none; }

.stat-label {
  font-size: 1rem;
  color: var(--ink);
  font-family: var(--font-main);
}

.stat-value {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 8px;
  letter-spacing: 0.1em;
}

.stat-value.green { background: var(--green-light); color: var(--green-text); }
.stat-value.red   { background: var(--red-light); color: var(--red-dark); }

/* ── Catch up bar ── */
.catch-up-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--red-light);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  gap: 1rem;
}

.catch-up-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.catch-up-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.catch-up-sub {
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.7;
}

.catch-up-btn {
  background: var(--red-dark);
  color: var(--white);
  border: none;
  border-radius: 12px;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.catch-up-btn:hover { opacity: 0.88; }

/* ── Year grid ── */
.year-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--white);
  border-radius: var(--radius);
}

.grid-cell {
  width: calc((100% - 4px * 24) / 25);
  aspect-ratio: 1;
  border-radius: 4px;
}

.grid-cell.completed { background: var(--green-light); }
.grid-cell.today     { background: var(--red-light); border: 3px solid var(--red-dark); }
.grid-cell.missed    { background: var(--red-light); }
.grid-cell.upcoming  { background: var(--bg); }

a.grid-cell {
  text-decoration: none;
  display: block;
  transition: opacity 0.15s;
}

a.grid-cell:hover { opacity: 0.75; }

/* ── Forms ── */
.form-page {
  padding: 2rem 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem;
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.form-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.form-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.form-field { margin-bottom: 1.5rem; }

.form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="email"],
.form-field input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

.form-field input[type="text"]:focus,
.form-field input[type="date"]:focus,
.form-field input[type="email"]:focus,
.form-field input[type="password"]:focus {
  border-color: var(--green-dark);
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23594A42' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  transition: border-color 0.15s;
}

.form-select:focus { border-color: var(--green-dark); }

.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.mode-option input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: var(--green-dark);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.mode-option:has(input:checked) {
  border-color: var(--green-dark);
  background: var(--green-light);
}

.mode-option-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mode-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.mode-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.form-submit {
  width: 100%;
  padding: 1rem;
  background: var(--green-dark);
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: opacity 0.15s;
}

.form-submit:hover { opacity: 0.88; }

.form-errors {
  background: var(--red-light);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--red-dark);
}

.form-back {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.form-back:hover { color: var(--ink); }

/* ── Dropdown divider ── */
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.dropdown-plan {
  font-size: 0.85rem !important;
  color: var(--muted) !important;
  padding-left: 1.5rem !important;
}

.dropdown-plan:hover { color: var(--ink) !important; }

.dropdown-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.dropdown-status-dot.on-track { background: var(--green-dark); }
.dropdown-status-dot.behind   { background: var(--red-dark); }

/* ── Onboarding ── */
.onboarding-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.onboarding-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  max-width: 520px;
  width: 100%;
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  text-align: center;
}

.onboarding-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.onboarding-body {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.onboarding-body strong {
  color: var(--ink);
  font-weight: 600;
}

.onboarding-note {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}

.onboarding-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green-dark);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
}

.onboarding-btn {
  width: 100%;
  padding: 1rem;
  background: var(--green-dark);
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.15s;
}

.onboarding-btn:hover { opacity: 0.88; }

/* ── Auth pages ── */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  cursor: pointer;
}

.remember-me input[type="checkbox"] {
  accent-color: var(--green-dark);
  width: 16px;
  height: 16px;
}

.forgot-link {
  color: var(--muted);
  font-size: 0.875rem;
}

.forgot-link:hover { color: var(--ink); }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-footer a { color: var(--green-text); font-weight: 600; }
.auth-footer a:hover { color: var(--green-dark); }

/* ── Toast notifications ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-main);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  z-index: 999;
  white-space: nowrap;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 3s forwards;
}

.toast-notice { background: var(--green-dark); color: var(--white); }
.toast-alert  { background: var(--red-dark); color: var(--white); }

.toast-icon {
  font-size: 1rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-message { color: var(--white); }

.toast-milestone {
  background: var(--ink);
  color: var(--white);
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 1rem 1.5rem;
}

.toast-milestone-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toast-milestone-label { font-weight: 600; font-size: 0.95rem; }
.toast-milestone-desc  { font-size: 0.8rem; opacity: 0.7; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(1rem); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(1rem); }
}

/* ── Custom tooltip ── */
.custom-tooltip {
  position: fixed;
  background: var(--ink);
  color: var(--white);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: var(--font-main);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.custom-tooltip.visible { opacity: 1; }

/* ── Save animation ── */
.save-animation {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
  visibility: hidden;
}

.save-animation.playing {
  visibility: visible;
  pointer-events: all;
}

.wave {
  position: absolute;
  bottom: -100%;
  left: -10%;
  width: 120%;
  height: 100%;
  background: var(--green-dark);
  border-radius: 40% 40% 0 0;
  transition: bottom 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.save-animation.playing .wave { bottom: -10%; }

.animation-content {
  position: absolute;
  bottom: -20%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: bottom 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
}

.save-animation.playing .animation-content { bottom: 5%; }

.piggy-bank {
  width: 200px;
  height: auto;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.5s,
              opacity 0.5s ease 0.5s;
  position: relative;
  z-index: 1;
}

.save-animation.playing .piggy-bank {
  transform: translateY(0);
  opacity: 1;
}

.coin {
  position: absolute;
  width: 60px;
  height: auto;
  top: -80px;
  left: 50%;
  transform: translateX(-35%);
  opacity: 0;
  z-index: -1;
  transition: top 0.5s ease 1.2s, opacity 0.3s ease 1.2s;
}

.save-animation.playing .coin { top: 10px; opacity: 1; }

.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.confetti-piece {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  animation: confetti-fall 1.5s ease forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Admin ── */
.admin-page {
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1.5px solid var(--border);
  text-align: center;
}

.admin-stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--green-text);
  margin-bottom: 0.25rem;
}

.admin-stat-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1.5px solid var(--border);
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.admin-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.admin-table { width: 100%; }

.admin-table-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0.5rem 0;
  border-bottom: 1.5px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.admin-table-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--bg);
  font-size: 0.9rem;
  align-items: center;
}

.admin-table-row:last-child { border-bottom: none; }

.admin-table.users .admin-table-header,
.admin-table.users .admin-table-row {
  grid-template-columns: 1fr 2fr 1fr 0.5fr 1fr;
}

.invite-code-text {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.status-available { color: var(--green-text); font-weight: 500; }
.status-used      { color: var(--muted); }

.admin-item {
  color: var(--muted);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.admin-item:hover {
  color: var(--ink) !important;
  background: var(--bg) !important;
}

.plan-back-link {
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.plan-back-link a:hover {
  color: var(--ink);
}

/* ── Mobile responsive ── */
@media (max-width: 480px) {
  .header { padding: 0.75rem 1rem; }
  .dashboard { padding: 1rem; }
  .plan-card { padding: 1rem; }

  .plan-card-total {
    font-size: 2rem;
    -webkit-text-stroke: 0.5px var(--ink);
  }

  .strip-cell { font-size: 0.85rem; }

  .strip-cell.today,
  .strip-cell.current {
    border-width: 2px !important;
  }

  .day-strip-cell.today             { border: 2px solid var(--red-dark) !important; }
  .day-strip-cell.completed.current { border: 2px solid var(--green-dark) !important; }
  .day-strip-cell.missed.current    { border: 2px solid var(--red-dark) !important; }

  .plan-page { padding: 1.5rem 1rem 2rem; }
  .plan-top-centre { display: none; }

  .plan-running-total {
    font-size: 1.8rem;
    -webkit-text-stroke: 0.5px var(--ink);
  }

  .amount-input {
    font-size: 5rem;
    -webkit-text-stroke: 3px var(--green-dark);
  }

  .saved-amount {
    font-size: 5rem;
    -webkit-text-stroke: 3px var(--green-light);
  }

  .save-btn, .saved-btn, .future-btn {
    font-size: 1.5rem;
    padding: 0.85rem;
  }

  .day-strip-cell { font-size: 0.85rem; }
  .stat-label, .stat-value { font-size: 0.875rem; }
  .form-card { padding: 1.5rem; }
  .form-title { font-size: 1.5rem; }
  .onboarding-card { padding: 2rem 1.5rem; }
  .onboarding-title { font-size: 1.5rem; }
  .badges-panel { gap: 0.35rem; }
  .badge { padding: 0.3rem 0.65rem; }
  .badge-label { font-size: 0.72rem; }
}