:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #18181b;
  --muted: #8a8a94;
  --border: #ececef;
  --accent: #3730a3;
  --accent-soft: #eef0fb;
  --shadow: 0 1px 2px rgba(20, 20, 25, 0.03), 0 1px 8px rgba(20, 20, 25, 0.03);

  --score-high: #b91c1c;
  --score-high-bg: #fdeaea;
  --score-mid: #1d4ed8;
  --score-mid-bg: #eaf0fd;
  --score-low: #6b7280;
  --score-low-bg: #f2f2f4;

  --priority-overdue: #b91c1c;
  --priority-overdue-bg: #fdeaea;
  --priority-due-today: #b45309;
  --priority-due-today-bg: #fef3e2;

  --status-good: #0d9488;
  --status-good-bg: #e6f5f3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101012;
    --card-bg: #19191c;
    --text: #ededf0;
    --muted: #8b8b93;
    --border: #28282d;
    --accent: #a5b4fc;
    --accent-soft: #23233a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px 10px rgba(0, 0, 0, 0.3);

    --score-high: #f87171;
    --score-high-bg: #3a1f22;
    --score-mid: #93c5fd;
    --score-mid-bg: #1c2a3f;
    --score-low: #9198a5;
    --score-low-bg: #232328;

    --priority-overdue: #f87171;
    --priority-overdue-bg: #3a1f22;
    --priority-due-today: #fbbf24;
    --priority-due-today-bg: #3a2f1a;

    --status-good: #14b8a6;
    --status-good-bg: #16332f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-left: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.dock {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.25rem;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 1.25rem;
  filter: grayscale(1);
  opacity: 0.55;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.dock-icon:hover {
  background: var(--accent-soft);
  opacity: 1;
  text-decoration: none;
}

