:root {
  --bg: #eef0f1;
  --panel: #ffffff;
  --ink: #16201f;
  --muted: #6a7574;
  --line: #e3e6e6;
  --line-soft: #eef1f1;
  --accent: #0d6b5f;
  --accent-strong: #084d45;
  --accent-soft: #e7f4ef;
  --amber: #b56816;
  --red: #b64034;
  --green: #207c54;
  --blue: #2f609a;
  --radius: 14px;
  --radius-md: 11px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(20, 32, 31, 0.09);
  --shadow-tight: 0 4px 14px rgba(20, 32, 31, 0.07);
  --shadow-soft: 0 1px 2px rgba(20, 32, 31, 0.04), 0 1px 1px rgba(20, 32, 31, 0.03);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 380px at 100% -12%, rgba(13, 107, 95, 0.045), transparent 70%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(130% 55% at 50% -10%, rgba(13, 107, 95, 0.18), transparent 62%),
    linear-gradient(168deg, #16211f 0%, #111b19 60%, #0d1614 100%);
  color: #f4f6f4;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-copy {
  min-width: 0;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0;
  color: #dce4e0;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease;
}

.brand-mark {
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #e9e3d2;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.12);
}

.brand span,
.eyebrow,
.muted {
  color: var(--muted);
}

.brand strong {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
}

.brand span {
  display: block;
  color: #cfd5d1;
  font-size: 0.82rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-label {
  padding: 0 8px 2px;
  color: rgba(244, 246, 244, 0.42);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(244, 246, 244, 0.5);
  font-size: 0.72rem;
  font-weight: 500;
}

.sidebar-foot-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #4ec0a8;
  box-shadow: 0 0 0 3px rgba(78, 192, 168, 0.18);
}

.nav-item {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 5px 10px 5px 6px;
  text-align: left;
  color: #cfdad5;
  background: transparent;
  font-weight: 540;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

@media (min-width: 901px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 88px 1fr;
  }

  .sidebar-collapsed .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .sidebar-collapsed .brand {
    flex-direction: column;
    gap: 9px;
    padding-right: 0;
    padding-left: 0;
  }

  .sidebar-collapsed .brand-mark {
    width: 54px;
    height: 54px;
  }

  .sidebar-collapsed .brand-copy,
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .nav-item > span:last-child,
  .sidebar-collapsed .sidebar-foot > span:last-child {
    display: none;
  }

  .sidebar-collapsed .sidebar-toggle {
    margin-left: 0;
  }

  .sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
  }

  .sidebar-collapsed .nav {
    gap: 12px;
  }

  .sidebar-collapsed .nav-item {
    min-height: 46px;
    grid-template-columns: 32px;
    justify-content: center;
    gap: 0;
    padding: 6px;
    text-align: center;
  }

  .sidebar-collapsed .sidebar-foot {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #d4ded8;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-item.active {
  color: #fff;
  border-color: rgba(78, 188, 165, 0.22);
  background: rgba(78, 188, 165, 0.1);
  box-shadow: inset 3px 0 0 #4ec0a8;
}

.nav-item.active .nav-icon {
  color: #0c1715;
  background: linear-gradient(150deg, #5fcdb4, #14947f);
  box-shadow: none;
}

.nav-item:hover {
  transform: translateX(2px);
}

main {
  min-width: 0;
  padding: 22px 24px 34px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 20px;
  border: 1px solid rgba(227, 230, 230, 0.9);
  border-radius: var(--radius);
  background: rgba(248, 250, 249, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(1.2);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.6rem;
  font-weight: 640;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.08rem;
  font-weight: 620;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.96rem;
  font-weight: 600;
}

.top-actions,
.actions,
.filters,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-filters {
  justify-content: flex-end;
}

.compact-field {
  width: auto;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.compact-field input,
.compact-field select {
  min-height: 34px;
  padding: 6px 8px;
}

.collapsible-panel {
  padding: 0;
}

.collapsible-panel > summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.collapsible-panel > summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--accent);
  font-size: 1.2rem;
}

.collapsible-panel[open] > summary {
  border-bottom: 1px solid var(--line-soft);
}

.collapsible-panel[open] > summary::after {
  content: "-";
}

.collapsible-panel > :not(summary),
.collapsible-content {
  margin: 18px;
}

.inner-collapsible {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #f7f9f8;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.inline-control {
  width: auto;
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.inline-control select {
  width: auto;
  min-width: 86px;
  padding: 7px 9px;
}

.primary,
.secondary,
.ghost,
.danger,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 38px;
  padding: 8px 14px;
  font-weight: 560;
  letter-spacing: 0;
  white-space: nowrap;
  transition:
    background 130ms ease,
    border-color 130ms ease,
    box-shadow 130ms ease,
    color 130ms ease,
    transform 130ms ease;
}

.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(13, 107, 95, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 107, 95, 0.28);
}

.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.secondary:hover {
  border-color: rgba(13, 107, 95, 0.3);
  background: #f6f8f7;
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.ghost:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.icon-button {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
  gap: 6px;
}

.icon-button:hover {
  color: var(--ink);
  border-color: rgba(13, 107, 95, 0.3);
  background: #f6f8f7;
}

.icon-only {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.icon-button.is-danger:hover {
  color: var(--red);
  border-color: rgba(182, 64, 52, 0.32);
  background: #fdecea;
}

.ui-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.danger {
  color: var(--red);
  background: #fdecea;
  border-color: rgba(182, 64, 52, 0.2);
}

.danger:hover {
  color: #fff;
  background: var(--red);
  border-color: transparent;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 20px;
  overflow-x: auto;
}

.card {
  padding: 16px;
}

.metric {
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding-left: 20px;
  border-color: var(--line);
  background: #fff;
}

.metric strong {
  font-size: 1.6rem;
  font-weight: 640;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric::before {
  content: "";
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  position: absolute;
  inset: 14px auto 14px 9px;
}

.metric.is-warn::before {
  background: var(--amber);
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 540;
}

.metric-sub {
  color: var(--muted);
  font-size: 0.72rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
}

.ti-title {
  display: block;
  font-weight: 580;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: #f8faf9;
  text-align: center;
  font-size: 0.88rem;
}

.occupancy-list {
  display: grid;
  gap: 12px;
}

.occupancy-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2fr) 44px;
  align-items: center;
  gap: 14px;
}

.occupancy-head {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.occupancy-head strong {
  font-weight: 580;
}

.occupancy-head span {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occupancy-bar {
  height: 8px;
  border-radius: 999px;
  background: #eaeeed;
  overflow: hidden;
}

.occupancy-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #2a9d87);
}

.occupancy-pct {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 540;
  background: #edf3f0;
  color: var(--accent-strong);
}

.badge.warn {
  background: #fff2dd;
  color: var(--amber);
}

.badge.danger {
  background: #ffe7e2;
  color: var(--red);
}

.badge.ok {
  background: #e6f4ed;
  color: var(--green);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f4f6f5;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover td {
  background: #f6f9f8;
}

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

.sheet-table {
  min-width: 860px;
  border: 1px solid var(--line);
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.sheet-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0)) left / 18px 100% no-repeat,
    linear-gradient(270deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0)) right / 18px 100% no-repeat,
    #fff;
}

.sheet-table-wrap .sheet-table {
  border: 0;
}

.sheet-table th,
.sheet-table td {
  border-right: 1px solid #eef1f0;
  border-bottom: 1px solid #eef1f0;
  padding: 8px 9px;
  vertical-align: middle;
}

.sheet-table th:last-child,
.sheet-table td:last-child {
  border-right: 0;
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  background: linear-gradient(180deg, #f6f8f7 0%, #e9edec 100%);
  color: #5a6766;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 #dde2e1;
}

.sheet-table tbody tr:nth-child(even) td {
  background: #fbfcfc;
}

.sheet-table tbody tr:hover td {
  background: #f2f8f5;
}

.sheet-table tbody tr:focus-within td {
  background: #eef8f4;
  box-shadow: inset 0 0 0 1px rgba(13, 107, 95, 0.18);
}

.sheet-primary-cell {
  min-width: 230px;
  font-weight: 580;
}

.sheet-primary-cell .muted {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
}

.sheet-number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sheet-action-cell,
.sheet-status-cell {
  white-space: nowrap;
}

.unit-suffix {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.recipe-list-table th:nth-child(1),
.recipe-list-table td:nth-child(1),
.ingredient-sheet-table th:nth-child(1),
.ingredient-sheet-table td:nth-child(1),
.inventory-sheet-table th:nth-child(1),
.inventory-sheet-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fcfdfd;
  box-shadow: 1px 0 0 #e6eae9;
}

.recipe-list-table thead th:nth-child(1),
.ingredient-sheet-table thead th:nth-child(1),
.inventory-sheet-table thead th:nth-child(1) {
  z-index: 3;
  background: linear-gradient(180deg, #f6f8f7 0%, #e9edec 100%);
}

.sheet-table tbody tr:nth-child(even) td:nth-child(1) {
  background: #fbfcfc;
}

.sheet-table tbody tr:hover td:nth-child(1),
.sheet-table tbody tr:focus-within td:nth-child(1) {
  background: #eef8f4;
}

.inventory-sheet-table {
  min-width: 1180px;
}

.ingredient-sheet-table {
  min-width: 900px;
}

.recipe-list-table {
  min-width: 760px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--ink);
  background: #fcfdfd;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(13, 107, 95, 0.22);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(13, 107, 95, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 107, 95, 0.08);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 540;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

.file-picker {
  width: fit-content;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--ink);
  background: #fff;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.import-hints {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.recipe-workspace {
  display: grid;
  gap: 16px;
}

.recipe-catalog-panel {
  padding-bottom: 16px;
}

.recipe-catalog-panel .section-heading {
  align-items: flex-start;
  gap: 14px;
}

.recipe-catalog-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.recipe-catalog-actions .compact-field {
  min-width: 260px;
}

.inline-add-recipe {
  position: relative;
}

.inline-add-recipe > summary {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.inline-add-recipe > summary::-webkit-details-marker {
  display: none;
}

.compact-add-button {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 650;
}

.compact-recipe-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: min(680px, calc(100vw - 320px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfdfd;
  box-shadow: var(--shadow);
}

.recipe-list-table th,
.recipe-list-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.recipe-list-table .sheet-primary-cell {
  min-width: 280px;
}

.recipe-list-table .sheet-action-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.recipe-list-table .sheet-action-cell button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 0.8rem;
}

.recipe-editor {
  display: grid;
  gap: 16px;
}

.ingredient-editor {
  display: grid;
  gap: 12px;
}

.ingredient-editor td select,
.ingredient-editor td input {
  min-width: 120px;
}

/* --- Catalogue recettes : lignes cliquables et plus soignees --- */
.badge.soft {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 540;
}

.recipe-row {
  cursor: pointer;
}

.recipe-row:hover td,
.recipe-row:focus-visible td {
  background: #eef8f4;
}

.recipe-row:focus-visible {
  outline: 2px solid rgba(13, 107, 95, 0.4);
  outline-offset: -2px;
}

.recipe-name-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.recipe-name-cell > div {
  display: grid;
  gap: 2px;
}

.recipe-name-cell .muted {
  display: block;
  font-size: 0.74rem;
}

.recipe-color-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(20, 32, 31, 0.18),
    0 1px 2px rgba(20, 32, 31, 0.12);
}

.recipe-color-dot.lg {
  width: 18px;
  height: 18px;
  margin-right: 9px;
  vertical-align: -2px;
}

.recipe-color-control {
  min-height: 42px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
}

.recipe-color-control input[type="color"] {
  width: 44px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: #fff;
  cursor: pointer;
}

.recipe-color-control span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.recipe-color-control .secondary {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 0.76rem;
}

.recipe-list-table .sheet-action-cell button {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  white-space: nowrap;
}

.recipe-list-table th:last-child,
.recipe-list-table td:last-child {
  width: 104px;
  min-width: 104px;
}

.recipe-list-table .sheet-action-cell button .ui-icon {
  width: 15px;
  height: 15px;
}

/* --- Page fiche recette (vue dediee) --- */
.recipe-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft);
}

