/* Fitness Rawrtine — palette derived from the dashboard inspiration:
   emerald + cyan + electric blue with subtle violet/pink accents,
   on a deep navy background that complements the logo.            */
:root {
  --bg: #060b1d;
  --bg-2: #0a1230;
  --panel: #0d1530;
  --panel-2: #142149;
  --panel-3: #1b2a5a;
  --border: #243463;
  --border-strong: #335089;
  --text: #eaf0ff;
  --muted: #8b9bc4;

  --emerald: #10b981;
  --emerald-2: #34d399;
  --cyan: #22d3ee;
  --cyan-2: #67e8f9;
  --blue: #3b82f6;
  --indigo: #6366f1;
  --violet: #a855f7;
  --pink: #f472b6;
  --amber: #fbbf24;

  --primary: var(--emerald);
  --primary-grad: linear-gradient(135deg, #10b981 0%, #06b6d4 60%, #3b82f6 100%);
  --accent: var(--cyan);
  --accent-2: var(--emerald-2);
  --warn: #fbbf24;
  --ok: #10b981;
  --err: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 500px at 88% -10%, rgba(34,211,238,0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(16,185,129,0.10), transparent 60%),
    linear-gradient(180deg, #04081a 0%, var(--bg) 50%, var(--bg-2) 100%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* ----- Top bar / menu ----- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(6,11,29,0.92), rgba(10,18,48,0.82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand img {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(34,211,238,0.25));
}
.brand .brand-text {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.3px;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (max-width: 540px) { .brand .brand-text { display: none; } }

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link.active {
  color: #04111c;
  background: linear-gradient(135deg, var(--emerald-2), var(--cyan));
  box-shadow: 0 4px 14px rgba(34,211,238,0.25);
}
.nav-link.weigh-in-cta {
  color: var(--emerald-2);
  background: rgba(16,185,129,0.10);
  border: 1px solid rgba(16,185,129,0.35);
}
.nav-link.weigh-in-cta:hover {
  background: rgba(16,185,129,0.20);
  color: #d1fae5;
}
.nav-link.logout { color: var(--muted); font-weight: 500; }
.nav-link.logout:hover { color: var(--text); }

@media (max-width: 720px) {
  .nav { gap: 2px; padding: 3px; }
  .nav-link { padding: 6px 10px; font-size: 12px; }
}

/* ----- Layout ----- */
.container { max-width: 1040px; margin: 0 auto; padding: 24px 20px 80px; }
.footer { text-align: center; color: var(--muted); padding: 30px 0 16px; font-size: 13px; }
.footer a { color: var(--muted); }
.health-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
  margin: 0 4px 0 6px;
  box-shadow: 0 0 6px rgba(0,0,0,0);
  transition: background 200ms, box-shadow 200ms;
}
.health-dot.ok  { background: var(--ok);  box-shadow: 0 0 8px var(--ok); }
.health-dot.err { background: var(--err); box-shadow: 0 0 8px var(--err); }

h1, h2, h3 { margin: 0 0 12px; letter-spacing: -0.01em; }

/* ----- Cards ----- */
.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 70%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin: 16px 0;
  box-shadow: 0 6px 22px rgba(0,0,0,0.32);
}
.card.narrow { max-width: 460px; margin: 40px auto; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid.two-col .full { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .grid.two, .grid.two-col { grid-template-columns: 1fr; }
}

.user-card .big {
  font-size: 44px;
  font-weight: 800;
  margin: 6px 0;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.user-card .big .unit {
  font-size: 18px;
  color: var(--muted);
  font-weight: 500;
  -webkit-text-fill-color: var(--muted);
}
.user-card.me { border-color: var(--emerald); box-shadow: 0 6px 22px rgba(16,185,129,0.18); }
.tag {
  background: linear-gradient(135deg, var(--emerald-2), var(--cyan));
  color: #04111c;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: middle;
  font-weight: 700;
  letter-spacing: 0.4px;
}

ul.metrics { list-style: none; padding: 0; margin: 6px 0; color: var(--muted); }
ul.metrics li { padding: 5px 0; border-bottom: 1px dashed rgba(255,255,255,0.07); }
ul.metrics li:last-child { border: none; }
ul.metrics strong { color: var(--text); }
.big-list li { font-size: 18px; padding: 8px 0; }

/* ----- Week banner ----- */
.week-banner {
  padding: 20px 22px;
  border-radius: 16px;
  margin: 16px 0;
  background:
    radial-gradient(140% 100% at 0% 0%, rgba(34,211,238,0.20) 0%, transparent 55%),
    radial-gradient(140% 100% at 100% 100%, rgba(16,185,129,0.20) 0%, transparent 55%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
}
.week-banner h1 { font-size: 22px; }
.week-banner .result { font-size: 18px; margin: 4px 0 0; }

/* ----- Inline weigh-in form ----- */
.weigh-in-top h2 { margin-bottom: 8px; }
.weigh-in-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 6px;
}
.weigh-in-form input[name="weight_lb"] {
  flex: 1 1 200px;
  font-size: 18px;
  padding: 12px 14px;
}
.weigh-in-form .btn { padding: 12px 16px; }

/* ----- Buttons ----- */
.actions { margin: 18px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 120ms, background 120ms, transform 80ms;
}
.btn:hover { border-color: var(--accent); background: rgba(34,211,238,0.08); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary-grad);
  border: none;
  color: #04111c;
  box-shadow: 0 6px 18px rgba(16,185,129,0.30);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.40);
  color: #fecaca;
}
.btn.danger:hover { background: rgba(239,68,68,0.20); border-color: var(--err); color: #fff; }

/* ----- Forms ----- */
form label {
  display: block;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
form input, form select, form textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  background: #0a1227;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-weight: 500;
  transition: border-color 120ms, box-shadow 120ms;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.18);
}
form button { margin-top: 10px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.table tr.totals td { font-weight: 700; }

.muted { color: var(--muted); }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.error { color: var(--err); }

/* ----- Modal ----- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 140ms ease-out;
}
.modal-dialog {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 60%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 18px 52px rgba(0,0,0,0.66);
  overflow: hidden;
  animation: modalIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 17px;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 8px;
  transition: background 100ms;
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.modal-body { padding: 16px 18px 18px; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}
body.modal-open { overflow: hidden; }