.dock-icon-logout { margin-top: auto; margin-bottom: 1rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-heading { display: flex; flex-direction: column; gap: 0.2rem; }

.topbar h1 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-greeting {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.logo-mark { color: var(--accent); font-size: 1rem; }

.topbar-actions { display: flex; align-items: center; gap: 1.25rem; }

.last-refreshed { font-size: 0.8rem; color: var(--muted); }

#refresh-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 7px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

#refresh-btn:hover { opacity: 0.8; }
#refresh-btn:disabled { opacity: 0.45; cursor: default; }

.connect-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.8rem 2rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
}

.connect-link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.connect-link:hover { text-decoration: underline; }

main { padding: 2rem; max-width: 1400px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.grid:not(.layout-ready) { visibility: hidden; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  flex-shrink: 0;
}

.card-body {
  max-height: 420px;
  overflow-y: auto;
}

.card.expanded .card-body {
  max-height: none;
  overflow: visible;
}

.card h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-controls { display: flex; align-items: center; gap: 0.25rem; }
.card-controls button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.2rem;
}
.card-controls button:hover { color: var(--accent); }

.card.collapsed .card-body { display: none; }

.card-icon {
  font-size: 0.95rem;
  filter: grayscale(1);
  opacity: 0.55;
}

.empty-state { color: var(--muted); font-size: 0.88rem; }

ul { list-style: none; margin: 0; padding: 0; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

.event-item, .email-item, .activity-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child, .email-item:last-child, .activity-item:last-child { border-bottom: none; }

.event-item { display: flex; gap: 0.85rem; }
.event-when { display: flex; flex-direction: column; min-width: 4.5rem; flex-shrink: 0; }
.event-date { color: var(--text); font-size: 0.8rem; font-weight: 600; }
.event-time { color: var(--muted); font-size: 0.8rem; }
.event-location { color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }
.event-location a { color: var(--muted); }
.event-location a:hover { color: var(--accent); text-decoration: underline; }

.email-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.email-header a { font-weight: 500; }
.email-sender { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.email-reason { font-size: 0.84rem; margin-top: 0.3rem; color: var(--muted); }

.score-badge {
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.score-badge.score-high { background: var(--score-high-bg); color: var(--score-high); }
.score-badge.score-mid { background: var(--score-mid-bg); color: var(--score-mid); }
.score-badge.score-low { background: var(--score-low-bg); color: var(--score-low); }

.email-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.resolve-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}
.resolve-btn:hover { text-decoration: underline; }
.resolve-btn:disabled { opacity: 0.5; cursor: default; }

.snooze-select, .reply-template-select {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  padding: 0;
  cursor: pointer;
}
.snooze-select:disabled { opacity: 0.5; cursor: default; }

.show-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0;
  margin-top: 0.85rem;
  cursor: pointer;
}
.show-more-btn:hover { text-decoration: underline; }

.email-item.resolved { color: var(--muted); font-size: 0.85rem; }
.resolved-text { color: var(--muted); }
.undo-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}
.undo-btn:hover { text-decoration: underline; }
.undo-btn:disabled { opacity: 0.5; cursor: default; }

.todo-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-label { display: flex; gap: 0.7rem; cursor: pointer; align-items: flex-start; flex: 1; min-width: 0; }

.todo-delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.todo-item:hover .todo-delete-btn { opacity: 1; }
.todo-delete-btn:hover { color: var(--score-high); }
.todo-delete-btn:disabled { opacity: 0.5; cursor: default; }

.todo-item.removing { color: var(--muted); font-size: 0.85rem; }
.todo-checkbox {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--text);
}
.todo-title-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.todo-title { font-size: 0.89rem; font-weight: 500; }
.todo-due { color: var(--muted); font-size: 0.75rem; font-weight: 500; margin-top: 0.2rem; }
.todo-detail { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.todo-item.completed .todo-title,
.todo-item.completed .todo-detail { text-decoration: line-through; color: var(--muted); }
.todo-item.completed .todo-due { display: none; }

.priority-badge {
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  flex-shrink: 0;
}
.priority-badge.priority-overdue { background: var(--priority-overdue-bg); color: var(--priority-overdue); }
.priority-badge.priority-due-today { background: var(--priority-due-today-bg); color: var(--priority-due-today); }

.quick-add-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.quick-add-form input[type="text"] {
  flex: 1 1 auto;
  min-width: 8rem;
}
.quick-add-form input,
.quick-add-form button {
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}
.quick-add-form button {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  cursor: pointer;
  font-weight: 500;
}
.quick-add-form button:hover { opacity: 0.85; }
.quick-add-form button:disabled { opacity: 0.5; cursor: default; }

.weekly-summary { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; margin-bottom: 1.25rem; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.35rem; font-weight: 600; }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 0.1rem; }

.activity-item { display: flex; gap: 0.85rem; }
.activity-type { color: var(--muted); font-size: 0.84rem; min-width: 4.2rem; }
.activity-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }

.trend-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 80px;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.trend-bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: default;
}
.trend-bar {
  width: 100%;
  max-width: 1.5rem;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity 0.15s ease;
}
.trend-bar-col:hover .trend-bar { opacity: 0.7; }
.trend-bar-label {
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 0.35rem;
  white-space: nowrap;
}

