@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #101913;
  --surface: #17231b;
  --surface-2: #1e2d23;
  --border: #2a3b2e;
  --text: #e9efe9;
  --muted: #8fa393;
  --gold: #e8a33d;
  --blue: #6fb3d8;
  --warn: #e0684f;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, .brand {
  font-family: 'Space Grotesk', sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.brand span { color: var(--gold); }

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}
nav a:hover { color: var(--text); }

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.big-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--gold);
}

.accent-protein .big-num { color: var(--blue); }
.accent-warn .big-num { color: var(--warn); }

.unit {
  font-size: 0.75rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin-bottom: 16px;
}

.card.narrow { max-width: 460px; }

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

.card h2 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.muted { color: var(--muted); font-size: 0.88rem; }
.muted.small { font-size: 0.8rem; margin-top: 14px; }

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

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.log-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.log-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.log-table tfoot td {
  border-bottom: none;
  border-top: 1px solid var(--border);
  font-weight: 700;
  padding-top: 8px;
}
.num { font-family: 'JetBrains Mono', monospace; text-align: right; }

.btn {
  display: inline-block;
  background: var(--gold);
  color: #1a1305;
  font-weight: 600;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 7px;
  border: none;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn.small { padding: 6px 12px; font-size: 0.8rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: var(--warn); }

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
input, select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.inline-form input { flex: 1; }

.workout-list { padding-left: 18px; font-size: 0.92rem; }

.exercise-list {
  padding-left: 20px;
  font-size: 0.92rem;
}
.exercise-list li { margin-bottom: 8px; }

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--gold);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}

.notice {
  border-color: var(--gold);
}

.off-results {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.off-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.off-result-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 160px;
}

.off-result-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.off-result-action {
  display: flex;
  gap: 6px;
  align-items: center;
}
.off-result-action input {
  width: 70px;
}

#scan-video {
  display: none;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 10px;
}

.off-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-toggle {
  display: flex;
  gap: 6px;
}
.mode-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}
.mode-btn.active {
  border-color: var(--gold);
  color: var(--gold);
}

.mode-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mode-panel[hidden] {
  display: none;
}
.mode-panel label.mini {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1;
  min-width: 100px;
}
.mode-panel input {
  width: 100%;
}
.quantity-hint {
  width: 100%;
  margin: 0 0 2px;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.auth-card {
  width: 100%;
  max-width: 360px;
}
.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.checkbox-row input { width: auto; }

.logout-form {
  display: inline;
  margin-left: 20px;
}
.logout-form .link-btn {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.logout-form .link-btn:hover { color: var(--text); }

.date-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.date-nav-btn {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}
.date-nav-btn.disabled {
  color: var(--border);
  pointer-events: none;
}
.date-nav-current {
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
}
.over-target td.num:first-of-type {
  color: var(--warn);
}

@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr; }
}
