:root{
  /* Bring-like palette */
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;

  --brand: #16a34a;      /* green */
  --brand-2: #22c55e;    /* brighter */
  --accent: #f97316;     /* orange */
  --danger: #ef4444;

  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --shadow-sm: 0 6px 16px rgba(17,24,39,.06);

  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 12px;

  --tap: 46px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
main{
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 12px 28px;
}

/* Header */
header{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(246,247,251,.85);
  border-bottom: 1px solid rgba(229,231,235,.8);
  padding: 10px 10px;
  display:flex;
  gap:10px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

header a{
  display:inline-flex;
  align-items:center;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration:none;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(229,231,235,.9);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

header a:hover{
  border-color: rgba(34,197,94,.35);
}

/* Cards */
.card{
  background: var(--card);
  border: 1px solid rgba(229,231,235,.9);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 14px 14px;
  margin: 12px 0;
}

.card h2{
  margin: 0 0 10px 0;
  font-size: 18px;
  letter-spacing: -.2px;
}

p{ margin: 8px 0; }
small{ color: var(--muted); }

/* Rows / forms */
.row{
  display:flex;
  gap:10px;
  align-items:center;
}

input, select, textarea{
  width:100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(229,231,235,.9);
  border-radius: var(--r-md);
  padding: 12px 12px;
  min-height: var(--tap);
  outline: none;
  box-shadow: 0 1px 0 rgba(17,24,39,.03);
}

textarea{ min-height: 120px; }

input:focus, select:focus, textarea:focus{
  border-color: rgba(34,197,94,.55);
  box-shadow: 0 0 0 4px rgba(34,197,94,.15);
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height: var(--tap);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(229,231,235,.9);
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  text-decoration:none;
  box-shadow: var(--shadow-sm);
  user-select:none;
}

.btn:hover{
  border-color: rgba(34,197,94,.35);
}

.btn.primary{
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-color: rgba(22,163,74,.35);
  color: #fff;
}

.btn.danger{
  background: #fff;
  border-color: rgba(239,68,68,.35);
  color: var(--danger);
}

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size: 12px;
  font-weight: 900;
  color: #065f46;
  background: rgba(34,197,94,.14);
  border: 1px solid rgba(34,197,94,.25);
  padding: 6px 10px;
  border-radius: 999px;
}

/* Tables */
table{
  width:100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--r-lg);
}

th, td{
  text-align:left;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(229,231,235,.85);
  vertical-align: middle;
}

th{
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}

tr:last-child td{ border-bottom: none; }

/* Item line */
.item{
  display:flex;
  align-items:center;
  gap: 10px;
}

/* Thumb (photo or placeholder icon) */
.thumb{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f3f4f6;
  border: 1px solid rgba(229,231,235,.9);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex: 0 0 44px;
}

.thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.thumb svg{
  width: 22px;
  height: 22px;
  opacity: .65;
}

/* Checkbox look (we keep your form-submit logic) */
.chk{
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

/* Mobile tweaks */
@media (max-width: 640px){
  .row{ flex-wrap: wrap; }
  header{ padding: 10px 8px; }
  header a{ box-shadow:none; }
  .card{ padding: 12px; }
  th{ display:none; }
  table, tbody, tr, td{ display:block; width:100%; }
  tr{ border-bottom: 1px solid rgba(229,231,235,.85); padding: 8px 0; }
  td{ border-bottom: none; padding: 6px 0; }
}

/* ===== Mobile UX ===== */
@media (max-width: 680px){
  header{
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  .btn, a.btn, button.btn{
    padding: 12px 14px;
    border-radius: 16px;
    font-weight: 900;
  }
  .card{ border-radius: 20px; }
}

/* Bottom nav */
.mobileNav{
  display:none;
}
@media (max-width: 680px){
  .mobileNav{
    display:flex;
    position:fixed;
    left:12px; right:12px; bottom:12px;
    gap:10px;
    background:#fff;
    border:1px solid rgba(229,231,235,.9);
    border-radius:18px;
    box-shadow: 0 16px 40px rgba(17,24,39,.12);
    padding:10px;
    z-index:2000;
  }
  .mobileNav a{
    flex:1;
    text-align:center;
    padding:12px 10px;
    border-radius:14px;
    font-weight:900;
    border:1px solid rgba(229,231,235,.9);
    background:#f9fafb;
  }
  main{ padding-bottom: 86px; } /* laisse la place à la bottom nav */
}

/* Swipe delete shell */
.swipeItem{
  position:relative;
  overflow:hidden;
  border-radius:18px;
}
.swipeInner{
  display:flex;
  align-items:center;
  gap:12px;
  transition: transform .18s ease;
  background:#fff;
}
.swipeDelete{
  position:absolute;
  top:0; right:0; bottom:0;
  width:96px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}
.meal-thumb {
  width: 120px;          /* largeur fixe */
  height: 90px;          /* hauteur fixe */
  border-radius: 14px;
  overflow: hidden;
  background: #f3f4f6;
  flex-shrink: 0;
  border: 1px solid rgba(229,231,235,.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.meal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;     /* 🔑 clé du problème */
  display: block;
}


