:root {
  --bg: #F5F2ED;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --surface-3: #F1ECE3;
  --text: #2A2521;
  --text-muted: #8C8276;
  --text-faint: #B3A99B;
  --border: #E7E1D7;
  --border-strong: #D8CFC1;
  --accent: #C15A2E;
  --accent-hover: #A94B24;
  --accent-soft: rgba(193, 90, 46, 0.10);
  --accent-line: rgba(193, 90, 46, 0.28);
  --bordeaux: #8E2B36;
  --bordeaux-soft: rgba(142, 43, 54, 0.10);
  --green: #4E8A5C;
  --green-soft: rgba(78, 138, 92, 0.12);
  --amber: #B6862B;
  --amber-soft: rgba(182, 134, 43, 0.13);
  --red: #C0392B;
  --red-soft: rgba(192, 57, 43, 0.12);
  --shadow-sm: 0 1px 2px rgba(42, 37, 33, 0.04);
  --shadow-md: 0 4px 16px rgba(42, 37, 33, 0.06);
  --shadow-lg: 0 12px 40px rgba(42, 37, 33, 0.12);
  --radius: 18px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #17140F;
  --surface: #211D17;
  --surface-2: #1C1913;
  --surface-3: #2A251E;
  --text: #ECE5D9;
  --text-muted: #998F7E;
  --text-faint: #6B6253;
  --border: #322C23;
  --border-strong: #423A2E;
  --accent: #D2693B;
  --accent-hover: #E07A4C;
  --accent-soft: rgba(210, 105, 59, 0.15);
  --accent-line: rgba(210, 105, 59, 0.34);
  --bordeaux: #C75863;
  --bordeaux-soft: rgba(199, 88, 99, 0.15);
  --green: #6BAE79;
  --green-soft: rgba(107, 174, 121, 0.15);
  --amber: #D2A445;
  --amber-soft: rgba(210, 164, 69, 0.15);
  --red: #DB6151;
  --red-soft: rgba(219, 97, 81, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv05' 1, 'ss01' 1, 'tnum' 1;
}

#root { height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

.tnum { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); }

