/* ProCalc — design system inspiré shadcn/ui, en CSS natif (zéro dépendance).
   Palette neutre + accent bleu ProCalc (#1289C7). Applique au formulaire ET au back-office. */
:root {
  /* Tokens shadcn */
  --background: #fafafa;
  --card: #ffffff;
  --foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #1289c7;
  --primary: #1289c7;
  --primary-foreground: #ffffff;
  --primary-hover: #0f76ab;
  --destructive: #ef4444;
  --destructive-soft: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);

  /* Alias hérités (compat avec styles inline existants) */
  --bleu: #1289c7; --bleu-fonce: #0f76ab; --bleu-clair: #e8f2f9;
  --noir: #09090b; --gris: #71717a; --gris-clair: #f4f4f5;
  --bord: #e4e4e7; --ok: #16a34a; --alerte: #d97706; --rouge: #ef4444;
  --ombre: 0 1px 2px rgba(16, 24, 40, 0.05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
* { touch-action: manipulation; } /* coupe le double-tap zoom (non hérité) */
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Inter", sans-serif;
  color: var(--foreground);
  background: var(--background);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- En-tête / logo --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
body:has(.topbar) { padding-top: calc(56px + env(safe-area-inset-top)); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; user-select: none; -webkit-user-select: none; cursor: default; }
.logo .drop { width: 22px; height: 22px; }
.logo .pro { color: var(--foreground); }
.logo .calc { color: var(--primary); }

.sync-chip {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 13px; font-weight: 500; color: var(--muted-foreground);
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  transition: background .12s, color .12s;
}
.sync-chip:hover { background: var(--muted); }
.sync-chip.pending { color: #fff; background: var(--alerte); border-color: transparent; }
.sync-chip.ok { color: var(--ok); background: #f0fdf4; border-color: #dcfce7; }
.sync-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Bandeau mode commercial */
body.mode-commercial { background: #f6f9fb; }
.commercial-banner { display: none; }
body.mode-commercial .commercial-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--primary); color: #fff; padding: 9px 16px; font-weight: 600; font-size: 14px;
}
.commercial-banner button {
  background: rgba(255, 255, 255, .18); color: #fff; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer;
}

/* --- Layout --- */
main { max-width: 660px; margin: 0 auto; padding: 20px 16px 120px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px;
}
.card > h2 {
  margin: 0 0 16px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted-foreground); font-weight: 600;
}
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label.q { display: block; font-weight: 500; font-size: 14px; margin-bottom: 7px; color: var(--foreground); }
label.q .req { color: var(--destructive); }
.hint { font-size: 13px; color: var(--muted-foreground); margin-top: 5px; }

/* Inputs / selects / textarea — style shadcn */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="password"],
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="search"], select, textarea {
  width: 100%; height: 44px; padding: 0 12px; font-size: 16px; font-family: inherit; color: var(--foreground);
  background: var(--card); border: 1px solid var(--input); border-radius: var(--radius-sm); outline: none;
  appearance: none; -webkit-appearance: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 38px; cursor: pointer;
}
input::placeholder, textarea::placeholder { color: #a1a1aa; }
input:focus, select:focus, textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(18, 137, 199, .18); }
/* Date/heure : indicateur de calendrier lisible + champ cohérent */
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .55; padding: 4px; border-radius: 4px;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--muted); }
input[type="datetime-local"], input[type="time"], input[type="date"] { color: var(--foreground); font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .row2 { grid-template-columns: 1fr; } }

/* Choix segmentés (bulles) — outline shadcn, sélection = accent */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  flex: 1 1 auto; min-width: 42%; text-align: center; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--input); background: var(--card); font-weight: 500; font-size: 14px; cursor: pointer;
  user-select: none; transition: background .12s, border-color .12s, color .12s;
}
.choices label:hover { background: var(--muted); }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label:has(input:checked) { border-color: var(--primary); background: rgba(18, 137, 199, .08); color: var(--primary-hover); box-shadow: 0 0 0 1px var(--primary) inset; }
.choices.compact label { min-width: 0; flex: 1 1 0; padding: 11px 6px; font-size: 14px; letter-spacing: -0.01em; }

/* Interrupteur (switch shadcn) */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 500; font-size: 14px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 24px; border-radius: 999px; background: var(--input); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }

.hidden { display: none !important; }

/* Produits */
.produit { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--card); }
.produit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.produit-head .t { font-weight: 600; font-size: 14px; color: var(--foreground); }
.produit-head .del { background: none; border: 0; color: var(--destructive); font-weight: 500; cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.produit-head .del:hover { background: var(--destructive-soft); }
.prix-bloc { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
body.mode-commercial .prix-bloc { display: block; }
.prix-ligne { display: flex; align-items: center; justify-content: space-between; font-weight: 500; font-size: 14px; color: var(--muted-foreground); }
.prix-ligne .val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--foreground); font-size: 15px; }
.add-produit {
  width: 100%; height: 44px; border: 1px dashed var(--border); color: var(--primary-hover);
  background: var(--card); border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .12s;
}
.add-produit:hover { background: var(--muted); }

