/* =========================================================
   ÉCLAT — progiciel de gestion pour salons de beauté
   Design concept: le carnet de rendez-vous du salon, tenu à
   jour du premier coup de fil jusqu'au bilan du mois. Fond
   ivoire poudré, encre prune, rehauts or — et une grille fine
   façon registre qui relie l'agenda, la caisse et les comptes.
   ========================================================= */

:root{
  --paper:      #FAF3EF;
  --surface:    #FFFFFF;
  --surface-2:  #FCF7F3;
  --ink:        #2A1E22;
  --ink-dim:    #6B5A5F;
  --ink-faint:  #9C8B8F;
  --line:       #EADFDA;
  --line-strong:#DCCCC2;

  --rose:       #9C3D57;
  --rose-dark:  #7C2E44;
  --rose-tint:  #F3E3E7;

  --gold:       #B98A3E;
  --gold-tint:  #F6EDDD;

  --sage:       #3F7859;
  --sage-tint:  #E4F0E9;

  --brick:      #B54B3C;
  --brick-tint: #FBE7E3;

  --sidebar-bg:   #241A1E;
  --sidebar-ink:  #F4E9E3;
  --sidebar-dim:  #B39CA2;
  --sidebar-line: rgba(244,233,227,0.12);

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 244px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 12px 28px -16px rgba(42,30,34,0.28);
  --shadow-lg: 0 24px 48px -20px rgba(42,30,34,0.35);
}

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

html, body{ height: 100%; }
body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4{ font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--ink); }
p{ margin: 0; }
ul{ margin: 0; padding: 0; list-style: none; }
a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }
input, select, textarea{ font-family: inherit; font-size: 14.5px; }

