/* ==========================================================================
   Backoffice Écrans — charte Restool (identique à HACCP, au portail et à Price Pilot)
   Marine #14273A · Orange #E07A2E · Brume #EEF1F4 · police Outfit
   ========================================================================== */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/Outfit-latin.woff2') format('woff2');
}

:root {
  --ink:        #14273A;
  --ink-70:     #4A5866;
  --ink-50:     #7D8FA0;
  --ink-30:     #A8B5C2;
  --terra:      #E07A2E;
  --terra-dark: #B5611E;
  --terra-soft: #F2C8A0;
  --terra-wash: #FDF0E6;
  --sand:       #D9DEE4;
  --sand-soft:  #EEF1F4;
  --paper:      #FFFFFF;

  --bg:            var(--sand-soft);
  --panel:         var(--paper);
  --ink-muted:     var(--ink-70);
  --gold:          var(--terra-dark);
  --on-accent:     #FFFFFF;
  --border:        rgba(20, 39, 58, .12);
  --border-strong: rgba(20, 39, 58, .28);

  --danger:  #A74B3A;
  --success: #4F7A5A;
  --warning: #C79A3D;

  --shadow-sm: 0 1px 3px rgba(20, 39, 58, .06);
  --shadow-md: 0 4px 16px rgba(20, 39, 58, .09), 0 1px 3px rgba(20, 39, 58, .05);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius: var(--radius-lg);
  --touch: 48px;

  --topbar-h: 60px;
  --sidebar-w: 280px;

  --font-ui: 'Outfit', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--terra-soft); color: var(--ink); }

a { color: var(--terra-dark); }
a:hover { color: var(--ink); }

h1, h2, h3 { margin: 0 0 0.5em; text-wrap: balance; color: var(--ink); }
h1 { font-weight: 700; font-size: 2.1rem; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1.2rem; }
h2 { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
h3 { font-weight: 600; font-size: 1.05rem; }

button, input, select, textarea { font-family: inherit; font-size: 1rem; }

:focus-visible { outline: 2px solid var(--terra); outline-offset: 3px; border-radius: 2px; }

/* ── Barre du haut (identique au portail Restool) ── */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--ink);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  z-index: 60;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.topbar-monogram { height: 34px; width: 34px; display: block; }

.topbar-wordmark { display: flex; flex-direction: column; gap: 1px; line-height: 1; }

.topbar-wordmark__brand {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.4px;
  color: var(--ink-30);
}

.topbar-wordmark__app {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #FFFFFF;
}

/* ── Structure ── */

.app-shell { min-height: 100vh; padding-top: var(--topbar-h); }

.content {
  margin-left: var(--sidebar-w);
  padding: 32px 40px 96px;
  max-width: 1180px;
}

/* ── Barre latérale (marine, comme le portail) ── */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 0 12px 16px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .06);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 8px 24px;
  margin: 0 -12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  display: block;
  /* Le logo fourni par le portail est blanc sur fond transparent : il se pose directement sur le bandeau marine. */
}

.brand-name { color: var(--paper); font-weight: 700; font-size: 1.15rem; text-align: center; padding: 0 12px; }

.topbar-logo { height: 34px; width: auto; display: block; }

.restool-back-link {
  display: flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 0 8px;
  color: rgba(255, 255, 255, .72); text-decoration: none; font-size: .9rem; border-radius: var(--radius-md);
}
.restool-back-link:hover { color: var(--paper); background: rgba(255, 255, 255, .06); }
.restool-back-logo { height: 20px; width: auto; opacity: .7; }

.nav-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch);
  padding: 0 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, .72);
  text-decoration: none;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: rgba(255, 255, 255, .06); color: var(--paper); }
.nav-link.active { background: rgba(255, 255, 255, .10); color: var(--paper); }
.nav-link.active .nav-icon { color: var(--terra); }

.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-foot form { margin: 0; }

.sidebar-user {
  font-size: .82rem;
  color: var(--ink-30);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--ink-30);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s;
}

