:root {
  --font-display: 'Onest', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e3e8ef;
  --text: #172434;
  --muted: #6c7a89;

  --nav: #0f1b2d;
  --nav-2: #17263d;

  --primary: #1f3a5a;
  --primary-hover: #16304e;
  --primary-soft: #edf4fb;

  --ok: #1f845a;
  --ok-bg: #edf9f3;

  --warn: #b97911;
  --warn-bg: #fff5e8;

  --bad: #bf3c2f;
  --bad-bg: #fff0ee;

  --shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --transition-fast: 0.15s ease;
  --transition-mid: 0.22s ease;
}

/* ── Mode nuit ──────────────────────────────────────────────────────────── */
body.dark-mode {
  --bg:           #000000;
  --surface:      #1c1c1e;
  --surface-soft: #2c2c2e;
  --surface2:     #2c2c2e;
  --line:         #3a3a3c;
  --text:         #f5f5f7;
  --muted:        #8e8e93;
  --primary-soft: #1e2d40;
  --shadow:       0 14px 35px rgba(0,0,0,0.6);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.5);

  --ok:     #30d158;
  --ok-bg:  #0c2218;
  --warn:   #ffd60a;
  --warn-bg:#252000;
  --bad:    #ff453a;
  --bad-bg: #2c0d0b;
}

body.dark-mode .button--danger {
  border-color: var(--bad);
}
body.dark-mode .button--danger:hover {
  background: var(--bad-bg);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: var(--muted);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  color: var(--text);
}

textarea {
  resize: vertical;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.1;
}

h3 {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.15;
}

p {
  margin-bottom: 0;
}

.page-subtitle {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
}

.text-muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid--two-columns {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.grid--three-columns {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.button,
.icon-button {
  border: 1px solid transparent;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.button--secondary:hover {
  background: var(--surface-soft);
}

.button--danger {
  background: var(--bad-bg);
  border-color: #f4c3be;
  color: var(--bad);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge--bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

@media (max-width: 1100px) {
  .grid--two-columns,
  .grid--three-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }
}

/* ─── No-macros mode ─────────────────────────────────────────────────────────── */

body.no-macros .db-meal-row__kcal,
body.no-macros .db-day-total,
body.no-macros .db-mini-stat,
body.no-macros .db-summary-ring-stats,
body.no-macros .dashboard-objective-row,
body.no-macros .dashboard-widget--objective .dashboard-widget__body,
body.no-macros .planner-objective-row,
body.no-macros .planner-objectives-card {
  display: none !important;
}

/* Icônes trait (js/icons.js) — remplacent les emojis, suivent la couleur du texte. */
.fp-ic { width: 1em; height: 1em; display: inline-block; flex: none; vertical-align: -0.14em; }
.fp-ic--fill { fill: currentColor; }
