/* Hotel Willy brand palette (from hotel-willy.it), applied over the base utility
   classes so no markup has to change. Loaded AFTER shell.css so it wins.

   Palette:  wine  #87152c (primary)   wine-dark #6f1024 (hover/active)
             coral #d94848 (secondary) ink #43403d (text)
             taupe #70645a  sand #a29182  cream #faf7f4  border #e4ddd6

   Contrast (WCAG): white on wine 8.7:1 ✓ · ink on cream 10.8:1 ✓ ·
   wine on white 8.6:1 ✓ · white on wine-dark 10.4:1 ✓ (hover). Coral is used
   only for large fills / dots, never as small text, to stay ≥ AA. */

:root { --willy-wine:#87152c; --willy-coral:#d94848; --willy-ink:#43403d; }

/* --- Collapsible sidebar --- */
body.sidebar-collapsed #willy-sidebar { display:none !important; }
#willy-open { display:none; }
body.sidebar-collapsed #willy-open {
  display:flex; align-items:center; justify-content:center;
  position:fixed; top:0.75rem; left:0.75rem; z-index:60;
  width:2.5rem; height:2.5rem; border-radius:0.75rem;
  background:#87152c; color:#fff; font-size:1.2rem; line-height:1;
  box-shadow:0 2px 10px rgba(0,0,0,0.25); border:none; cursor:pointer;
}
body.sidebar-collapsed #willy-open:hover { background:#6f1024; }
/* keep the floating ☰ from sitting on top of the page header logo (desktop) */
@media (min-width: 768px) {
  body.sidebar-collapsed header { padding-left: 4rem !important; }
}

/* --- Mobile: sidebar becomes a slide-in drawer with a backdrop --- */
#willy-backdrop { display:none; }
@media (max-width: 767px) {
  #willy-sidebar { position:fixed; top:0; left:0; bottom:0; z-index:70; box-shadow:0 0 40px rgba(0,0,0,0.5); }
  body:not(.sidebar-collapsed) #willy-backdrop { display:block; position:fixed; inset:0; z-index:69; background:rgba(0,0,0,0.5); }
  /* clear the top strip for the floating ☰ button */
  body.sidebar-collapsed #willy-app { padding-top:3.25rem; }
}