.recipe-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recipe-detail-bar .ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.recipe-detail-bar .ghost .ui-icon {
  transform: rotate(180deg);
}

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.sheet-table input,
.sheet-table select,
.sheet-table .table-input {
  min-height: 30px;
  border-color: transparent;
  border-radius: 4px;
  padding: 5px 7px;
  background: transparent;
  box-shadow: none;
}

.sheet-table input:hover,
.sheet-table select:hover,
.sheet-table .table-input:hover {
  border-color: #d2d8d6;
  background: #fff;
}

.sheet-table input:focus,
.sheet-table select:focus,
.sheet-table .table-input:focus {
  border-color: rgba(13, 107, 95, 0.62);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(13, 107, 95, 0.1);
}

.sheet-table .strong-input {
  font-weight: 650;
}

.sheet-table .muted-input {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.sheet-table .number-input {
  max-width: 86px;
  text-align: right;
}

.add-ingredient-form {
  padding-top: 4px;
}

.alert-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f0c98a;
  border-radius: var(--radius-sm);
  color: #69400e;
  background: #fff7e8;
}

.calendar-schedule-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.calendar-schedule-preview div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
}

.calendar-schedule-preview span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-schedule-preview strong {
  font-size: 0.88rem;
}

.calendar-validation {
  padding: 10px 12px;
  border: 1px solid;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
}

