:root {
  --blue:    #6b7fd4;
  --purple:  #9b6fd4;
  --coral:   #e8716a;
  --pink:    #e06b9a;
  --orange:  #f0a04b;
  --yellow:  #f5c842;
  --bg:      #f4f2fb;
  --white:   #ffffff;
  --text:    #1e1e3a;
  --muted:   #8888aa;
  --border:  #e2dff0;
  --surface: #ffffff;
  --radius:  20px;

  --grad-logo: linear-gradient(135deg, #6b7fd4, #c06b9a, #f0a04b);
  --grad-warm: linear-gradient(135deg, #f0a04b, #e8716a, #e06b9a);
  --grad-cool: linear-gradient(135deg, #6b7fd4, #9b6fd4, #c06b9a);
  --grad-sun:  linear-gradient(135deg, #f5c842, #f0a04b);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', sans-serif;
  min-height: 100vh;
  padding-bottom: 100px;
  /* iOS safe-area padding for notch / home indicator when running as installed PWA / native */
  padding-top: env(safe-area-inset-top);
}

/* Subtle dot pattern bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #9b6fd422 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 18px;
  position: relative;
  z-index: 1;
}

/* HEADER */
.header {
  padding: 44px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 4px 10px rgba(155,111,212,0.35));
}

.logo-text {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-text span {
  background: var(--grad-logo);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-streak {
  background: var(--grad-sun);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: white;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 14px rgba(240,160,75,0.35);
}

/* NAV */
.nav {
  display: flex;
  background: var(--white);
  border-radius: 16px;
  padding: 5px;
  margin-bottom: 22px;
  gap: 4px;
  box-shadow: 0 2px 16px rgba(107,127,212,0.1);
  border: 1px solid var(--border);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 4px;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.nav-btn .nav-icon { font-size: 16px; }

.nav-btn.active {
  background: var(--grad-cool);
  color: white;
  box-shadow: 0 4px 12px rgba(107,127,212,0.3);
}

/* SCREENS */
.screen { display: none; }
.screen.active { display: block; animation: rise 0.35s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* CARD */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(107,127,212,0.08);
}

.card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 4px;
}

.card-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* PARTNER ROW */
.partner-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grad-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(224,107,154,0.3);
}

.partner-info strong { display: block; font-size: 15px; font-weight: 700; }
.partner-info span   { font-size: 12px; color: var(--muted); }

/* DATE PILL */
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 22px;
  font-weight: 600;
}

/* WEATHER DISPLAY */
.weather-display {
  text-align: center;
  margin-bottom: 6px;
}

.weather-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 6px;
  animation: floatIcon 3s ease-in-out infinite;
  min-height: 76px;
  line-height: 1;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.weather-condition {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: var(--text);
  min-height: 24px;
}

.weather-subtitle {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  min-height: 20px;
  margin-bottom: 20px;
  margin-top: 4px;
}

/* RATING BOXES */
.rating-hint {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.rating-boxes {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-bottom: 22px;
}

.rbox {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.rbox:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(107,127,212,0.2);
}

.rbox.active {
  border-color: transparent;
  color: white;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* SUBMIT BTN */
.btn-primary {
  width: 100%;
  background: var(--grad-logo);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 20px rgba(155,111,212,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(155,111,212,0.4);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* SUCCESS */
.success-card {
  text-align: center;
  padding: 28px 20px;
}
.success-icon { font-size: 60px; margin-bottom: 12px; }
.success-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 22px;
  margin-bottom: 8px;
}
.success-sub { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* INSIGHTS */
.streak-card {
  background: var(--grad-cool);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 28px rgba(107,127,212,0.3);
}

.streak-num {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 42px;
  color: white;
  line-height: 1;
}

.streak-right strong {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: white;
}
.streak-right span {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

/* Week bars */
.week-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  margin-top: 16px;
  padding-bottom: 4px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  border-radius: 8px 8px 0 0;
  transition: height 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-day { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 0.5px; }
.bar-val { font-size: 11px; font-weight: 800; font-family: 'Nunito', sans-serif; }

/* Stats */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
}

.stat-val {
  font-family: 'Nunito', sans-serif;
  font-size: 24px;
  font-weight: 900;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  font-weight: 700;
}

/* Pattern chips */
.pattern-wrap {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Month grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: 14px;
}

.month-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  border: 1px solid transparent;
}

/* FORECAST (ALERTS) */
.forecast-header {
  background: var(--grad-warm);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: 0 8px 28px rgba(232,113,106,0.3);
}

.forecast-header .fh-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-bottom: 4px;
}

.forecast-header .fh-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: white;
}

.forecast-header .fh-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
  line-height: 1.5;
}

.alert-card {
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid transparent;
  background: var(--white);
  box-shadow: 0 2px 12px rgba(107,127,212,0.07);
}

.alert-card.sunny  { border-left: 4px solid var(--yellow); }
.alert-card.cloudy { border-left: 4px solid var(--blue); }
.alert-card.stormy { border-left: 4px solid var(--coral); }
.alert-card.warm   { border-left: 4px solid var(--orange); }

.alert-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }

.alert-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 5px;
}

.sunny  .alert-badge { background: rgba(245,200,66,0.15);  color: #b8860b; }
.cloudy .alert-badge { background: rgba(107,127,212,0.12); color: var(--blue); }
.stormy .alert-badge { background: rgba(232,113,106,0.15); color: var(--coral); }
.warm   .alert-badge { background: rgba(240,160,75,0.15);  color: #c07820; }

.alert-body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  font-family: 'Nunito', sans-serif;
}

.alert-body p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.alert-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* SETTINGS */
.profile-hero {
  background: var(--grad-logo);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(155,111,212,0.25);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,0.4);
}

.profile-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 20px;
  color: white;
}