.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  width: 100%; text-align: left; transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-faint); }
.nav-item:hover .nav-ico { color: var(--text-muted); }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
  padding: 1px 7px; border-radius: 20px;
}
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.user-av {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--bordeaux); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.crumb strong { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--text-faint); }
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-muted);
  border: 1px solid transparent; transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.content { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.content-inner { max-width: 1180px; margin: 0 auto; }

/* ---------- Generic ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  transition: background .14s, border-color .14s, transform .06s;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-muted);
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.bordeaux { background: var(--bordeaux-soft); color: var(--bordeaux); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.layers { background: rgba(120,90,160,0.13); color: #7d5aa0; }
[data-theme="dark"] .chip.layers { background: rgba(176,148,208,0.16); color: #b094d0; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }

/* ---------- Fiche header ---------- */
.fiche-head { padding: 20px 22px; margin-bottom: 18px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.fiche-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: var(--bordeaux-soft); color: var(--bordeaux);
  display: grid; place-items: center;
}
.fiche-icon svg { width: 26px; height: 26px; }
.fiche-icon.semi { background: rgba(120,90,160,0.13); color: #7d5aa0; }
[data-theme="dark"] .fiche-icon.semi { background: rgba(176,148,208,0.16); color: #b094d0; }
.semi-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: #7d5aa0; background: rgba(120,90,160,0.13); padding: 1px 6px; border-radius: 6px; margin-right: 7px; vertical-align: middle; }
.semi-tag svg { width: 11px; height: 11px; }
[data-theme="dark"] .semi-tag { color: #b094d0; background: rgba(176,148,208,0.16); }
.semi-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; display: flex; gap: 9px; align-items: flex-start; }
.semi-note svg { width: 17px; height: 17px; color: #7d5aa0; flex-shrink: 0; margin-top: 1px; }
[data-theme="dark"] .semi-note svg { color: #b094d0; }
.dd-ico { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.dd-ico svg { width: 16px; height: 16px; }
.dd-ico.semi { background: rgba(120,90,160,0.13); color: #7d5aa0; }
[data-theme="dark"] .dd-ico.semi { background: rgba(176,148,208,0.16); color: #b094d0; }
.fiche-name-input {
  font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 3px 8px; margin: -3px -8px; width: 100%;
  transition: background .14s, border-color .14s;
}
.fiche-name-input:hover { background: var(--surface-3); }
.fiche-name-input:focus { outline: none; background: var(--surface); border-color: var(--accent-line); }
.fiche-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* header fields */
.hfields { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.hfield { display: flex; flex-direction: column; }
.hfield-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 7px; }
.qte-fab { display: flex; align-items: center; gap: 8px; }
.qte-hint { font-size: 11.5px; color: var(--text-faint); font-style: italic; }
.price-input.accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); font-size: 16px; }
.price-input.accent:focus { background: var(--surface); }

/* interrupteur DLC indépendante */
.dlc-toggle { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px 0 8px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); transition: .13s; }
.dlc-toggle:hover { border-color: var(--accent-line); }
.dlc-toggle.on { border-color: var(--accent-line); background: var(--accent-soft); }
.dlc-switch { width: 36px; height: 21px; border-radius: 12px; background: var(--border-strong); position: relative; flex-shrink: 0; transition: background .15s; }
.dlc-toggle.on .dlc-switch { background: var(--accent); }
.dlc-knob { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.dlc-toggle.on .dlc-knob { transform: translateX(15px); }
.dlc-toggle-txt { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: left; color: var(--text); }
.dlc-toggle-txt em { font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--text-muted); }

.fiche-select {
  appearance: none; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 8px 32px 8px 12px; font-size: 13px; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238C8276' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.fiche-select:focus { outline: none; border-color: var(--accent-line); }

/* ---------- Segmented ---------- */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); transition: background .14s, color .14s; white-space: nowrap;
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Layout split ---------- */
.fiche-grid { display: grid; grid-template-columns: 1fr 352px; gap: 18px; align-items: start; }
@media (max-width: 1180px) {
  .fiche-grid { grid-template-columns: 1fr; }
  .summary { position: static !important; flex-direction: row; flex-wrap: wrap; }
  .summary > .card { flex: 1; min-width: 300px; }
}

/* ---------- Ingredients table ---------- */
.tbl-card { overflow: visible; border-radius: 14px; }
.tbl-card > .tbl-head:first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.tbl-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.tbl-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.tbl-head .count { color: var(--text-muted); font-weight: 500; margin-left: 7px; font-size: 13px; }

table.ing { width: 100%; border-collapse: collapse; }
table.ing thead th {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint); text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
table.ing thead th.num { text-align: right; }
table.ing thead th.accent-th { color: var(--accent); }
table.ing tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.ing tbody tr:last-child td { border-bottom: none; }
table.ing tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.ing-name { font-weight: 600; font-size: 13.5px; }
.ing-name.clickable { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.ing-name.clickable:hover { color: #7d5aa0; }
[data-theme="dark"] .ing-name.clickable:hover { color: #b094d0; }
.ing-expand { width: 14px; height: 14px; color: var(--text-faint); transition: transform 0.16s ease; flex-shrink: 0; }
.ing-expand.open { transform: rotate(90deg); color: #7d5aa0; }
[data-theme="dark"] .ing-expand.open { color: #b094d0; }
.ing-fiche-row.open > td { border-bottom-color: transparent; }
/* sous-composition d'un semi-fini, dépliée */
.ing-sub-row td { padding: 6px 12px; border-bottom: 1px solid var(--border); background: rgba(120,90,160,0.045); }
[data-theme="dark"] .ing-sub-row td { background: rgba(176,148,208,0.06); }
.ing-sub-row:hover td { background: rgba(120,90,160,0.08); }
.ing-sub-name { display: flex; align-items: center; gap: 7px; padding-left: 26px; font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.ing-sub-bullet { width: 6px; height: 6px; border-radius: 50%; background: #b89dd0; flex-shrink: 0; }
.ing-sub-q { font-size: 12.5px; color: var(--text-muted); }
.ing-sub-dim { color: var(--text-muted); }
.ing-code { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ing-cat { font-size: 11px; color: var(--text-muted); }

/* unit weight editor (articles à la pièce) */
.unit-weight { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 11px; color: var(--text-muted); background: var(--surface-3); padding: 2px 8px; border-radius: 7px; }
.uw-input { width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 11.5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; color: var(--text); }
.uw-input:focus { outline: none; border-color: var(--accent-line); }

/* base qty cell */
.base-qty { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* scaled (calculée) qty */
.scaled-qty { font-weight: 700; font-size: 14.5px; color: var(--accent); }
.scaled-unit { font-size: 11px; color: var(--text-faint); margin-left: 3px; }

.qty-input {
  width: 72px; text-align: right; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 9px; font-size: 13px; font-weight: 600;
}
.qty-input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); }

.unit-select {
  appearance: none; background: transparent; border: 1px solid transparent;
  border-radius: 7px; padding: 5px 22px 5px 8px; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B3A99B' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center; cursor: pointer;
}
.unit-select:hover { background-color: var(--surface-3); }
.unit-select:focus { outline: none; border-color: var(--accent-line); }

.cost-strong { font-weight: 700; }
.part-bar-wrap { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.part-bar { width: 46px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.part-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.part-pct { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

.row-del {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  color: var(--text-faint); opacity: 0; transition: opacity .14s, background .14s, color .14s;
}
tr:hover .row-del { opacity: 1; }
.row-del:hover { background: var(--red-soft); color: var(--red); }
.row-del svg { width: 15px; height: 15px; }

/* ---------- Add ingredient ---------- */
.add-row { padding: 13px 16px; border-top: 1px solid var(--border); position: relative; }
.search-wrap { position: relative; }
.search-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 10px 12px 10px 38px; font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 17px; height: 17px; }

.dropdown {
  position: absolute; left: 16px; right: 16px; top: calc(100% - 4px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 540px; overflow-y: auto; padding: 6px;
}
.dd-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px;
  width: 100%; text-align: left; transition: background .12s;
}
.dd-item:hover, .dd-item.kbd { background: var(--accent-soft); }
.dd-name { font-weight: 600; font-size: 13px; }
.dd-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.dd-price { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.dd-price b { font-size: 13px; font-weight: 700; }
.dd-price span { font-size: 11px; color: var(--text-muted); display: block; }
.dd-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------- Summary panel ---------- */
.summary { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.sum-card { padding: 18px 20px; }
.sum-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; }

.sum-row { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; }
.sum-row .lbl { font-size: 13px; color: var(--text-muted); }
.sum-row .val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-divider { height: 1px; background: var(--border); margin: 10px 0; }

.cost-hero {
  background: var(--bordeaux-soft); border-radius: 14px; padding: 15px 17px; margin: 4px 0 6px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.cost-hero .lbl { font-size: 12.5px; font-weight: 600; color: var(--bordeaux); }
.cost-hero .val { font-size: 24px; font-weight: 750; color: var(--bordeaux); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.cost-hero .unit { font-size: 13px; font-weight: 600; opacity: 0.7; }

.price-hero {
  background: var(--accent); border-radius: 14px; padding: 16px 18px; color: #fff;
}
.price-hero .ph-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.price-hero .lbl { font-size: 12px; font-weight: 600; opacity: 0.9; }
.price-hero .ph-val { display: flex; align-items: baseline; gap: 6px; }
.price-hero .val { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price-hero .unit { font-size: 14px; font-weight: 600; opacity: 0.85; }
.price-hero .ph-sub { font-size: 11.5px; opacity: 0.85; margin-top: 7px; display: flex; justify-content: space-between; }

.override-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: rgba(255,255,255,0.22); padding: 2px 7px; border-radius: 20px; }

/* margin control */
.marge-ctl { margin: 6px 0 2px; }
.marge-ctl-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.marge-ctl-top .lbl { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.marge-val-box { display: flex; align-items: center; gap: 4px; }
.marge-input {
  width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 8px;
}
.marge-input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); }
.marge-pct-sign { font-weight: 700; color: var(--text-muted); }

input[type="range"].slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
  cursor: pointer;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow-sm); cursor: grab;
}
input[type="range"].slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); cursor: grab;
}

.price-edit-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.price-input-wrap { position: relative; flex: 1; }
.price-input {
  width: 100%; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 30px 8px 12px;
}
.price-input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); }
.price-input-suffix { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); font-weight: 600; pointer-events: none; }
.reset-btn { font-size: 11.5px; color: var(--accent); font-weight: 600; padding: 6px 8px; border-radius: 7px; }
.reset-btn:hover { background: var(--accent-soft); }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; }
.mini-stat .lbl { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.mini-stat .val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mini-stat .val.green { color: var(--green); }
.mini-stat .val.red { color: var(--red); }
.mini-stat .sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

.portion-note { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.portion-note svg { width: 13px; height: 13px; color: var(--text-faint); }

.placeholder-screen { display: grid; place-items: center; padding: 80px 20px; text-align: center; }
.placeholder-screen .ph-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-3); color: var(--text-faint); display: grid; place-items: center; margin: 0 auto 18px; }
.placeholder-screen .ph-ico svg { width: 28px; height: 28px; }
.placeholder-screen h2 { font-size: 18px; font-weight: 650; margin-bottom: 6px; }
.placeholder-screen p { color: var(--text-muted); font-size: 13.5px; max-width: 340px; }

.empty-rows { padding: 34px; text-align: center; color: var(--text-muted); font-size: 13px; }
