:root{
  --bg:#f6f7f9;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#005f88;
  --danger:#b91c1c;
  --shadow: 0 10px 24px rgba(0,0,0,.06);
  --radius: 14px;
}

html[data-theme="dark"]{
  --bg:#0b1220;
  --card:#0f1a2c;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --border:#20304a;
  --shadow: 0 10px 24px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{ color:inherit; text-decoration:none; }
h1{ margin:0 0 12px; font-size:22px; }
h2{ margin:0 0 10px; font-size:18px; }
h3{ margin:0; font-size:16px; }

.container{ max-width: 1100px; margin: 18px auto; padding: 0 14px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px;
  border-bottom:1px solid var(--border);
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(8px);
}
html[data-theme="dark"] .topbar{ background: rgba(15,26,44,.65); }

.brand a{ font-weight:700; letter-spacing:.2px; }
.topbar-actions{ display:flex; gap:10px; align-items:center; }

.footer{
  max-width: 1100px;
  margin: 12px auto 22px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card.inner{
  margin-top: 10px;
  padding: 12px;
  box-shadow:none;
}

.narrow{ max-width: 520px; margin: 0 auto; }

.grid{ display:grid; gap:14px; }
.grid.two{ grid-template-columns: 1fr 1fr; }
@media (max-width: 860px){
  .grid.two{ grid-template-columns: 1fr; }
}

.row{ display:flex; gap:10px; align-items:center; }
.row.space{ justify-content:space-between; }

.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.big{ font-size: 22px; font-weight: 700; }

.sep{ border:none; border-top:1px solid var(--border); margin: 12px 0; }

.btn{
  border:1px solid var(--border);
  background: var(--card);
  padding: 9px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 600;
}
.btn:hover{ filter: brightness(1.03); }
.btn.primary{
  background: var(--primary);
  border-color: transparent;
  color: white;
}
.btn.ghost{
  background: transparent;
}
.btn.danger{
  background: var(--danger);
  color: white;
  border-color: transparent;
}
.btn.tiny{
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
}

.form{ display:flex; flex-direction:column; gap:10px; }
input, select{
  border:1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline:none;
}
input::placeholder{ color: var(--muted); }

.flash-wrap{ display:flex; flex-direction:column; gap:8px; margin-bottom: 12px; }
.flash{
  border:1px solid var(--border);
  background: rgba(0,0,0,.04);
  border-radius: 12px;
  padding: 10px 12px;
}
html[data-theme="dark"] .flash{ background: rgba(255,255,255,.04); }
.flash.success{ border-color: rgba(34,197,94,.35); }
.flash.error{ border-color: rgba(239,68,68,.35); }

.banner{
  margin-top: 12px;
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,.03);
}
html[data-theme="dark"] .banner{ background: rgba(255,255,255,.03); }

.list{ display:flex; flex-direction:column; gap:10px; margin-top: 10px; }
.list-item{
  display:flex; justify-content:space-between; gap:10px; align-items:center;
  padding: 10px 12px;
  border:1px solid var(--border);
  border-radius: 12px;
}
.list-item:hover{ filter: brightness(1.02); }
.list-title{ font-weight: 700; }

.pill{
  border:1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.table-wrap{ width:100%; overflow:auto; }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 860px;
}
.table th, .table td{
  border-bottom:1px solid var(--border);
  padding: 10px 10px;
  vertical-align: top;
}
.table th{ text-align:left; font-size: 12px; color: var(--muted); }
.table td.num, .table th.num{ text-align:right; }

.exrow{
  grid-template-columns: 1fr 140px auto;
  align-items:center;
  gap: 10px;
  margin-top: 8px;
}

/* Exclusions: éviter les débordements en grid/flex */
.exrow input{
  min-width: 0; /* super important, sinon ça force le dépassement */
}

/* Desktop (par défaut): tu gardes ta grid 3 colonnes */

/* Mobile: empiler libellé / prix / bouton */
@media (max-width: 640px){
  .exrow{
    display: flex;          /* on override le display grid */
    flex-direction: column; /* empile */
    gap: 8px;
  }

  .exrow input{
    width: 100%;
  }

  /* bouton supprimer sous le prix */
  .exrow .removeEx{
    align-self: flex-end;   /* bouton à droite */
    width: auto;
  }
}

.exrow .removeEx{
  width: 100%;
}

.table tbody td {
  border-bottom: 1px solid var(--line);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
