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

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #020617;
    color: #e5e7eb;
}

.layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #4ade80, #22c55e 40%, #16a34a);
    box-shadow: 0 4px 10px rgba(34,197,94,0.4);
}

.logo-text {
    font-weight: 700;
    letter-spacing: 0.03em;
}

nav {
    display: flex;
    gap: 0.5rem;
}

nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.95rem;
    background: linear-gradient(145deg, #0f172a, #020617);
    border-radius: 999px;
    border: 1px solid #1f2937;
    box-shadow: 0 3px 0 #020617;
    font-size: 0.85rem;
    color: #e5e7eb;
    text-decoration: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s ease;
}

nav a:hover {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #020617;
    background: linear-gradient(145deg, #111827, #020617);
}

nav a:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 #020617;
}

.card {
    background: #020617;
    border-radius: 0.9rem;
    padding: 1.1rem;
    margin-bottom: 1rem;
    border: 1px solid #1e293b;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #111827;
    border: 1px solid #374151;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: 2fr 1.4fr;
}

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    padding: 0.45rem 0.35rem;
    border-bottom: 1px solid #1e293b;
}

th {
    text-align: left;
    font-weight: 500;
    color: #9ca3af;
}

tr:nth-child(even) td {
    background: #020617;
}

input,
select {
    background: #020617;
    border-radius: 0.45rem;
    border: 1px solid #374151;
    color: #e5e7eb;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: #60a5fa;
}

button {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 0.95rem;
    font-size: 0.9rem;
    cursor: pointer;
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 3px 0 #1d4ed8;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

button.secondary {
    background: linear-gradient(145deg, #4b5563, #374151);
    box-shadow: 0 3px 0 #111827;
}

button.danger {
    background: linear-gradient(145deg, #b91c1c, #7f1d1d);
    box-shadow: 0 3px 0 #450a0a;
}

button:hover {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 rgba(0,0,0,0.6);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    min-width: 130px;
    flex: 1;
}

.form-field label {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.15rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.chip {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #020617;
    border: 1px solid #334155;
}

/* Scroll interne pour les listes / graphiques */
.scroll-area {
    max-height: 380px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

@media (min-height: 900px) {
    .scroll-area {
        max-height: 520px;
    }
}

/* Recherche dynamique d'aliments */
.food-search-wrapper {
    position: relative;
}

.food-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #020617;
    border: 1px solid #1f2937;
    border-radius: 0.5rem;
    margin-top: 0.2rem;
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    display: none;
}

.food-results-item {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.food-results-item span {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.food-results-item:hover {
    background: #111827;
}

@media (max-width: 600px) {
    .layout {
        padding: 1rem;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ==== NAV 3D + plus gros ==== */
header nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 10px 18px;
  min-width: 110px;

  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);

  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  box-shadow:
    0 10px 22px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.16);

  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.2px;

  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

header nav a:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.20);
  box-shadow:
    0 14px 28px rgba(0,0,0,0.40),
    inset 0 1px 0 rgba(255,255,255,0.20);
}

header nav a:active {
  transform: translateY(1px);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

header nav a.active {
  border-color: rgba(96, 165, 250, 0.45);
  background: linear-gradient(180deg, rgba(96,165,250,0.22), rgba(255,255,255,0.05));
}

/* ==== Pagination page aliments ==== */
.pagination {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 10px 22px rgba(0,0,0,0.30);
}
/* ==== NAV : actif en rouge doux ==== */
header nav a.active {
  border-color: rgba(244, 63, 94, 0.45);
  background: linear-gradient(180deg, rgba(244,63,94,0.20), rgba(255,255,255,0.05));
  box-shadow:
    0 14px 28px rgba(0,0,0,0.40),
    inset 0 1px 0 rgba(255,255,255,0.20);
}

/* ==== Toolbar aliments (plein écran) ==== */
.toolbar{
  display:flex;
  gap:16px;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom: 0.75rem;
}

.toolbar-search{
  display:flex;
  gap:10px;
  align-items:flex-end;
  flex: 1;
  min-width: 320px;
  justify-content:flex-end;
}
.toolbar-search input{
  min-width: 320px;
  flex: 1;
}

/* ==== Ajouter un aliment (repliable) ==== */
.details-add{
  margin: 0.75rem 0 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
}
.details-add summary{
  cursor:pointer;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  list-style: none;
}
.details-add summary::-webkit-details-marker{ display:none; }
.details-add summary::after{
  content:"▾";
  float:right;
  opacity:0.65;
}
.details-add[open] summary::after{ content:"▴"; }

.add-grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}
@media (max-width: 1100px){
  .add-grid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 640px){
  .add-grid{ grid-template-columns: 1fr; }
}

/* ==== Table “Excel” ==== */
.table-excel table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12, 17, 30, 0.92);
  backdrop-filter: blur(10px);
}
.table-excel table tbody tr:hover{
  background: rgba(255,255,255,0.04);
}