.calendar-validation.is-valid {
  border-color: rgba(30, 126, 86, 0.28);
  background: #edf8f2;
  color: #185f43;
}

.calendar-validation.is-invalid {
  border-color: rgba(184, 64, 48, 0.28);
  background: #fff0ed;
  color: #8c3026;
}

.sync-preview-list {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7faf8;
}

.sync-preview-list ul {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.timeline-item > strong {
  font-variant-numeric: tabular-nums;
  font-weight: 580;
}

.timeline-item > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.timeline-item .muted {
  font-size: 0.8rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2,
.section-heading p {
  margin-bottom: 4px;
}

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 540;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.calendar-tools {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.calendar-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.calendar-nav .secondary {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.82rem;
}

.calendar-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.calendar-jump select {
  min-width: 190px;
  padding: 6px 8px;
  font-size: 0.84rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--accent);
}

.calendar-panel {
  margin-top: 16px;
}

.calendar-panel.calendar-primary {
  margin-top: 0;
}

.calendar-conflicts {
  position: relative;
  justify-self: end;
}

.calendar-conflicts summary {
  min-height: 28px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.calendar-conflicts summary::-webkit-details-marker {
  display: none;
}

.calendar-conflicts summary .ui-icon {
  width: 13px;
  height: 13px;
}

.calendar-conflicts.has-conflicts summary {
  border-color: rgba(190, 61, 47, 0.28);
  color: var(--danger);
  background: rgba(190, 61, 47, 0.06);
}

.calendar-conflicts.is-clear summary {
  color: var(--accent);
  background: rgba(13, 107, 95, 0.05);
}

.calendar-conflict-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  width: min(340px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-tight);
  font-size: 0.78rem;
}

.calendar-conflict-popover ul {
  margin: 0;
  padding-left: 18px;
}

.calendar-conflict-popover p {
  margin: 0;
}

.calendar-footer-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}

.calendar-add-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(13, 107, 95, 0.22);
}