.profile-sub { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 2px; }

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

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

.settings-left strong { display: block; font-size: 14px; font-weight: 700; }
.settings-left span   { font-size: 12px; color: var(--muted); }

.toggle {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--grad-cool);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(107,127,212,0.3);
}

.toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 3px;
  right: 3px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.toggle.off { background: var(--border); box-shadow: none; }
.toggle.off::after { right: auto; left: 3px; }

.pro-banner {
  background: var(--grad-warm);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 20px rgba(232,113,106,0.25);
}

.pro-banner strong {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 16px;
  color: white;
}

.pro-banner span { font-size: 12px; color: rgba(255,255,255,0.8); }

.pro-price {
  background: rgba(255,255,255,0.25);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.4);
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================================
   AUTH
   ============================================================================ */

/* Show/hide based on auth state. is-loading is the initial class until
   getSession() resolves, preventing a flash of the wrong UI. */
.auth-screen          { display: none; }
body.is-loading .app,
body.is-logged-out .app           { display: none; }
body.is-logged-out .auth-screen   { display: flex; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  overflow-y: auto;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 26px 26px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(107,127,212,0.15);
}

.auth-logo {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 14px rgba(155,111,212,0.35));
  margin-bottom: 14px;
}

.auth-wordmark {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.5px;
  margin: 0 0 6px 0;
  color: var(--text);
}

.auth-wordmark span {
  background: var(--grad-logo);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s;
}

.auth-tab.active {
  background: var(--grad-cool);
  color: white;
  box-shadow: 0 3px 10px rgba(107,127,212,0.3);
}

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

.auth-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--purple);
  background: var(--white);
}

.auth-submit {
  width: 100%;
  background: var(--grad-logo);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(155,111,212,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(155,111,212,0.4);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-oauth {
  width: 100%;
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}

.auth-oauth:hover { background: var(--bg); border-color: var(--purple); }
.auth-apple       { color: #000; }

.auth-message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  display: none;
  text-align: left;
}

.auth-message.show { display: block; }
.auth-message.error { background: rgba(232,113,106,0.1); color: var(--coral); }
.auth-message.info  { background: rgba(107,127,212,0.1); color: var(--blue); }

.auth-foot {
  margin-top: 14px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* ============================================================================
   SETTINGS — Account card
   ============================================================================ */

.account-card { text-align: center; }

.account-email {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  word-break: break-all;
}

.btn-signout {
  background: var(--bg);
  color: var(--coral);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, border-color 0.15s;
}

.btn-signout:hover {
  background: rgba(232,113,106,0.08);
  border-color: var(--coral);
}
