/* ==================================================================
   HZ Barber — Thème & composants
   ================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
  --ink: #16110d;
  --panel: #211a15;
  --panel2: #2a211a;
  --card: #f4ece1;
  --card-soft: #e9dccb;
  --line: #3a2f26;
  --text: #2b211a;
  --muted: #8a7a68;
  --cream: #f4ece1;
  --red: #b3382e;
  --red-dark: #8c2a23;
  --brass: #c9a55c;
  --navy: #2d4a6b;
  --green: #3f7d55;
  --display: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.stripe {
  height: 6px;
  background-image: repeating-linear-gradient(45deg,
    var(--red) 0 14px, var(--cream) 14px 28px, var(--navy) 28px 42px, var(--cream) 42px 56px);
  position: sticky; top: 0; z-index: 50;
}
.loading { text-align: center; padding: 80px 20px; color: var(--muted); }

.container { max-width: 720px; margin: 0 auto; padding: 0 18px 120px; }
.container-wide { max-width: 1080px; margin: 0 auto; padding: 0 18px 60px; }

h1, h2, h3, .display { font-family: var(--display); }
a { color: var(--brass); }

/* ---------- En-tête ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  max-width: 1080px; margin: 0 auto; padding: 18px 18px 12px;
}
.brand-logo { display: block; }
.brand-text {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; line-height: 1; color: var(--cream); font-size: 22px;
}
.brand-text .b { color: var(--brass); }
.topbar .sub {
  color: var(--brass); font-family: var(--display); text-transform: uppercase;
  letter-spacing: .25em; font-size: 11px; margin-top: 3px;
}
.topbar .spacer { flex: 1; }

/* ---------- Boutons ---------- */
.btn {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; border: 1px solid var(--line); background: var(--panel2);
  color: var(--cream); border-radius: 12px; padding: 11px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-brass { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--red); color: #e2897f; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 18px; font-size: 16px; }
.btn-sm { padding: 7px 11px; font-size: 12px; }
.btn-icon { padding: 9px; border-radius: 10px; }

/* ---------- Surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cardlight { background: var(--card); color: var(--text); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }
.brass { color: var(--brass); }
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

/* ---------- Fil d'étapes ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 18px; flex-wrap: wrap; }
.steps .st {
  flex: 1; min-width: 40px; height: 5px; border-radius: 99px; background: var(--line);
}
.steps .st.done { background: var(--brass); }
.steps .st.cur { background: var(--red); }
.step-title { font-family: var(--display); text-transform: uppercase; letter-spacing: .03em;
  font-size: 20px; margin: 0 0 4px; }
.step-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------- Tuiles sélectionnables ---------- */
.tiles { display: grid; gap: 10px; }
.tiles.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tiles.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  text-align: left; background: var(--panel2); border: 1px solid var(--line);
  color: var(--cream); border-radius: 14px; padding: 14px 15px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, background .12s, transform .06s;
}
.tile:hover { border-color: var(--brass); transform: translateY(-1px); }
.tile.active { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.tile .t-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.tile .t-meta { display: flex; gap: 12px; align-items: baseline; }
.tile .t-price { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--brass); }
.tile.active .t-price { color: var(--red-dark); }
.tile .t-dur { font-size: 12px; color: var(--muted); }
.tile.active .t-dur { color: var(--red-dark); }
.tile .t-desc { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.tile.active .t-desc { color: var(--red-dark); }
.tile.row { flex-direction: row; align-items: center; justify-content: space-between; }
.tile .check { margin-left: auto; }

/* tuile coiffeur */
.barber-tile { align-items: center; text-align: center; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: var(--cream);
  display: flex; align-items: center; justify-content: center; font-family: var(--display);
  font-weight: 700; font-size: 22px; margin: 0 auto 6px;
}
.tile.active .avatar { background: var(--red); }

/* ---------- Créneaux ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot {
  background: var(--panel2); border: 1px solid var(--line); color: var(--cream);
  border-radius: 10px; padding: 11px 6px; text-align: center; cursor: pointer;
  font-family: var(--display); font-size: 15px; letter-spacing: .03em;
}
.slot:hover { border-color: var(--brass); }
.slot.active { background: var(--red); border-color: var(--red); color: #fff; }

/* bande de jours */
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.day {
  flex: 0 0 auto; width: 66px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 4px; text-align: center; cursor: pointer; color: var(--cream);
}
.day:hover { border-color: var(--brass); }
.day.active { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.day.off { opacity: .35; cursor: not-allowed; }
.day .dow { font-size: 11px; text-transform: uppercase; color: var(--muted); }
.day.active .dow { color: var(--red-dark); }
.day .dnum { font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1.1; }
.day .dmon { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.day.active .dmon { color: var(--red-dark); }

/* calendrier mensuel */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-family: var(--display); text-transform: capitalize; letter-spacing: .02em; font-size: 16px; color: var(--cream); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); font-family: var(--display);
  text-transform: uppercase; padding: 2px 0; }
.cal-day { min-height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
  cursor: pointer; font-family: var(--display); font-size: 15px; background: var(--panel2);
  border: 1px solid var(--line); color: var(--cream); }
.cal-day:hover { border-color: var(--brass); }
.cal-day.active { background: var(--red); border-color: var(--red); color: #fff; }
.cal-day.off { opacity: .28; cursor: not-allowed; background: transparent; border-color: transparent; }
.cal-day.blank { background: transparent; border: 0; cursor: default; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brass); }

/* fenêtre de répétition (disposition façon widget calendrier) */
.reppanel { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 8px; }
.rep-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.rep-row:last-child { margin-bottom: 0; }
.rep-lbl { min-width: 140px; font-weight: 600; color: var(--cream); }
.dows { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dows .dow { width: 42px; height: 40px; border: 0; border-left: 1px solid var(--line); background: var(--panel);
  color: var(--cream); cursor: pointer; font-family: var(--display); font-size: 14px; }
.dows .dow:first-child { border-left: 0; }
.dows .dow.on { background: var(--green); color: #fff; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; background: var(--ink); color: var(--cream); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: var(--body);
  outline: none; color-scheme: dark;
}
.input:focus { border-color: var(--brass); }
textarea.input { resize: vertical; min-height: 64px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Récapitulatif ---------- */
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.summary-total { display: flex; justify-content: space-between; font-family: var(--display);
  font-weight: 700; font-size: 20px; padding-top: 10px; border-top: 1px solid var(--card-soft); margin-top: 8px; }

/* ---------- Barre d'action (bas) ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: linear-gradient(to top, var(--ink) 70%, transparent);
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.actionbar .recap { flex: 1; min-width: 0; }
.actionbar .recap .l1 { font-family: var(--display); font-size: 15px; color: var(--cream); }
.actionbar .recap .l2 { font-size: 12px; color: var(--muted); }

/* ---------- Divers ---------- */
.badge { display: inline-block; background: var(--panel2); border: 1px solid var(--line);
  color: var(--brass); font-size: 11px; padding: 2px 8px; border-radius: 99px;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .06em; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.qty-pill { display:inline-flex; align-items:center; gap:6px; background:var(--ink); border-radius:99px; padding:2px; }
.qty-pill button { width:26px;height:26px;border-radius:50%;border:1px solid var(--line);background:var(--panel2);color:var(--cream);cursor:pointer;font-size:16px;line-height:1; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 16px; left: 0; right: 0; display: flex; justify-content: center; z-index: 100; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--brass); color: var(--cream);
  padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 90%; }
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

/* ==================================================================
   Espace pro (gérant / coiffeur)
   ================================================================== */
.tabs { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 5px; margin-bottom: 18px; overflow-x: auto; }
.tab { flex: 1 0 auto; white-space: nowrap; border: 0; background: transparent; color: var(--cream);
  font-family: var(--display); text-transform: uppercase; letter-spacing: .03em; font-size: 13px;
  padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--brass); color: var(--ink); }

/* agenda */
.agenda-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.agenda-grid { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.agenda-cols { display: grid; }
.col-head { padding: 8px 6px; text-align: center; font-family: var(--display); text-transform: uppercase;
  font-size: 12px; letter-spacing: .04em; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
  color: var(--brass); position: sticky; top: 0; background: var(--panel2); }
.col-head:first-child { border-left: 0; }
.timecol { border-left: 0 !important; color: var(--muted) !important; }
.agenda-body { position: relative; display: grid; }
.gridline { border-bottom: 1px dashed rgba(138,122,104,.18); border-left: 1px solid var(--line); position: relative; }
.gridline.hourlabel::before { content: attr(data-h); position: absolute; left: 4px; top: -8px; font-size: 10px;
  color: var(--muted); font-family: var(--display); background: var(--panel); padding: 0 3px; }
.appt {
  position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 5px 7px; overflow: hidden;
  background: var(--navy); color: #fff; border: 1px solid rgba(255,255,255,.15); cursor: pointer; font-size: 12px;
}
.appt .a-time { font-family: var(--display); font-size: 11px; opacity: .85; }
.appt .a-name { font-weight: 600; line-height: 1.15; }
.appt.cancelled { background: #4a3b33; text-decoration: line-through; opacity: .6; }
.appt.src-staff { background: var(--red-dark); }
.closed-band { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(0,0,0,.25) 0 6px, transparent 6px 12px); pointer-events: none; }

/* listes config */
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .n { font-weight: 600; }
.list-row .m { font-size: 12px; color: var(--muted); }
.inactive { opacity: .5; }

/* matrice durées personnalisées */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
table.matrix th { background: var(--panel2); font-family: var(--display); text-transform: uppercase; font-size: 11px; color: var(--brass); position: sticky; }
table.matrix td.svc { text-align: left; position: sticky; left: 0; background: var(--panel); }
table.matrix input { width: 56px; background: var(--ink); color: var(--cream); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px; text-align: center; color-scheme: dark; }
table.matrix .def { color: var(--muted); }
table.matrix .ovr input { border-color: var(--brass); color: var(--brass); }

/* modale */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: flex;
  align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  width: 100%; max-width: 460px; }
.modal h3 { margin: 0 0 14px; text-transform: uppercase; letter-spacing: .03em; }

/* login */
.login-wrap { max-width: 400px; margin: 40px auto 0; }
.pin { letter-spacing: .1em; }

@media (max-width: 520px) {
  .tiles.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .brand-text { font-size: 18px; }
}