.calendar-add-button .ui-icon {
  width: 20px;
  height: 20px;
}

.calendar-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(13, 107, 95, 0.35) rgba(216, 209, 196, 0.35);
  scrollbar-width: thin;
}

.calendar-scroll.dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.calendar-scroll.dragging .calendar-grid {
  pointer-events: none;
}

.calendar-grid {
  --resource-width: 140px;
  --day-width: 78px;
  width: max(100%, calc(var(--resource-width) + (var(--calendar-days) * var(--day-width))));
  min-width: 0;
  display: grid;
  grid-template-columns: var(--resource-width) repeat(var(--calendar-days), var(--day-width));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.calendar-corner,
.calendar-day-head,
.calendar-resource,
.calendar-cell {
  min-height: 56px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-corner,
.calendar-day-head {
  min-height: 48px;
  display: grid;
  align-content: center;
  padding: 6px;
  background: #f4f6f5;
}

.calendar-corner {
  position: sticky;
  left: 0;
  z-index: 6;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  box-shadow: 10px 0 18px rgba(29, 37, 38, 0.1);
}

.calendar-day-head span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 540;
  text-transform: uppercase;
}

.calendar-day-head strong {
  font-size: 0.78rem;
}

.calendar-day-head.weekend {
  background: #e9edec;
}

.calendar-row {
  display: contents;
}

.calendar-resource {
  position: sticky;
  left: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 7px;
  background: #f7f9f8;
  box-shadow: 10px 0 18px rgba(29, 37, 38, 0.08);
}

.calendar-resource span {
  color: var(--muted);
  font-size: 0.7rem;
}

.calendar-resource meter {
  width: 100%;
  height: 6px;
}

.calendar-cell {
  position: relative;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 6px;
  background: #fff;
}

.calendar-cell.empty {
  background: repeating-linear-gradient(-45deg, #ffffff, #ffffff 8px, #f3f6f5 8px, #f3f6f5 16px);
}

.calendar-cell.weekend {
  box-shadow: inset 0 0 0 999px rgba(29, 37, 38, 0.06);
}

.calendar-cell.empty.weekend {
  background:
    linear-gradient(rgba(29, 37, 38, 0.05), rgba(29, 37, 38, 0.05)),
    repeating-linear-gradient(-45deg, #ffffff, #ffffff 8px, #f3f6f5 8px, #f3f6f5 16px);
}

.calendar-cell.active {
  color: #fff;
  border-right-color: rgba(255, 255, 255, 0.35);
}

.calendar-cell span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: 0;
}

.calendar-cell.editable span {
  padding-right: 17px;
}

.calendar-cell small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.55rem;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.calendar-edit {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.calendar-edit .ui-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.calendar-edit:hover {
  background: rgba(255, 255, 255, 0.34);
}

.brew,
.legend-dot.brew {
  background: var(--blue);
}

.fermentation,
.legend-dot.fermentation {
  background: var(--accent);
}

.dryhop,
.legend-dot.dryhop {
  background: var(--green);
}

.coldcrash,
.legend-dot.coldcrash {
  background: #4f6f8a;
}

.carb,
.legend-dot.carb {
  background: var(--amber);
}

.packaging,
.legend-dot.packaging {
  background: var(--red);
}

.transfer,
.available,
.legend-dot.transfer {
  background: #596569;
}

.cleaning {
  background: repeating-linear-gradient(45deg, #4f8b93, #4f8b93 5px, #6aa6ad 5px, #6aa6ad 10px);
  color: #fff;
}

.legend-dot.cleaning {
  background: #4f8b93;
}

.brew-card-list {
  display: grid;
  gap: 8px;
}

.brew-card {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(260px, 1.3fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.brew-card:hover {
  border-color: rgba(13, 107, 95, 0.25);
  box-shadow: var(--shadow-tight);
}

.brew-card h3,
.brew-card p {
  margin-bottom: 4px;
}

.brew-card dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.brew-card dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.brew-card dd {
  margin: 3px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
}

.brew-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.form-subsection {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.form-subsection h3 {
  margin-bottom: 0;
}

.form-subsection p {
  margin: 6px 0 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 25, 24, 0.46);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(20, 32, 31, 0.28);
}

.plan-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.plan-month {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(231, 244, 239, 0.5), rgba(255, 255, 255, 0) 92px),
    #fff;
  box-shadow: var(--shadow-soft);
}

.plan-month:hover {
  border-color: rgba(13, 107, 95, 0.28);
  box-shadow: var(--shadow-tight);
}

.plan-month h3 {
  margin-bottom: 4px;
}

.plan-month-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-month-head span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.plan-month-head .icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1.1rem;
  box-shadow: 0 3px 8px rgba(13, 107, 95, 0.18);
}

.plan-month-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.plan-month-kpis span {
  display: grid;
  gap: 2px;
  min-height: 56px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.plan-month-kpis strong {
  color: var(--ink);
  font-size: 1rem;
}

.plan-month-list {
  display: grid;
  gap: 5px;
}

.month-brew-pill {
  overflow: hidden;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  border-left: 3px solid currentColor;
  color: var(--accent-strong);
  background: #eef8f2;
  font-size: 0.74rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-brew-pill.ready {
  color: #7a4a06;
  background: #fff4db;
}

.month-brew-pill.blocked {
  color: #9f2f28;
  background: #fae7e3;
}

.month-brew-pill.scheduled {
  color: var(--accent-strong);
  background: #e8f7ef;
}

.month-brew-pill.empty {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.month-brew-pill.ready {
  color: var(--amber);
  background: #fff7e8;
}

.month-brew-pill.blocked {
  color: var(--red);
  background: #fff0ed;
}

.month-brew-pill.empty {
  color: var(--muted);
  background: #fff;
}

.month-slot-list {
  display: grid;
  gap: 8px;
}

.month-slot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.month-slot-row > div:first-child {
  display: grid;
  gap: 3px;
}

.month-slot-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.month-slot-row.scheduled {
  border-left-color: var(--green);
  background: #eef8f2;
}

.month-slot-row.ready {
  border-left-color: var(--amber);
  background: #fff7e8;
}

.month-slot-row.blocked {
  border-left-color: var(--red);
  background: #fff0ed;
}

.plan-slot {
  display: grid;
  gap: 7px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.plan-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-slot-top span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf3f0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 600;
}

.plan-slot-top strong {
  font-size: 0.72rem;
  text-transform: uppercase;
}

.plan-slot-product {
  min-height: 20px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-slot select,
.plan-slot input,
.plan-slot button {
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.86rem;
}

.plan-slot button {
  width: 100%;
}

.plan-slot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.plan-slot-actions .icon-button {
  min-height: 32px;
  padding: 6px;
}

.plan-slot small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-slot.scheduled {
  border-color: rgba(32, 124, 84, 0.35);
  border-left-color: var(--green);
  background: #eef8f2;
}

.plan-slot.ready {
  border-color: rgba(181, 104, 22, 0.35);
  border-left-color: var(--amber);
  background: #fff7e8;
}

.plan-slot.blocked {
  border-color: rgba(182, 64, 52, 0.35);
  border-left-color: var(--red);
  background: #fff0ed;
}

.plan-slot.empty {
  background: #f7f9f8;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.plan-slot.off-season {
  border-color: #e5a08d;
  border-left-color: #d56b4d;
  background: #fff3ef;
}

.plan-slot.off-season .plan-slot-top span {
  background: #ffe7e2;
  color: var(--red);
}

.plan-report {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.plan-report.warn {
  border-left-color: var(--amber);
  background: #fff7e8;
}

.plan-report-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-report-head strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-report ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 0.84rem;
}

.plan-report li {
  margin-top: 3px;
}

.plan-status-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.plan-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.embedded-panel {
  box-shadow: none;
}

.plan-rules-modal {
  width: min(1040px, 100%);
}

.tank-map {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.equipment-panel > .section-heading {
  margin-bottom: 14px;
}

.equipment-heading-actions {
  flex-wrap: nowrap;
}

.equipment-heading-actions .icon-only {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

.equipment-modal {
  width: min(680px, 100%);
}

.tank {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #f6f8f7;
  padding: 16px;
}

.tank-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 107, 95, 0.18);
  z-index: 0;
}

.tank > *:not(.tank-fill) {
  position: relative;
  z-index: 1;
}

.tank-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tank-head h3,
.tank-head p {
  margin-bottom: 3px;
}

.tank-head .icon-only {
  width: 32px;
  min-height: 32px;
  padding: 0;
  flex: 0 0 auto;
}

.tank-cleaning {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(104, 114, 115, 0.22);
}

.tank-cleaning span,
.tank-cleaning small {
  color: var(--muted);
}

.tank-cleaning small {
  font-size: 0.78rem;
}

.tank-actions {
  margin-top: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  flex: 0 0 auto;
}

.status-dot.warn {
  background: var(--amber);
}

.status-dot.danger {
  background: var(--red);
}

.status-dot.muted-dot {
  background: var(--muted);
}

.kpi-list,
.plain-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kpi-list li,
.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.kpi-list li:last-child,
.plain-list li:last-child {
  border-bottom: 0;
}

/* --- Graphiques de la section Rapports --- */
.report-chart {
  width: 100%;
  height: auto;
  margin-top: 6px;
}

.report-chart .chart-grid {
  stroke: #eef1f1;
  stroke-width: 1;
}

.report-chart .chart-grid-label {
  fill: #9aa7a5;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.report-chart .chart-axis {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 540;
}

.report-chart .chart-val {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.report-chart .chart-col rect {
  transition:
    opacity 140ms ease,
    filter 140ms ease;
}

.report-chart .chart-col:hover rect {
  filter: brightness(1.08);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.report-donut {
  width: 160px;
  height: 160px;
  flex: none;
}

.report-donut circle {
  transition: stroke-width 140ms ease;
}

.report-donut .donut-value {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.report-donut .donut-label {
  fill: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-legend {
  flex: 1 1 180px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.84rem;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: none;
}

.legend-name {
  color: var(--ink);
  font-weight: 540;
}

.legend-value {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.report-bars {
  display: grid;
  gap: 11px;
  margin-top: 6px;
}

.report-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 30%) 1fr auto;
  align-items: center;
  gap: 12px;
}

.report-bar-label {
  font-size: 0.84rem;
  font-weight: 540;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #eef1f1;
  overflow: hidden;
}

.report-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--accent);
  min-width: 4px;
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.report-bar-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --- Page Coûts --- */
.legend-chip {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  vertical-align: baseline;
}

.cost-detail-wrap {
  max-height: 460px;
}

.cost-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
}

.cost-cell strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cost-bar {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #eef1f1;
  overflow: hidden;
}

.cost-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f9d92, #b56816);
  min-width: 3px;
}

/* Décomposition du coût (fiche recette) */
.cost-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 4px;
}

.cost-breakdown > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfc;
  font-size: 0.82rem;
  color: var(--muted);
}

.cost-breakdown > span strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cost-breakdown-total {
  border-color: rgba(13, 107, 95, 0.3) !important;
  background: var(--accent-soft) !important;
  color: var(--accent-strong) !important;
}

/* Diagnostics de fiabilité */
.cost-issues {
  border: 1px solid #f3dcc0;
  background: #fff8ef;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.cost-issues > strong {
  color: var(--amber);
}

.cost-issues ul {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.cost-issues li {
  font-size: 0.85rem;
}

.cost-issues li.issue-danger {
  color: var(--red);
}

.cost-ok {
  border: 1px solid #cde8da;
  background: #eef8f2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--green);
  font-weight: 540;
}

.cost-issue-list {
  display: grid;
  gap: 7px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.cost-issue-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfc;
  font-size: 0.86rem;
}

/* --- Éditeur de règles par blocs --- */
.rule-builder {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  margin-top: 8px;
}

.rule-palette {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-content: start;
}

.rule-palette-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.rule-palette-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 560;
  text-align: left;
  cursor: pointer;
  background: #e4e1f7;
  color: #3c3489;
  transition: filter 130ms ease, transform 130ms ease;
}

.rule-palette-chip:hover {
  filter: brightness(0.97);
  transform: translateX(2px);
}

.rule-palette-chip .ui-icon-dot,
.rule-empty .ui-icon-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  display: inline-block;
}

.rule-canvas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 12px 12px, rgba(20, 32, 31, 0.06) 1px, transparent 1.4px) 0 0 / 22px 22px,
    #f7f9f8;
  border: 1px solid var(--line);
  min-height: 120px;
}

.rule-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.rule-block.is-off {
  opacity: 0.5;
}

.rule-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.rule-toggle input {
  position: absolute;
  opacity: 0;
  width: 34px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.rule-toggle span {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #cfd6d4;
  position: relative;
  transition: background 140ms ease;
}

.rule-toggle span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 140ms ease;
}

.rule-toggle input:checked + span {
  background: var(--accent);
}

.rule-toggle input:checked + span::after {
  transform: translateX(14px);
}

.rule-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tag-when {
  background: #cecbf6;
  color: #26215c;
}

.tag-then {
  background: #f5c4b3;
  color: #4a1b0c;
}

.rule-seg {
  border: 0;
  border-radius: 7px;
  padding: 7px 26px 7px 11px;
  font-size: 0.82rem;
  font-weight: 560;
  width: auto;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.rule-seg.seg-when {
  background-color: #cecbf6;
  color: #26215c;
}

.rule-seg.seg-then {
  background-color: #f5c4b3;
  color: #4a1b0c;
}

.rule-pill {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 560;
  width: auto;
  min-width: 0;
  background: #b5d4f4;
  color: #042c53;
  appearance: none;
}

select.rule-pill {
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23042c53' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.rule-pill-num {
  width: 64px;
}

.rule-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rule-pill-suffix {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 560;
}

.rule-pill-static {
  background: #eef1f1;
  color: var(--muted);
}

.rule-note {
  flex: 1;
  min-width: 90px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: #fcfdfd;
}

.rule-del {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.rule-del:hover {
  background: #ffe7e2;
  color: var(--red);
}

.rule-empty {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.rule-add-block {
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.rule-add-block:hover {
  background: #ddeee9;
}

.optim-proposal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid rgba(13, 107, 95, 0.3);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.optim-proposal-main {
  flex: 1 1 320px;
  min-width: 0;
}

.optim-proposal-main h3 {
  margin: 0 0 4px;
}

.optim-impact {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.optim-proposal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-period-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.order-period-chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fcfdfd;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 560;
  cursor: pointer;
  transition: all 130ms ease;
}

.order-period-chip:hover {
  border-color: rgba(13, 107, 95, 0.4);
  background: #f6f8f7;
}

.order-period-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.order-period-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.order-adjust > summary {
  cursor: pointer;
  font-weight: 560;
  color: var(--accent-strong);
}

.weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.weekday-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.weekday-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.weekday-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 560;
  color: var(--muted);
  background: #fcfdfd;
  transition: all 130ms ease;
}

.weekday-chip.on span,
.weekday-chip input:checked + span {
  background: var(--accent-soft);
  border-color: rgba(13, 107, 95, 0.4);
  color: var(--accent-strong);
}

@media (max-width: 760px) {
  .rule-builder {
    grid-template-columns: 1fr;
  }
  .rule-palette {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: #25302f;
  box-shadow: var(--shadow);
}

.order-brew-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.order-brew-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-soft);
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.order-brew-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-tight);
}

.order-brew-card.selected {
  border-color: rgba(17, 94, 89, 0.35);
  border-left-color: var(--accent);
  background: linear-gradient(180deg, #f2fbf6, #e8f7ef);
}

.order-brew-card.blocked {
  border-color: rgba(188, 59, 50, 0.28);
  border-left-color: var(--red);
  background: #fff4f1;
}

.order-brew-card input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.order-brew-card span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.order-brew-card strong,
.order-brew-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-brew-card small {
  color: var(--muted);
  font-weight: 540;
}

.compact-select {
  width: min(220px, 100%);
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
}

.table-input {
  width: 100%;
  min-width: 90px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfdfd;
  font: inherit;
}

.table-input:focus {
  background: #fff;
}

.strong-input {
  font-weight: 600;
}

.muted-input {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.number-input {
  max-width: 92px;
}

.supplier-email-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.supplier-email-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.supplier-email-card h3 {
  margin: 0;
}

.email-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.email-table-preview {
  overflow-x: auto;
  border: 1px solid #cfd8d3;
  border-radius: var(--radius-sm);
  background: #fff;
}

.email-excel-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.email-excel-table th,
.email-excel-table td {
  padding: 8px 10px;
  border: 1px solid #d8e0dc;
  text-align: left;
  white-space: nowrap;
}

.email-excel-table th {
  position: sticky;
  top: 0;
  background: #0d6b5f;
  color: #fff;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.email-excel-table tbody tr:nth-child(even) {
  background: #f5faf8;
}

.email-excel-table tbody tr:hover {
  background: #eef6f3;
}

.email-excel-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.email-text-fallback summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.email-preview {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f4f6f5;
  color: var(--ink);
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

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

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .nav {
    gap: 12px;
  }

  .nav-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-label {
    grid-column: 1 / -1;
  }

  .nav-item {
    grid-template-columns: 30px 1fr;
  }

  .sidebar-foot {
    margin-top: 14px;
  }

  .recipe-catalog-actions {
    justify-content: flex-start;
  }

  .recipe-catalog-actions .compact-field {
    min-width: min(100%, 260px);
  }

  .compact-recipe-form {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .inline-add-recipe {
    width: 100%;
  }

  .topbar,
  .timeline-item,
  .section-heading,
  .brew-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .legend {
    justify-content: flex-start;
  }

  .calendar-tools {
    justify-items: start;
  }

  .calendar-nav {
    justify-content: flex-start;
  }

  .calendar-schedule-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brew-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .occupancy-row {
    grid-template-columns: 1fr auto;
  }

  .occupancy-bar {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 560px) {
  main {
    padding: 16px;
  }

  .nav-section {
    grid-template-columns: 1fr;
  }

  .calendar-schedule-preview {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
