@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500;600;700&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --pink-bg: #fff0f5;
  --pink-bg-2: #ffe4ee;
  --pink-primary: #f472a0;
  --pink-primary-dark: #e0568a;
  --pink-soft: #ffd6e8;
  --pink-line: #fbc6dd;
  --ink: #6b4257;
  --ink-soft: #9c7488;
  --white: #ffffff;
  --amber: #e8a94a;
  --amber-bg: #fff3e0;
  --green: #6fbf8f;
  --shadow: 0 8px 24px rgba(228, 110, 160, 0.14);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(180deg, var(--pink-bg) 0%, var(--pink-bg-2) 100%);
  color: var(--ink);
  min-height: 100vh;
}

h1, h2, h3, .brand { font-family: 'Quicksand', sans-serif; }

.hidden { display: none !important; }

/* ---------- Login ---------- */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card .emoji { font-size: 40px; }
.login-card h1 { margin: 8px 0 4px; color: var(--pink-primary-dark); font-size: 24px; }
.login-card p { color: var(--ink-soft); margin: 0 0 20px; font-size: 14px; }
.login-card input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid var(--pink-line);
  font-size: 16px;
  outline: none;
  margin-bottom: 14px;
  font-family: inherit;
}
.login-card input:focus { border-color: var(--pink-primary); }
.login-error { color: #d9537a; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

button.primary {
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-primary-dark));
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Quicksand', sans-serif;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(224, 86, 138, 0.35);
}
button.primary:active { transform: translateY(1px); }

/* ---------- App shell ---------- */
#app { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.topbar .greeting { font-family: 'Quicksand'; font-size: 22px; font-weight: 700; color: var(--pink-primary-dark); }
.streak-badge {
  background: var(--white);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-card {
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-primary-dark));
  border-radius: var(--radius);
  padding: 26px 24px;
  color: white;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero-card .label { font-size: 13px; opacity: 0.9; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.hero-card .amount { font-family: 'Quicksand'; font-size: 40px; font-weight: 700; margin: 4px 0 6px; }
.hero-card .sub { font-size: 14px; opacity: 0.95; }

.milestone-banner {
  background: #fff8e6;
  border: 2px solid #ffe1a8;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 700;
  color: #a97418;
  margin-bottom: 16px;
  text-align: center;
}

/* ---------- Tabs ---------- */
.tabbar {
  display: flex;
  gap: 8px;
  background: var(--white);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.tabbar button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 6px;
  border-radius: 12px;
  font-family: 'Quicksand';
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.tabbar button.active {
  background: var(--pink-soft);
  color: var(--pink-primary-dark);
}

.tabpanel { display: none; }
.tabpanel.active { display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 {
  font-size: 16px;
  margin: 0 0 14px;
  color: var(--pink-primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.paycheck-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.paycheck-toggle button {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  border: 2px solid var(--pink-line);
  background: white;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
}
.paycheck-toggle button.active {
  background: var(--pink-soft);
  border-color: var(--pink-primary);
  color: var(--pink-primary-dark);
}

/* Quick log */
.quicklog { display: flex; flex-direction: column; gap: 10px; }
.quicklog select, .quicklog input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--pink-line);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  width: 100%;
}
.quicklog select:focus, .quicklog input:focus { border-color: var(--pink-primary); }

/* Category rows */
.cat-group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 700;
  margin: 18px 0 8px;
}
.cat-group-title:first-child { margin-top: 0; }

.cat-row { margin-bottom: 14px; }
.cat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 14px;
}
.cat-row-top .name { font-weight: 700; }
.cat-row-top .nums { color: var(--ink-soft); font-size: 13px; }
.bar-track {
  height: 10px;
  background: var(--pink-bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb6cf, var(--pink-primary));
  transition: width 0.3s ease;
}
.bar-fill.over { background: linear-gradient(90deg, #ffcf8a, var(--amber)); }
.cat-note { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* Debt cards */
.debt-card {
  border: 2px solid var(--pink-line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.debt-card .top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.debt-card .balance { color: var(--pink-primary-dark); font-family: 'Quicksand'; font-size: 20px; }
.debt-card .meta { font-size: 13px; color: var(--ink-soft); }
.debt-card.tbd { border-style: dashed; opacity: 0.85; }

/* Savings goals */
.goal-card { margin-bottom: 16px; }
.goal-card .top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; font-size: 14px;}
.goal-card .pct { color: var(--green); font-weight: 800; }
.goal-complete-tag {
  display: inline-block;
  background: #eafaf0;
  color: #3f9d6b;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
  margin-left: 6px;
}

.empty-note { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 12px 0; }

.recent-log { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--pink-bg-2); }
.recent-log:last-child { border-bottom: none; }
.recent-log .meta { color: var(--ink-soft); }
.recent-log .del { color: #d9788f; cursor: pointer; font-size: 12px; margin-left: 8px; }

.encourage {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: -6px;
  margin-bottom: 16px;
}
