:root {
  --brand: #7a4f2a;
  --brand-light: #a9774a;
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #2b2320;
  --muted: #8a7f78;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #c62828;
}

* { box-sizing: border-box; }

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

.app { max-width: 480px; margin: 0 auto; padding: 1rem; }

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 1rem;
}
.app__header h1 { color: var(--brand); margin: 0; font-size: 1.6rem; }

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #eee;
  color: var(--muted);
}
.badge--ok { background: #e6f4e6; color: var(--ok); }
.badge--warn { background: #fdf0db; color: var(--warn); }
.badge--err { background: #fde6e6; color: var(--err); }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.card h2 { margin-top: 0; color: var(--brand); }

form { display: flex; flex-direction: column; gap: 0.8rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
input {
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--brand-light); border-color: var(--brand-light); }

button {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
button:hover { background: var(--brand-light); }
button.secondary { background: #efe7df; color: var(--brand); }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--err); font-size: 0.9rem; margin: 0; min-height: 1.2em; }
.msg { color: var(--brand); font-size: 0.9rem; min-height: 1.2em; }

.app { max-width: 640px; }
.header-right { display: flex; align-items: center; gap: 0.6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
section.card + .card, #view-labo .card + .card { margin-top: 1rem; }

button.link { background: none; color: var(--brand); padding: 0.2rem 0; text-decoration: underline; font-size: 0.9rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.grid { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.grid th, .grid td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid #eee; font-size: 0.95rem; }
.grid th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.grid .qty { text-align: right; width: 7rem; }
.qty-input { width: 6rem; text-align: right; }

.cat-row td { background: #f4ece3; color: var(--brand); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.chk { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); flex: 0 0 auto; }
.inline-form select { flex: 0 0 auto; padding: 0.5rem; border-radius: 8px; border: 1px solid #ddd; }

.actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; align-items: center; }
.inline-form input { flex: 1 1 8rem; }
.inline-form input[type=number] { flex: 0 0 5rem; }
.inline-form button { flex: 0 0 auto; }

/* Impression : on ne montre que la zone d'impression. */
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
}
