/* d-app design system
   Hybrid of Behance Zentum Health + Behance Nutrition Diary App + Dribbble Nutrisee.
   One file, no build step, no CDN. Loaded by every page of d-app. */

/* ─── Tokens ───────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:            #f7f8fa;
  --bg-card:       #ffffff;
  --bg-elevated:   #fbfbfd;
  --bg-subtle:     #f0f2f7;
  --border:        #e8eaf0;
  --border-strong: #d6dae3;

  /* Text */
  --text-primary:  #0e1320;
  --text-secondary:#5a6478;
  --text-muted:    #9aa3b5;
  --text-on-accent:#ffffff;

  /* Accent — deep blue from Zentum */
  --accent:        #0057ff;
  --accent-hover:  #003fd1;
  --accent-soft:   #e6efff;

  /* Nutrition semantics */
  --protein:       #22c55e;
  --protein-soft:  #dcfce7;
  --fat:           #f59e0b;
  --fat-soft:      #fef3c7;
  --carbs:         #3b82f6;
  --carbs-soft:    #dbeafe;
  --kcal:          #0e1320;

  /* Signals */
  --success:       #16a34a;
  --success-soft:  #dcfce7;
  --warning:       #f59e0b;
  --warning-soft:  #fef3c7;
  --danger:        #dc2626;
  --danger-soft:   #fee2e2;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Shadows — soft, not material */
  --shadow-sm: 0 1px 2px rgba(14,19,32,0.04), 0 1px 1px rgba(14,19,32,0.02);
  --shadow-md: 0 6px 18px rgba(14,19,32,0.06);
  --shadow-lg: 0 20px 40px rgba(14,19,32,0.08);

  /* Spacing — 4px grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Typography scale */
  --fs-micro:   11px;
  --fs-caption: 13px;
  --fs-body:    15px;
  --fs-h2:      18px;
  --fs-h1:      24px;
  --fs-display: 32px;
  --fs-hero:    44px;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  --lh-tight:   1.25;
  --lh-normal:  1.5;

  /* Layout */
  --max-w:      960px;
  --nav-h:      64px;
  --bottom-nav-h: 72px;
}

[data-theme="dark"] {
  --bg:            #0e1320;
  --bg-card:       #161c2c;
  --bg-elevated:   #1c2336;
  --bg-subtle:     #131827;
  --border:        #252d42;
  --border-strong: #2f3850;
  --text-primary:  #f2f4f8;
  --text-secondary:#a0aac0;
  --text-muted:    #6b7692;
  --accent:        #4d8bff;
  --accent-hover:  #76a4ff;
  --accent-soft:   #1a2744;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.4);
}

/* ─── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4));
}
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { line-height: var(--lh-tight); }
ul { list-style: none; }

/* ─── Typography helpers ─────────────────────────────────────────── */
.display  { font-size: var(--fs-display); font-weight: var(--fw-bold); }
.hero     { font-size: var(--fs-hero);    font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.h1       { font-size: var(--fs-h1);      font-weight: var(--fw-semi); }
.h2       { font-size: var(--fs-h2);      font-weight: var(--fw-semi); }
.body     { font-size: var(--fs-body);    font-weight: var(--fw-regular); }
.caption  { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--text-secondary); }
.micro    { font-size: var(--fs-micro);   font-weight: var(--fw-semi);
            text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.muted    { color: var(--text-muted); }
.secondary{ color: var(--text-secondary); }

/* ─── Layout shell ───────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.stack > * + * { margin-top: var(--sp-5); }
.stack-lg > * + * { margin-top: var(--sp-8); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); }

/* ─── Top nav (desktop) ──────────────────────────────────────────── */
.topnav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.topnav-brand {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}
.topnav-brand span { color: var(--accent); }
.topnav-links {
  display: flex;
  gap: var(--sp-2);
  flex: 1;
}
.topnav-links a {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  font-size: var(--fs-caption);
  transition: background 0.15s, color 0.15s;
}
.topnav-links a:hover { background: var(--bg-subtle); color: var(--text-primary); }
.topnav-links a.active { background: var(--accent-soft); color: var(--accent); }
.topnav-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--fw-semi);
  font-size: var(--fs-caption);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Bottom nav (mobile) ────────────────────────────────────────── */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  height: var(--bottom-nav-h);
  z-index: 20;
  padding: var(--sp-2) 0 calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
}
.bottomnav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: var(--fs-micro);
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--fw-medium);
  padding: var(--sp-1) var(--sp-2);
  min-width: 56px;
}
.bottomnav a .ico { font-size: 22px; line-height: 1; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a:hover { color: var(--text-primary); }
.bottomnav a.active:hover { color: var(--accent); }

/* ─── Card ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.card-hover { transition: box-shadow 0.2s, transform 0.2s; }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.card-header h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semi);
}
.card-meta { color: var(--text-muted); font-size: var(--fs-caption); }

/* ─── Stat tile ──────────────────────────────────────────────────── */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.stat-value {
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}
.stat-meta {
  font-size: var(--fs-micro);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  margin-top: var(--sp-1);
}
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: var(--sp-2);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}
.progress-fill.protein { background: var(--protein); }
.progress-fill.fat     { background: var(--fat); }
.progress-fill.carbs   { background: var(--carbs); }
.progress-fill.over    { background: var(--danger); }

