/* ---------------------------------------------------------------
   Suivi atelier — un seul élément marquant : l'étiquette de dépôt
   (carton kraft perforé) en tête de la page client. Tout le reste
   reste calme et lisible sur mobile.
   --------------------------------------------------------------- */
:root {
  --ink: #1f2a37;
  --ink-soft: #5b6878;
  --paper: #eceff2;
  --surface: #ffffff;
  --line: #d5dbe1;
  --accent: #1d5c9e;
  --accent-ink: #ffffff;
  --kraft: #e7d3a6;
  --kraft-edge: #cdb27a;
  --kraft-ink: #3b2f17;

  --progress: #1d5c9e;
  --action: #a8480a;
  --wait: #6b5b95;
  --ready: #1c7348;
  --closed: #6f7782;

  --radius-s: 6px;
  --radius-m: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
small, .muted { color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.is-admin .wrap { max-width: 1180px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; }

/* ---------- barre du haut ---------- */
.topbar { background: var(--ink); color: #fff; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .01em; }
.brand small { color: #aab6c3; font-weight: 400; margin-left: 4px; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav a { color: #fff; text-decoration: none; }
.nav a.muted { color: #aab6c3; }

/* ---------- boutons & champs ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  font: 600 15px/1 var(--font); padding: 12px 18px; border-radius: var(--radius-s);
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn-small { padding: 8px 12px; font-size: 14px; }
.nav .btn { color: var(--accent-ink); }

label { display: block; font-weight: 600; font-size: 14px; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  display: block; width: 100%; margin-top: 4px;
  font: 16px/1.4 var(--font); color: var(--ink);
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.choice label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin-right: 18px; font-size: 15px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }

.stack > * + * { margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border-radius: var(--radius-m); padding: 20px; border: 1px solid var(--line); margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 40px auto; }
.flash { background: #e3f1e9; color: #164f33; border-radius: var(--radius-s); padding: 12px 14px; margin-bottom: 16px; }
.error { background: #fbe9e2; color: #7d2a08; border-radius: var(--radius-s); padding: 10px 14px; margin: 0 0 12px; }
.error p { margin: 0; }
.empty { text-align: center; padding: 48px 12px; }
.empty p { max-width: 46ch; margin: 0 auto 16px; }

/* ---------- pastilles de statut ---------- */
.status {
  display: inline-block; font-weight: 700; font-size: 15px;
  padding: 5px 12px; border-radius: 999px; color: #fff; background: var(--progress);
  vertical-align: middle;
}
.status.small { font-size: 13px; padding: 3px 10px; font-weight: 600; }
.tone-progress { background: var(--progress); }
.tone-action   { background: var(--action); }
.tone-wait     { background: var(--wait); }
.tone-ready    { background: var(--ready); }
.tone-closed   { background: var(--closed); }

/* ---------- l'étiquette de dépôt (page client) ---------- */
.tag {
  position: relative;
  background:
    repeating-linear-gradient(115deg, rgba(0,0,0,.018) 0 2px, transparent 2px 6px),
    var(--kraft);
  color: var(--kraft-ink);
  border-radius: 10px 10px 10px 10px;
  padding: 26px 22px 22px 70px;
  margin: 8px 0 20px;
  box-shadow: 0 1px 0 var(--kraft-edge), 0 8px 18px -12px rgba(59,47,23,.45);
  /* coin coupé façon étiquette */
  clip-path: polygon(34px 0, 100% 0, 100% 100%, 34px 100%, 0 calc(100% - 34px), 0 34px);
}
.tag-hole {
  position: absolute; left: 20px; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  border-radius: 50%; background: var(--paper);
  box-shadow: 0 0 0 5px #f4ead2, 0 0 0 6px var(--kraft-edge);
}
.tag-kind { margin: 0; font-size: 14px; font-weight: 600; color: #6f5a2d; }
.tag-ref {
  font-size: clamp(2rem, 8vw, 2.9rem); font-weight: 800; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; margin: 0 0 2px; color: var(--kraft-ink);
}
.tag-device { margin: 0 0 14px; font-size: 17px; }

.timeline { list-style: none; display: flex; margin: 18px 0 0; padding: 0; counter-reset: s; }
.timeline li { flex: 1; position: relative; text-align: center; font-size: 12.5px; color: #7a6843; padding-top: 22px; }
.timeline li::before {
  content: ""; position: absolute; top: 4px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--kraft); border: 2px solid #b39a63; z-index: 1;
}
.timeline li + li::after {
  content: ""; position: absolute; top: 10px; right: 50%; width: 100%; height: 2px; background: #c9b17c;
}
.timeline li.done::before { background: var(--kraft-ink); border-color: var(--kraft-ink); }
.timeline li.done::after, .timeline li.now::after { background: var(--kraft-ink); }
.timeline li.now { color: var(--kraft-ink); font-weight: 700; }
.timeline li.now::before { background: #fff; border: 4px solid var(--kraft-ink); width: 18px; height: 18px; margin-left: -9px; top: 2px; }
.timeline li.done { color: var(--kraft-ink); }
@media (max-width: 420px) {
  .tag { padding-left: 58px; }
  .tag-hole { left: 16px; }
  .timeline li span { display: none; }
  .timeline li.now span { display: block; position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .timeline { padding-bottom: 18px; }
}

.panel-action { border: 2px solid var(--action); }
.panel-action h2 { color: var(--action); }
.panel-ready { border: 2px solid var(--ready); }
.panel-ready h2 { color: var(--ready); }
.estimate { font-size: 18px; }
.accord { display: flex; gap: 10px; flex-wrap: wrap; }

.details summary { cursor: pointer; font-weight: 700; }
.details dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
.details dt { color: var(--ink-soft); }
.details dd { margin: 0; }
@media (max-width: 480px) { .details dl { grid-template-columns: 1fr; } .details dd { margin-bottom: 8px; } }

/* ---------- fil de messages ---------- */
.thread h2 { margin-top: 8px; }
.msg { max-width: 86%; margin: 10px 0; padding: 10px 14px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.msg header { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.msg time { font-weight: 400; color: var(--ink-soft); margin-left: 6px; }
.msg-mine { margin-left: auto; background: #dde9f6; border-color: #c3d6ec; border-bottom-right-radius: 3px; }
.msg-them { border-bottom-left-radius: 3px; }
.msg.is-new { box-shadow: 0 0 0 2px var(--action); }
.msg-system { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 14px 0; }
.msg-system time { margin-left: 4px; }
.reply { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; }
.reply textarea { margin-bottom: 12px; }
.reply-row { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.reply-row label:first-child { flex: 0 1 260px; }
.reply-row .btn { margin-left: auto; }
.closed-note { text-align: center; margin-top: 18px; }

.foot { font-size: 14px; color: var(--ink-soft); padding-bottom: 32px; }

/* ---------- espace atelier ---------- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 4px; }
.tabs a { padding: 7px 14px; border-radius: 4px; text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--ink); color: #fff; }
.search { display: flex; gap: 8px; flex: 1 1 340px; max-width: 480px; }
.search input { margin: 0; }

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.list { width: 100%; border-collapse: collapse; min-width: 720px; }
.list th { text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list td { padding: 10px 14px; border-bottom: 1px solid #edf0f3; vertical-align: top; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f5f8fb; }
.list tr.has-unread td:first-child { box-shadow: inset 4px 0 0 var(--action); }
.list a { font-weight: 700; text-decoration: none; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 6px; border-radius: 999px; background: var(--action); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }

.ticket-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.ticket-head p { margin: 0; }
.ticket-head h1 { margin: 2px 0 4px; }
.link-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: start; }
.link-box form { margin: 0; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .ticket-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- v2 : état du lien, dossier clôturé ---------- */
.link-state {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-s);
  padding: 8px 14px; margin-bottom: 16px; font-size: 14px;
}
.link-state p { margin: 0; color: var(--ink-soft); }
.link-state form { display: flex; align-items: center; gap: 10px; margin: 0; }
.closed-note { text-align: left; margin-top: 18px; border-left: 4px solid var(--closed); }
.closed-note h2 { color: var(--closed); }
.closed-note p { margin: 0 0 8px; }

/* ---------- suppression manuelle ---------- */
.danger { border-color: #e6c3b5; }
.danger summary { cursor: pointer; font-weight: 700; color: #8a2c0b; }
.danger p { font-size: 14px; color: var(--ink-soft); }
.btn-danger { background: #a3290a; }

/* ---------- rappel, consultations, facturation ---------- */
.callback { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); padding: 12px 16px; }
.callback summary { cursor: pointer; font-weight: 700; }
.callback-in { padding-top: 10px; }
.callback-in p { font-size: 15px; }
.callback-done { margin-top: 14px; font-size: 14px; color: var(--ink-soft); }

.callback-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: #fbe9e2; border-left: 4px solid var(--action); border-radius: var(--radius-s);
  padding: 10px 14px; margin-bottom: 12px;
}
.callback-banner p { margin: 0; }
.callback-banner form { margin: 0; }
.callback-banner .btn { background: var(--action); }

.seen-line { font-size: 14px; color: var(--ink-soft); margin: 0 0 14px; }
.seen-no { color: var(--action); font-weight: 600; }
.seen-ok { color: var(--ready); font-weight: 600; }

.msg-private {
  text-align: center; font-size: 13px; color: #6b5b95; margin: 12px 0;
  background: #f1eefa; border-radius: 999px; padding: 4px 12px; display: block;
}
.msg-private time { color: var(--ink-soft); margin-left: 6px; }

.badge-call { background: var(--action); }
.badge-bill { background: var(--wait); }

.money .stf { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 14px 0 6px;
  border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.money .stf dt { color: var(--ink-soft); }
.money .stf dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.money .stf .stf-total { font-size: 18px; font-weight: 800; color: var(--ink); }

.invoice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 16px 20px; margin-bottom: 12px; }
.invoice h2 { margin: 0 0 2px; }
.invoice p { margin: 2px 0; }
.invoice .todo { color: var(--action); font-weight: 600; }
.invoice form { margin: 0; }

.logout { margin: 0; }
.logout button { background: none; border: 0; padding: 0; color: #aab6c3; font: inherit; cursor: pointer; }
.logout button:hover { color: #fff; }

/* ---------- fermeture exceptionnelle ---------- */
.closure-banner {
  background: #fff4e5; border: 2px solid var(--action); color: #5c2a05;
  border-radius: var(--radius-m); padding: 14px 18px; margin: 0 0 18px;
}
.closure-banner strong { color: var(--action); font-size: 17px; }
.closure-banner p { margin: 8px 0 0; }
.closure-admin { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 10px 16px; }
.closure-admin a { font-weight: 700; color: var(--action); }
.nav a.nav-alert { color: #ffb489; font-weight: 700; }
.closure-on { border: 2px solid var(--action); }
.closure-on h2 { color: var(--action); }
.closure-on blockquote { margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--line); background: var(--paper); border-radius: 4px; }
.closure-preview { background: var(--paper); border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px; }
.closure-preview p { margin: 4px 0; }
.closure-preview code { font-size: 13px; white-space: normal; word-break: break-word; }

/* ---------- v7 : comptes, clients, modèles, IA, photos, rapport ---------- */
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
form.inline select, form.inline input { width: auto; margin: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .cols-2 { grid-template-columns: 1fr; } }
.users tr.is-off td { opacity: .55; }
.add-user { margin-top: 18px; }
.add-user h2 { margin: 0; }

.client-finder { position: relative; background: var(--paper); border-radius: var(--radius-s); padding: 10px 12px; }
.client-results { position: absolute; left: 12px; right: 12px; z-index: 5; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: 0 8px 20px rgba(0,0,0,.12); padding: 4px; max-height: 320px; overflow: auto; }
.client-results p { margin: 6px 8px; }
.client-hit { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 4px; padding: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.client-hit:hover, .client-hit:focus { background: #eef4fb; }
.client-hit small { display: block; color: var(--ink-soft); }
.client-picked { margin: 8px 0 0; }

.reply-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.reply-tools select { width: auto; margin: 0; max-width: 100%; }
.ai-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ai-row input { margin: 0; font-size: 14px; }
.ai-row .btn { white-space: nowrap; }

.template-head { display: flex; gap: 8px; align-items: center; }
.template-head input { margin: 0; font-weight: 700; }
.template-tools { display: flex; gap: 4px; }
.template-actions { display: flex; justify-content: space-between; align-items: center; }

.report-box { margin-top: 18px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.report-head h2 { margin: 0; }
.report-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.report-public .report-text { white-space: normal; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.photo-grid figcaption { font-size: 11px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.photo-grid .linklike { font-size: 11px; }

.export { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; font-size: 14px; }
.export label { font-weight: 400; }
.export input { width: auto; margin: 0; display: inline-block; }
.danger-inline { border-color: #e6c3b5; }

/* ---------- pièces jointes des échanges ---------- */
.file-pick { font-weight: 600; font-size: 14px; margin: 0 0 12px; }
.file-pick input[type=file] { display: block; margin-top: 4px; font: inherit; font-size: 14px; max-width: 100%; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att { display: flex; flex-direction: column; gap: 2px; }
.att-img img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: #fff; }
.att-pdf { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; text-decoration: none; color: var(--ink); max-width: 240px; }
.att-pdf small { display: block; color: var(--ink-soft); font-size: 12px; }
.att-pdf span:last-child { overflow: hidden; text-overflow: ellipsis; word-break: break-word; font-size: 14px; }
.att-icon { flex: none; background: #b3261e; color: #fff; font-weight: 800; font-size: 11px; border-radius: 4px; padding: 6px 5px; }
.att-del { font-size: 12px; }
@media (max-width: 420px) { .att-img img { width: 96px; height: 96px; } }

/* ---------- demandes en ligne ---------- */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.request-intro p { color: var(--ink-soft); }
.request-form .choice label { display: flex; margin: 0 0 6px; }
.small { font-size: 13px; }
.request-done { text-align: left; }
.new-request { margin-top: 26px; }
.request-head h2 { margin: 2px 0 4px; }
.request-head p { margin: 0 0 2px; }
.request-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 12px; }
.refuse summary { list-style: none; display: inline-block; }
.refuse summary::-webkit-details-marker { display: none; }
.refuse[open] { flex-basis: 100%; }
.refuse form { margin-top: 10px; }
.request-origin { background: #eef4fb; border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 4px; margin: 0; }

/* =====================================================================
   v9 — Interface rafraîchie
   Barre blanche, menu avec page active, statuts en pastilles teintées,
   surfaces calmes. Seul élément décoratif : l'étiquette kraft du logo,
   écho de l'étiquette de la page client.
   ===================================================================== */
:root {
  --canvas: #f2f4f7;
  --ink: #17212b;
  --ink-soft: #5d6b7a;
  --line: #e3e8ee;
  --line-strong: #d3dae2;
  --accent: #1f5fa6;
  --accent-soft: #e8f0fa;
  --radius-s: 8px;
  --radius-m: 12px;
}
body { background: var(--canvas); color: var(--ink); }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }

/* ---------- en-tête ---------- */
.topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { min-height: 60px; gap: 18px; flex-wrap: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 17px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-tag { width: 24px; height: 24px; flex: none; transform: rotate(-12deg); }
.brand small { display: none; }
.nav { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; align-self: stretch; }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; color: var(--ink-soft); text-decoration: none;
  font-size: 15px; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.nav a.nav-alert { color: #c2410c; }
.nav-side { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.nav-side > a:not(.btn) { color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 550; }
.nav-side > a.on, .nav-side > a:hover { color: var(--ink); }
.logout button { color: var(--ink-soft); font-size: 15px; }
.logout button:hover { color: var(--ink); }
.nav-side .btn { color: #fff; }
.badge { background: #c2410c; font-size: 11.5px; min-width: 19px; padding: 1px 6px; margin-left: 0; }
@media (max-width: 1080px) {
  .topbar-in { flex-wrap: wrap; row-gap: 0; padding-top: 8px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; min-height: 44px; }
  .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 560px) { .nav-side > a:not(.btn), .logout { display: none; } }

/* ---------- boutons, champs ---------- */
.btn { border-radius: var(--radius-s); padding: 10px 16px; font-weight: 600; font-size: 14.5px; line-height: 1.2;
  transition: background-color .15s, box-shadow .15s; }
.btn:hover { filter: none; background: #194f8b; }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { background: #f5f7f9; }
.btn-small { padding: 7px 12px; font-size: 13.5px; }
.btn-danger { background: #b3261e; }
.btn-danger:hover { background: #941f18; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 9px 11px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- surfaces ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px; }
.flash { background: #fff; border: 1px solid var(--line); border-left: 4px solid #1c7348; color: var(--ink); border-radius: var(--radius-s); }
.error { background: #fff; border: 1px solid #f0d2c6; border-left: 4px solid #b3261e; color: #7d1d16; }
main.wrap { padding-top: 26px; }
.is-admin .wrap { max-width: 1240px; }

/* ---------- statuts : pastilles teintées dans l'espace atelier ---------- */
.is-admin .status { font-weight: 650; font-size: 13px; padding: 4px 10px; }
.is-admin .tone-progress { background: #e8f0fa; color: #1f5fa6; }
.is-admin .tone-action   { background: #fdeee6; color: #a8480a; }
.is-admin .tone-wait     { background: #efecf7; color: #5b4b8a; }
.is-admin .tone-ready    { background: #e3f2ea; color: #17663f; }
.is-admin .tone-closed   { background: #eef0f2; color: #5d6670; }
.is-admin .ticket-head h1 .status { vertical-align: 4px; }

/* ---------- onglets ---------- */
.tabs { background: #e9edf1; border: 0; border-radius: 10px; padding: 3px; }
.tabs a { border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.tabs a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(23,33,43,.12); }

/* ---------- listes ---------- */
.table-scroll { border: 1px solid var(--line); border-radius: var(--radius-m); }
.list th { background: #f8f9fb; font-size: 12.5px; font-weight: 650; color: var(--ink-soft); padding: 10px 14px; }
.list td { padding: 12px 14px; font-size: 14.5px; border-bottom-color: #eef1f4; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: #f7f9fc; }
.list tr.has-unread td:first-child { box-shadow: inset 3px 0 0 #c2410c; }
.list tr.has-unread a { color: var(--ink); }

/* ---------- fil des échanges (atelier) ---------- */
.is-admin .msg { border-radius: 14px; box-shadow: none; }
.is-admin .msg-mine { background: #eaf1fa; border-color: #d4e2f3; }
.msg-private { background: #f3f1f9; color: #5b4b8a; border-radius: 8px; }
.msg-system { color: var(--ink-soft); }
.seen-line { font-size: 13.5px; }
.link-state { border-style: solid; border-color: var(--line); background: #fff; border-radius: var(--radius-s); }

/* ---------- page client : étiquette sans œillet, frise aérée ---------- */
.tag { padding: 26px 24px 24px 30px; }
.timeline li { padding-top: 34px; }
@media (max-width: 420px) {
  .tag { padding-left: 24px; }
  .timeline { padding-bottom: 24px; }
  .timeline li.now span { top: 34px; }
}

/* En-tête sur deux lignes : nom + actions, puis le menu. Aucun chevauchement, même avec un nom long. */
.topbar-in { flex-wrap: wrap; row-gap: 0; padding-top: 10px; min-height: 0; }
.brand { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.nav { order: 3; flex-basis: 100%; min-height: 46px; overflow-x: auto; scrollbar-width: none; margin-left: -11px; }
.nav::-webkit-scrollbar { display: none; }
.nav-side { padding-bottom: 2px; }

/* Petites étiquettes dans les listes : teintées, comme les statuts */
.list .badge-call { background: #fdeee6; color: #a8480a; }
.list .badge-bill { background: #efecf7; color: #5b4b8a; }
.list .badge { font-weight: 650; }

/* Mobile : références, téléphones et onglets restent sur une ligne */
.list td:first-child, .list td small, .list .status, .list .badge { white-space: nowrap; }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; }

/* Ligne « réponse au devis » de la fiche, créneaux de rappel */
.quote-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid #a8480a; border-radius: var(--radius-s);
  padding: 8px 14px; margin-bottom: 10px; font-size: 14px; }
.quote-line p { margin: 0; }
.slots label { display: flex; margin: 0 0 8px; font-size: 15px; }

/* ---------- Menu « Plus » de la fiche dossier ---------- */
.link-box { align-items: center; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; display: inline-block; margin-left: 7px; vertical-align: 2px;
  border: 4px solid transparent; border-top: 5px solid currentColor; border-bottom: 0; }
.menu[open] > summary { background: #f2f4f7; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 28px rgba(23,33,43,.14); }
.menu-list form { margin: 0; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: 14.5px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus-visible, .menu-list button:focus-visible { background: #f2f5f9; }
.menu-list form:last-child { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.link-state-note { font-size: 13.5px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 8px 14px; margin: 0 0 12px; }

/* Réponse : l'assistant IA sous la zone de saisie */
.reply .ai-row { margin: -4px 0 14px; }

/* ---------- Logo de la boutique ---------- */
.brand-logo { display: block; height: 54px; width: auto; max-width: 100%; }
.is-public .brand-logo { height: 56px; }
.is-public .topbar-in { padding-bottom: 8px; }
@media (max-width: 560px) { .brand-logo { height: 42px; } .is-public .brand-logo { height: 46px; } }

/* =====================================================================
   Demande en ligne en 3 étapes
   ===================================================================== */
.wizard { padding: 22px 22px 20px; }
.wizard .step { border: 0; margin: 0; padding: 0; min-width: 0; }
.wizard .step + .step { margin-top: 28px; }                     /* sans JavaScript : étapes à la suite */
.wizard-on .step + .step { margin-top: 0; }
.step-title { display: block; width: 100%; font-size: 1.2rem; font-weight: 700; margin: 0 0 16px; padding: 0; outline: none; }
.step-num { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 2px; }

/* Barre de progression (affichée seulement quand les étapes sont actives) */
.wizard-progress { display: none; list-style: none; margin: 0 0 22px; padding: 0; gap: 6px; counter-reset: wz; }
.wizard-on .wizard-progress { display: flex; }
.wizard-progress li { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); padding-top: 10px; position: relative; }
.wizard-progress li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--line); }
.wizard-progress li.done::before, .wizard-progress li.now::before { background: var(--accent); }
.wizard-progress li.now { color: var(--ink); }
@media (max-width: 420px) { .wizard-progress li { font-size: 11.5px; } }

/* Choix du type : grandes cartes faciles à toucher */
.type-cards { display: grid; gap: 10px; }
.type-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line-strong);
  border-radius: 10px; cursor: pointer; font-weight: 400; background: #fff; transition: border-color .15s, background-color .15s; }
.type-card:hover { border-color: #9fb6d1; }
.type-card input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.type-card strong { display: block; font-size: 16px; color: var(--ink); }
.type-card small { display: block; color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.type-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* Boutons Précédent / Suivant */
.step-nav { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.step-nav [data-prev] { margin-right: auto; }
.step-nav [data-next], .step-nav [data-prev] { display: none; }
.wizard-on .step-nav [data-next], .wizard-on .step-nav [data-prev] { display: inline-block; }
.step-nav .btn { padding: 12px 22px; font-size: 15.5px; }

/* Écran final */
.request-done { text-align: center; padding: 30px 24px; }
.request-done p { max-width: 46ch; margin-left: auto; margin-right: auto; }
.done-mark { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: #e3f2ea; position: relative; }
.done-mark::after { content: ""; position: absolute; left: 20px; top: 13px; width: 13px; height: 24px;
  border: solid #1c7348; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.done-ref { font-size: 15px; }
.done-hours { font-weight: 700; font-size: 16px; }


/* =====================================================================
   v13 — Espace atelier : fond plus soutenu pour mieux distinguer
   les bulles de dialogue des lignes d'information
   ===================================================================== */
.is-admin { background: #e2e7ee; }
.is-admin .panel, .is-admin .table-scroll { border-color: #d4dbe4; }

/* Bulles : blanches (client) et bleutées (atelier), avec contour et légère ombre */
.is-admin .msg { background: #fff; border: 1px solid #cfd7e1; box-shadow: 0 1px 2px rgba(23,33,43,.06); }
.is-admin .msg-mine { background: #e1ecf9; border-color: #b9cfea; }

/* Lignes d'information : petites étiquettes centrées, nettement différentes des bulles */
.is-admin .msg-system, .is-admin .msg-private {
  display: table; margin: 12px auto; padding: 4px 14px; border-radius: 999px;
  font-size: 12.5px; line-height: 1.4; text-align: center; box-shadow: none;
}
.is-admin .msg-system { background: #d3dae3; color: #3d4a57; font-weight: 600; }
.is-admin .msg-system time { font-weight: 400; color: #5d6b7a; }
.is-admin .msg-private { background: #ddd6f0; color: #4a3d78; }
.is-admin .msg-private time { color: #6c6390; }
.is-admin .msg.is-new { box-shadow: 0 0 0 2px #a8480a; }


/* v14 — statut « Demande reçue » : neutre, avant le dépôt du matériel */
.tone-neutral { background: #7b8794; }
.is-admin .tone-neutral { background: #eceff3; color: #4d5a67; box-shadow: inset 0 0 0 1px #d3dae2; }

/* =====================================================================
   v17 — Fiche dossier : volets repliables (Informations, Montants, Facturation)
   ===================================================================== */
.fold { padding: 0; }
.fold > summary { list-style: none; cursor: pointer; padding: 15px 20px; display: flex; flex-wrap: wrap;
  align-items: baseline; justify-content: space-between; gap: 4px 12px; border-radius: var(--radius-m); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: #f7f9fc; }
.fold-title { font-weight: 650; font-size: 1.05rem; display: inline-flex; align-items: baseline; gap: 8px; }
.fold-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; position: relative; top: -2px; }
.fold[open] > summary .fold-title::before { transform: rotate(45deg); }
.fold-hint { font-size: 13px; color: var(--ink-soft); }
.fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius-m) var(--radius-m) 0 0; }
.fold[open] > summary .fold-hint { display: none; }
.fold > form { padding: 16px 20px 20px; }
@media (prefers-reduced-motion: reduce) { .fold-title::before { transition: none; } }

/* v19 — adresse et mot de passe */
.zip-city { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px; }
.pw-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.pw-row input { margin: 0 !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pw-field[hidden] { display: none; }

/* =====================================================================
   v21 — Notes privées entre agents
   ===================================================================== */
.reply-mode { display: inline-flex; gap: 4px; background: #e9edf1; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.reply-mode label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  font-weight: 600; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; }
.reply-mode input { position: absolute; opacity: 0; pointer-events: none; }
.reply-mode label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(23,33,43,.12); }
.reply-mode label:has(input[value=note]:checked) { background: #fff7d6; color: #6b5200; }
.reply-mode label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 1px; }
.note-only { display: none; margin: 0; }
.reply.is-note { background: #fffbea; border-color: #ecd98a; }
.reply.is-note textarea { background: #fffdf3; border-color: #e3cf7c; }
.reply.is-note .reply-only { display: none; }
.reply.is-note .note-only { display: block; align-self: center; }
.reply.is-note .btn[type=submit] { background: #8a6d00; }

/* Note dans le fil : bandeau jaune, pleine largeur, nettement distinct des messages au client */
.is-admin .msg-note { max-width: 100%; margin-left: 0; background: #fff7d6; border: 1px dashed #d6b94a;
  box-shadow: none; border-radius: 10px; }
.note-tag { display: inline-block; background: #8a6d00; color: #fff; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; border-radius: 4px; padding: 1px 6px; margin-right: 4px; vertical-align: 1px; }