/* --- Accent = wine, always with light text (buttons, active nav, totals) --- */
.bg-emerald-500 { background-color:#87152c !important; color:#ffffff !important; }
.hover\:bg-emerald-400:hover, .hover\:bg-emerald-500:hover { background-color:#6f1024 !important; color:#ffffff !important; }
.text-emerald-400, .text-emerald-500 { color:#87152c !important; }
.accent-emerald-500 { accent-color:#87152c !important; }
.border-emerald-500, .border-emerald-500\/50, .border-emerald-500\/60, .focus\:border-emerald-500:focus, .focus\:border-emerald-400:focus { border-color:#87152c !important; }
.ring-emerald-500\/50 { --tw-ring-color:rgba(135,21,44,0.45) !important; }
.peer:checked ~ .peer-checked\:bg-emerald-500 { background-color:#87152c !important; color:#ffffff !important; }
/* emerald status text used for "OK/online" stays a readable green — leave as is only in device dots (inline) */

/* --- Warm LIGHT theme = the default look (matches the hotel: white + wine) --- */
body.theme-light { background:#faf7f4 !important; color:#43403d !important; }
body.theme-light .bg-slate-900, body.theme-light .bg-slate-900\/70 { background-color:#ffffff !important; }
body.theme-light .bg-slate-800, body.theme-light .bg-slate-800\/90, body.theme-light .bg-slate-800\/80 { background-color:#f3ede7 !important; }
body.theme-light .bg-slate-800\/60 { background-color:#efe8e1 !important; }
body.theme-light .bg-slate-700 { background-color:#ffffff !important; }
body.theme-light .bg-slate-600 { background-color:#e8e0d8 !important; }
body.theme-light .text-white, body.theme-light .text-slate-100, body.theme-light .text-slate-200 { color:#3a3733 !important; }
body.theme-light .text-slate-300 { color:#4a453f !important; }  /* ~8:1 on cream */
body.theme-light .text-slate-400 { color:#5c534a !important; }  /* ~6.4:1 */
body.theme-light .text-slate-500, body.theme-light .text-slate-600 { color:#6b6157 !important; }  /* ~5.3:1 — no longer disappearing */
body.theme-light .border-slate-700, body.theme-light .border-slate-600, body.theme-light .border-slate-500 { border-color:#e4ddd6 !important; }
body.theme-light .amber-900\/10, body.theme-light .bg-amber-900\/10 { background-color:#f6efe6 !important; }
body.theme-light .bg-amber-900\/20 { background-color:#f0e6d8 !important; }
body.theme-light .text-amber-400 { color:#b45309 !important; }

/* --- Sidebar: theme-aware (dark charcoal in dark, warm off-white in light) --- */
#willy-sidebar { background-color:#2b2320 !important; border-color:#3a302b !important; }
#willy-sidebar .border-slate-700 { border-color:#3a302b !important; }
#willy-sidebar .text-white { color:#f5efe9 !important; }
#willy-sidebar .text-slate-300 { color:#cbbfb4 !important; }
#willy-sidebar .text-slate-400 { color:#a2968a !important; }
#willy-sidebar .hover\:bg-slate-800:hover { background-color:#3a302b !important; }
#willy-sidebar .text-emerald-400 { color:#f5efe9 !important; }  /* logo mark contrast on dark */

/* Hotel Willy logo: positive (dark ink) on the light sidebar, negative (white) on dark */
.willy-logo-dark { display: none; }
body:not(.theme-light) .willy-logo-light { display: none; }
body:not(.theme-light) .willy-logo-dark { display: block; }

/* light theme → warm off-white sidebar with dark ink text + wine logo */
body.theme-light #willy-sidebar { background-color:#f3ede7 !important; border-color:#e4ddd6 !important; }
body.theme-light #willy-sidebar .border-slate-700 { border-color:#e4ddd6 !important; }
body.theme-light #willy-sidebar .text-white { color:#3a3733 !important; }
body.theme-light #willy-sidebar .text-slate-300 { color:#4a453f !important; }
body.theme-light #willy-sidebar .text-slate-400 { color:#6b6157 !important; }
body.theme-light #willy-sidebar .hover\:bg-slate-800:hover { background-color:#e8e0d8 !important; }
body.theme-light #willy-sidebar .text-emerald-400 { color:#87152c !important; }
/* active nav item (wine fill) keeps light text in both themes — already handled by .bg-emerald-500 */

/* --- Warm DARK theme (toggle) — keep usable, wine accents --- */
body:not(.theme-light) { background-color:#211b18 !important; }
body:not(.theme-light) .bg-slate-800, body:not(.theme-light) .bg-slate-800\/90, body:not(.theme-light) .bg-slate-800\/60 { background-color:#2b2320 !important; }
body:not(.theme-light) .bg-slate-900 { background-color:#2b2320 !important; }
/* diagram histogram track — warm, slightly lifted off the card so it reads as a lane */
body:not(.theme-light) #diagram-section .bg-slate-800\/60 { background-color:#322925 !important; }
body:not(.theme-light) .bg-slate-700 { background-color:#3a302b !important; }
body:not(.theme-light) .border-slate-700, body:not(.theme-light) .border-slate-600 { border-color:#3a302b !important; }
/* wine accent text is too dark on a dark bg — lighten it to a readable rose */
body:not(.theme-light) .text-emerald-400 { color:#e6a6ae !important; }

/* --- Text on coloured fills must stay light in EVERY theme (must come last to
   win specificity ties against the theme-light .text-white override). --- */
.oncolor { color:#ffffff !important; }
body.theme-light .bg-emerald-500, body:not(.theme-light) .bg-emerald-500 { color:#ffffff !important; }

/* --- Placeholders: Tailwind's placeholder-slate-500 is blue-tinted grey → warm it
   (the .text-slate-* overrides don't reach the ::placeholder pseudo) --- */
.placeholder-slate-500::placeholder { color:#8f8479 !important; }
body.theme-light .placeholder-slate-500::placeholder { color:#9a8f83 !important; }

/* --- Dark theme: warm text greys (Tailwind slate is blue-tinted → no blue text) --- */
body:not(.theme-light) .text-slate-300 { color:#d8cfc6 !important; }
body:not(.theme-light) .text-slate-400 { color:#b3a89d !important; }
body:not(.theme-light) .text-slate-500, body:not(.theme-light) .text-slate-600 { color:#8f8479 !important; }

/* ================================================================
   NO BLUE, ANYWHERE. Tailwind's `slate` is blue-tinted; every opacity
   variant that isn't remapped above leaks blue through. Catch them all.
   ================================================================ */
/* modal backdrops / scrims — warm dark translucent, never blue-black */
.bg-slate-950\/80, .bg-slate-950\/70, .bg-slate-950\/60, .bg-slate-950\/50 { background-color: rgba(33,27,24,0.72) !important; }
/* LIGHT theme: every slate panel/opacity variant → warm cream */
body.theme-light .bg-slate-900\/50, body.theme-light .bg-slate-900\/60 { background-color:#ffffff !important; }
body.theme-light .bg-slate-800\/40, body.theme-light .bg-slate-800\/80 { background-color:#efe8e1 !important; }
body.theme-light .bg-slate-700\/50, body.theme-light .bg-slate-700\/30 { background-color:#f3ede7 !important; }
body.theme-light .bg-slate-500 { background-color:#c9bcae !important; }
/* DARK theme: every slate panel/opacity variant → warm charcoal */
body:not(.theme-light) .bg-slate-900\/50, body:not(.theme-light) .bg-slate-900\/60 { background-color:#2b2320 !important; }
body:not(.theme-light) .bg-slate-800\/40, body:not(.theme-light) .bg-slate-800\/80 { background-color:#2b2320 !important; }
body:not(.theme-light) .bg-slate-700\/50, body:not(.theme-light) .bg-slate-700\/30 { background-color:#3a302b !important; }
body:not(.theme-light) .bg-slate-600 { background-color:#4a3f38 !important; }
body:not(.theme-light) .bg-slate-500 { background-color:#5a4d44 !important; }
/* borders + rings that still carry a cool tint (incl. opacity variants like the
   diagram gridlines .border-slate-700/60) */
body.theme-light .border-slate-800, body.theme-light .border-slate-500\/50, body.theme-light .border-slate-700\/60, body.theme-light .border-slate-700\/30 { border-color:#e4ddd6 !important; }
body:not(.theme-light) .border-slate-800, body:not(.theme-light) .border-slate-500, body:not(.theme-light) .border-slate-700\/60, body:not(.theme-light) .border-slate-700\/30 { border-color:#3a302b !important; }
/* a couple of text shades not yet remapped (both themes) */
body.theme-light .text-slate-700 { color:#43403d !important; }
body:not(.theme-light) .text-slate-200, body:not(.theme-light) .text-slate-100 { color:#efe7df !important; }