:focus-visible{ outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Shell layout ---------- */
.app-shell{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar{
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-bottom: 34px;
}
.brand-mark{ width: 30px; height: 30px; color: var(--gold); flex-shrink: 0; }
.brand-word{ display: flex; flex-direction: column; line-height: 1.15; }
.brand-name{ font-family: var(--font-display); font-style: italic; font-size: 23px; color: #fff; }
.brand-tag{ font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sidebar-dim); }

.nav{ display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-dim);
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav-ico{ width: 18px; text-align: center; color: var(--gold); font-size: 14px; }
.nav a:hover{ background: rgba(244,233,227,0.06); color: var(--sidebar-ink); }
.nav a.active{ background: var(--rose); color: #fff; }
.nav a.active .nav-ico{ color: #fff; }

.sidebar-foot{
  padding: 14px 10px 4px;
  border-top: 1px solid var(--sidebar-line);
  font-size: 12.5px;
}
.sidebar-foot p:first-child{ color: var(--sidebar-ink); font-weight: 600; margin-bottom: 2px; }
.sidebar-foot-dim{ color: var(--sidebar-dim); font-size: 11.5px; }

.drawer-toggle{
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 60;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 8px;
  width: 42px; height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.drawer-toggle span{ width: 18px; height: 2px; background: var(--sidebar-ink); display: block; }
.drawer-scrim{
  display: none;
  position: fixed; inset: 0;
  background: rgba(20,14,16,0.5);
  z-index: 45;
}

/* ---------- Main / topbar ---------- */
.main{ min-width: 0; }
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250,243,239,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 22px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar h1{ font-size: 25px; }
.topbar-actions{ display: flex; gap: 10px; flex-wrap: wrap; }

.view-root{ padding: 30px 34px 64px; }

@media (max-width: 980px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed; left: 0; top: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 50;
  }
  .sidebar.open{ transform: translateX(0); }
  .drawer-toggle{ display: flex; }
  .drawer-scrim[data-open]{ display: block; }
  .topbar{ padding: 18px 20px 18px 66px; }
  .view-root{ padding: 22px 18px 50px; }
}

/* ---------- Buttons ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover{ transform: translateY(-1px); }
.btn-primary{ background: var(--rose); color: #fff; }
.btn-primary:hover{ background: var(--rose-dark); }
.btn-gold{ background: var(--gold); color: #fff; }
.btn-gold:hover{ background: #a67a34; }
.btn-ghost{ background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover{ border-color: var(--rose); color: var(--rose); }
.btn-danger{ background: var(--surface); color: var(--brick); border-color: #E7C3BB; }
.btn-danger:hover{ background: var(--brick-tint); }
.btn-sm{ padding: 7px 12px; font-size: 13px; }
.btn-icon{ padding: 8px 10px; }
.btn:disabled{ opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Stat cards ---------- */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
@media (max-width: 980px){ .stat-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px){ .stat-grid{ grid-template-columns: 1fr; } }

.stat-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.stat-value{ font-family: var(--font-display); font-size: 30px; color: var(--ink); }
.stat-sub{ font-size: 12.5px; color: var(--ink-dim); margin-top: 4px; }
.stat-value.positive{ color: var(--sage); }
.stat-value.negative{ color: var(--brick); }

/* ---------- Generic section / card ---------- */
.section{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 26px;
  overflow: hidden;
}
.section-head{
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2{ font-size: 18px; }
.section-body{ padding: 20px 22px; }
.section-sub{ color: var(--ink-dim); font-size: 13.5px; }

.empty-state{
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

/* ---------- Ledger table ---------- */
.ledger{ width: 100%; border-collapse: collapse; }
.ledger th{
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.ledger td{
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
.ledger tbody tr:hover{ background: var(--surface-2); }
.ledger .num{ font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ledger .row-actions{ display: flex; gap: 6px; justify-content: flex-end; }
.table-scroll{ overflow-x: auto; }

/* ---------- Badges ---------- */
.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-confirme{ background: var(--rose-tint); color: var(--rose-dark); }
.badge-en_attente{ background: var(--gold-tint); color: #8A6423; }
.badge-termine{ background: var(--sage-tint); color: var(--sage); }
.badge-annule{ background: var(--line); color: var(--ink-faint); text-decoration: line-through; }
.badge-dot{ width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

/* ---------- Forms ---------- */
.form-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.single{ grid-template-columns: 1fr; }
@media (max-width: 640px){ .form-grid{ grid-template-columns: 1fr; } }

.field{ display: flex; flex-direction: column; gap: 6px; }
.field label{ font-size: 12.5px; font-weight: 600; color: var(--ink-dim); }
.field input, .field select, .field textarea{
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus{ outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.field textarea{ resize: vertical; min-height: 72px; }
.field-hint{ font-size: 11.5px; color: var(--ink-faint); }
.form-actions{ display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.search-bar{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  min-width: 220px;
}
.search-bar input{ border: none; outline: none; flex: 1; background: transparent; }

/* ---------- Modal ---------- */
.modal-overlay{
  position: fixed; inset: 0;
  background: rgba(36,26,30,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
  overflow-y: auto;
  z-index: 80;
}
.modal{
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}
@keyframes modal-in{ from{ opacity:0; transform: translateY(8px); } to{ opacity:1; transform: translateY(0); } }
.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3{ font-size: 19px; }
.modal-close{
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--ink-faint); line-height: 1; padding: 4px;
}
.modal-close:hover{ color: var(--ink); }
.modal-body{ padding: 22px 24px; }
.modal-wide{ max-width: 760px; }

/* ---------- Toasts ---------- */
.toast-root{
  position: fixed;
  bottom: 22px; right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.toast{
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
}
@keyframes toast-in{ from{ opacity:0; transform: translateY(8px);} to{ opacity:1; transform: translateY(0);} }

/* ---------- Agenda ---------- */
.agenda-toolbar{
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.agenda-date-nav{ display: flex; align-items: center; gap: 6px; }
.agenda-date-label{
  font-family: var(--font-display);
  font-size: 17px;
  min-width: 220px;
}
.agenda-legend{ display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.agenda-legend .chip{ gap: 8px; }
.legend-swatch{ width: 9px; height: 9px; border-radius: 50%; }

.agenda-grid-wrap{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.agenda-grid{
  display: grid;
  min-width: 640px;
}
.agenda-col-headers{
  display: grid;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
  border-bottom: 1px solid var(--line-strong);
}
.agenda-col-header{
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13.5px;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.agenda-col-header:first-child{ border-left: none; }
.agenda-staff-dot{ width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.agenda-body{ display: grid; position: relative; }
.agenda-hours{
  position: relative;
  border-right: 1px solid var(--line);
}
.agenda-hour-label{
  position: absolute;
  left: 10px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.agenda-col{
  position: relative;
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(
    to bottom,
    var(--line) 0,
    var(--line) 1px,
    transparent 1px,
    transparent 60px
  );
  cursor: pointer;
}
.agenda-appt{
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: filter .15s ease;
}
.agenda-appt:hover{ filter: brightness(1.08); }
.agenda-appt .appt-time{ font-family: var(--font-mono); font-size: 10.5px; opacity: 0.85; }
.agenda-appt .appt-name{ font-weight: 700; margin: 1px 0; }
.agenda-appt .appt-service{ font-size: 11px; opacity: 0.9; }
.agenda-appt.is-annule{ opacity: 0.45; text-decoration: line-through; }
.agenda-appt.is-termine{ opacity: 0.6; }

/* ---------- Cards list (clients / staff) ---------- */
.tile-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.tile{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover{ transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile-top{ display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar{
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.tile-name{ font-weight: 700; font-size: 15px; }
.tile-sub{ font-size: 12.5px; color: var(--ink-dim); }
.tile-meta{ display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-dim); margin-bottom: 12px; }
.tile-actions{ display: flex; gap: 8px; }

/* ---------- Caisse (POS) ---------- */
.pos-layout{
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 980px){ .pos-layout{ grid-template-columns: 1fr; } }

.pos-catalog{ display: flex; flex-direction: column; gap: 18px; }
.pos-service-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.pos-service-btn{
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.pos-service-btn:hover{ border-color: var(--rose); transform: translateY(-1px); }
.pos-service-btn .s-name{ font-weight: 700; font-size: 13.5px; display: block; margin-bottom: 4px; }
.pos-service-btn .s-price{ font-family: var(--font-mono); font-size: 12.5px; color: var(--rose-dark); }

.ticket{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 96px;
}
.ticket-head{ padding: 18px 20px; border-bottom: 1px dashed var(--line-strong); }
.ticket-items{ padding: 6px 20px; min-height: 60px; }
.ticket-item{
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px;
}
.ticket-item-name{ font-size: 13.5px; }
.ticket-item-price{ font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.ticket-item-remove{ background: none; border: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; }
.ticket-item-remove:hover{ color: var(--brick); }
.ticket-total{
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 20px; border-top: 1px dashed var(--line-strong);
  font-family: var(--font-display);
}
.ticket-total .amt{ font-size: 24px; }
.ticket-foot{ padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.pay-modes{ display: flex; gap: 8px; }
.pay-mode-btn{
  flex: 1;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12.5px;
  cursor: pointer;
  text-align: center;
}
.pay-mode-btn.selected{ background: var(--rose); border-color: var(--rose); color: #fff; }

/* ---------- Comptabilité ---------- */
.acct-tabs{ display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.acct-tab{
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-dim);
}
.acct-tab.active{ background: var(--ink); border-color: var(--ink); color: #fff; }

.filter-row{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filter-row .field{ min-width: 150px; }

/* ---------- Misc ---------- */
.text-dim{ color: var(--ink-dim); }
.text-faint{ color: var(--ink-faint); }
.mt-0{ margin-top: 0; }
.stack{ display: flex; flex-direction: column; gap: 10px; }
.row-between{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
hr.rule{ border: none; border-top: 1px solid var(--line); margin: 18px 0; }
