/* Vega Dashboard v0.2 - light + warm
   Modern fitness-app palette: cream + coral + peach + sage.
   Mobile-first. */

:root {
  /* Backgrounds */
  --bg:        #fdf8f1;     /* warm cream — the main canvas */
  --bg-soft:   #f7eee0;     /* slightly deeper cream */
  --bg-card:   #ffffff;     /* card surfaces — clean white */
  --bg-tint:   #fff5ec;     /* subtle peach tint for accent cards */

  /* Text */
  --ink:       #2b1f1a;     /* near-black warm */
  --ink-soft:  #5c4a40;     /* secondary text */
  --ink-muted: #8e7a6c;     /* tertiary, hints */
  --ink-line:  #ebdfd0;     /* subtle dividers */

  /* Accents — sunrise palette */
  --coral:     #ff6f5e;
  --coral-deep:#e85342;
  --peach:     #ffb37a;
  --amber:     #f6a92b;
  --sage:      #6fb38a;
  --sage-deep: #4f9670;
  --sky:       #5fa8c4;
  --rose:      #e07a8f;
  --plum:      #8e5e9e;

  /* Tints (10-15% alpha versions) */
  --coral-tint: #ffe1db;
  --peach-tint: #ffe9d4;
  --amber-tint: #fdecc4;
  --sage-tint:  #d8ecdf;
  --sky-tint:   #d8ebf2;

  --radius:    16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(43,31,26,0.04), 0 1px 3px rgba(43,31,26,0.06);
  --shadow:    0 2px 6px rgba(43,31,26,0.06), 0 8px 24px rgba(255,111,94,0.08);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(255,179,122,0.25), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(246,169,43,0.15), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(111,179,138,0.12), transparent 50%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-star { font-size: 48px; margin-bottom: 4px; }
.login-card h1 {
  margin: 0 0 4px;
  font-size: 34px;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-weight: 700;
}
.login-tag {
  margin: 0 0 24px;
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
#loginForm { display: flex; flex-direction: column; gap: 12px; }
#loginForm input {
  background: var(--bg);
  border: 1.5px solid var(--ink-line);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
}
#loginForm input:focus { border-color: var(--coral); }
#loginForm button {
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-deep) 100%);
  color: #fff;
  border: 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(255,111,94,0.35);
}
#loginForm button:hover { box-shadow: 0 6px 18px rgba(255,111,94,0.45); }
#loginForm button:active { transform: translateY(1px); }
.login-error {
  margin: 12px 0 0;
  color: var(--coral-deep);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- APP CHROME ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ink-line);
  position: sticky; top: 0;
  background: rgba(253,248,241,0.85);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-star { font-size: 24px; }
.brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.brand-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-muted);
}
.topnav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--ink-line);
  box-shadow: var(--shadow-sm);
}
.nav-btn {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: all 0.15s ease;
}
.nav-btn:hover { color: var(--ink); }
.nav-btn.active {
  background: var(--coral);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(255,111,94,0.35);
}

.main {
  padding: 18px 20px 100px;
  max-width: 980px;
  margin: 0 auto;
}

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

/* ---------- HERO CARD ---------- */
.hero-card {
  background: linear-gradient(135deg, #ffd29a 0%, #ffb37a 50%, #ff9e6b 100%);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 18px;
  color: #4a2618;
  box-shadow: 0 4px 18px rgba(255,158,107,0.25);
}
.hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.7;
}
.hero-title {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.4px;
}
.hero-line {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  opacity: 0.88;
}

/* ---------- TODAY SO FAR ---------- */
.today-card {
  background: var(--bg-card);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.today-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.today-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.today-card-actions { display: flex; gap: 6px; }
.danger-btn {
  background: transparent;
  border: 1px solid var(--coral-tint);
  color: var(--coral-deep);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.3px;
  font-weight: 500;
}
.danger-btn:hover {
  background: var(--coral-tint);
}
.today-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.today-pill {
  background: var(--bg-tint);
  border: 1px solid var(--peach-tint);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.today-pill strong { color: var(--ink); font-weight: 600; }
.today-pill .clear-x {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  margin: 0;
}
.today-pill .clear-x:hover { color: var(--coral-deep); }
.today-empty {
  color: var(--ink-muted);
  font-size: 13px;
  font-style: italic;
}

/* ---------- QUICK ROW ---------- */
.quick-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--ink-line);
  color: var(--ink);
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  box-shadow: var(--shadow-sm);
}
.quick-btn:hover {
  border-color: var(--coral);
  color: var(--coral-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,111,94,0.15);
}
.quick-btn:active { transform: translateY(0); }
.quick-btn.success {
  background: var(--sage-tint);
  border-color: var(--sage);
  color: var(--sage-deep);
}
@media(min-width: 640px) { .quick-row { grid-template-columns: repeat(4, 1fr); } }

