:root {
  --pink: #f5a9b8;
  --pink-deep: #ee7fa3;
  --blue: #5bcefa;
  --blue-deep: #38a8de;
  --gold: #ffd97d;
  --gold-deep: #efb73e;
  --lavender: #c9b6f0;
  --ink: #5b4a5e;
  --ink-soft: #9b8aa0;
  --card: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Quicksand', system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(160deg, #d9f3ff 0%, #fdeef3 35%, #ffffff 55%, #fde7ef 75%, #def2fd 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.blob {
  position: fixed;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.blob-pink { background: var(--pink); top: -20vmax; right: -15vmax; }
.blob-blue { background: var(--blue); bottom: -25vmax; left: -15vmax; }

main {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

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

h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--blue-deep), var(--pink-deep), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline { margin: 6px 0 0; color: var(--ink-soft); font-weight: 500; }

.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(180, 140, 170, 0.18);
  padding: 24px;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---- top grid ---- */

.top-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.checkin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

input[type='date'] {
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
  border: 1px solid rgba(155, 138, 160, 0.3);
  border-radius: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.slider-group { margin: 18px 0; }

.slider-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 8px;
}

.slider-label output {
  font-weight: 700;
  min-width: 2.2em;
  text-align: right;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
input[type='range'].fem  { background: linear-gradient(90deg, #ffffff, var(--pink), var(--pink-deep)); }
input[type='range'].masc { background: linear-gradient(90deg, #ffffff, var(--blue), var(--blue-deep)); }
input[type='range'].enby { background: linear-gradient(90deg, #ffffff, var(--gold), var(--gold-deep)); }

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink-soft);
  box-shadow: 0 3px 8px rgba(91, 74, 94, 0.25);
  transition: transform 0.15s;
}
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type='range'].fem::-webkit-slider-thumb  { border-color: var(--pink-deep); }
input[type='range'].masc::-webkit-slider-thumb { border-color: var(--blue-deep); }
input[type='range'].enby::-webkit-slider-thumb { border-color: var(--gold-deep); }

input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink-soft);
  box-shadow: 0 3px 8px rgba(91, 74, 94, 0.25);
}
input[type='range'].fem::-moz-range-thumb  { border-color: var(--pink-deep); }
input[type='range'].masc::-moz-range-thumb { border-color: var(--blue-deep); }
input[type='range'].enby::-moz-range-thumb { border-color: var(--gold-deep); }

.budget {
  margin: 0 0 12px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.budget b { color: var(--ink); }

#note {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(155, 138, 160, 0.3);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  margin: 4px 0 14px;
}
#note:focus { outline: 2px solid var(--pink); border-color: transparent; }

#save {
  width: 100%;
  padding: 13px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--blue), var(--pink-deep));
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(238, 127, 163, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
#save:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(238, 127, 163, 0.45); }
#save:active { transform: translateY(0); }

.feedback {
  text-align: center;
  height: 1.2em;
  margin: 10px 0 0;
  font-weight: 600;
  color: var(--pink-deep);
}

/* ---- stats ---- */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px 14px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--blue-deep), var(--pink-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-value.stat-text { font-size: 1.35rem; }

.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin-top: 4px; }
.stat-sub { font-size: 0.72rem; color: var(--ink-soft); margin-top: 2px; }

.avg-bars { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.avg-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.avg-row i { font-style: normal; }
.avg-row b { min-width: 2em; text-align: right; font-size: 0.8rem; }
.avg-row .bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(155, 138, 160, 0.15);
  overflow: hidden;
}
.avg-row .bar div { height: 100%; border-radius: 999px; width: 0; transition: width 0.6s ease; }
#avg-fem  { background: linear-gradient(90deg, var(--pink), var(--pink-deep)); }
#avg-masc { background: linear-gradient(90deg, var(--blue), var(--blue-deep)); }
#avg-enby { background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }

/* ---- charts ---- */

.charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

.chart-wrap { position: relative; height: 260px; }
.donut-wrap { display: flex; justify-content: center; }

/* ---- history ---- */

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

.history-card li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
  border-bottom: 1px solid rgba(155, 138, 160, 0.15);
}
.history-card li:last-child { border-bottom: none; }

.h-date { font-weight: 700; min-width: 7.2em; }

.h-bars { display: flex; flex-direction: column; gap: 3px; width: 130px; flex-shrink: 0; }
.h-bars span { height: 6px; border-radius: 999px; display: block; }
.h-bars .hb-fem  { background: var(--pink-deep); }
.h-bars .hb-masc { background: var(--blue-deep); }
.h-bars .hb-enby { background: var(--gold-deep); }

.h-note {
  flex: 1;
  color: var(--ink-soft);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h-actions { display: flex; gap: 6px; }
.h-actions button {
  border: none;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.12s, background 0.12s;
}
.h-actions button:hover { transform: scale(1.1); background: #fff; }

.empty { color: var(--ink-soft); text-align: center; font-weight: 500; }

footer {
  text-align: center;
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
}
footer code { background: rgba(255, 255, 255, 0.6); padding: 2px 6px; border-radius: 6px; }

/* ---- auth ---- */

.auth-main {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 0;
}

.auth-card { padding: 28px; }

.auth-tabs {
  display: flex;
  gap: 8px;
  background: rgba(155, 138, 160, 0.12);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 20px;
}

.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(91, 74, 94, 0.12);
}

.auth-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 14px 0 6px;
}

.auth-card input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(155, 138, 160, 0.3);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}
.auth-card input:focus { outline: 2px solid var(--pink); border-color: transparent; }

.auth-error {
  min-height: 1.2em;
  margin: 12px 0 4px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4567c;
}

#auth-submit {
  width: 100%;
  padding: 13px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--blue), var(--pink-deep));
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(238, 127, 163, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
#auth-submit:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(238, 127, 163, 0.45); }

.auth-warning {
  margin: 18px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}
.auth-warning b { color: #d4567c; }

.user-chip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.user-chip button {
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.user-chip button:hover { background: #fff; color: #d4567c; }

/* ---- toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(91, 74, 94, 0.25);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 10;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---- responsive ---- */

@media (max-width: 820px) {
  .top-grid, .charts-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
  .h-note { display: none; }
}
