* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #fafaf7;
  color: #1f2937;
}

/* ── Auth pages ───────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border: 1px solid #ececec;
  border-radius: 20px;
  padding: 32px 28px;
}

.auth-eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 600;
  margin: 0;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 20px;
}

.auth-error {
  background: #fcebeb;
  color: #791f1f;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.auth-form input {
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: #d85a30;
}

.btn-primary {
  margin-top: 6px;
  padding: 12px 0;
  border-radius: 12px;
  border: none;
  background: #639922;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:active { transform: scale(0.98); }

.auth-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.auth-switch a {
  color: #d85a30;
  font-weight: 600;
  text-decoration: none;
}

/* ── App shell ────────────────────────────────────────── */
.app-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px 16px 48px;
}

.app-shell {
  width: 100%;
  max-width: 420px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.app-user {
  font-size: 13px;
  color: #6b7280;
}

.app-user strong { color: #1f2937; }

.logout-link {
  font-size: 12px;
  color: #9ca3af;
  text-decoration: none;
}

.header {
  text-align: center;
  margin-bottom: 16px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0;
  font-weight: 600;
}

.title {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 4px 0 0;
}

.flame-card {
  background: #ffffff;
  border: 1px solid #ececec;
  border-radius: 20px;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}

.flame-icon {
  width: 72px;
  height: 72px;
}

.streak-number {
  font-size: 48px;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
  margin-top: 6px;
}

.streak-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stage-message {
  font-size: 14px;
  color: #374151;
  margin-top: 10px;
  text-align: center;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

.stat-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  text-align: center;
}

.week-section {
  background: #ffffff;
  border: 1px solid #ececec;
  border-radius: 20px;
  padding: 16px 14px 18px;
  margin-bottom: 16px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.nav-button {
  border: none;
  background: transparent;
  font-size: 22px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.week-range {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

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

.day-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
}

.day-label.today { color: #d85a30; }

.day-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
}

.day-circle:active { transform: scale(0.95); }

.day-circle.clean {
  background: #639922;
  border-color: #639922;
  color: #ffffff;
}

.day-circle.slip {
  background: #e24b4a;
  border-color: #e24b4a;
  color: #ffffff;
}

.day-circle.future {
  opacity: 0.35;
  cursor: default;
}

.day-circle.today-ring {
  box-shadow: 0 0 0 2px #fde4d8;
  border-color: #d85a30;
}

.slip-toggle {
  border: none;
  background: transparent;
  font-size: 10px;
  color: #c2c2c2;
  cursor: pointer;
  padding: 0;
}

.primary-cta {
  width: 100%;
  padding: 14px 0;
  border-radius: 14px;
  border: none;
  background: #639922;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
}

.primary-cta:disabled {
  background: #c0dd97;
  cursor: default;
}

.reset-link {
  display: block;
  margin: 0 auto;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1f2937;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
