:root {
  --brand: #ff6b35;
  --brand-dark: #e5531f;
  --brand-light: #fff3ec;
  --text: #222;
  --muted: #777;
  --border: #e5e5e5;
  --bg: #fafafa;
  --card-bg: #fff;
  --danger: #d33;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }

.navbar { background: var(--brand); color: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.navbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { color: white; font-weight: bold; font-size: 18px; }
.navbar nav { display: flex; gap: 16px; flex-wrap: wrap; }
.navbar nav a { color: white; opacity: 0.9; }
.navbar nav a:hover { opacity: 1; text-decoration: none; }

h1 { font-size: 26px; margin: 12px 0 8px; }
h2 { font-size: 18px; margin: 20px 0 8px; }

.muted { color: var(--muted); font-size: 13px; }

.page-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}

.btn {
  display: inline-block; padding: 8px 14px; background: #eee;
  color: var(--text); border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; text-decoration: none;
}
.btn:hover { background: #e0e0e0; text-decoration: none; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b02a2a; }

.flashes { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; }
.flash-success { background: #e7f6e7; color: #2b7a2b; border-left: 4px solid #4caf50; }
.flash-error { background: #fdeaea; color: #b02a2a; border-left: 4px solid #d33; }

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

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin: 20px 0;
}
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-value { font-size: 28px; font-weight: bold; color: var(--brand); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; }

.recipe-list { list-style: none; padding: 0; margin: 0; }
.recipe-list li {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.recipe-list li:last-child { border-bottom: none; }

.tag {
  display: inline-block; background: var(--brand-light); color: var(--brand-dark);
  font-size: 11px; padding: 2px 8px; border-radius: 12px;
  margin-right: 4px; margin-left: 4px;
}

.form label { display: block; margin-bottom: 14px; font-weight: 500; }
.form input[type=text],
.form input[type=url],
.form input[type=number],
.form input[type=search],
.form textarea,
.form select {
  display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; background: white;
}
.form textarea { resize: vertical; min-height: 100px; }
.form .row { display: flex; gap: 12px; flex-wrap: wrap; }
.form .row label { flex: 1; min-width: 120px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form select {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; min-width: 220px;
}

.checkbox { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.diets-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
}
legend { padding: 0 8px; font-weight: bold; }

.planner-scroll { overflow-x: auto; margin: 12px 0; }
.planner { border-collapse: collapse; min-width: 900px; width: 100%; }
.planner th, .planner td {
  border: 1px solid var(--border); padding: 6px;
  text-align: center; vertical-align: top;
}
.planner th { background: #f5f5f5; font-size: 13px; }
.planner select {
  width: 100%; padding: 6px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 13px; background: white;
}
.week-nav { display: flex; gap: 8px; flex-wrap: wrap; }

.shopping-list { list-style: none; padding: 0; margin: 12px 0; }
.shopping-item { border-bottom: 1px solid var(--border); }
.shopping-item label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; cursor: pointer;
}
.shopping-item.checked .label-text {
  text-decoration: line-through; color: var(--muted);
}
.shopping-item input[type=checkbox] { width: 18px; height: 18px; }

.progress {
  height: 8px; background: #eee; border-radius: 4px;
  overflow: hidden; margin-bottom: 16px;
}
.progress-bar { background: var(--brand); height: 100%; transition: width 0.2s; }

.two-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; }
@media (max-width: 700px) {
  .two-cols { grid-template-columns: 1fr; }
  .planner-scroll { font-size: 12px; }
}

.instructions {
  background: #f8f8f8; padding: 12px; border-radius: var(--radius);
  white-space: pre-wrap; font-family: inherit; font-size: 14px; margin: 0;
}

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px;
}

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* Catégories de courses */
.shopping-category {
  margin-bottom: 24px;
}
.category-title {
  font-size: 16px;
  color: #ff6b35;
  border-bottom: 2px solid #ff6b35;
  padding-bottom: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