button.sidebar-logout:hover { background: none; color: var(--terra); }
.sidebar-logout .nav-icon { width: 16px; height: 16px; }

/* ── Mobile / tablette portrait : barre de navigation en bas ── */

@media (max-width: 759px) {
  .topbar { padding: 0 16px; }
  .topbar-monogram { height: 30px; width: 30px; }

  .sidebar {
    top: auto;
    bottom: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    overflow-x: auto;
  }

  .brand, .sidebar-foot { display: none; }

  .nav-links { flex-direction: row; justify-content: space-between; width: 100%; gap: 0; }

  .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 0;
    text-align: center;
  }

  .nav-label { font-size: 0.6rem; white-space: nowrap; }
  .nav-icon { width: 18px; height: 18px; }

  .content { margin-left: 0; padding: 20px 16px; padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.7rem; }

  /* Lignes de plats : la poignée et « Suppr. » passent au-dessus, le formulaire prend toute la largeur */
  .item-row { flex-wrap: wrap; }
  .item-row > form:last-child { margin-left: auto; }
  .item-row > .item-row__form,
  .item-row > .carte-item-row__form { flex: 1 1 100%; order: 3; flex-wrap: wrap; }
  .item-row .carte-item-row__form input[type="text"],
  .item-row .carte-item-row__fields .input-name-large { width: 100%; min-width: 0; }
  .item-row .input-price { width: 100% !important; text-align: left; }
}

/* ── Connexion ── */

.login-body { padding-top: var(--topbar-h); }

.login-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 28px 28px;
  text-align: center;
}

.login-card__logo { width: 96px; height: auto; margin: 0 auto 8px; display: block; mix-blend-mode: multiply; }
.login-card h1 { margin-bottom: 2px; }
.login-card__subtitle { color: var(--ink-70); margin: 0 0 24px 0; }
.login-card__error { color: var(--danger); font-weight: 500; margin: 0 0 12px 0; }

.login-card label {
  display: block;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-70);
  margin-bottom: 6px;
}

.login-card input { width: 100%; margin-bottom: 16px; }
.login-card button { width: 100%; }

/* ── Tableau de bord ── */

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.dashboard-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

.dashboard-card:hover { border-color: var(--terra); box-shadow: var(--shadow-md); color: var(--ink); }
.dashboard-card h2 { margin-bottom: 0.3rem; }
.dashboard-card p { color: var(--ink-70); margin: 0; }
.dashboard-card--accent { border-color: var(--terra); background: var(--terra-wash); }

/* ── Onglets (chips) ── */

.menu-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.tab {
  min-height: var(--touch);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-md);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  transition: background .12s, color .12s, border-color .12s;
}

.tab:hover { border-color: var(--ink); color: var(--ink); }

.tab--active, .tab--active:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-accent);
}

.menu-price-form {
  background: var(--terra-wash);
  border: 1px solid var(--terra-soft);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.menu-price-form label { font-weight: 500; color: var(--ink); }
.menu-price-form input { width: 120px; }

/* ── Champs ── */

input:not([type='checkbox']):not([type='radio']):not([type='file']),
select,
textarea {
  min-height: var(--touch);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 10px 12px;
}

input[type='file'] { max-width: 100%; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--terra); }

input:not([type='checkbox']):not([type='radio']):focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--terra);
  outline: 2px solid color-mix(in srgb, var(--terra) 30%, transparent);
  outline-offset: 0;
  border-radius: var(--radius-sm);
}

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }

/* ── Boutons ── */

button {
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--terra);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 600;
  transition: background .15s ease-out, border-color .15s, color .15s, opacity .12s;
}

button:hover { background: var(--terra-dark); }
button:active { opacity: .9; }

button.btn-danger {
  background: var(--paper);
  color: var(--danger);
  border-color: var(--danger);
}

button.btn-danger:hover { background: var(--danger); color: var(--on-accent); }

/* ── Cartes ── */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 20px;
}

.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-70);
}

.stacked-form input,
.stacked-form select,
.stacked-form textarea { font-size: 1rem; color: var(--ink); }