/* Total commercial */
.total-bloc { display: none; }
body.mode-commercial .total-bloc {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--foreground); color: #fff; padding: 16px 18px; border-radius: var(--radius); margin-bottom: 16px;
}
.total-bloc .lbl { font-weight: 500; font-size: 14px; opacity: .9; }
.total-bloc .amount { font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* Barre d'action bas de page */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: saturate(180%) blur(8px); border-top: 1px solid var(--border);
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 660px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }

/* Boutons */
button.primary {
  flex: 1; height: 48px; border: 0; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-foreground);
  font-size: 16px; font-weight: 600; cursor: pointer; transition: background .12s;
}
button.primary:hover { background: var(--primary-hover); }
button.primary:active { transform: translateY(1px); }
button.ghost { height: 48px; padding: 0 18px; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--card); font-weight: 600; font-size: 15px; cursor: pointer; transition: background .12s; }
button.ghost:hover { background: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px);
  background: var(--foreground); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px;
  opacity: 0; transition: all .22s; z-index: 40; max-width: 90%; text-align: center; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--destructive); }
.toast.ok { background: var(--ok); }

/* Login */
.login-wrap { max-width: 380px; margin: 14vh auto; padding: 0 20px; }
.login-wrap .card { padding: 28px; }
.login-wrap .logo { justify-content: center; font-size: 28px; margin-bottom: 4px; }
.login-wrap p.sub { text-align: center; color: var(--muted-foreground); margin: 0 0 22px; font-size: 14px; }
.err-msg { color: var(--destructive); font-weight: 500; margin-top: 10px; min-height: 20px; font-size: 14px; }

/* ============ Back-office ============ */
/* Onglets style shadcn (conteneur muted, actif = carte blanche) */
.tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; background: var(--muted); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.tabs button { background: transparent; border: 0; padding: 8px 14px; font-weight: 500; color: var(--muted-foreground); cursor: pointer; border-radius: 7px; font-size: 14px; transition: background .12s, color .12s; }
.tabs button:hover { color: var(--foreground); }
.tabs button.active { color: var(--foreground); background: var(--card); box-shadow: var(--shadow-sm); }

.admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.admin-toolbar input, .admin-toolbar select { width: auto; flex: 1 1 180px; height: 40px; font-size: 14px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--muted); }
th { background: transparent; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); font-weight: 600; }
td.money { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Table éditable */
table.edit { table-layout: auto; }
table.edit td { padding: 7px 8px; vertical-align: middle; }
table.edit tbody tr:hover { background: transparent; }
table.edit input, table.edit select { height: 38px; padding: 0 10px; font-size: 14px; border-radius: 8px; width: 100%; min-width: 96px; }
table.edit input.num { text-align: right; min-width: 84px; }
.tbl-actions { display: flex; gap: 6px; white-space: nowrap; }

.btn-sm { height: 38px; padding: 0 12px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); font-weight: 500; cursor: pointer; font-size: 13px; color: var(--foreground); transition: background .12s; }
.btn-sm:hover { background: var(--muted); }
a.btn-sm { display: inline-flex; align-items: center; text-decoration: none; }
.btn-sm.save { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm.save:hover { background: var(--primary-hover); }
.btn-sm.del { color: var(--destructive); border-color: var(--border); }
.btn-sm.del:hover { background: var(--destructive-soft); border-color: #fecaca; }

/* Options */
.opt-group { margin-bottom: 18px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.opt-group h3 { font-size: 14px; margin: 0 0 12px; color: var(--foreground); font-weight: 600; }
.opt-group h3 .muted { font-weight: 400; }
.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row input.val { flex: 1; height: 38px; }
.opt-row input.ord { width: 66px; height: 38px; text-align: right; }
.muted { color: var(--muted-foreground); font-size: 13px; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; height: 38px; }
.section-add { margin: 8px 0 18px; }

/* --- Fenêtre de détail d'une fiche (dialog shadcn) --- */
tbody.clickable tr { cursor: pointer; }
.modal-overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, .5); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 24px 16px; overflow: auto; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 20px 45px rgba(0, 0, 0, .25); width: 100%; max-width: 660px; margin: auto; }
.modal-head { position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--border); padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-radius: var(--radius) var(--radius) 0 0; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head .sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.modal-body { padding: 20px; }
.modal-foot { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--border); padding: 14px 20px; display: flex; gap: 10px; align-items: center; border-radius: 0 0 var(--radius) var(--radius); }
.modal-foot .spacer { flex: 1; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted-foreground); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--muted); color: var(--foreground); }
.detail-sec { margin-bottom: 20px; }
.detail-sec:last-child { margin-bottom: 0; }
.detail-sec h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 480px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item { min-width: 0; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item .k { font-size: 12px; color: var(--muted-foreground); margin-bottom: 3px; }
.detail-item .v { font-size: 14px; font-weight: 500; word-break: break-word; }
.detail-item .v.empty { color: #a1a1aa; font-weight: 400; }
.detail-item input, .detail-item select { height: 40px; font-size: 14px; }
.detail-prod { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.detail-prod .ph { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; }
.detail-prod .pm { font-size: 13px; color: var(--muted-foreground); margin-top: 4px; }
.detail-total { display: flex; justify-content: space-between; align-items: center; background: var(--foreground); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); margin-top: 6px; }
.detail-total .amount { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }

/* --- Layout dashboard : sidebar gauche --- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 244px; flex: none; background: var(--card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; padding: 16px 12px; }
.sidebar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; padding: 6px 8px 18px; user-select: none; letter-spacing: -0.02em; }
.sidebar .brand .drop { width: 22px; height: 22px; }
.sidebar .brand .pro { color: var(--foreground); } .sidebar .brand .calc { color: var(--primary); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--muted-foreground); font-weight: 500; font-size: 14px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; text-decoration: none; }
.nav-item:hover { background: var(--muted); color: var(--foreground); }
.nav-item.active { background: var(--muted); color: var(--foreground); }
.nav-item .ic { width: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; opacity: .9; }
.nav-item .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .spacer { flex: 1; }
.sidebar .side-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.admin-main { margin-left: 244px; flex: 1; min-width: 0; max-width: none; padding: 26px 30px 60px; }
.admin-main h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.admin-main .page-sub { color: var(--muted-foreground); font-size: 14px; margin: 0 0 22px; }
.admin-mobile-top { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .admin-main { margin-left: 0; padding: 16px; }
  .admin-mobile-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); z-index: 20; }
  .admin-mobile-top .menu-btn { background: none; border: 1px solid var(--border); border-radius: 8px; height: 38px; width: 42px; font-size: 18px; cursor: pointer; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
}

/* --- Sélecteur de date maison (calendrier shadcn) --- */
.datepick { position: relative; }
.datepick-trigger {
  width: 100%; height: 44px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--card);
  font-size: 16px; color: var(--foreground); cursor: pointer; text-align: left; font-family: inherit;
}
.datepick-trigger:hover { background: var(--muted); }
.datepick-trigger[data-empty] span { color: #a1a1aa; }
.datepick-trigger svg { color: var(--muted-foreground); flex: none; }
.datepick-pop {
  position: absolute; z-index: 45; top: calc(100% + 6px); left: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0,0,0,.16); padding: 14px; width: 304px; max-width: calc(100vw - 32px);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 600; font-size: 14px; text-transform: capitalize; }
.cal-head button { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; font-size: 16px; color: var(--foreground); line-height: 1; }
.cal-head button:hover { background: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--muted-foreground); padding: 4px 0; text-transform: uppercase; }
.cal-day { height: 36px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--foreground); font-family: inherit; }
.cal-day:hover:not(:disabled) { background: var(--muted); }
.cal-day.other { color: transparent; cursor: default; }
.cal-day.today { box-shadow: 0 0 0 1px var(--border) inset; font-weight: 600; }
.cal-day.sel { background: var(--primary); color: #fff; font-weight: 600; }
.cal-day.sel:hover { background: var(--primary-hover); }
.cal-time { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.cal-time > span:first-child { font-size: 13px; color: var(--muted-foreground); width: 46px; flex: none; }
.cal-time > span:not(:first-child) { flex: none; color: var(--muted-foreground); }
.cal-time select { height: 38px; width: auto; flex: 1 1 0; min-width: 0; font-size: 14px; }
.cal-foot { display: flex; gap: 8px; margin-top: 12px; }
.cal-foot button { flex: 1; height: 38px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); cursor: pointer; font-weight: 500; font-size: 13px; color: var(--foreground); font-family: inherit; }
.cal-foot button:hover { background: var(--muted); }
.cal-foot button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.cal-foot button.primary:hover { background: var(--primary-hover); }

/* --- Data-table shadcn (pages Produits/Foires/Conseillers) --- */
.table-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.btn-add { height: 38px; padding: 0 16px; background: var(--primary); color: #fff; border: 0; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn-add:hover { background: var(--primary-hover); }
.table-wrap table tbody.clickable tr, .data-table tbody tr { cursor: pointer; }
.data-table td { font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .field { margin-bottom: 0; }
.form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

/* Bouton secondaire shadcn (outline) — ex. Export Excel */
.btn-outline { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); color: var(--foreground); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn-outline:hover { background: var(--muted); }
.btn-outline svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted-foreground); }

/* En-têtes de colonnes triables */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--foreground); }
th.sortable.active { color: var(--foreground); }
th .sort-ar { font-size: 10px; color: var(--muted-foreground); margin-left: 2px; }
.data-table th.num, .data-table td.num, table th.num, table td.num { text-align: right; }