/* ---------- TILE GRID ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media(min-width: 720px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }
.tile {
  background: var(--bg-card);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 16px 14px 12px;
  min-height: 132px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.tile-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.tile-sub { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.tile-chart { width: 100%; max-height: 60px; margin-top: 8px; }

#tile-tinnitus .tile-value { color: var(--coral-deep); }
#tile-weight .tile-value   { color: var(--amber); }
#tile-sleep .tile-value    { color: var(--sky); }
#tile-water .tile-value    { color: var(--sage-deep); }

/* ---------- VEGA CARD ---------- */
.vega-card {
  background: linear-gradient(135deg, var(--bg-tint) 0%, #ffe9d4 100%);
  border: 1px solid var(--peach);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.vega-card-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--coral-deep);
  margin-bottom: 8px;
  font-weight: 700;
}
.vega-card-body {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

/* ---------- LOG FORM ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 22px 22px 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.card h3 { margin: 24px 0 8px; font-size: 16px; color: var(--ink-soft); font-weight: 600; }
.muted { color: var(--ink-muted); margin: 0 0 18px; font-size: 14px; }
.muted.small { font-size: 12px; margin-top: 12px; }

fieldset {
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-sm);
  padding: 14px 16px 18px;
  margin: 0 0 16px;
  background: var(--bg);
}
legend {
  color: var(--coral-deep);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 8px;
  font-weight: 700;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 14px;
}
@media(min-width: 640px) { .grid-2 { grid-template-columns: repeat(3, 1fr); } }
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
label.full { grid-column: 1 / -1; }
label input,
label select,
label textarea {
  background: var(--bg-card);
  border: 1.5px solid var(--ink-line);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  transition: border-color 0.12s ease;
}
label input:focus,
label select:focus,
label textarea:focus { border-color: var(--coral); }

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.save-btn {
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-deep) 100%);
  color: #fff;
  border: 0;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  flex: 1;
  box-shadow: 0 4px 14px rgba(255,111,94,0.35);
}
.save-btn:hover { box-shadow: 0 6px 18px rgba(255,111,94,0.45); }
.save-btn:active { transform: translateY(1px); }
.clear-btn {
  background: transparent;
  border: 1.5px solid var(--ink-line);
  color: var(--ink-soft);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.clear-btn:hover {
  border-color: var(--coral);
  color: var(--coral-deep);
}
.save-status {
  text-align: center;
  font-size: 13px;
  color: var(--sage-deep);
  margin-top: 14px;
  min-height: 18px;
  font-weight: 500;
}
.save-status.error { color: var(--coral-deep); }

/* ---------- TRENDS ---------- */
.range-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.range-btn {
  background: var(--bg);
  border: 1.5px solid var(--ink-line);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.range-btn.active {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}
.big-chart {
  background: var(--bg);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 18px;
  height: 280px;
}

/* ---------- PLAN ---------- */
.plan-week {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}
@media(min-width: 640px) { .plan-week { grid-template-columns: repeat(2, 1fr); } }
.plan-day {
  background: var(--bg-tint);
  border: 1px solid var(--peach-tint);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plan-day strong {
  color: var(--coral-deep);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}
.plan-day span { color: var(--ink); font-size: 14px; }

/* ---------- FOOTER ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--ink-muted);
  border-top: 1px solid var(--ink-line);
  margin-top: 32px;
}
.link-btn {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 12px;
}
.link-btn:hover { color: var(--coral-deep); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(43,31,26,0.25);
  transition: transform 0.25s ease;
  z-index: 100;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--sage-deep); }
.toast.error { background: var(--coral-deep); }