.spotify-subheading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.spotify-subheading:not(:first-child) { margin-top: 1.25rem; }
.spotify-list { list-style: none; padding: 0; margin: 0; }
.spotify-item {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.spotify-item:last-child { border-bottom: none; }
.spotify-thumb {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.spotify-thumb-empty { background: var(--border); }
.spotify-details { min-width: 0; }
.spotify-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }

.summary-banner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.summary-icon { filter: grayscale(1); opacity: 0.6; }
.summary-list { list-style: none; padding: 0; }
.summary-list li {
  padding: 0.35rem 0;
  font-size: 0.92rem;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}
.summary-list li:last-child { border-bottom: none; }

.weather-current { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.4rem; }
.weather-icon-big { font-size: 2.25rem; line-height: 1; }
.weather-temp { font-size: 1.5rem; font-weight: 600; display: block; }
.weather-desc { color: var(--muted); font-size: 0.88rem; }
.weather-location { color: var(--muted); font-size: 0.8rem; margin-bottom: 1rem; }
.weather-forecast { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.weather-day {
  flex: 1 1 auto;
  min-width: 4rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.4rem;
}
.weather-day-today { border-color: var(--text); }
.weather-day-date { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 500; }
.weather-day-icon { display: block; font-size: 1.25rem; margin: 0.35rem 0; }
.weather-day-temps { display: block; font-size: 0.83rem; font-weight: 600; }

.run-nudge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.83rem;
  font-weight: 500;
  margin-top: 1rem;
}

.weather-location-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.weather-location-form input {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}
.weather-location-form button {
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--text);
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-weight: 500;
}
.weather-location-form button:hover { opacity: 0.85; }
.weather-location-form button:disabled { opacity: 0.5; cursor: default; }
.weather-location-error {
  color: var(--score-high);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.news-source { margin-bottom: 1.2rem; }
.news-source:last-child { margin-bottom: 0; }
.news-source-row { display: flex; align-items: center; justify-content: space-between; }
.news-source-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
}
.news-item { padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.87rem; line-height: 1.4; }
.news-item:last-child { border-bottom: none; }

.source-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.5rem;
}
.source-toggle-btn:hover { color: var(--accent); text-decoration: underline; }
.source-toggle-btn:disabled { opacity: 0.5; cursor: default; }

.news-mutes { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.news-mute-form { display: flex; gap: 0.5rem; }
.news-mute-form input {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}
.news-mute-form button {
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--text);
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font-weight: 500;
}
.news-mute-form button:hover { opacity: 0.85; }
.news-mute-form button:disabled { opacity: 0.5; cursor: default; }

.mute-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.mute-chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.4rem 0.15rem 0.65rem;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.mute-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.mute-remove:disabled { opacity: 0.5; cursor: default; }

.calendar-page { max-width: 1100px; margin: 0 auto; }

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.calendar-nav-arrow {
  font-size: 1.3rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.1rem 0.5rem;
}
.calendar-nav-arrow:hover { color: var(--accent); text-decoration: none; }

.calendar-month-label {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  min-width: 12ch;
}

.add-event-btn {
  margin-left: auto;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 7px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
}
.add-event-btn:hover { opacity: 0.8; }

