/* Espace admin : A Casa di u Nebbiu */
:root {
  --lichen: #DEDCCF; --lichen-2: #D2D0C1; --paper: #F4F2EC; --maquis: #1E2A22; --maquis-2: #27362C;
  --viola: #4F416E; --gold: #E0A82E; --gold-2: #F0C25A; --gold-dark: #A9780F; --arbousier: #C2412D;
  --chalk: #EEEBE2; --ink: #1E2A22; --muted: #56604F; --line: rgba(30, 42, 34, .14); --field: #C9C6B6;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-script: "Casa Script", "Apple Chancery", cursive;
}
@font-face { font-family: "Casa Script"; src: url("../fonts/casa-script.woff") format("woff"); font-display: swap; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; font: 400 1rem/1.5 var(--f-body); color: var(--ink); background: var(--lichen); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-weight: 600; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .6rem 1.1rem; border: 1.5px solid transparent; border-radius: 11px; font-weight: 700; font-size: .98rem; line-height: 1.1; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .2s, transform .12s, box-shadow .12s, opacity .2s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--sm { min-height: 40px; padding: .4rem .85rem; font-size: .92rem; }
.btn--block { width: 100%; }
.btn--gold { background: var(--gold); color: var(--maquis); box-shadow: 0 3px 0 var(--gold-dark); }
.btn--gold:hover { background: var(--gold-2); }
.btn--gold:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dark); }
.btn--dark { background: var(--maquis); color: var(--chalk); }
.btn--line { border-color: var(--maquis); background: transparent; }
.btn--line:hover { background: rgba(30, 42, 34, .06); }
.btn--ghost { background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn--add { width: 100%; margin-top: .4rem; border: 2px dashed rgba(30, 42, 34, .3); background: rgba(255, 255, 255, .35); color: var(--maquis); }
.btn--add:hover { border-color: var(--maquis); background: rgba(255, 255, 255, .7); }
.btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-idle { opacity: .55; box-shadow: none; }
.ib { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; cursor: pointer; color: var(--maquis); }
.ib svg { width: 18px; height: 18px; }
.ib:hover:not(:disabled) { border-color: var(--maquis); }
.ib:disabled { opacity: .35; cursor: default; }
.ib--del { color: var(--arbousier); }
.ib--del:hover:not(:disabled) { border-color: var(--arbousier); background: #fff4f1; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 80% at 50% 0%, #2B3A2F 0%, var(--maquis) 60%); }
.login__card { width: min(100%, 420px); padding: 32px 28px 26px; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); text-align: center; }
.login__logo { display: block; width: 64px; height: 64px; margin: 0 auto 6px; color: var(--maquis); }
.login__logo svg { width: 100%; height: 100%; }
.login__title { margin: 0; font-size: 1.6rem; font-weight: 800; }
.login__sub { margin: 0 0 20px; font: 400 2rem/1.2 var(--f-script); color: var(--viola); }
.login__card .f { text-align: left; }
.login__err, .login__msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #FBE6E1; color: #8E2A1A; font-weight: 600; text-align: left; }
.login__msg { background: #EFEAF7; color: var(--viola); }
.login__demo { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: #EFEAF7; color: var(--viola); text-align: left; font-size: .95rem; }
.login__back { display: inline-block; margin-top: 16px; color: var(--muted); font-size: .92rem; }

/* ---------- Structure ---------- */
.adm { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: var(--maquis); color: var(--chalk); overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: inherit; text-decoration: none; }
.side__logo { width: 40px; height: 40px; flex: none; }
.side__logo svg { width: 100%; height: 100%; }
.side__brand strong { display: block; font-size: .98rem; line-height: 1.2; }
.side__brand small { display: block; color: rgba(238, 235, 226, .65); font-size: .82rem; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.tab { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 11px; background: transparent; color: rgba(238, 235, 226, .82); font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; }
.tab:hover { background: rgba(238, 235, 226, .07); color: var(--chalk); }
.tab.is-active { background: rgba(224, 168, 46, .16); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.tab__ico { width: 20px; height: 20px; flex: none; }
.tab__ico svg { width: 100%; height: 100%; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid rgba(238, 235, 226, .12); }
.side__link { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; color: rgba(238, 235, 226, .8); text-decoration: none; font-weight: 600; cursor: pointer; text-align: left; }
.side__link svg { width: 18px; height: 18px; }
.side__link:hover { background: rgba(238, 235, 226, .07); color: var(--chalk); }
.main { min-width: 0; padding: 0 clamp(16px, 3vw, 40px) 60px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 calc(-1 * clamp(16px, 3vw, 40px)) 20px; padding: 18px clamp(16px, 3vw, 40px); background: rgba(222, 220, 207, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.top p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; max-width: 64ch; }
.top__save { display: flex; align-items: center; gap: 12px; flex: none; }
.dirty { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 700; color: var(--arbousier); }
.dirty::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.demo { max-width: 920px; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #EFEAF7; color: var(--viola); font-weight: 600; font-size: .95rem; }
.panel { max-width: 920px; }

/* ---------- Cartes et champs ---------- */
.card { margin: 0 0 16px; padding: clamp(18px, 2.5vw, 26px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.card__t { margin: 0 0 14px; font-size: 1.12rem; font-weight: 800; }
.card__lead { margin: -6px 0 14px; color: var(--muted); }
.sub { margin: 18px 0 10px; font-size: 1rem; font-weight: 800; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.empty { margin: 4px 0 12px; padding: 16px; border-radius: 12px; background: rgba(255, 255, 255, .6); color: var(--muted); text-align: center; }
.f { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.f__l { font-size: .88rem; font-weight: 700; color: var(--ink); }
.f__h { font-size: .84rem; color: var(--muted); }
.in { width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; font-size: 16px; line-height: 1.35; transition: border-color .15s, box-shadow .15s; }
textarea.in { resize: vertical; min-height: 80px; }
select.in { appearance: none; -webkit-appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E2A22' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 18px no-repeat; }
.in:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(224, 168, 46, .3); }
.in--time { width: auto; min-width: 118px; }
.grid { display: grid; gap: 0 14px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tg { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 6px; cursor: pointer; font-weight: 700; user-select: none; }
.tg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg__ui { position: relative; width: 46px; height: 28px; flex: none; border-radius: 999px; background: #B9B6A6; transition: background-color .2s; }
.tg__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.tg input:checked + .tg__ui { background: #4E7A3A; }
.tg input:checked + .tg__ui::after { transform: translateX(18px); }
.tg input:focus-visible + .tg__ui { outline: 3px solid var(--gold); outline-offset: 2px; }
.tg--sm { margin: 0; font-size: .9rem; }
.tg--sm .tg__ui { width: 40px; height: 24px; }
.tg--sm .tg__ui::after { width: 18px; height: 18px; }
.tg--sm input:checked + .tg__ui::after { transform: translateX(16px); }

.rows .row { padding-bottom: 6px; border-bottom: 1px dashed var(--line); margin-bottom: 10px; }
.row { display: flex; align-items: flex-end; gap: 10px; }
.row .f { margin-bottom: 8px; }
.f--grow { flex: 1 1 auto; }
.f--price { flex: 0 0 150px; }
.row .ctrl { margin-bottom: 10px; }
.row--svc { align-items: center; }
.row--svc .tg { margin-top: 18px; }
.row--svc .f:not(.f--grow) { flex: 0 0 160px; }
.ctrl { display: inline-flex; gap: 4px; flex: none; }
.bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.bar-actions .btn--add { width: auto; margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* Carte */
.cat { padding: 0; overflow: hidden; }
.cat.is-hidden .cat__name { opacity: .5; text-decoration: line-through; }
.cat__h { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 6px; }
.cat__toggle { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.cat__toggle:hover { background: rgba(30, 42, 34, .05); }
.cat__chev { width: 22px; height: 22px; flex: none; transition: transform .2s; }
.cat__chev svg { width: 100%; height: 100%; }
.cat__toggle[aria-expanded="true"] .cat__chev { transform: rotate(90deg); }
.cat__name { font-weight: 800; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat__count { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--lichen); color: var(--muted); font-size: .8rem; font-weight: 700; }
.cat__tools { display: flex; align-items: center; gap: 12px; flex: none; }
.cat__body { padding: 6px 20px 20px; border-top: 1px solid var(--line); }
.items { display: flex; flex-direction: column; }
.it { padding: 14px 0 10px; border-top: 1px dashed var(--line); }
.it:first-child { border-top: 0; padding-top: 4px; }
.it.is-out { background: linear-gradient(90deg, rgba(194, 65, 45, .06), transparent 70%); }
.it .f { margin-bottom: 8px; }
.it__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 320px; }
.chipbox { position: relative; cursor: pointer; }
.chipbox input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chipbox span { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 4px 10px; border: 1.5px solid var(--field); border-radius: 999px; background: #fff; font-size: .84rem; font-weight: 700; color: var(--muted); }
.chipbox span svg { width: 15px; height: 15px; }
.chipbox input:checked + span { background: var(--maquis); border-color: var(--maquis); color: var(--chalk); }
.chipbox input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Spécialités */
.spe { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; }
.spe__art { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--lichen-2); }
.spe__art svg { width: 88%; height: 88%; }
.spe__art img { width: 100%; height: 100%; object-fit: cover; }
.spe__ctrl { display: flex; justify-content: flex-end; }

/* Images */
.img { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.img__prev { width: 150px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: var(--lichen-2); color: var(--muted); font-size: .84rem; text-align: center; padding: 0; }
.img__prev img { width: 100%; height: 100%; object-fit: cover; }
.img__prev--contain img { object-fit: contain; padding: 8px; }
.img__prev span { padding: 8px; }
.img__btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Horaires */
.hours { display: flex; flex-direction: column; }
.hr { display: grid; grid-template-columns: 110px 110px minmax(0, 1fr); align-items: center; gap: 10px 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.hr:last-child { border-bottom: 0; }
.hr.is-closed .hr__day { color: var(--muted); }
.hr__ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.hr__range { display: inline-flex; align-items: center; gap: 8px; }

/* Galerie */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.gal__item { margin: 0; padding: 14px; }
.gal__prev { aspect-ratio: 4 / 3; margin-bottom: 12px; overflow: hidden; border-radius: 12px; background: var(--lichen-2); }
.gal__prev img, .gal__prev svg { width: 100%; height: 100%; object-fit: cover; }
.gal__item .ctrl { width: 100%; justify-content: flex-end; }

/* Accueil */
.shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 10px 14px; border: 1.5px solid var(--field); border-radius: 12px; background: #fff; font-weight: 700; text-align: left; cursor: pointer; }
.shortcut svg { width: 18px; height: 18px; flex: none; }
.shortcut:hover { border-color: var(--maquis); }
.moment + .moment { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* Sauvegardes */
.bk { list-style: none; margin: 0; padding: 0; }
.bk li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.bk li:last-child { border-bottom: 0; }

/* Notifications */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(92vw, 480px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--maquis); color: var(--chalk); font-weight: 600; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); pointer-events: auto; transition: opacity .4s, transform .4s; }
.toast--ok { background: #2F5A2A; }
.toast--err { background: #8E2A1A; }
.toast--info { background: var(--viola); }
.toast button { flex: none; padding: 6px 10px; border: 1.5px solid rgba(238, 235, 226, .5); border-radius: 8px; background: transparent; color: inherit; font-weight: 800; cursor: pointer; }
.toast.is-out { opacity: 0; transform: translateY(8px); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .adm { display: block; }
  .side { position: sticky; z-index: 30; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; padding: 10px 12px 8px; padding-top: calc(10px + env(safe-area-inset-top)); overflow: visible; }
  .side__brand { padding: 0; min-width: 0; }
  .side__brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side__logo { width: 34px; height: 34px; }
  .side__nav { grid-column: 1 / -1; flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .side__nav::-webkit-scrollbar { display: none; }
  .tab { width: auto; min-height: 40px; padding: 6px 12px; border-radius: 999px; background: rgba(238, 235, 226, .08); font-size: .92rem; }
  .tab.is-active { box-shadow: none; background: var(--gold); color: var(--maquis); }
  .tab__ico { display: none; }
  .side__foot { grid-column: 2; grid-row: 1; flex-direction: row; margin: 0; padding: 0; border: 0; }
  .side__link { min-height: 40px; padding: 6px 10px; font-size: 0; gap: 0; }
  .side__link svg { width: 22px; height: 22px; }
  .main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .top { position: static; margin-bottom: 14px; padding-top: 16px; padding-bottom: 14px; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .top h1 { font-size: 1.3rem; }
  .top__save { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; justify-content: space-between; padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); background: var(--maquis); box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .4); }
  .top__save .btn { margin-left: auto; min-width: 160px; }
  .dirty { color: #FF9C85; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .row .f--grow { flex: 1 1 100%; }
  .row .f--price { flex: 1 1 auto; }
  .row--svc .f:not(.f--grow) { flex: 1 1 auto; }
  .spe { grid-template-columns: 1fr; }
  .spe__art { max-width: 220px; }
  .hr { grid-template-columns: 1fr auto; }
  .hr__ranges { grid-column: 1 / -1; }
  .cat__h { flex-wrap: wrap; padding-right: 10px; }
  .cat__tools { width: 100%; justify-content: space-between; padding-left: 8px; }
  .shortcuts { grid-template-columns: 1fr; }
  .card { border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; } }