.stacked-form button { align-self: flex-start; }

.day-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.day-picker__option {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--paper);
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  color: var(--ink) !important;
  cursor: pointer;
}

.closure-list { list-style: none; margin: 16px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.closure-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--sand-soft);
  text-transform: capitalize;
}

.closure-list__item form { margin: 0; }

.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 180px; }

.form-error { color: var(--danger); font-weight: 500; }
.form-success { color: var(--success); font-weight: 500; }
.page-intro { color: var(--ink-70); margin-top: -0.6rem; }
.section-title { margin-top: 2rem; }

/* ── Catégories / plats ── */

.category-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.category-card__header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.category-card__title { margin: 0; font-size: 1.15rem; }

.category-rename-form { flex: 1; margin: 0; }
.category-rename-form input { width: 100%; max-width: 320px; }

.drag-handle {
  cursor: grab;
  color: var(--ink-50);
  font-size: 1.2rem;
  user-select: none;
  touch-action: none;
  padding: 0.4rem;
}

.item-list { list-style: none; margin: 0 0 16px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--sand-soft);
}

.item-row--inactive { opacity: 0.55; }
.item-row.dragging { opacity: 0.5; border-color: var(--terra); }

.item-row__form { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.item-row__form input[type="text"] { flex: 1; min-width: 0; }
.item-row__form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; flex-shrink: 0; }

.autosave-status { font-size: 0.85rem; color: var(--success); opacity: 0; transition: opacity .2s ease; white-space: nowrap; }
.autosave-status.is-visible { opacity: 1; }
.autosave-status--error { color: var(--danger); }

.input-name-large {
  font-size: 1.2rem !important;
  padding: 0.8rem 1rem !important;
  font-weight: 500;
}

/* ── Interrupteur de type Apple ── */

.toggle-switch {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: fit-content;
}

.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-switch__track {
  position: relative;
  width: 56px;
  height: 32px;
  flex-shrink: 0;
  background: var(--sand);
  border-radius: 999px;
  transition: background-color .2s ease;
}

.toggle-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}

.toggle-switch input:checked ~ .toggle-switch__track { background: var(--success); }
.toggle-switch input:checked ~ .toggle-switch__track .toggle-switch__thumb { transform: translateX(24px); }
.toggle-switch input:focus-visible ~ .toggle-switch__track { outline: 2px solid var(--terra); outline-offset: 2px; }

.toggle-switch__label { font-size: 1rem; font-weight: 500; color: var(--ink); }

.toggle-switch--warning input:checked ~ .toggle-switch__track { background: var(--terra); }

/* ── Carte : nom + prix, description, allergènes, interrupteurs ── */

.carte-item-row { align-items: flex-start; }

.carte-item-row__form { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.carte-item-row__fields { display: flex; gap: 12px; flex-wrap: wrap; }
.carte-item-row__fields .input-name-large { flex: 1; min-width: 200px; }

.input-price {
  width: 110px;
  font-size: 1.1rem !important;
  padding: 0.8rem 1rem !important;
  font-weight: 500;
  text-align: right;
}

.input-description {
  width: 100%;
  font-size: 0.95rem !important;
  color: var(--ink-70);
}

.allergen-picker {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: var(--paper);
}

.allergen-picker summary {
  cursor: pointer;
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-height: 32px;
}

.allergen-picker summary::marker,
.allergen-picker summary::-webkit-details-marker { display: none; content: ''; }

.allergen-picker summary::before { content: '▸'; color: var(--ink-50); }
.allergen-picker[open] summary::before { content: '▾'; }

.allergen-picker__summary { font-weight: 400; color: var(--ink-70); font-size: 0.9rem; }

.allergen-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px 16px;
  margin-top: 12px;
}

.allergen-picker__grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 0.92rem;
  font-weight: 400;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Calendrier (sélecteur de date Restool) ── */

.datepicker { position: relative; display: inline-block; max-width: 100%; }

.datepicker__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  width: 100%;
  min-width: 270px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-align: left;
}