.add-event-form {
  flex-direction: column;
  gap: 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.add-event-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.add-event-row input[type="text"] { flex: 1 1 auto; min-width: 10rem; }

.add-event-form input,
.add-event-form button {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.add-event-allday {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.add-event-form button[type="submit"] {
  background: var(--text);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.add-event-form button[type="submit"]:hover { opacity: 0.85; }
.add-event-form button[type="submit"]:disabled { opacity: 0.5; cursor: default; }

#add-event-cancel { background: none; cursor: pointer; color: var(--muted); }
#add-event-cancel:hover { color: var(--accent); }

.add-event-error { color: var(--score-high); font-size: 0.82rem; margin: 0; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.calendar-weekday {
  background: var(--card-bg);
  min-width: 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day {
  background: var(--card-bg);
  height: 128px;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow: hidden;
}
.calendar-day:hover { background: var(--accent-soft); }

.calendar-day-outside { opacity: 0.4; }

.calendar-day-number { font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }

.calendar-day-events {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  scrollbar-width: thin;
}
.calendar-day-events::-webkit-scrollbar { width: 5px; }
.calendar-day-events::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.calendar-day-events::-webkit-scrollbar-track { background: transparent; }

.calendar-day-today .calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
}

.calendar-event-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event-pill a { color: inherit; }

.calendar-event-time { font-weight: 600; margin-right: 0.2rem; }

.finance-page, .health-page { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }

.finance-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1.15rem;
}

.status-badge {
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.status-badge.status-good { background: var(--status-good-bg); color: var(--status-good); }
.status-badge.status-behind { background: var(--priority-overdue-bg); color: var(--priority-overdue); }

.finance-summary-row { display: flex; gap: 2.5rem; align-items: flex-start; flex-wrap: wrap; }
.finance-summary-gap { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }

.finance-top-category { color: var(--muted); font-size: 0.82rem; margin-top: 1rem; }

.card-link {
  display: inline-block;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  margin-top: 0.9rem;
}
.card-link:hover { text-decoration: underline; }

.finance-trend-legend {
  display: flex;
  gap: 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.legend-swatch {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.legend-income { background: var(--accent); }
.legend-expenses { background: var(--score-high); }

.finance-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  height: 150px;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.finance-trend-group {
  flex: 1 1 0;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: default;
}
.finance-trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 100%;
  width: 100%;
}
.finance-trend-bar {
  width: 30%;
  max-width: 1.1rem;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity 0.15s ease;
}
.finance-trend-bar-income { background: var(--accent); }
.finance-trend-bar-expenses { background: var(--score-high); }
.finance-trend-group:hover .finance-trend-bar { opacity: 0.7; }
.finance-trend-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.4rem;
  white-space: nowrap;
}

.finance-category-list { display: flex; flex-direction: column; gap: 0.65rem; }
.finance-category-row { display: flex; align-items: center; gap: 0.75rem; }
.finance-category-name {
  width: 6.5rem;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text);
}
.finance-category-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.finance-category-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0 5px 5px 0;
  min-width: 2px;
}
.finance-category-amount {
  width: 4.5rem;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.login-body {
  padding-left: 0;
  min-height: 100vh;
  display: flex;
}
.login-main {
  margin: auto;
  width: 100%;
  max-width: 320px;
  padding: 1.5rem;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  text-align: center;
}
.login-card input,
.login-card button {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}
.login-card button {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  cursor: pointer;
  font-weight: 500;
}
.login-card button:hover { opacity: 0.85; }
.login-error {
  margin: 0;
  font-size: 0.82rem;
  color: var(--priority-overdue);
  text-align: center;
}

.health-chart-wide {
  overflow-x: auto;
  justify-content: flex-start;
}
.health-chart-wide .trend-bar-col {
  flex: 0 0 32px;
}

.health-report-status {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.health-report-text {
  margin: 0 0 0.6rem;
  line-height: 1.5;
}
.health-report-recommendation {
  margin: 0;
  color: var(--muted);
}

.health-section-title { display: flex; align-items: center; gap: 0.4rem; }

.health-stat-callout { margin-bottom: 0.25rem; }

.health-bullet-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.health-bullet-list li {
  font-size: 0.82rem;
  color: var(--text);
  padding-left: 0.9rem;
  position: relative;
}
.health-bullet-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.chart-with-axis {
  display: flex;
  gap: 0.6rem;
}
.chart-y-axis {
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  flex-shrink: 0;
  padding-right: 0.4rem;
}
.chart-axis-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.chart-plot { flex: 1; min-width: 0; }
.chart-plot-area {
  position: relative;
  height: 110px;
}
.chart-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
}
.chart-gridline-base { bottom: 0; top: auto; }
.chart-bars-row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
}
.chart-bar-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: default;
}
.chart-bar {
  width: 100%;
  max-width: 20px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.chart-labels-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.chart-labels-row span {
  flex: 1 1 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
}

/* ---------- Mobile layout ---------- */
@media (max-width: 640px) {
  body {
    padding-left: 0;
    padding-bottom: 60px;
  }

  .dock {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 60px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding-top: 0;
    border-right: none;
    border-top: 1px solid var(--border);
  }
  .dock-icon-logout { margin: 0; }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
  }
  .topbar-actions { width: 100%; justify-content: space-between; }

  .connect-banner { padding: 0.7rem 1.25rem; }

  main { padding: 1rem; }

  .grid { gap: 1rem; }

  .card { padding: 1.1rem; }

  .weekly-summary { gap: 1rem 1.5rem; }

  .calendar-day { height: 96px; padding: 0.4rem 0.4rem; }
  .calendar-nav { flex-wrap: wrap; }

  .chart-y-axis { width: 2rem; }
}