/* Boutons-icônes d'action (dans les tables) */
.icon-act { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; color: var(--muted-foreground); padding: 0; }
.icon-act:hover { background: var(--muted); color: var(--foreground); }
.icon-act.del:hover { background: var(--destructive-soft); color: var(--destructive); border-color: #fecaca; }
.icon-act svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-add { display: inline-flex; align-items: center; gap: 7px; }
.btn-add svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm.save svg, .btn-sm.del svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; margin-right: 5px; }
.opt-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.opt-group-head h3 { margin: 0; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: #e6f6ee; color: var(--ok); }
.badge.off { background: var(--muted); color: var(--muted-foreground); }

/* ============ Ajustements shadcn admin (overrides) ============ */
/* Tables dimensionnées au contenu (plus d'étirement forcé) */
table { width: auto; }
.table-wrap { width: fit-content; max-width: 100%; }
th, td { padding: 8px 14px; }
.data-table td { padding: 7px 14px; }
/* Boutons-icônes plus compacts (ligne moins haute) */
.icon-act { width: 30px; height: 30px; }
.icon-act svg { width: 14px; height: 14px; }
/* Bouton "Ajouter" : graisse medium + hauteur alignée shadcn */
.btn-add { font-weight: 500; height: 36px; }
/* Champs plus denses côté admin (14px / 38px) — le formulaire mobile reste en 16px */
.admin-main input:not([type=checkbox]), .admin-main select,
.modal input:not([type=checkbox]), .modal select,
.admin-toolbar input, .admin-toolbar select { font-size: 14px; height: 38px; }
.btn-sm { height: 36px; }
/* Barre de filtres : largeurs fixes, export poussé à droite */
.admin-toolbar input[type="search"] { flex: 0 0 260px; width: 260px; }
.admin-toolbar select { flex: 0 0 210px; width: 210px; }
/* Indicateur de tri en icône SVG (au lieu des glyphes ▲▼) */
.sort-ar { display: inline-flex; vertical-align: middle; }
.sort-ar svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
th.sortable:not(.active) .sort-ar { opacity: .4; }
/* Encart d'avertissement (alert shadcn) */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); font-size: 13px; color: var(--muted-foreground); margin: 0 0 18px; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; stroke: var(--alerte); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Cellules de data-table : tronque les textes très longs (ellipsis + title au survol) */
.data-table td { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
/* Actions en haut de page (ex. Nouveau formulaire) */
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.btn-add { text-decoration: none; }

/* Tables en pleine largeur d'écran (la colonne principale absorbe l'espace) */
table { width: 100%; }
.table-wrap { width: 100%; max-width: 100%; }
.data-table td { max-width: none; overflow: visible; text-overflow: clip; }
.col-flex { width: 100%; }

/* Combobox cherchable (sélection de foire) */
.combo { position: relative; }
.combo-input { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.combo-list { position: absolute; z-index: 25; top: calc(100% + 4px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 264px; overflow-y: auto; padding: 4px; }
.combo-item { padding: 10px 12px; border-radius: 7px; cursor: pointer; font-size: 15px; }
.combo-item:hover, .combo-item.active { background: var(--muted); }
.combo-empty { padding: 12px; color: var(--muted-foreground); font-size: 14px; text-align: center; }

/* --- Détail de fiche : sections plus visibles + texte +20% + footer plus haut --- */
.detail-sec { margin-bottom: 24px; }
.detail-sec h4 { font-size: 14px; color: var(--foreground); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding-bottom: 8px; margin-bottom: 14px; border-bottom: 2px solid var(--border); }
.detail-item .k { font-size: 14px; }
.detail-item .v { font-size: 17px; }
.modal-head h2 { font-size: 19px; }
.modal-head .sub { font-size: 13px; }
.detail-prod .ph { font-size: 17px; }
.detail-prod .pm { font-size: 15px; }
.detail-total { padding: 14px 18px; }
.detail-total span:first-child { font-size: 16px; }
.detail-total .amount { font-size: 22px; }
.modal-body { padding: 22px 20px; }
.modal-foot { padding: 18px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 18px rgba(16, 24, 40, .07); }

/* --- Modal : header/footer fixes, seul le corps défile (plus de transparence) --- */
.modal { max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { position: static; flex: none; }
.modal-body { overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.modal-foot { position: static; flex: none; }
/* Plus d'espace au-dessus de chaque titre de section */
.detail-sec { margin-bottom: 34px; }
.detail-sec:first-child { margin-top: 4px; }

/* Sélection multiple dans le tableau des fiches */
.selcol { width: 40px; text-align: center; }
.rowsel, #selAll { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(18,137,199,.08); border: 1px solid var(--primary); border-radius: 10px; margin-bottom: 12px; }
.bulk-bar .cnt { font-weight: 600; font-size: 14px; color: var(--primary-hover); }
.bulk-bar .spacer { flex: 1; }

/* --- Responsive mobile : page Fiches --- */
@media (max-width: 640px) {
  .admin-toolbar { gap: 8px; }
  .admin-toolbar input[type="search"], .admin-toolbar select { flex: 1 1 100%; width: 100%; }
  .admin-toolbar > div { width: 100%; margin-left: 0 !important; }
  .admin-toolbar > div .btn-outline { flex: 1 1 0; justify-content: center; padding: 0 10px; }
  .page-actions .btn-add { width: 100%; justify-content: center; }
  .bulk-bar { flex-wrap: wrap; }
  .bulk-bar .btn-sm { flex: 1 1 auto; justify-content: center; }
  /* Colonnes secondaires masquées sur petit écran (moins de scroll horizontal) */
  .col-hide-m { display: none; }
}

/* --- Tablette : textes du formulaire +30% (champs, placeholders, choix, boutons) ---
   Ne touche PAS les libellés (label.q) ni les titres de sections. */
@media (min-width: 641px) and (max-width: 1200px) {
  #fiche label.q { font-size: 21px; }
  #fiche input:not([type=checkbox]):not([type=radio]),
  #fiche select,
  #fiche .combo-input,
  #fiche .datepick-trigger { font-size: 21px; height: 54px; }
  #fiche textarea { font-size: 21px; height: auto; }
  #fiche .choices label { font-size: 18px; padding: 14px 16px; }
  #fiche .add-produit { font-size: 18px; height: 54px; }
  #fiche .combo-item { font-size: 18px; }
  #fiche .datepick-pop .cal-day,
  #fiche .datepick-pop .cal-time select,
  #fiche .datepick-pop .cal-foot button,
  #fiche .cal-title { font-size: 17px; }
  #fiche .produit-head .t { font-size: 18px; }
  #fiche .prix-ligne, #fiche .prix-ligne .val, #fiche .switch { font-size: 17px; }
  .total-bloc .lbl { font-size: 18px; }
  .total-bloc .amount { font-size: 28px; }
  .actionbar button.primary { font-size: 21px; height: 58px; }
  .actionbar button.ghost { font-size: 19px; height: 58px; }
}

/* --- Confirmation d'enregistrement (grand écran) --- */
.success-overlay { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(9, 9, 11, .45); backdrop-filter: blur(3px); padding: 24px; }
.success-overlay.show { display: flex; animation: sfade .2s ease; }
@keyframes sfade { from { opacity: 0; } to { opacity: 1; } }
.success-card { background: #fff; border-radius: 22px; padding: 44px 40px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); max-width: 92%; animation: spop .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes spop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success-check { width: 104px; height: 104px; margin: 0 auto 22px; border-radius: 50%; background: #e6f6ee; display: flex; align-items: center; justify-content: center; }
.success-check svg { width: 60px; height: 60px; fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.success-check svg circle { stroke: var(--ok); opacity: .25; stroke-width: 3; }
.success-check svg path { stroke-dasharray: 44; stroke-dashoffset: 44; animation: sdraw .45s .12s forwards ease; }
@keyframes sdraw { to { stroke-dashoffset: 0; } }
.success-title { font-size: 28px; font-weight: 700; color: var(--foreground); margin-bottom: 8px; letter-spacing: -.01em; }
.success-sub { font-size: 17px; color: var(--muted-foreground); }

/* Infos de contact affichées en MAJUSCULES (nom, prénom, adresse, ville...). */
#fiche #nom, #fiche #prenom, #fiche #rue, #fiche #ville,
#fiche #nom_ppe, #fiche #entreprise,
#fiche #chantier_rue, #fiche #chantier_ville { text-transform: uppercase; }
#fiche #nom::placeholder, #fiche #prenom::placeholder, #fiche #rue::placeholder, #fiche #ville::placeholder,
#fiche #nom_ppe::placeholder, #fiche #entreprise::placeholder,
#fiche #chantier_rue::placeholder, #fiche #chantier_ville::placeholder { text-transform: none; }

/* Nom de foire en MAJUSCULES dans le formulaire (recherche + liste). */
#fiche #foireSearch { text-transform: uppercase; }
#fiche #foireSearch::placeholder { text-transform: none; }
#foireList .combo-opt, #foireList [data-val] { text-transform: uppercase; }

/* ---- Verrou du contexte (bouton lock/unlock en haut à droite de la carte) ---- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; }
.lock-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none; padding: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--muted-foreground); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.lock-btn svg { width: 20px; height: 20px; }
.lock-btn .ic-closed { display: none; }
.lock-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.lock-btn.on .ic-open { display: none; }
.lock-btn.on .ic-closed { display: block; }
/* Carte verrouillée : champs grisés + non modifiables */
#ctxCard.locked input:disabled,
#ctxCard.locked select:disabled { background: #f4f4f5; color: var(--foreground); -webkit-text-fill-color: var(--foreground); cursor: not-allowed; }
/* Bulles de choix (Foire / Autre) : simple gris, sans surbrillance bleue ni fondu */
#ctxCard.locked .choices label { background: #f4f4f5; color: var(--muted-foreground); cursor: not-allowed; }
#ctxCard.locked .choices label:hover { background: #f4f4f5; }
#ctxCard.locked .choices label:has(input:checked) { border-color: #d4d4d8; background: #e9e9ec; color: var(--foreground); box-shadow: none; }

/* ---- Création d'un conseiller depuis le formulaire ---- */
.with-add { display: flex; gap: 8px; align-items: stretch; }
.with-add select { flex: 1 1 auto; min-width: 0; }
.add-inline {
  flex: none; width: 46px; border: 1px solid var(--primary); border-radius: 10px;
  background: var(--card); color: var(--primary); font-size: 24px; font-weight: 500;
  line-height: 1; cursor: pointer;
}
.add-inline:disabled { opacity: .4; cursor: not-allowed; }
.new-conseiller {
  margin-top: 10px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px;
  display: flex; flex-direction: column; gap: 8px; background: #fafafa;
}
.new-conseiller input, .new-conseiller select { width: 100%; }
.nc-actions { display: flex; gap: 8px; justify-content: flex-end; }
.nc-cancel, .nc-save { border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.nc-cancel { border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.nc-save { border: 1px solid var(--primary); background: var(--primary); color: #fff; }

/* Nouveau conseiller : prénom/nom affichés en MAJUSCULES (e-mail laissé normal). */
#newConseiller #ncPrenom, #newConseiller #ncNom { text-transform: uppercase; }
#newConseiller #ncPrenom::placeholder, #newConseiller #ncNom::placeholder { text-transform: none; }

/* ---- Vue Toutes / Devis (liste des fiches) ---- */
.view-tabs { display: inline-flex; gap: 4px; background: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.view-tabs button { border: 0; background: transparent; padding: 7px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted-foreground); cursor: pointer; transition: background .12s, color .12s; }
.view-tabs button.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* ---- Colonne État : badge-select compact (En cours / Fait) ---- */
td.etat-col { width: 1%; white-space: nowrap; }
.etat-sel { width: auto; min-width: 106px; height: 32px; padding: 0 30px 0 12px; font-size: 13px; font-weight: 600; border-radius: 999px; background-position: right 9px center; cursor: pointer; }
.etat-sel.todo { color: #92400e; background-color: #fffbeb; border-color: #fde68a; }
.etat-sel.done { color: #166534; background-color: #f0fdf4; border-color: #bbf7d0; }
.etat-sel:focus { box-shadow: 0 0 0 3px rgba(18, 137, 199, .15); }

/* ---- Dispos calendrier dans le sélecteur de date (créneaux déjà pris) ---- */
.cal-day.has-ev { position: relative; }
.cal-day.has-ev::after { content: ""; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
.cal-day.sel.has-ev::after, .cal-day.today.has-ev::after { background: currentColor; }
.cal-busy { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.cb-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); font-weight: 700; margin-bottom: 6px; }
.cb-list { max-height: 132px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.cb-item { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.cb-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--foreground); white-space: nowrap; }
.cb-item.allday .cb-time { color: var(--muted-foreground); font-weight: 500; }
.cb-sub { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-empty { font-size: 13px; color: var(--ok); font-weight: 500; }
.cb-hint, .cb-load { font-size: 12px; color: var(--muted-foreground); }
.cb-warn { font-size: 13px; font-weight: 600; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }

/* ==================== Vue calendrier hebdomadaire (sélecteur de RDV) ==================== */
body.week-open { overflow: hidden; }
.week-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(9, 9, 11, .45); display: flex; align-items: center; justify-content: center; padding: 12px; }
.week-overlay[hidden] { display: none; }
.week-card { background: var(--card); border-radius: 16px; width: min(1040px, 100%); height: min(92vh, 820px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.week-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex: none; }
.week-nav { display: flex; gap: 6px; }
.week-nav button, .week-close { height: 38px; min-width: 38px; padding: 0 12px; border: 1px solid var(--border); background: var(--card); border-radius: 9px; font-weight: 600; font-size: 15px; cursor: pointer; color: var(--foreground); }
.week-nav button:hover, .week-close:hover { background: var(--muted); }
.week-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.week-close { flex: none; }
.week-full { flex: none; display: inline-flex; align-items: center; justify-content: center; height: 38px; width: 38px; padding: 0; border: 1px solid var(--border); background: var(--card); border-radius: 9px; cursor: pointer; color: var(--muted-foreground); }
.week-full:hover { background: var(--muted); color: var(--foreground); }
.week-full svg { width: 17px; height: 17px; }
/* Plein écran : la carte occupe tout l'écran (utile sur grand écran). */
.week-overlay.full { padding: 0; }
.week-overlay.full .week-card { width: 100%; height: 100%; max-width: none; border-radius: 0; }

.week-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.wk-grid { display: flex; min-width: 720px; }
.wk-gutter { width: 52px; flex: none; position: sticky; left: 0; z-index: 6; background: var(--card); }
.wk-cols { display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); flex: 1; }
.wk-col { min-width: 0; border-left: 1px solid var(--border); position: relative; }
.wk-col.today { background: rgba(18, 137, 199, .045); }
.wk-colhead { height: 40px; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-foreground); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 4; }
.wk-col.today .wk-colhead, .wk-col.today .wk-colhead b { color: var(--primary); }
.wk-colhead b { font-size: 15px; color: var(--foreground); }
.wk-allday { border-bottom: 1px solid var(--border); padding: 2px 3px; overflow: hidden; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 40px; background: var(--card); z-index: 3; }
.wk-ad { flex: none; height: 18px; font-size: 10px; line-height: 18px; background: #e4e4e7; color: #3f3f46; box-shadow: inset 3px 0 0 #a1a1aa; border-radius: 4px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-colbody { position: relative; background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 40px); cursor: copy; }
.wk-ev { position: absolute; left: 2px; right: 2px; background: #e4e4e7; border-left: 3px solid #a1a1aa; border-radius: 4px; font-size: 10px; line-height: 1.15; padding: 2px 4px; overflow: hidden; color: #3f3f46; pointer-events: none; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.wk-ev b { color: #18181b; }
.wk-selblock { position: absolute; left: 2px; right: 2px; background: rgba(18, 137, 199, .92); color: #fff; border-radius: 5px; font-size: 11px; line-height: 1.15; box-shadow: 0 1px 6px rgba(0, 0, 0, .3); z-index: 3; pointer-events: auto; touch-action: none; cursor: grab; overflow: hidden; }
.wk-selblock:active { cursor: grabbing; }
.wk-selblock.conflict { background: rgba(239, 68, 68, .93); }
.wk-selt { display: block; padding: 3px 6px; font-weight: 600; }
.wk-selt .wc { font-weight: 700; }
.wk-handle { position: absolute; left: 0; right: 0; height: 11px; cursor: ns-resize; touch-action: none; z-index: 1; }
.wk-handle.top { top: -1px; } .wk-handle.bot { bottom: -1px; }
.wk-handle::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); width: 26px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .9); }
.wk-handle.top::after { top: 2px; } .wk-handle.bot::after { bottom: 2px; }
.wk-hours { position: relative; }
.wk-hour { height: 40px; font-size: 10px; color: var(--muted-foreground); text-align: right; padding-right: 5px; box-sizing: border-box; }
.wk-hour span { position: relative; top: -6px; }

.week-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); flex: none; }
.week-selinfo { flex: 1 1 220px; font-size: 14px; color: var(--foreground); }
.week-dur { display: inline-flex; gap: 4px; background: var(--muted); border-radius: 9px; padding: 3px; }
.week-dur button { border: 0; background: transparent; padding: 7px 13px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted-foreground); cursor: pointer; }
.week-dur button.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
.week-actions { display: inline-flex; gap: 8px; }
.week-actions button { height: 40px; padding: 0 18px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.week-actions .primary { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 640px) {
  .week-card { height: 96vh; width: 100%; border-radius: 12px; }
  /* En-tête : navigation + fermeture sur une ligne, dates dessous (sinon le titre se casse en 4). */
  .week-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .week-full { display: none; }                 /* déjà quasi plein écran sur mobile */
  .week-head .week-nav { order: 1; }
  .week-head .week-close { order: 2; margin-left: auto; }
  .week-title { order: 3; flex: 1 0 100%; text-align: center; font-size: 15px; white-space: nowrap; }
  .week-nav button, .week-close { height: 36px; min-width: 36px; padding: 0 10px; }
  .week-tech { padding: 8px 12px; }
  .wk-grid { min-width: 640px; }
  .wk-cols { grid-template-columns: repeat(7, minmax(84px, 1fr)); }
  .week-selinfo { flex-basis: 100%; }
  .week-dur { flex: 1; } .week-dur button { flex: 1; }
  .week-actions { flex: 1; } .week-actions button { flex: 1; }
}

/* ---- Aperçu de l'événement calendrier dans le formulaire ---- */
.cal-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fafafa; }
.cal-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted-foreground); margin: 0 0 5px; }
.cal-sub:not(:first-child) { margin-top: 12px; }
#calTitleReset { border: 1px solid var(--border); background: var(--card); border-radius: 6px; width: 24px; height: 24px; padding: 0; cursor: pointer; color: var(--muted-foreground); font-size: 13px; line-height: 1; }
#calTitleReset:hover { background: var(--muted); color: var(--foreground); }
.cal-details { margin-top: 12px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--foreground); }
.cal-details span { color: var(--muted-foreground); font-weight: 600; margin-right: 4px; }
.cal-relances { margin-top: 10px; }
.cal-rel-t { font-size: 12px; font-weight: 600; color: var(--muted-foreground); margin-bottom: 3px; }
.cal-rel { font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }

/* ---- Nature de la demande : Test + bouton « + » révélant D (Devis) / S (SAV) ---- */
.nature-choices { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.nature-choices label { display: flex; align-items: center; justify-content: center; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--input); background: var(--card); font-weight: 500; font-size: 14px; cursor: pointer; user-select: none; position: relative; transition: background .12s, border-color .12s, color .12s; }
.nature-choices label.nat-main { flex: 1 1 auto; }
.nature-choices label.nat-x { flex: 0 0 auto; min-width: 48px; font-weight: 700; }
.nature-choices label:has(input:checked) { border-color: var(--primary); background: rgba(18, 137, 199, .08); color: var(--primary-hover); box-shadow: 0 0 0 1px var(--primary) inset; }
.nature-choices label:hover { background: var(--muted); }
.nature-choices input { position: absolute; opacity: 0; pointer-events: none; }
.nat-add { flex: 0 0 auto; width: 48px; border: 1px solid var(--primary); background: var(--card); color: var(--primary); border-radius: var(--radius-sm); font-size: 22px; font-weight: 500; line-height: 1; cursor: pointer; }
.nat-add:hover { background: rgba(18, 137, 199, .08); }

/* ---- Sélecteur de technicien dans la vue calendrier ---- */
.week-tech { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 14px; border-bottom: 1px solid var(--border); flex: none; }
.wt-label { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.week-tech select { width: auto; flex: 0 0 auto; min-width: 88px; height: 32px; padding: 0 28px 0 10px; font-weight: 700; font-size: 13px; background-position: right 8px center; }
.wt-add { flex: none; width: 32px; height: 32px; border: 1px solid var(--primary); background: var(--card); color: var(--primary); border-radius: 8px; font-size: 17px; line-height: 1; cursor: pointer; }
.wt-add:hover { background: rgba(18, 137, 199, .08); }
.wt-new { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; background: #fafafa; }
.wt-new input { flex: 1 1 140px; width: auto; height: 38px; }
.wt-new button { flex: 0 0 auto; height: 38px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.wt-new button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Délai de relance test (aperçu événement) ---- */
#calRelTestBox { margin-top: 4px; }
.cal-reltest { display: flex; align-items: center; gap: 8px; }
.cal-reltest input { width: 96px; flex: 0 0 auto; }
.cal-reltest span { font-size: 12px; color: var(--muted-foreground); }

/* ---- Ligne prix produit : « + » pour saisir un nouveau prix ---- */
.prix-right { display: inline-flex; align-items: center; gap: 8px; }
.prix-plus { width: 30px; height: 30px; flex: none; border: 1px solid var(--primary); background: var(--card); color: var(--primary); border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; }
.prix-plus:hover { background: rgba(18, 137, 199, .08); }
.prix-plus.on { background: var(--primary); color: #fff; }

/* ---- Modes de prix : « Prix foire » + « + » (Nouveau prix) ---- */
.prix-modes { display: flex; align-items: stretch; gap: 8px; }
.prix-modes .prix-mode { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 11px 14px; border: 1px solid var(--input); background: var(--card); border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; cursor: pointer; user-select: none; position: relative; }
.prix-modes .prix-mode:has(input:checked) { border-color: var(--primary); background: rgba(18, 137, 199, .08); color: var(--primary-hover); box-shadow: 0 0 0 1px var(--primary) inset; }
.prix-modes .prix-mode input { position: absolute; opacity: 0; pointer-events: none; }
.prix-modes .prix-plus { flex: 0 0 auto; width: 48px; height: auto; display: inline-flex; align-items: center; justify-content: center; }
.prix-modes .prix-plus svg { width: 22px; height: 22px; }