.datepicker__trigger:hover { background: var(--paper); border-color: var(--ink); }
.datepicker__trigger[aria-expanded="true"] { border-color: var(--terra); box-shadow: 0 0 0 3px color-mix(in srgb, var(--terra) 25%, transparent); }
.datepicker__trigger svg { color: var(--terra); flex-shrink: 0; }
.datepicker__value { text-transform: capitalize; }
.datepicker__value.is-empty { color: var(--ink-50); font-weight: 400; text-transform: none; }

.datepicker__error { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--danger); font-weight: 500; }

.datepicker__pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 16px 40px rgba(20, 39, 58, .14);
  padding: 14px;
}

.datepicker__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.datepicker__title { font-weight: 700; font-size: 1.1rem; text-transform: capitalize; letter-spacing: -0.01em; }

button.datepicker__nav {
  min-height: 40px;
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sand-soft);
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
}

button.datepicker__nav:hover { background: var(--sand); }

.datepicker__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.datepicker__dow {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-50);
  letter-spacing: 0.05em;
  padding: 6px 0;
}

.datepicker__cell--empty { min-height: 42px; }

button.datepicker__day {
  position: relative;
  min-height: 42px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

button.datepicker__day:hover:not(:disabled) { background: var(--sand-soft); border-color: var(--border-strong); }
button.datepicker__day.is-weekend { color: var(--ink-70); }
button.datepicker__day.is-today { border-color: var(--terra); color: var(--terra-dark); font-weight: 700; }
button.datepicker__day:disabled { color: var(--ink-30); opacity: .45; cursor: not-allowed; }

button.datepicker__day.is-selected,
button.datepicker__day.is-selected:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-accent);
}

button.datepicker__day.is-holiday::after,
button.datepicker__day.is-marked::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--terra);
}

button.datepicker__day.is-marked::after { background: var(--danger); }
button.datepicker__day.is-selected::after { background: var(--terra-soft); }

.datepicker__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-70);
}

.datepicker__legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--terra); }
.datepicker__legend-item b { color: var(--ink); font-weight: 700; }

.datepicker__foot { display: flex; justify-content: space-between; margin-top: 8px; }

button.datepicker__link {
  min-height: 36px;
  padding: 0 8px;
  background: none;
  border: none;
  color: var(--terra-dark);
  font-weight: 600;
  font-size: 0.92rem;
}

button.datepicker__link:hover { background: none; color: var(--ink); }
button.datepicker__link--muted { color: var(--ink-70); }

.stacked-form .datepicker { display: block; }
.form-row .datepicker__trigger { min-width: 0; }

.datepicker__error[hidden],
.datepicker__pop[hidden] { display: none; }


/* ── Boîtes de dialogue ── */

button.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
button.btn-ghost:hover { background: var(--sand-soft); border-color: var(--ink-50); }

dialog.dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(20, 39, 58, .35);
  color: var(--ink);
}

dialog.dialog::backdrop { background: rgba(20, 39, 58, .55); }

.dialog__form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dialog__form h2 { margin: 0; }
.dialog__form p { margin: 0; }
.dialog__field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 500; color: var(--ink-70); }
.dialog__field input { font-size: 1.05rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }


/* ── Page Menus : vue en cartes ── */

.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-bar h1 { margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; align-items: stretch; }

.menu-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .15s;
}

