/* ==========================================================================
   LocSki Easy — « La location de ski, simplement. »
   Design system : violet, clair, aéré, gros boutons pour tablette.
   ========================================================================== */

:root {
  --violet-50: #f6f2ff;
  --violet-100: #ede5ff;
  --violet-200: #dccbff;
  --violet-300: #c2a5ff;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --violet-800: #5b21b6;
  --brand-gradient: linear-gradient(135deg, #9046ff 0%, #7c3aed 45%, #5b21b6 100%);

  --ink: #1f2533;
  --ink-2: #3b4253;
  --muted: #6b7280;
  --faint: #9ca3af;
  --bg: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #faf9fd;
  --border: #e8e5f0;
  --border-strong: #d6d1e4;

  --green: #15803d;   --green-bg: #e9f8ef;
  --amber: #b45309;   --amber-bg: #fff4e0;
  --red: #c81e1e;     --red-bg: #fdecec;
  --blue: #1d4ed8;    --blue-bg: #eaf0ff;
  --wa: #128c4a;      --wa-bg: #e7f8ee;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(31, 37, 51, .06);
  --shadow: 0 1px 2px rgba(31, 37, 51, .05), 0 6px 20px rgba(76, 29, 149, .06);
  --shadow-lg: 0 10px 40px rgba(76, 29, 149, .14);

  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tap: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eeeaf7; --ink-2: #d4cfe2; --muted: #a39db5; --faint: #7d7790;
    --bg: #14111c; --surface: #1d1928; --surface-2: #231e30; --border: #312a42; --border-strong: #41395a;
    --violet-50: #241b38; --violet-100: #2d2147; --violet-200: #3d2b63; --violet-700: #b794ff; --violet-800: #c9b0ff;
    --green: #4ade80; --green-bg: #13301f; --amber: #fbbf24; --amber-bg: #33260b;
    --red: #f87171; --red-bg: #3a1616; --blue: #93b4ff; --blue-bg: #18213d; --wa: #4ade80; --wa-bg: #12301f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #eeeaf7; --ink-2: #d4cfe2; --muted: #a39db5; --faint: #7d7790;
  --bg: #14111c; --surface: #1d1928; --surface-2: #231e30; --border: #312a42; --border-strong: #41395a;
  --violet-50: #241b38; --violet-100: #2d2147; --violet-200: #3d2b63; --violet-700: #b794ff; --violet-800: #c9b0ff;
  --green: #4ade80; --green-bg: #13301f; --amber: #fbbf24; --amber-bg: #33260b;
  --red: #f87171; --red-bg: #3a1616; --blue: #93b4ff; --blue-bg: #18213d; --wa: #4ade80; --wa-bg: #12301f;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-icon { width: 40px; height: 40px; border-radius: 11px; display: block; }
.brand-word { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.brand-word span { color: var(--violet-600); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px;
  color: var(--ink-2); font-weight: 600; text-decoration: none; position: relative;
}
.nav a:hover { background: var(--violet-50); }
.nav a.active { background: var(--violet-100); color: var(--violet-800); }
.nav .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--violet-600); color: #fff;
  font-size: .72rem; display: inline-flex; align-items: center; justify-content: center;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.shop-pill { font-size: .85rem; color: var(--muted); text-align: right; line-height: 1.2; }
.shop-pill strong { color: var(--ink); display: block; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--violet-100); color: var(--violet-800);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar.brand-bg { background: var(--brand-gradient); color: #fff; }

.main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 20px 110px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid > *, .split > *, .stack > * { min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.mt { margin-top: 18px; } .mt-sm { margin-top: 8px; } .mt-lg { margin-top: 32px; }
.mb { margin-bottom: 18px; }

/* Barre d'onglets mobile */
.tabbar { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; }
.card.flat { box-shadow: none; }
.card.tight { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.section-title { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .98rem; cursor: pointer; text-decoration: none !important;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--violet-600); color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, .28); }
.btn-primary:hover { background: #6d28d9; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--violet-50); border-color: var(--violet-300); }
.btn-soft { background: var(--violet-100); color: var(--violet-800); }
.btn-soft:hover { background: var(--violet-200); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--violet-50); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-success { background: var(--green); color: #fff; }
.btn-wa { background: #25d366; color: #073b1d; }
.btn-wa:hover { background: #1fbe5b; }
.btn-lg { min-height: var(--tap); padding: 12px 22px; font-size: 1.05rem; border-radius: 14px; }
.btn-xl { min-height: 64px; padding: 16px 26px; font-size: 1.15rem; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-hero {
  background: var(--brand-gradient); color: #fff; min-height: 72px; font-size: 1.2rem; border-radius: 18px;
  box-shadow: 0 10px 30px rgba(124, 58, 237, .35); padding: 16px 28px; letter-spacing: .01em;
}
.btn-hero:hover { filter: brightness(1.06); }
.btn-hero, .btn-block { white-space: normal; text-align: center; }
form.button_to:has(.btn-block) { width: 100%; }
.btn-hero .sub { display: block; font-weight: 600; font-size: .85rem; opacity: .85; }

/* Grandes tuiles d'action du tableau de bord */
.action-tiles { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 128px; padding: 20px;
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--ink); font-weight: 800; font-size: 1.1rem; text-decoration: none !important; transition: transform .1s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile .ico { font-size: 1.7rem; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--violet-50); }
.tile small { display: block; font-weight: 600; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.tile.primary { background: var(--brand-gradient); color: #fff; border: 0; }
.tile.primary .ico { background: rgba(255, 255, 255, .18); }
.tile.primary small { color: rgba(255, 255, 255, .8); }

/* ---------- Stats ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat .value { font-size: 2.3rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat .label { color: var(--muted); font-weight: 600; margin-top: 6px; }
.stat.accent .value { color: var(--violet-600); }
.stat.warn .value { color: var(--amber); }
.stat.danger .value { color: var(--red); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--violet-50); color: var(--violet-800); white-space: nowrap;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.wa { background: var(--wa-bg); color: var(--wa); }
.status-draft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.status-awaiting_signature { background: var(--amber-bg); color: var(--amber); }
.status-active { background: var(--green-bg); color: var(--green); }
.status-returned { background: var(--blue-bg); color: var(--blue); }
.status-cancelled { background: var(--red-bg); color: var(--red); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 6px; border-bottom: 1px solid var(--border);
  color: var(--ink); text-decoration: none !important;
}
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--violet-50); border-radius: 12px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; }
.list-row .meta { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .chev { color: var(--faint); font-size: 1.3rem; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 2.4rem; margin-bottom: 6px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=search], .field select, .field textarea, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--violet-500); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18);
}
.input.sm { min-height: 40px; padding: 6px 10px; font-size: .95rem; border-radius: 10px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .suffix { display: flex; align-items: center; padding: 0 12px; border: 1.5px solid var(--border-strong); border-left: 0; border-radius: 0 12px 12px 0; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.errors { background: var(--red-bg); color: var(--red); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.checkline { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1.5px solid var(--border); cursor: pointer; background: var(--surface); }
.checkline input { width: 26px; height: 26px; accent-color: var(--violet-600); flex-shrink: 0; margin-top: 1px; }
.checkline:has(input:checked) { border-color: var(--violet-500); background: var(--violet-50); }

/* Recherche XXL */
.search-xl { position: relative; }
.search-xl input {
  width: 100%; min-height: 64px; padding: 14px 20px 14px 56px; font-size: 1.2rem; border-radius: 18px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--ink); font-family: inherit; box-shadow: var(--shadow-sm);
}
.search-xl input:focus { outline: none; border-color: var(--violet-500); box-shadow: 0 0 0 5px rgba(139, 92, 246, .16); }
.search-xl .ico { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; opacity: .55; }

/* ---------- Chips de sélection (personnes / matériel) ---------- */
.choice {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: var(--tap);
  border: 1.5px solid var(--border-strong); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 700;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.choice input[type=checkbox], .choice input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.choice .tick { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: transparent; font-size: .9rem; }
.choice:has(input:checked) { border-color: var(--violet-600); background: var(--violet-50); color: var(--violet-800); }
.choice:has(input:checked) .tick { background: var(--violet-600); border-color: var(--violet-600); color: #fff; }
.choice .emoji { font-size: 1.3rem; }

.participant { border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; transition: border-color .15s; }
.participant.on { border-color: var(--violet-300); box-shadow: 0 0 0 4px var(--violet-50); }
.participant-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.participant-body { padding: 0 18px 18px; display: none; }
.participant.on .participant-body { display: block; }
.measure-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.items-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.item-card { border: 1.5px solid var(--border); border-radius: 14px; padding: 10px; background: var(--surface-2); }
.item-card:has(input.item-toggle:checked) { border-color: var(--violet-500); background: var(--violet-50); }
.item-card .item-fields { display: none; gap: 8px; margin-top: 10px; grid-template-columns: 1fr 1fr; }
.item-card:has(input.item-toggle:checked) .item-fields { display: grid; }
.item-card .choice { border: 0; background: transparent; padding: 4px; min-height: 40px; }
.item-card .choice:has(input:checked) { background: transparent; }
.formula-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.formula-choices .choice { min-height: 48px; font-size: .95rem; }
.price-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.price-options:empty { display: none; }
.price-option { border: 1.5px solid var(--border-strong); background: var(--surface); border-radius: 12px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); min-height: 48px; }
.price-option small { display: block; font-weight: 600; color: var(--muted); font-size: .75rem; }
.price-option.selected { border-color: var(--violet-600); background: var(--violet-600); color: #fff; }
.price-option.selected small { color: rgba(255,255,255,.85); }
.price-hint { font-size: .88rem; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 6px 10px; }
.previous-season { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 8px 12px; font-size: .88rem; color: var(--muted); margin-bottom: 12px; }

.totals { position: sticky; top: 84px; }
.total-line { display: flex; justify-content: space-between; padding: 6px 0; }
.total-line.big { font-size: 1.5rem; font-weight: 800; border-top: 2px solid var(--border); margin-top: 8px; padding-top: 12px; }

/* ---------- Fiche famille ---------- */
.family-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.family-hero .contact { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); margin-top: 6px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.person-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.person-card .name { font-weight: 800; font-size: 1.05rem; }
.measure { display: flex; flex-wrap: wrap; gap: 6px; }
.measure span { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px; font-size: .85rem; font-weight: 600; }
.season-block { border-left: 3px solid var(--violet-200); padding-left: 16px; margin-left: 6px; }
.season-label { font-weight: 800; color: var(--violet-700); font-size: 1.05rem; }
.timeline { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Flash ---------- */
.flash-zone { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100% - 32px)); }
.flash { padding: 14px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow-lg); display: flex; justify-content: space-between; gap: 10px; animation: drop .25s ease-out; }
.flash.notice { background: #102a1b; color: #d9fbe6; }
.flash.alert { background: var(--red); color: #fff; }
.flash button { background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

/* Bandeau simulation */
.sim-banner { background: var(--amber-bg); color: var(--amber); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: .9rem; display: block; }
.info-banner { background: var(--violet-50); color: var(--violet-800); border-radius: 12px; padding: 12px 16px; font-weight: 600; display: flex; gap: 10px; align-items: center; }

/* ---------- WhatsApp ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; height: calc(100vh - 200px); min-height: 520px; padding: 0; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; }
.inbox-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--ink); text-decoration: none !important; }
.inbox-item:hover { background: var(--violet-50); }
.inbox-item.active { background: var(--violet-100); }
.inbox-item .grow { min-width: 0; flex: 1; }
.inbox-item .preview { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread { background: #25d366; color: #073b1d; border-radius: 999px; min-width: 22px; height: 22px; font-size: .75rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thread-head .badge { white-space: normal; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 16px; font-size: .95rem; box-shadow: var(--shadow-sm); }
.bubble .txt { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: #dcf8c6; color: #10291a; border-bottom-right-radius: 4px; }
:root[data-theme="dark"] .bubble.out { background: #1f4d33; color: #e7fbe9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bubble.out { background: #1f4d33; color: #e7fbe9; } }
.bubble .meta { display: flex; gap: 8px; justify-content: flex-end; font-size: .72rem; opacity: .7; margin-top: 4px; }
.bubble .doc { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.05); padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; font-weight: 700; }
.thread-compose { border-top: 1px solid var(--border); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.window-state { font-size: .82rem; font-weight: 700; }
.wa-preview { background: #e5ddd5; border-radius: 16px; padding: 20px; }
.wa-preview .bubble { max-width: 100%; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--brand-gradient); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-side h1 { font-size: 2.6rem; max-width: 460px; }
.auth-side .lead { opacity: .9; font-size: 1.15rem; margin-top: 14px; max-width: 440px; }
.auth-side .icon { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.auth-points { display: flex; flex-direction: column; gap: 10px; font-weight: 600; opacity: .95; position: relative; z-index: 1; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { width: 260px; margin-bottom: 30px; border-radius: 8px; }
.demo-box { margin-top: 26px; border: 1px dashed var(--violet-300); background: var(--violet-50); border-radius: 14px; padding: 14px; font-size: .9rem; }
.demo-box button { all: unset; cursor: pointer; display: block; padding: 6px 8px; border-radius: 8px; color: var(--violet-800); font-weight: 700; }
.demo-box button:hover { background: var(--violet-100); }

/* ---------- Mode tablette client ---------- */
.kiosk { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.kiosk-top .shop { font-weight: 800; font-size: 1.15rem; }
.kiosk-lock { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 1.2rem; text-decoration: none !important; }
.kiosk-lock:hover { background: var(--violet-50); }
.kiosk-main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 24px 60px; }
.kiosk h1 { font-size: 2.1rem; }
.kiosk .lead { font-size: 1.15rem; color: var(--muted); margin-top: 6px; }
.kiosk .input, .kiosk .field input, .kiosk .field select { min-height: 58px; font-size: 1.15rem; border-radius: 14px; }
.kiosk .field label { font-size: 1rem; }
.steps { display: flex; gap: 10px; margin-bottom: 28px; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; color: var(--muted); }
.step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.step.current { border-color: var(--violet-500); color: var(--violet-800); background: var(--violet-50); }
.step.current .n, .step.done .n { background: var(--violet-600); border-color: var(--violet-600); color: #fff; }
.step.done { color: var(--ink-2); }

.signature-wrap { position: relative; border: 2px dashed var(--violet-300); border-radius: 18px; background: #fff; touch-action: none; }
.signature-wrap canvas { display: block; width: 100%; height: 240px; border-radius: 18px; cursor: crosshair; }
.signature-wrap .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b9b3c9; font-size: 1.2rem; pointer-events: none; font-weight: 700; }
.signature-wrap .baseline { position: absolute; left: 30px; right: 30px; bottom: 56px; border-bottom: 1.5px solid #e1dcef; pointer-events: none; }
.terms-box { max-height: 240px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; font-size: .92rem; white-space: pre-line; color: var(--ink-2); }

.pinpad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; justify-content: center; margin-top: 20px; }
.pinpad button { height: 84px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 1.7rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.pinpad button:active { background: var(--violet-100); }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-top: 18px; min-height: 18px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; background: var(--violet-600); }

.done-hero { text-align: center; padding: 50px 20px; }
.done-hero .check { width: 110px; height: 110px; border-radius: 50%; background: var(--green-bg); color: var(--green); font-size: 3.5rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }

/* ---------- Admin ---------- */
.admin-bar { background: #1f1633; color: #e9e2ff; }
.admin-bar a { color: #e9e2ff; }
.admin-bar .nav a:hover { background: rgba(255, 255, 255, .08); }
.admin-bar .nav a.active { background: rgba(255, 255, 255, .16); color: #fff !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .brand-word { display: none; }
  .nav a { padding: 10px 10px; }
}
@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; }
  .totals { position: static; }
  .action-tiles { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-pill { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 760px) {
  .main { padding: 18px 16px 110px; }
  .nav { display: none; }
  .topbar-inner { padding: 10px 16px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--muted); font-size: .72rem; font-weight: 700; text-decoration: none; }
  .tabbar a .i { font-size: 1.35rem; }
  .tabbar a.active { color: var(--violet-700); background: var(--violet-50); }
  h1 { font-size: 1.5rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 2; }
  .measure-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-grid { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--border); }
  .bubble { max-width: 90%; }
  .steps .step .t { display: none; }
  .kiosk-main { padding: 20px 16px 40px; }
  .kiosk h1 { font-size: 1.6rem; }
  .pinpad { grid-template-columns: repeat(3, 72px); }
  .pinpad button { height: 72px; }
  .card { padding: 16px; }
  .brand-word { display: none; }
  .btn { white-space: normal; }
  .family-hero .contact { flex-direction: column; gap: 4px; }
  .action-tiles { grid-template-columns: 1fr; }
  .tile { min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .value { font-size: 1.8rem; }
  .page-head .btn-lg { width: 100%; }
  .family-hero .grow { min-width: 0 !important; }
  .family-hero .avatar.lg { display: none; }
  .family-hero > .btn { width: 100%; }
  .card-head { flex-wrap: wrap; }
  .family-hero .contact span { overflow-wrap: anywhere; }
}

@media print {
  .topbar, .tabbar, .flash-zone, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
