:root {
  --bg: #0f0f0f;
  --bg-elevated: #161616;
  --bg-card: #141414;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --accent: #c0392b;
  --accent-hover: #e74c3c;
  --border: #2a2a2a;
  --border-accent: rgba(192, 57, 43, 0.45);
  --radius: 2px;
  --font: "Syne", system-ui, sans-serif;
  --max: 1120px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(10px);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  z-index: 60;
}

.nav-brand span { color: var(--accent); }

.nav-toggle {
  display: none;
  position: relative;
  z-index: 60;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle:focus-visible {
  outline: none;
  border-color: var(--border-accent);
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-nav.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-nav.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.25rem;
  list-style: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

/* Hero */
.hero {
  padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  color: var(--text);
  max-width: 36ch;
  margin-bottom: 1rem;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 52ch;
  font-weight: 400;
}

.hero-accent-line {
  width: 64px;
  height: 3px;
  background: var(--accent);
  margin-top: 2rem;
}

/* Sections */
section {
  padding: 4rem 0;
}

section + section {
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.section-intro {
  color: var(--text-muted);
  max-width: 62ch;
  margin-bottom: 2.5rem;
  font-size: 1.02rem;
}

/* Project cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.25s ease;
}

.project-card:hover,
.project-card:focus-within {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.project-card:hover::before,
.project-card:focus-within::before {
  background: var(--accent);
}

.project-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.card-url {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.card-url a {
  color: var(--accent);
  word-break: break-all;
  transition: color 0.2s ease;
}

.card-url a:hover,
.card-url a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.btn-visit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 0.6rem 1.15rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-visit:hover,
.btn-visit:focus-visible {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

/* LaPorte Labs */
.suite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.suite-item {
  padding: 1.25rem 1.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

.suite-item strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.suite-item p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Daily Operator Checklist */
.checklist-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.75rem 1.5rem;
  max-width: 640px;
}

.checklist-panel .badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-accent);
  color: var(--accent);
  margin-bottom: 1rem;
}

.checklist-panel h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.checklist-panel > p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.checklist-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.checklist-meta strong {
  color: var(--text);
  font-weight: 700;
}

.checklist-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checklist-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.checklist-row .checklist-item {
  flex: 1;
}

.checklist-delete {
  flex-shrink: 0;
  width: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.checklist-delete:hover,
.checklist-delete:focus-visible {
  color: var(--accent-hover);
  border-color: var(--border-accent);
  background: rgba(192, 57, 43, 0.08);
  outline: none;
}

.checklist-status {
  min-height: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.checklist-status.is-submitted {
  color: #7dcea0;
}

.checklist-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-submit {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.btn-submit:hover,
.btn-submit:focus-visible {
  background: transparent;
  color: var(--accent);
  outline: none;
}

.btn-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.checklist-item:hover,
.checklist-item:focus-visible {
  border-color: var(--border-accent);
  outline: none;
}

.checklist-item.is-done {
  color: var(--text-muted);
}

.checklist-item.is-done .check-label {
  text-decoration: line-through;
  text-decoration-color: rgba(163, 163, 163, 0.7);
}

.check-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 1px;
  background: var(--bg-card);
  position: relative;
}

.checklist-item.is-done .check-box {
  background: var(--accent);
  border-color: var(--accent);
}

.checklist-item.is-done .check-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.notes-form {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.notes-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.notes-input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.notes-input::placeholder {
  color: #666;
}

.btn-add {
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-add:hover,
.btn-add:focus-visible {
  background: transparent;
  color: var(--accent);
  outline: none;
}

.notes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.note-text {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}

.note-delete {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.note-delete:hover,
.note-delete:focus-visible {
  color: var(--accent-hover);
  border-color: var(--border-accent);
  background: rgba(192, 57, 43, 0.08);
  outline: none;
}

.notes-empty,
.ops-error {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.ops-error {
  color: var(--accent-hover);
  border-color: var(--border-accent);
}

/* Fuel tracker */
.fuel-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.fuel-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.fuel-panel.span-12 { grid-column: span 12; }
.fuel-panel.span-7 { grid-column: span 7; }
.fuel-panel.span-5 { grid-column: span 5; }
.fuel-panel.span-6 { grid-column: span 6; }
.fuel-panel.span-4 { grid-column: span 4; }

.fuel-panel h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.fuel-panel > .panel-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
  line-height: 1.5;
}

.fuel-panel > .panel-desc strong {
  color: var(--text);
  font-weight: 700;
}

.field-labels {
  display: grid;
  grid-template-columns: 1fr 5rem 5rem;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-labels-ing {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0.25rem;
}

.qty-legend {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: -0.35rem 0 0.75rem;
}

.fuel-stats {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem 1.5rem;
  align-items: end;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-value span {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-sub {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-sub.is-over { color: var(--accent-hover); }

.fuel-bar {
  height: 6px;
  margin-top: 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.fuel-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease, background 0.25s ease;
}

.fuel-bar-fill.is-over { background: #e74c3c; }
.fuel-bar-fill.is-protein { background: #7dcea0; }
.fuel-bar-fill.is-protein.is-over { background: #7dcea0; }

.goals-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: end;
}

.goals-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.goals-form input {
  width: 5.25rem;
  padding: 0.5rem 0.55rem;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.goals-form input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.btn-ghost {
  padding: 0.5rem 0.75rem;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--text);
  border-color: var(--border-accent);
  outline: none;
}

.btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.section-head h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.quick-food-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.fuel-cat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.fuel-cat > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
}

.fuel-cat > summary::-webkit-details-marker { display: none; }

.fuel-cat > summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.fuel-cat[open] > summary::after {
  content: "–";
}

.fuel-cat-count {
  margin-left: auto;
  margin-right: 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.fuel-cat-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
}

.fuel-cat-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fuel-cat-label select {
  width: 100%;
  max-width: 16rem;
  padding: 0.65rem 0.75rem;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fuel-cat-label select:focus {
  outline: none;
  border-color: var(--border-accent);
}

.food-cat-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.quick-food-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.quick-food-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.15rem;
  margin-left: auto;
}

.quick-food-meta {
  flex: 1;
  min-width: 10rem;
}

.quick-food-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.quick-food-macros {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.qty-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.qty-group-select {
  flex-wrap: nowrap;
}

.qty-select-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.qty-select {
  min-width: 4.5rem;
  min-height: 2.4rem;
  padding: 0.4rem 0.5rem;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.qty-select:focus {
  outline: none;
  border-color: var(--border-accent);
}

.qty-log-btn {
  min-width: 4.25rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.qty-log-btn:hover,
.qty-log-btn:focus-visible {
  color: var(--accent);
  background: transparent;
}

.qty-btn {
  min-width: 2.15rem;
  padding: 0.35rem 0.45rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.qty-btn:hover,
.qty-btn:focus-visible {
  color: var(--text);
  border-color: var(--border-accent);
  background: rgba(192, 57, 43, 0.08);
  outline: none;
}

.log-list,
.food-lib,
.history-list,
.weight-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.food-lib {
  min-height: 0;
}

.log-item,
.food-card,
.history-row,
.weight-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.log-item-top,
.food-card-top,
.history-row,
.weight-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.log-main,
.food-main {
  flex: 1;
  min-width: 0;
}

.log-name,
.food-name {
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-word;
}

.log-meta,
.food-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.macro-pill {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.macro-pill small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

.icon-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--accent-hover);
  border-color: var(--border-accent);
  background: rgba(192, 57, 43, 0.08);
  outline: none;
}

.icon-btn.is-fav {
  color: #f1c40f;
}

.expand-btn {
  margin-top: 0.45rem;
  padding: 0;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.expand-btn:hover,
.expand-btn:focus-visible {
  color: var(--text);
  outline: none;
}

.ingredient-breakdown {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
  display: none;
  flex-direction: column;
  gap: 0.3rem;
}

.ingredient-breakdown.is-open { display: flex; }

.ingredient-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ingredient-line strong {
  color: var(--text);
  font-weight: 600;
}

.recipe-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.9rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.recipe-form-grid {
  display: grid;
  grid-template-columns: 1fr 5rem 5rem;
  gap: 0.5rem;
}

.recipe-form input,
.ingredient-editor input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.recipe-form input:focus,
.ingredient-editor input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.recipe-form input::placeholder,
.ingredient-editor input::placeholder { color: #666; }

.ingredient-editor {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ingredient-row {
  display: grid;
  grid-template-columns: 1fr 4.5rem 4.5rem auto;
  gap: 0.4rem;
  align-items: center;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: auto;
}

.history-row {
  align-items: center;
  justify-content: space-between;
}

.history-date {
  font-weight: 700;
  font-size: 0.9rem;
}

.history-vals {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
}

.history-vals strong {
  color: var(--text);
  font-weight: 700;
}

.history-row.is-today {
  border-color: var(--border-accent);
}

.week-avg {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-accent);
  background: rgba(192, 57, 43, 0.06);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.week-avg strong {
  font-weight: 800;
}

.weight-form {
  display: grid;
  grid-template-columns: 1fr 5.5rem auto;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.weight-trend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.chart-wrap {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.5rem 0.35rem;
  overflow: hidden;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chart-key {
  display: inline-block;
  width: 1.1rem;
  height: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
  border-radius: 1px;
}

.fuel-status {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.fuel-status.is-ok { color: #7dcea0; }
.fuel-status.is-err { color: var(--accent-hover); }

.fuel-drawer {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.15rem 0.85rem 0.85rem;
}

.fuel-drawer > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fuel-drawer > summary::-webkit-details-marker { display: none; }

.fuel-drawer > summary::after {
  content: " +";
  color: var(--accent);
}

.fuel-drawer[open] > summary::after {
  content: " –";
}

.fuel-goals-drawer {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
}

.fuel-intro-mobile { display: none; }
.fuel-mobile-only { display: none !important; }

@media (max-width: 900px) {
  .fuel-intro-desktop { display: none; }
  .fuel-intro-mobile { display: block; }
  .fuel-desktop-only { display: none !important; }
  .fuel-mobile-only { display: block !important; }

  .fuel-foods-drawer:not([open]) {
    /* closed by default on phone via JS */
  }

  .fuel-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  .quick-food-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .quick-food-actions {
    margin-left: 0;
    justify-content: flex-end;
  }

  .qty-group {
    width: 100%;
  }

  .qty-group-select {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    width: 100%;
  }

  .qty-select-label {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.45rem;
  }

  .qty-select,
  .qty-log-btn {
    min-height: 44px;
    font-size: 1rem;
  }

  .qty-btn.is-extra {
    display: none;
  }

  .panel-desc {
    font-size: 0.85rem;
  }

  .fuel-panel.span-5 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .weight-trend {
    grid-template-columns: 1fr 1fr;
  }

  .fuel-drawer {
    margin-top: 1.15rem;
  }
}

@media (min-width: 901px) {
  .fuel-grid {
    align-items: start;
  }

  .fuel-goals-drawer > summary {
    display: none;
  }

  .fuel-goals-drawer {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
  }

  .fuel-goals-drawer .goals-form {
    display: flex;
  }

  .fuel-foods-drawer > summary {
    display: none;
  }

  .fuel-foods-drawer {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
  }

  .fuel-panel.span-5 .fuel-foods-drawer[open] {
    display: flex;
    flex-direction: column;
    height: var(--fuel-side-h, auto);
    max-height: var(--fuel-side-h, none);
    overflow: hidden;
  }

  .fuel-panel.span-5 .fuel-foods-drawer > .panel-desc,
  .fuel-panel.span-5 .fuel-foods-drawer > .recipe-form {
    flex-shrink: 0;
  }

  .fuel-panel.span-5 .food-lib {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.2rem;
    margin-top: 0.35rem;
    scrollbar-gutter: stable;
  }

  .fuel-daily > .fuel-drawer > summary {
    /* week chart stays as drawer on desktop too? keep visible open */
  }
}

.chart-key.is-cals { background: var(--accent); }
.chart-key.is-weight { background: #7dcea0; }

.day-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-top: 1rem;
}

.day-total-card {
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.day-total-card.is-remain {
  border-color: var(--border-accent);
  background: rgba(192, 57, 43, 0.06);
}

.day-total-value {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.day-total-value span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-log-form {
  display: grid;
  grid-template-columns: 1fr 5.5rem 5.5rem auto;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.quick-log-form input {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.quick-log-form input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.quick-log-form input::placeholder { color: #666; }

.quick-log-save {
  margin-bottom: 0.25rem;
}

@media (max-width: 640px) {
  .day-totals {
    grid-template-columns: 1fr;
  }

  .quick-log-form {
    grid-template-columns: 1fr 1fr;
  }

  .quick-log-form input:first-child,
  .quick-log-form .btn-add {
    grid-column: 1 / -1;
  }
}

.trend-box {
  padding: 0.65rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.trend-box .stat-label { margin-bottom: 0.25rem; }
.trend-box strong {
  font-size: 1.05rem;
  font-weight: 800;
}

.trend-box.is-down strong { color: #7dcea0; }
.trend-box.is-up strong { color: var(--accent-hover); }

@media (max-width: 900px) {
  .fuel-panel.span-7,
  .fuel-panel.span-5,
  .fuel-panel.span-6,
  .fuel-panel.span-4 {
    grid-column: span 12;
  }

  .fuel-stats {
    grid-template-columns: 1fr 1fr;
  }

  .goals-form {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .recipe-form-grid,
  .ingredient-row,
  .weight-form {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-form-grid input:first-child,
  .ingredient-row input:first-child,
  .weight-form input:first-child {
    grid-column: 1 / -1;
  }

  .weight-trend {
    grid-template-columns: 1fr;
  }
}

/* Contact */
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15rem;
  transition: color 0.2s ease;
}

.contact-email:hover,
.contact-email:focus-visible {
  color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 1rem;
}

.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    height: auto;
    min-height: var(--nav-h);
  }

  .site-nav .wrap {
    position: relative;
    flex-wrap: wrap;
    min-height: var(--nav-h);
  }

  .nav-links {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: 100%;
    order: 3;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid var(--border);
    background: rgba(15, 15, 15, 0.98);
  }

  .site-nav.is-open .nav-links {
    display: flex;
  }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links a {
    display: block;
    padding: 0.95rem 0.15rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .hero { padding: 3.5rem 0 3rem; }
  section { padding: 3rem 0; }
}

/* Standalone tool pages */
.page-main > section:first-child {
  padding-top: 3rem;
}

.nav-links a[aria-current="page"] {
  color: var(--text);
}