.menu-card:hover { box-shadow: var(--shadow-md); }
.menu-card.is-off { opacity: .72; }
.menu-card__bar { height: 8px; background: var(--c); }
.menu-card__body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.menu-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.menu-card__top h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.01em; }
.menu-card__price { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.menu-card__when { color: var(--ink-70); }

.day-dots { display: flex; gap: 4px; }
.day-dots span { width: 26px; height: 26px; border-radius: 6px; background: var(--sand-soft); color: var(--ink-50); font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.day-dots span.on { background: var(--c); color: #fff; }

.menu-card__dishes { list-style: none; margin: 4px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; color: var(--ink-70); font-size: 0.9rem; }
.menu-card__dishes li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-card__dishes li::before { content: '· '; }
.menu-card__dishes .is-muted { color: var(--ink-50); }

.menu-card__foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); background: #FAFBFC; }
.menu-card__foot form { margin: 0; }

a.btn-outline {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
}

a.btn-outline:hover { background: var(--sand-soft); border-color: var(--ink); color: var(--ink); }

button.card-add {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  color: var(--ink-70);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font-weight: 600;
}

button.card-add:hover { background: var(--paper); color: var(--ink); border-color: var(--ink-50); }
.card-add__plus { width: 44px; height: 44px; border-radius: 50%; background: var(--terra); color: #fff; font-size: 1.7rem; line-height: 44px; text-align: center; font-weight: 400; }

.status { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.status--live { background: #E2EDE5; color: var(--success); }
.status--wait { background: #F7EBCF; color: #8A6A1C; }
.status--off { background: var(--sand); color: var(--ink-70); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Page d'un menu ── */

.crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--ink-70); font-weight: 500; }
.crumb a { text-decoration: none; color: var(--ink-70); }
.crumb a:hover { color: var(--terra-dark); }
.crumb strong { color: var(--ink); }

.menu-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 6px solid var(--c);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
  margin-bottom: 18px;
}

.menu-top__spacer { flex: 1; }

input.menu-title-input {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 460px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 4px 10px;
  margin-left: -10px;
}

input.menu-title-input:hover { border-color: var(--border-strong); background: var(--paper); }

.menu-cols { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 18px; align-items: start; }
.menu-side { display: flex; flex-direction: column; gap: 16px; }
.menu-side .card { margin-bottom: 0; }

.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card__head h2 { margin: 0; }

.fam-block { padding-top: 14px; }
.fam-block + .fam-block { border-top: 1px solid var(--border); margin-top: 14px; }
.fam-block.dragging { opacity: .5; }
.fam-block__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fam-block__rename { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; }

.fam-block__rename input {
  min-height: 40px;
  font-weight: 700;
  font-size: 1.05rem;
  border-color: transparent;
  background: transparent;
  padding: 0 10px;
  margin-left: -6px;
  flex: 1;
  min-width: 0;
}

.fam-block__rename input:hover { border-color: var(--border-strong); background: var(--paper); }
.fam-block__head form { margin: 0; }
.fam-block__count { color: var(--ink-50); font-size: 0.88rem; white-space: nowrap; }
.fam-block .item-list { margin-bottom: 10px; }

button.btn-text-danger {
  min-height: 36px;
  padding: 0 8px;
  background: none;
  border: none;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}

button.btn-text-danger:hover { background: none; text-decoration: underline; }

.side-card { padding: 18px; }
.side-card h2 { font-size: 1.05rem; margin-bottom: 12px; }

.price-field { display: flex; align-items: center; gap: 10px; }
.price-field input { flex: 1; font-size: 1.2rem; font-weight: 600; }
.price-field span { font-weight: 700; color: var(--ink-70); }

.seg-radio { display: flex; gap: 8px; margin-bottom: 14px; }
.seg-radio label { flex: 1; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-radio span { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--paper); font-weight: 600; text-align: center; padding: 0 8px; }
.seg-radio input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--terra); outline-offset: 2px; }

.menu-hours[hidden] { display: none; }
.menu-hours { margin-bottom: 14px; }
.menu-hours .form-row { gap: 10px; flex-wrap: nowrap; }
.menu-hours .form-row label { min-width: 0; }
.preset-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.muted-label { font-size: 0.85rem; color: var(--ink-70); }

.mini-label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 500; color: var(--ink-70); }
.mini-label input { width: 100%; }
.mini-title { font-size: 0.72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-50); font-weight: 600; margin-bottom: 6px; }

