/* =====================================================================
   CARLYVIA — interface professionnelle
   Graphite + cobalt, laiton réservé au logo et au compteur partenaire.
   Une seule famille (Archivo), largeurs variables : étendue pour la
   marque et les chiffres-clés, normale pour le texte.
   ===================================================================== */

:root {
  --ink: #14212B;
  --ink-2: #3D4B57;
  --ink-3: #6B7884;
  --line: #D9DFE5;
  --line-2: #E7EBEF;
  --surface: #EEF1F4;
  --card: #FFFFFF;
  --cobalt: #2340C4;
  --cobalt-2: #1A2F92;
  --cobalt-tint: #E6EBFB;
  --brass: #B08D57;

  --venu: #17693E;   --venu-bg: #E2F4EA;
  --nonvenu: #A1261F; --nonvenu-bg: #FBE7E6;
  --confirm: #8A5A00; --confirm-bg: #FFF3D6;
  --reporte: #5B3AA8; --reporte-bg: #EEE8FA;
  --annule: #5A6570;  --annule-bg: #ECEEF0;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 0 rgba(20, 33, 43, .06), 0 1px 3px rgba(20, 33, 43, .06);
  --sidebar: 248px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bottom-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
.flip { transform: rotate(180deg); }

/* ---------------------------------------------------------------- Marque */
.logo { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.logo-mark { width: 32px; height: 32px; }
.logo-word { font-weight: 800; font-stretch: 125%; letter-spacing: .06em; font-size: 19px; }
.logo-xl .logo-mark { width: 56px; height: 56px; }
.logo-xl .logo-word { font-size: 34px; }

/* ---------------------------------------------------------------- Coquille */
.sidebar { display: none; }
.shell { min-height: 100vh; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 16px); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.topbar-mark { color: #fff; }
.topbar-mark .logo-mark { width: 28px; height: 28px; }
.page-title { font-size: 17px; font-weight: 700; font-stretch: 110%; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topsearch { display: none; }
.bell { position: relative; color: inherit; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.bell:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.bell .ic { width: 22px; height: 22px; }
.badge {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--nonvenu); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--ink);
}

.content { padding: 16px; max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-size: 11px; font-weight: 600; min-width: 0;
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.is-active { color: var(--cobalt); }
.bottom-nav a.is-primary span { display: none; }
.bottom-nav a.is-primary .ic {
  width: 52px; height: 52px; padding: 13px; margin-top: -22px;
  border-radius: 50%; background: var(--cobalt); color: #fff; box-shadow: 0 6px 16px rgba(35, 64, 196, .35);
}

@media (min-width: 1024px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 25;
    display: flex; flex-direction: column; background: var(--ink); color: #fff; padding: 22px 14px 14px;
  }
  .sidebar-brand { color: #fff; padding: 0 10px 22px; }
  .sidebar-brand:hover { text-decoration: none; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
    color: #C3CCD4; font-weight: 500;
  }
  .side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
  .side-nav a.is-active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--brass); }
  .side-nav .count { margin-left: auto; background: var(--nonvenu); color: #fff; border-radius: 9px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
  .side-user-id { display: grid; min-width: 0; flex: 1; }
  .side-user-id strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user-id small { color: #93A0AB; font-size: 12px; }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: #2B3A46; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
  .icon-btn { background: none; border: 0; color: #C3CCD4; padding: 6px; border-radius: 6px; cursor: pointer; }
  .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

  .shell { margin-left: var(--sidebar); padding-bottom: 32px; }
  .topbar { background: var(--surface); color: var(--ink); padding: 18px 28px 6px; position: static; }
  .topbar-mark { display: none; }
  .page-title { font-size: 26px; font-weight: 800; font-stretch: 112%; }
  .bell { color: var(--ink-2); }
  .bell:hover { background: var(--line-2); }
  .badge { border-color: var(--surface); }
  .topsearch {
    display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
    border-radius: 999px; padding: 0 14px; height: 40px; width: 320px; color: var(--ink-3);
  }
  .topsearch input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; color: var(--ink); }
  .topsearch:focus-within { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
  .content { padding: 18px 28px; gap: 20px; }
  .bottom-nav { display: none; }
}

/* ---------------------------------------------------------------- Messages */
.flash, .notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.flash { margin: 12px 16px 0; }
@media (min-width: 1024px) { .flash { margin: 12px 28px 0; } }
.flash-success, .notice-ok { background: var(--venu-bg); border-color: #BFE3CE; color: #0F4A2B; }
.flash-error { background: var(--nonvenu-bg); border-color: #F1C4C1; color: #7A1B15; }
.notice-warn { background: var(--confirm-bg); border-color: #F1DDA6; color: #5F3E00; }
a.notice:hover { text-decoration: none; filter: brightness(.98); }
.hint { color: var(--ink-3); font-size: 13.5px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; align-items: center; gap: 12px; max-width: min(92vw, 460px);
  padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(20,33,43,.3);
}
.toast a { color: #fff; font-weight: 700; text-decoration: underline; white-space: nowrap; }
@media (min-width: 1024px) { .toast { bottom: 24px; left: auto; right: 24px; transform: none; } }

/* ---------------------------------------------------------------- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-2); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-danger { background: var(--nonvenu); color: #fff; }
.btn-danger-text { color: var(--nonvenu); }
.btn-venu { background: var(--venu); color: #fff; }
.btn-venu:hover { background: #10532F; }
.btn-nonvenu { background: var(--card); color: var(--nonvenu); border: 2px solid var(--nonvenu); }
.btn-nonvenu:hover { background: var(--nonvenu-bg); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 16px; }
.btn-xl { min-height: 58px; font-size: 17px; padding: 0 22px; border-radius: var(--r); }
.btn-block { width: 100%; }
.btn .ic { width: 20px; height: 20px; }
.btn-xl .ic { width: 24px; height: 24px; }

.toggle {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-3);
}
.toggle.is-on { background: var(--cobalt-tint); color: var(--cobalt); border-color: #BFCBF3; }

/* ---------------------------------------------------------------- Pastilles */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.4;
}
.pill .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.pill-a_venir { background: var(--cobalt-tint); color: var(--cobalt); }
.pill-a_confirmer { background: var(--confirm-bg); color: var(--confirm); }
.pill-client_venu { background: var(--venu-bg); color: var(--venu); }
.pill-client_non_venu { background: var(--nonvenu-bg); color: var(--nonvenu); }
.pill-reporte { background: var(--reporte-bg); color: var(--reporte); }
.pill-annule { background: var(--annule-bg); color: var(--annule); text-decoration: line-through; }
.pill-period-a_regler { background: var(--confirm-bg); color: var(--confirm); }
.pill-period-reglee { background: var(--venu-bg); color: var(--venu); }
.pill-period-en_retard { background: var(--nonvenu); color: #fff; }
.pill-on { background: var(--venu-bg); color: var(--venu); }
.pill-off { background: var(--annule-bg); color: var(--annule); }

/* ---------------------------------------------------------------- Panneaux & KPI */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
fieldset.panel { margin: 0; }
.panel-title { font-size: 16px; font-weight: 700; font-stretch: 108%; padding: 0; margin-bottom: 12px; }
legend.panel-title { float: left; width: 100%; }
legend.panel-title + * { clear: both; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head .panel-title { margin: 0; }
.panel-head a { font-size: 14px; font-weight: 600; }
.sub { font-size: 14px; font-weight: 700; margin: 18px 0 8px; color: var(--ink-2); }
.panel-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel-ink .panel-title { color: #fff; }
@media (min-width: 720px) { .panel { padding: 20px 22px; } }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 20px; }
  .grid-wide-left { grid-template-columns: 1.5fr 1fr; }
}

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1280px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpis-admin { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis-3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important; }
.kpi {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); min-width: 0;
}
a.kpi:hover { border-color: var(--ink-3); text-decoration: none; }
.kpi-label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 800; font-stretch: 115%; line-height: 1.05; letter-spacing: -.01em; }
.kpi-money { font-size: 22px; }
.kpi-small { font-size: 20px; }
.kpi-foot { font-size: 12px; color: var(--ink-3); }
.kpi-good .kpi-value { color: var(--venu); }
.kpi-bad .kpi-value { color: var(--nonvenu); }
.kpi-accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi-accent .kpi-label { color: #AEB9C3; }
a.kpi-accent:hover { border-color: var(--ink); background: #1C2D3A; }

/* ---------------------------------------------------------------- Accueil */
.hello { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.hello h2 { font-size: 24px; font-weight: 800; font-stretch: 112%; }
@media (min-width: 1024px) { .hello h2 { font-size: 30px; } }
.btn-new { width: 100%; }
@media (min-width: 720px) { .btn-new { width: auto; } }

/* ---------------------------------------------------------------- Compteur partenaire (élément signature) */
.partner-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1100px) { .partner-top { grid-template-columns: minmax(340px, 420px) 1fr; gap: 20px; align-items: stretch; } }
.kpis-partner { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; align-content: stretch; }
.kpis-partner .kpi { justify-content: space-between; }

.cluster {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #22384A 0%, var(--ink) 62%);
  color: #fff; border-radius: var(--r-lg); padding: 20px 20px 18px; text-align: center;
}
.cluster-title { font-size: 13px; font-weight: 600; color: #AEB9C3; font-stretch: 110%; letter-spacing: .02em; }
.cluster-gauge { width: min(260px, 80%); margin: 10px auto -58px; overflow: visible; }
.g-track { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 9; stroke-linecap: round; }
.g-fill { fill: none; stroke: var(--brass); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .9s cubic-bezier(.2,.7,.2,1); }
.g-tick { stroke: rgba(255,255,255,.35); stroke-width: 1.5; stroke-linecap: round; }
.cluster-amount { position: relative; font-size: 40px; font-weight: 800; font-stretch: 118%; letter-spacing: -.01em; line-height: 1; }
.cluster-detail { margin-top: 10px; color: #D7DEE4; font-size: 14px; }
.cluster-due { margin-top: 4px; color: #AEB9C3; font-size: 13.5px; }
.cluster-due strong { color: var(--brass); font-weight: 700; }
.cluster-late {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px;
  padding: 8px 10px; border-radius: var(--r-sm); background: rgba(161, 38, 31, .25); color: #FFD2CE; font-weight: 600; font-size: 14px;
}
.cluster-late .ic { width: 16px; height: 16px; }
.cluster-total { margin-top: 10px; font-size: 13.5px; color: #D7DEE4; }
@media (min-width: 1024px) { .cluster-amount { font-size: 46px; } }

/* ---------------------------------------------------------------- Bloc action obligatoire */
.due-block {
  border: 2px solid var(--confirm); background: #FFFBF1; border-radius: var(--r-lg); padding: 14px;
}
.due-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: #5F3E00; margin-bottom: 12px; }
.due-title .ic { color: var(--confirm); }

/* ---------------------------------------------------------------- Cartes RDV (mobile-first) */
.cards { display: grid; gap: 12px; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.rdv-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px;
  display: grid; gap: 12px; box-shadow: var(--shadow);
}
.rdv-card.is-due { border-color: #E7C977; }
.rdv-card-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.rdv-card-time { display: grid; text-align: center; min-width: 58px; padding: 6px 4px; border-radius: var(--r-sm); background: var(--surface); }
.rdv-card-time strong { font-size: 18px; font-weight: 800; font-stretch: 112%; }
.rdv-card-time span { font-size: 11px; color: var(--ink-3); }
.rdv-card-name { font-weight: 700; font-size: 16px; color: var(--ink); }
.rdv-card-body p { font-size: 14px; }
.rdv-card-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rdv-card-links .btn { min-height: 44px; }
.rdv-card-links .btn, .rdv-card-result .btn, .result-actions .btn { white-space: normal; padding: 0 10px; text-align: center; line-height: 1.2; }
.rdv-card-links, .rdv-card-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hello h2, .appt-id h2 { overflow-wrap: anywhere; }
.cards, .grid-2, .partner-top { min-width: 0; }
.grid-2 > *, .partner-top > * { min-width: 0; }
.rdv-card-result { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------------------------------------------------------- Tableaux → cartes */
.table-wrap { overflow-x: auto; margin: 0 -2px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-3);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr[data-href] { cursor: pointer; }
table.data tbody tr:hover { background: #F7F9FA; }
table.data .num { text-align: right; }
table.data .when strong { display: block; font-size: 15px; }
table.data .when span { font-size: 12px; color: var(--ink-3); }
.rowlink { color: var(--ink); font-weight: 600; }
.tel { color: var(--ink); white-space: nowrap; }
tr.is-off td { opacity: .6; }
tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--nonvenu); }
tr.is-void td { text-decoration: line-through; color: var(--ink-3); }
.data-dense td { padding: 8px 10px; font-size: 13px; }
.kv span { display: inline-block; margin: 1px 8px 1px 0; }
.kv b { font-weight: 600; color: var(--ink-3); }
.act { font-weight: 600; }
.act-correction_admin, .act-acces_refuse, .act-connexion_bloquee, .act-avoir_genere, .act-montant_annule { color: var(--nonvenu); }
.act-montant_genere, .act-reglement_valide { color: var(--venu); }

@media (max-width: 719px) {
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px;
  }
  table.data td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.data td::before { content: attr(data-label); color: var(--ink-3); font-size: 12.5px; text-align: left; flex: none; }
  table.data td.num { text-align: right; }
  table.data .when { display: flex; }
  table.data .when strong { display: inline; margin-right: 6px; }
  .panel .table-wrap { margin: 0; }
  tr.is-late { border-left: 4px solid var(--nonvenu) !important; }
}

.empty { display: grid; justify-items: center; gap: 12px; padding: 36px 16px; text-align: center; color: var(--ink-3); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty .ic { width: 32px; height: 32px; }
.count-line { color: var(--ink-3); font-size: 13.5px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--ink-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------------------------------------------------------------- Filtres */
.filters { display: grid; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); text-decoration: none; }
.chip.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters-row select, .filters-row input[type=text], .filters-row input[type=date] {
  height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); padding: 0 10px; max-width: 100%;
}
.filters-row .narrow { width: 120px; }
.field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-3); }
.field-search { flex: 1 1 220px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); padding: 0 10px; color: var(--ink-3); }
.field-search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; color: var(--ink); }
.field-search:focus-within { border-color: var(--cobalt); }
.link-reset { font-size: 14px; font-weight: 600; }

/* ---------------------------------------------------------------- Formulaires */
.stack { display: grid; gap: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field small { font-size: 12.5px; color: var(--ink-3); }
.field small.err, .err { color: var(--nonvenu); font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .note-input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #C7CFD7; border-radius: var(--r-sm);
  background: var(--card); font-size: 16px; /* 16px : pas de zoom iOS */
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .note-input:focus { outline: 0; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
[aria-invalid=true] { border-color: var(--nonvenu) !important; background: #FFFAFA !important; }
.fields { display: grid; gap: 12px; }
.fields-4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) {
  .fields-2 { grid-template-columns: 1fr 1fr; }
  .fields-3 { grid-template-columns: repeat(3, 1fr); }
  .fields-4 { grid-template-columns: repeat(4, 1fr); }
  .field-span2 { grid-column: span 2; }
}
.field-full { grid-column: 1 / -1; display: grid; gap: 8px; justify-items: start; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--cobalt); }
.pw { position: relative; display: block; }
.pw input { padding-right: 48px !important; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 8px; color: var(--ink-3); cursor: pointer; }
.input-suffix { display: flex; align-items: center; gap: 10px; }
.input-suffix input { max-width: 160px; font-size: 22px !important; font-weight: 700; }

/* Formulaire nouveau RDV */
.rdv-form { display: grid; gap: 16px; max-width: 980px; }
.rdv-form .panel { display: grid; gap: 14px; }
.partner-filter { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid #C7CFD7; border-radius: var(--r-sm); font-size: 16px; }
.partner-pick { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); max-height: 264px; overflow-y: auto; padding: 2px; }
.partner-opt input { position: absolute; opacity: 0; pointer-events: none; }
.partner-opt span {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; font-weight: 600; background: var(--card);
}
.partner-opt span .ic { color: var(--ink-3); }
.partner-opt input:checked + span { border: 2px solid var(--cobalt); background: var(--cobalt-tint); color: var(--cobalt); }
.partner-opt input:checked + span .ic { color: var(--cobalt); }
.partner-opt input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.slots { font-size: 14px; background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 6px; }
.slots .busy { display: flex; flex-wrap: wrap; gap: 6px; }
.slots .busy span { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.form-submit { position: sticky; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; }
@media (min-width: 1024px) { .form-submit { bottom: 16px; max-width: 420px; } }
.dup-box { border: 2px solid var(--confirm); background: #FFFBF1; border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 10px; }
.dup-title { display: flex; gap: 8px; align-items: center; font-weight: 700; color: #5F3E00; }
.dup-box ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.success-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--venu-bg); border: 1px solid #BFE3CE; color: #0F4A2B;
}
.success-banner > .ic { width: 28px; height: 28px; background: var(--venu); color: #fff; border-radius: 50%; padding: 5px; }
.success-banner div { display: grid; flex: 1; min-width: 200px; }

/* ---------------------------------------------------------------- Fiche RDV */
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; color: var(--ink-2); width: max-content; }
.back .ic { width: 16px; height: 16px; }
.appt-head {
  display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px;
}
.appt-time { display: grid; text-align: center; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: var(--r); }
.appt-hour { font-size: 26px; font-weight: 800; font-stretch: 118%; line-height: 1.1; }
.appt-day { font-size: 12px; color: #AEB9C3; max-width: 120px; }
.appt-id h2 { font-size: 20px; font-weight: 800; font-stretch: 108%; }
.appt-id p { color: var(--ink-2); }
.appt-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.appt-status small { color: var(--ink-3); }
@media (min-width: 720px) {
  .appt-head { grid-template-columns: auto 1fr auto; padding: 18px 22px; }
  .appt-status { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 4px; }
  .appt-id h2 { font-size: 24px; }
}
.quick-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .quick-actions { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .quick-actions { display: flex; } }
.result-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 12px; }
.result-box.is-due { border: 2px solid var(--confirm); background: #FFFBF1; }
.result-box h2 { font-size: 17px; font-weight: 700; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-actions form { display: grid; gap: 8px; }
.result-actions .btn { width: 100%; }
@media (min-width: 720px) { .result-actions { max-width: 560px; } }
.panel-confirm { border: 2px solid var(--venu); }
.panel-confirm p { margin-bottom: 14px; }
.more-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.action-details { flex: 1 1 100%; }
@media (min-width: 720px) { .action-details { flex: 0 0 auto; } .action-details[open] { flex-basis: 100%; } }
.action-details summary { list-style: none; width: max-content; }
.action-details summary::-webkit-details-marker { display: none; }
.inline-form { display: grid; gap: 10px; margin-top: 10px; padding: 14px; background: var(--surface); border-radius: var(--r); }
@media (min-width: 720px) { .inline-form { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; } }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.comment { background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14.5px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 10px 0; border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-3); }
.timeline li.tl-money::before { border-color: var(--brass); background: var(--brass); }
.timeline time { font-size: 12.5px; color: var(--ink-3); padding-top: 2px; }
.timeline div { display: grid; gap: 2px; font-size: 14px; }
.timeline .note { background: var(--surface); padding: 4px 8px; border-radius: 4px; font-size: 13px; }

/* ---------------------------------------------------------------- Listes compactes */
.updates, .bill-lines, .due-list, .notif-list { list-style: none; margin: 0; padding: 0; }
.updates li a, .updates li > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.updates li:last-child a { border-bottom: 0; }
.updates a:hover { text-decoration: none; background: #F7F9FA; }
.upd-main { display: grid; min-width: 0; font-size: 14px; }
.bill-lines li a { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); color: var(--ink); font-size: 14px; }
.bill-lines li a:hover { text-decoration: none; background: #F7F9FA; }
.due-list li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.1); color: #fff; }
.due-list li a:hover { text-decoration: none; }
.due-list small { display: block; color: #AEB9C3; font-size: 12.5px; }
.due-list strong.late { color: #FFB4AD; }
.due-total { display: flex; justify-content: space-between; padding-top: 12px; color: #AEB9C3; }
.due-total strong { color: var(--brass); font-size: 20px; font-stretch: 112%; }
.period-link { display: inline-block; margin: 2px 6px 2px 0; padding: 2px 8px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; }
.period-link.is-late { background: var(--nonvenu-bg); color: var(--nonvenu); }
.period-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.period-head h2 { font-size: 24px; font-weight: 800; font-stretch: 112%; }
.settle-form { display: grid; gap: 12px; }
@media (min-width: 900px) { .settle-form { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; } }
.panel-settle { border: 2px solid var(--cobalt); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (min-width: 720px) { .row-actions { justify-content: flex-start; } }

.notif-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.notif-list li a { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.notif-list li:last-child a { border-bottom: 0; }
.notif-list li a:hover { background: #F7F9FA; text-decoration: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.is-unread .notif-dot { background: var(--cobalt); }
.is-unread strong { color: var(--ink); }
.notif-body { display: grid; gap: 2px; font-size: 14px; }
.notif-body span { color: var(--ink-3); }
.notif-list time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------------------------------------------------------------- Graphique */
.barchart { width: 100%; height: 190px; }
.bar-total { fill: #C9D2F2; }
.bar-venus { fill: var(--cobalt); }
.barchart-axis { display: grid; grid-template-columns: repeat(14, 1fr); font-size: 11px; color: var(--ink-3); text-align: center; margin-top: 6px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-total { background: #C9D2F2; } .lg-venus { background: var(--cobalt); margin-left: 8px; }
.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter progress { width: 90px; height: 8px; appearance: none; border: 0; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.meter progress::-webkit-progress-bar { background: var(--line-2); }
.meter progress::-webkit-progress-value { background: var(--venu); }
.meter progress::-moz-progress-bar { background: var(--venu); }

/* ---------------------------------------------------------------- Dialogue de confirmation */
dialog.confirm {
  border: 0; border-radius: var(--r-lg); padding: 22px; width: min(92vw, 440px); color: var(--ink);
  box-shadow: 0 20px 60px rgba(20,33,43,.35);
}
dialog.confirm::backdrop { background: rgba(20, 33, 43, .55); }
.confirm-msg { font-size: 17px; font-weight: 700; line-height: 1.35; margin-bottom: 18px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { min-height: 50px; }
dialog.confirm[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* ---------------------------------------------------------------- Connexion */
body.auth { display: grid; min-height: 100vh; background: var(--surface); }
.auth-side { display: none; }
.auth-main { display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px; }
.auth-card { width: min(100%, 420px); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 22px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.auth-card .flash { margin: 0; }
.auth-mobile-logo { color: var(--ink); display: flex; justify-content: center; padding-bottom: 6px; }
.auth-title { font-size: 22px; font-weight: 800; font-stretch: 112%; }
.auth-legal { font-size: 12.5px; color: var(--ink-3); text-align: center; }
@media (min-width: 960px) {
  body.auth { grid-template-columns: 1.1fr 1fr; }
  .auth-side {
    display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; overflow: hidden;
    background: var(--ink); color: #fff; position: relative;
  }
  .auth-tagline { font-size: clamp(28px, 3.2vw, 44px); font-weight: 700; font-stretch: 108%; line-height: 1.12; max-width: 14ch; letter-spacing: -.01em; }
  .auth-road { position: absolute; right: -40px; bottom: -10px; width: 78%; color: rgba(255,255,255,.14); }
  .auth-mobile-logo { display: none; }
}

/* ---------------------------------------------------------------- Erreurs */
body.error-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.error-box { display: grid; justify-items: center; gap: 14px; text-align: center; max-width: 520px; }
.error-code { font-size: 72px; font-weight: 800; font-stretch: 125%; color: var(--line); line-height: 1; }
.error-box h1 { font-size: 22px; }
.error-detail { text-align: left; white-space: pre-wrap; background: var(--card); padding: 12px; border-radius: 8px; font-size: 12px; max-width: 100%; overflow: auto; }

/* ---------------------------------------------------------------- Accessibilité */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .bottom-nav, .topbar-actions, .quick-actions, .result-box, .more-actions { display: none !important; }
  .shell { margin: 0; }
}
