/* Supapp webapp — system font stack, phone-first, light/dark */

:root {
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #666;
  --accent: #6c63ff;
  --accent-light: #e8e6ff;
  --overdue: #e74c3c;
  --overdue-bg: #fdecea;
  --thisweek: #f39c12;
  --thisweek-bg: #fef9e7;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a2e;
    --card-bg: #252545;
    --text: #e0e0e0;
    --text-secondary: #999;
    --accent: #8b83ff;
    --accent-light: #2d2d5e;
    --overdue: #ff6b6b;
    --overdue-bg: #3d1f1f;
    --thisweek: #ffc107;
    --thisweek-bg: #3d3520;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.app-shell {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* ── Login page ─────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: 24px;
}
.login-card {
  text-align: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 48px 32px;
  box-shadow: var(--shadow);
  max-width: 360px; width: 100%;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #6c63ff, #4ecdc4);
  border-radius: 18px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.tagline { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.login-unavailable { color: var(--text-secondary); font-style: italic; padding: 16px 0; }

/* ── Header ──────────────────────────────────────────────────────────── */
.sticky-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
  backdrop-filter: blur(10px);
}
.app-title { font-size: 22px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.refresh-btn {
  background: var(--card-bg); border: none; font-size: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); color: var(--text);
}
.logout-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.header-date { padding: 0 16px 8px; color: var(--text-secondary); font-size: 13px; }

/* ── Content ─────────────────────────────────────────────────────────── */
.overview-content { padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 17px; margin-bottom: 14px; }
.empty-state { color: var(--text-secondary); font-size: 14px; text-align: center; padding: 20px 0; }

/* ── Goals ───────────────────────────────────────────────────────────── */
.goal-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.goal-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
}
.goal-title { flex: 1; margin-right: 12px; }
.goal-due { font-size: 12px; white-space: nowrap; }
.goal-overdue { background: var(--overdue-bg); }
.goal-overdue .goal-due { color: var(--overdue); font-weight: 600; }
.goal-thisweek { background: var(--thisweek-bg); }
.goal-thisweek .goal-due { color: var(--thisweek); font-weight: 600; }
.goal-later { background: var(--accent-light); }
.goal-later .goal-due { color: var(--text-secondary); }

/* ── Tracker ─────────────────────────────────────────────────────────── */
.tracker-grid { display: flex; flex-direction: column; gap: 12px; }
.tracker-card { border: 1px solid rgba(128,128,128,.15); border-radius: 12px; padding: 14px; }
.tracker-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tracker-label { font-size: 14px; font-weight: 600; }
.tracker-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.tracker-spark { margin: 4px 0; text-align: center; }
.tracker-time { font-size: 12px; color: var(--text-secondary); }

/* ── Journal ─────────────────────────────────────────────────────────── */
.journal-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.journal-item { border-bottom: 1px solid rgba(128,128,128,.1); padding-bottom: 12px; }
.journal-item:last-child { border-bottom: none; padding-bottom: 0; }
.journal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.journal-kind { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.journal-time { font-size: 12px; color: var(--text-secondary); }
.journal-text { font-size: 14px; line-height: 1.6; color: var(--text); }