.day-chips { display: flex; gap: 6px; }
.day-chips label { cursor: pointer; }
.day-chips input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-chips span { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--sand-soft); color: var(--ink-50); font-weight: 700; border: 1px solid transparent; }
.day-chips input:checked + span { background: var(--ink); color: #fff; }
.day-chips input:focus-visible + span { outline: 2px solid var(--terra); outline-offset: 2px; }

button.btn-chip {
  min-height: 36px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-weight: 600;
}

button.btn-chip:hover { background: var(--sand-soft); border-color: var(--ink); }

.side-card .inline-form { margin-bottom: 10px; }
.side-card .closure-list { margin-top: 0; }
.delete-menu { text-align: center; margin: 4px 0 0 0; }

@media (max-width: 1100px) {
  .menu-cols { grid-template-columns: minmax(0, 1fr); }
}

.menu-cols > * { min-width: 0; }

@media (max-width: 759px) {
  .card-grid { grid-template-columns: 1fr; }
  .menu-top { padding: 12px 14px; }
  input.menu-title-input { font-size: 1.3rem; max-width: none; }
  .card__head, .fam-block__head { flex-wrap: wrap; }
  .fam-block__head .fam-handle { order: 1; }
  .fam-block__count { order: 2; }
  .fam-block__head > form:last-child { order: 3; margin-left: auto; }
  .fam-block__rename { flex: 1 1 100%; order: 4; }
  .card { padding: 16px; }
}

/* Lignes de plats de la page d'un menu : le nom prend toute la place, le libellé « Actif » et le message d'enregistrement ne bougent pas la mise en page. */
.fam-block .item-row { position: relative; }
.fam-block .item-row .input-name-large { font-size: 1.05rem !important; padding: 0.7rem 0.9rem !important; }
.fam-block .toggle-switch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fam-block .item-row .autosave-status { position: absolute; right: 12px; bottom: 1px; font-size: 0.72rem; pointer-events: none; }
.fam-block__rename .autosave-status { font-size: 0.78rem; }

button.tab--add { background: transparent; border: 2px dashed var(--border-strong); color: var(--ink-70); font-weight: 600; }
button.tab--add:hover { background: var(--paper); border-color: var(--ink-50); color: var(--ink); }

/* ── Communication : cartes de diffusion ── */

.event-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .15s;
}

.event-card:hover { box-shadow: var(--shadow-md); }
.event-card.is-off { opacity: .72; }
.event-card.dragging { opacity: .45; outline: 2px solid var(--terra); }

.event-card__media { position: relative; aspect-ratio: 16 / 9; background: var(--sand); overflow: hidden; }
.event-card__media img,
.event-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; }

.event-card__textonly {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(160deg, #1C3348, var(--ink));
  color: #fff;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.event-card__badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(20, 39, 58, .8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.event-card__handle {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, .92);
  border-radius: var(--radius-sm);
  color: var(--ink-70);
  padding: 4px 8px;
  box-shadow: var(--shadow-sm);
}

.event-card__status { position: absolute; top: 10px; right: 10px; box-shadow: var(--shadow-sm); }

.event-card__body { padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.event-card__body h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }

.event-card__text {
  margin: 0;
  color: var(--ink-70);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card__dates { display: flex; align-items: center; gap: 8px; color: var(--ink-70); font-size: 0.9rem; font-weight: 500; margin-top: 2px; }
.event-card__dates svg { color: var(--terra); flex-shrink: 0; }

.event-card__foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); background: #FAFBFC; }
.event-card__foot { margin-top: 8px; }
.event-card__foot form { margin: 0; }

button.btn-outline-button {
  min-height: 40px;
  padding: 0 18px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

button.btn-outline-button:hover { background: var(--sand-soft); border-color: var(--ink); }

/* ── Boîtes de dialogue larges (formulaires) ── */

dialog.dialog--wide { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 24px); overflow: visible; }
.dialog__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog__row .datepicker__trigger { min-width: 0; }
.dialog__field textarea { font-size: 1rem; resize: vertical; }
.dialog__actions--split { justify-content: space-between; align-items: center; }
.dialog__actions-right { display: flex; gap: 10px; }

@media (max-width: 759px) {
  dialog.dialog--wide { overflow: auto; }
  .dialog__row { grid-template-columns: 1fr; }
}

/* ── Heures de diffusion (diffusions) et heures prédéfinies (réglages) ── */

.seg-radio--stack { flex-wrap: wrap; }
.seg-radio--stack label { flex: 1 1 120px; }
.seg-radio--stack span { flex-direction: column; gap: 1px; min-height: 52px; font-size: 0.92rem; }
.seg-radio--stack small { font-size: 0.72rem; font-weight: 500; opacity: .75; }
.custom-hours[hidden] { display: none; }
.custom-hours { margin-top: 10px; }

.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; max-width: 640px; }
.preset-block { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--sand-soft); }
.preset-block h3 { margin: 0 0 10px; font-size: 1.05rem; }
.preset-block .form-row { gap: 10px; flex-wrap: nowrap; }
.preset-block .form-row label { min-width: 0; }
.presets-form .autosave-status { display: block; margin-top: 12px; min-height: 1.2em; }