/* ─── Macro ring (pure CSS conic-gradient) ───────────────────────── */
.macro-ring {
  --p-pct: 0deg;     /* protein end */
  --f-pct: 0deg;     /* fat end (cumulative) */
  --c-pct: 0deg;     /* carbs end (cumulative) */
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(
    var(--protein) 0deg   var(--p-pct),
    var(--fat)     var(--p-pct) var(--f-pct),
    var(--carbs)   var(--f-pct) var(--c-pct),
    var(--bg-subtle) var(--c-pct) 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto;
}
.macro-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  background: var(--bg-card);
  border-radius: 50%;
}
.macro-ring-inner {
  position: relative;
  text-align: center;
}
.macro-ring-value {
  font-size: 28px;
  font-weight: var(--fw-bold);
  line-height: 1;
}
.macro-ring-label {
  font-size: var(--fs-micro);
  color: var(--text-muted);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--sp-1);
}

/* ─── Macro bars (alternative to ring) ───────────────────────────── */
.macro-bars { display: flex; flex-direction: column; gap: var(--sp-3); }
.macro-bar {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
}
.macro-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  justify-self: center;
}
.macro-bar.protein .dot { background: var(--protein); }
.macro-bar.fat     .dot { background: var(--fat); }
.macro-bar.carbs   .dot { background: var(--carbs); }
.macro-bar .track {
  background: var(--bg-subtle);
  border-radius: var(--r-pill);
  height: 8px;
  overflow: hidden;
}
.macro-bar .fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}
.macro-bar.protein .fill { background: var(--protein); }
.macro-bar.fat     .fill { background: var(--fat); }
.macro-bar.carbs   .fill { background: var(--carbs); }
.macro-bar .nums {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  color: var(--text-primary);
  white-space: nowrap;
}
.macro-bar .nums span { color: var(--text-muted); font-weight: var(--fw-regular); }

/* ─── Meal card ──────────────────────────────────────────────────── */
.meal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.meal:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.meal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.meal-body { flex: 1; min-width: 0; }
.meal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}
.meal-type {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  color: var(--text-primary);
  text-transform: capitalize;
}
.meal-time {
  font-size: var(--fs-micro);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}
.meal-desc {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.meal-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.meal-menu {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 0 var(--sp-2);
  line-height: 1;
}
.meal-menu:hover { color: var(--text-primary); }

/* ─── Chips ──────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.chip.kcal    { background: var(--bg-subtle);    color: var(--kcal); }
.chip.protein { background: var(--protein-soft); color: var(--success); }
.chip.fat     { background: var(--fat-soft);     color: #b45309; }
.chip.carbs   { background: var(--carbs-soft);   color: #1e40af; }
.chip.neutral { background: var(--bg-subtle);    color: var(--text-secondary); }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  min-height: 44px;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--text-on-accent); }
.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-tertiary {
  background: transparent;
  color: var(--accent);
  padding: 12px 8px;
}
.btn-tertiary:hover { color: var(--accent-hover); }
.btn-danger {
  background: var(--danger);
  color: var(--text-on-accent);
}
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: var(--fs-micro); }
.btn-block { width: 100%; }

/* ─── Form ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}
.field .hint {
  font-size: var(--fs-micro);
  color: var(--text-muted);
  margin-top: -2px;
}
.input, .textarea, .select {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 12px var(--sp-4);
  font: inherit;
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 96px; resize: vertical; }
.field.error .input,
.field.error .textarea { border-color: var(--danger); }
.field.error .hint    { color: var(--danger); }

/* ─── Chart wrapper (Chart.js container) ─────────────────────────── */
.chart {
  position: relative;
  height: 220px;
  width: 100%;
}
.chart-sm { height: 120px; }

/* ─── Misc helpers ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; border: 0; }
.pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger  { background: var(--danger-soft);  color: var(--danger); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .topnav { display: none; }
  .bottomnav { display: block; }
  body { padding-top: var(--sp-4); }
  .container { padding: 0 var(--sp-4); }
  .card { padding: var(--sp-5); }
  .macro-ring { width: 160px; height: 160px; }
  .stat-value { font-size: 28px; }
}
@media (min-width: 721px) {
  .bottomnav { display: none; }
}

/* =========================================================================
   Phase 2: auth pages (login/register/2fa/profile) + dashboard additions
   ========================================================================= */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: var(--sp-8);
}

