/*
  Tendance Sublime — tokens de marque
  Couleurs extraites du vrai logo (orange vif) et des murs du salon
  (framboise profonde, photo du salon coiffuretendancesublime.fr).
  Deux accents forts plutot qu'un seul terracotta : orange (action, chiffres
  cles) + framboise (nav, structure) — l'association reelle du salon.
*/
:root {
  --ink: #241119;
  --ink-soft: #7a5d68;
  --bg: #fdf9f7;
  --panel: #ffffff;
  --orange: #e97d11;
  --orange-dark: #c5680b;
  --orange-wash: #fdead4;
  --raspberry: #7c1d3d;
  --raspberry-bright: #a32a52;
  --raspberry-wash: #f7e4ea;
  --border: #ecdfe2;
  --radius-sm: 5px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  margin: 0 0 .3em;
  color: var(--ink);
  letter-spacing: -0.01em;
}

a { color: var(--raspberry-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ---------- layout ---------- */

.layout { display: flex; min-height: 100vh; }

.topbar-mobile {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: 12px;
  background: var(--raspberry);
  color: #fbe9ee;
  padding: 12px 16px;
}
.topbar-mobile .brand-mini { font-family: "Fraunces", serif; font-size: 18px; }
.topbar-mobile button {
  background: none; border: none; color: #fbe9ee; cursor: pointer;
  padding: 4px; display: flex; align-items: center;
}
.topbar-mobile svg { width: 24px; height: 24px; }

.sidebar-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 8, 13, .45);
  z-index: 39;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--raspberry);
  color: #f4dee5;
  padding: 26px 0 20px;
  display: flex;
  flex-direction: column;
  /* Colle la barre laterale a la hauteur de l'ecran (pas a celle du
     contenu principal, qui peut etre bien plus longue) pour que le pied
     de page (utilisateur connecte / deconnexion) reste toujours visible
     sans avoir a faire defiler une barre laterale demesurement longue. */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand-logo {
  margin: 0 22px 22px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
}
.sidebar .brand-logo img { width: 100%; height: auto; display: block; }

.sidebar nav a {
  display: block;
  padding: 10px 22px;
  color: #eecbd6;
  font-size: 14.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.06); }
.sidebar nav a.active {
  color: #fff;
  background: rgba(0,0,0,.14);
  border-left-color: var(--orange);
}

.sidebar .footer {
  margin-top: auto;
  padding: 14px 22px 0;
  font-size: 12px;
  color: #d9adba;
  border-top: 1px solid rgba(255,255,255,.14);
}
.sidebar .footer a { color: #f4c9d5; }

.main { flex: 1; padding: 34px 40px; max-width: 1220px; min-width: 0; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  border-left: 3px solid var(--orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.kpi .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.kpi .value { font-family: "Fraunces", serif; font-size: 27px; margin-top: 5px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; }
tr:hover td { background: var(--orange-wash); }

.search {
  width: 100%; max-width: 360px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
}

.btn {
  display: inline-block;
  padding: 9px 18px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { background: var(--orange-dark); text-decoration: none; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; background: var(--orange-wash); color: var(--orange-dark);
  font-weight: 600;
}

.pagination { margin-top: 18px; display:flex; gap:8px; align-items:center; font-size: 14px; flex-wrap: wrap;}
.pagination a, .pagination span { padding: 5px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pagination .current { background: var(--raspberry); color:#fff; border-color: var(--raspberry); }

.client-header { display:flex; justify-content: space-between; align-items:flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 20px;}
.client-header h1 { font-size: 27px; }
.client-meta { color: var(--ink-soft); font-size: 14px; margin-top: 4px;}

.notes-box {
  white-space: pre-wrap;
  background: var(--orange-wash);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  margin: 16px 0 24px;
}

.timeline { margin-top: 8px; }
.visit-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 12px; background: #fff; }
.visit-card .visit-head { display:flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--ink-soft); margin-bottom: 8px;}
.visit-card .visit-total { font-family: "Fraunces", serif; font-size: 18px; color: var(--raspberry-bright);}
.visit-items { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.visit-items li { display:flex; justify-content: space-between; padding: 3px 0; gap: 12px; }
.visit-items li .qty { color: var(--ink-soft); font-size: 12px; margin-left: 6px;}
.canceled { opacity: .55; }

.bars { display:flex; align-items:flex-end; gap: 6px; height: 120px; margin-top: 8px; overflow-x: auto; }
.bars .bar-wrap { flex:1; min-width: 34px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; }
.bars .bar { width: 100%; background: var(--orange); border-radius: 3px 3px 0 0; min-height:2px; }
.bars .bar-label { font-size: 10px; color: var(--ink-soft); margin-top: 6px; white-space: nowrap; }

.login-wrap {
  min-height: 100vh; display:flex; align-items:center; justify-content:center;
  background: linear-gradient(155deg, var(--raspberry) 0%, #5c1530 62%, #430f23 100%);
  padding: 24px;
}
.login-card {
  width: 360px; max-width: 100%;
  padding: 34px 30px;
  border: none;
  box-shadow: 0 20px 50px rgba(20, 6, 12, .35);
}
.login-card .logo-wrap {
  display: flex; justify-content: center; margin-bottom: 18px;
}
.login-card .logo-wrap img { width: 190px; height: auto; }
.login-card .sub { text-align:center; color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }
.login-card label { display:block; font-size: 13px; margin: 14px 0 4px; color: var(--ink-soft); }
.login-card input { width:100%; padding: 10px 12px; border:1px solid var(--border); border-radius: var(--radius-sm); font-size:14px; }
.login-card .btn { width:100%; margin-top: 20px; padding: 11px 18px; }
.error { color: #a3372b; font-size: 13px; margin-top: 10px; }

.empty { color: var(--ink-soft); font-style: italic; padding: 20px 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.export-btn:hover { border-color: var(--orange); background: var(--orange-wash); text-decoration: none; }
.export-btn svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--orange-dark); }
.export-btn .t { font-weight: 600; font-size: 14.5px; }
.export-btn .s { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .topbar-mobile { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 40;
    box-shadow: 8px 0 30px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.open { display: block; }

  .main { padding: 20px 16px 40px; }
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .client-header { flex-direction: column; }
  .client-header > .card { width: 100%; text-align: left; }
  .topbar { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
}

@media (max-width: 480px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}