@media (max-width: 759px) {
  .dialog__actions--split { flex-wrap: wrap; gap: 8px; }
  .dialog__actions-right { flex: 1; justify-content: flex-end; }
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .7);
  text-decoration: none;
  transition: color .15s, background .15s;
}

.topbar-settings:hover,
.topbar-settings.active { color: #fff; background: rgba(255, 255, 255, .12); }
.topbar-settings .nav-icon { width: 20px; height: 20px; }

/* ── Écrans ── */

.screen-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.screen-row { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--sand-soft); display: flex; flex-direction: column; gap: 10px; }
.screen-row__form { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 0; }
.screen-row__form input[type="text"] { flex: 1 1 220px; max-width: 360px; font-weight: 600; }
.screen-row__url, .screen-url { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.screen-row__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.screen-row__meta form { margin: 0; }

code[data-screen-url] {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  word-break: break-all;
}

.screen-url { margin: 0 0 18px 0; }

a.btn-chip--link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

a.btn-chip--link:hover { background: var(--sand-soft); border-color: var(--ink); color: var(--ink); }

.tab__count { margin-left: 8px; min-width: 22px; height: 22px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--sand-soft); color: var(--ink-70); font-size: 0.78rem; font-weight: 600; }
.tab--active .tab__count { background: rgba(255, 255, 255, .18); color: #fff; }

.dialog__field select { min-height: var(--touch); background: var(--paper); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; font-size: 1rem; color: var(--ink); }

.toggle-switch[hidden] { display: none !important; }

[data-when][hidden] { display: none !important; }

.event-card__kind {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.event-card__kind--info { background: #B3261E; }
.event-card__kind--event { background: var(--ink); }
.event-card__badge { left: auto; right: 10px; }


/* ── Fichier joint actuel (fenêtre de modification d'une diffusion) ── */

.current-media { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--sand-soft); margin-bottom: 8px; }
.current-media__thumb { width: 120px; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; background: var(--sand); flex-shrink: 0; }
.current-media__thumb img, .current-media__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.current-media__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 0.9rem; }
.current-media__info strong { font-size: 0.95rem; color: var(--ink); }
.current-media__info span { color: var(--ink-70); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 0.88rem; font-weight: 500; color: var(--danger); cursor: pointer; }

.datepicker__legend { min-height: 3.2rem; align-content: flex-start; }

/* ── Liens « Voir écran … » de la barre latérale ── */

.nav-link--screen-first { margin-top: 10px; position: relative; }
.nav-link--screen-first::before { content: ''; position: absolute; top: -6px; left: 14px; right: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.nav-label--short { display: none; }
.nav-link--screen .nav-label--full { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 759px) {
  .nav-label--full { display: none; }
  .nav-label--short { display: inline; }
  .nav-link--screen-first { margin-top: 0; }
  .nav-link--screen-first::before { display: none; }
  .nav-link--screen { flex: 1 0 auto; min-width: 64px; }
}

/* Menus choisis par écran (Réglages) */
.screen-menus { margin: 12px 0 4px; padding: 12px 14px; background: rgba(0,0,0,.03); border-radius: 10px; }
.screen-menus h3 { margin: 0 0 8px; font-size: 14px; }
.menu-choice-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