.auth-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: var(--sp-6);
}

.auth-brand span {
    color: var(--accent);
}

.auth-foot {
    margin-top: var(--sp-5);
    text-align: center;
    font-size: 13px;
}

.auth-foot a {
    color: var(--accent);
    text-decoration: none;
}

.auth-foot a:hover {
    text-decoration: underline;
}

/* Callouts (info / success / error) */
.callout {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.callout.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.callout.success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

/* Block-width primary action */
.btn-block {
    display: block;
    width: 100%;
}

/* 2FA setup: QR + secret */
.qr-block {
    margin-top: var(--sp-6);
    padding: var(--sp-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-4);
}

.qr-block img {
    background: #fff;
    padding: var(--sp-3);
    border-radius: var(--r-md);
}

.totp-secret {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    justify-content: center;
}

.totp-secret code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--r-sm);
    letter-spacing: 0.05em;
    word-break: break-all;
    max-width: 100%;
}

/* Backup codes list */
.backup-codes {
    list-style: none;
    padding: 0;
    margin: var(--sp-4) 0 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-2);
}

.backup-codes li {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: var(--sp-2) var(--sp-3);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 14px;
    text-align: center;
}

/* Small helper text */
.micro {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Disabled inputs (Profile email field) */
input:disabled,
textarea:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ---------- OAuth buttons (phase 2.1) ---------- */
.oauth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-4);
  color: var(--text-muted);
  font-size: 13px;
  text-transform: lowercase;
}
.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-google:hover {
  background: var(--bg-elevated);
  border-color: #d0d5e0;
  color: var(--text-primary);
}
.btn-google svg { flex-shrink: 0; }

/* --- Nutrition: progress-bar alias -------------------------------- */
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

/* --- Nutrition: meal cards ---------------------------------------- */
.meal-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--bg-card);
  transition: box-shadow 0.15s ease;
}
.meal-card:hover { box-shadow: var(--shadow-sm); }
.meal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.meal-card-type {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.meal-emoji { font-size: 18px; line-height: 1; }
.meal-type-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  color: var(--text-primary);
  text-transform: capitalize;
}
.meal-desc {
  font-size: var(--fs-body);
  color: var(--text-primary);
  margin: 0 0 var(--sp-3);
  line-height: 1.45;
}
.meal-macros {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.meal-comment {
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-subtle);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--accent-soft);
}
.meal-actions {
  display: flex;
  gap: var(--sp-1);
}

/* --- Macro chips -------------------------------------------------- */
.macro-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: var(--fw-semi);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.macro-chip::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.macro-chip.kcal    { color: var(--accent);   background: rgba(0,87,255,0.08); }
.macro-chip.protein { color: var(--protein);  background: rgba(34,197,94,0.10); }
.macro-chip.fat     { color: var(--fat);      background: rgba(245,158,11,0.10); }
.macro-chip.carbs   { color: var(--carbs);    background: rgba(59,130,246,0.10); }

/* --- Icon buttons ------------------------------------------------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}
.btn-icon:hover             { background: var(--bg-subtle); color: var(--text-primary); }
.btn-icon.btn-danger:hover  { background: rgba(220,38,38,0.08); color: var(--danger); }

/* --- Modals ------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14,19,32,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: var(--sp-4);
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  width: 100%; max-width: 480px;
  padding: var(--sp-6);
}
.modal-box h3 { margin: 0 0 var(--sp-4); }
.modal-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.modal-body textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  font-size: var(--fs-body);
}
.modal-footer {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-5);
}
.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
