/* ===========================================================================
   Radarcheck — Saraïlis avocats
   Palette papier chaud + Fraunces / Inter / DM Mono (continuité Profit First & RADAR)
   =========================================================================== */

:root {
  --paper:        #FAF8F3;
  --paper-2:      #F2EEE5;
  --card:         #FFFFFF;
  --ink:          #1C1B19;
  --ink-soft:     #4A463F;
  --ink-faint:    #8A8579;
  --line:         #E4DED1;
  --line-strong:  #D6CFBE;

  /* sémantique KPI */
  --sage:   #5B8C7A;  /* facturable / positif */
  --sage-bg:#E7F0EB;
  --slate:  #64748B;  /* non facturable / neutre */
  --slate-bg:#EAEDF1;
  --amber:  #C28A3E;  /* occupation / attention */
  --amber-bg:#F6ECD9;
  --terra:  #B85C5C;  /* alerte / écart */
  --terra-bg:#F6E4E1;
  --navy:   #2B3A4A;  /* structure */

  /* Accents de la page de connexion (alignés sur l'app Académie) */
  --login-wine:  #7a1e30;
  --login-coral: #cf6249;
  --login-label: #6c6960;
  --login-muted: #8d897f;

  --radius:   14px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(28,27,25,.04), 0 8px 24px rgba(28,27,25,.05);
  --shadow-lg:0 12px 40px rgba(28,27,25,.12);

  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:    "DM Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; }

a { color: var(--navy); }

button { font-family: inherit; cursor: pointer; }

.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.hidden { display: none !important; }

/* ---- Boutons ------------------------------------------------------------ */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--navy); }
.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: #1f2b37; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-2); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-danger { color: var(--terra); border-color: var(--terra); background: transparent; }
.btn-danger:hover { background: var(--terra-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Champs ------------------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 500; }
input, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--sage); outline-offset: -1px; border-color: var(--sage); }
input.num { font-family: var(--font-mono); text-align: right; }

/* =========================================================================
   ÉCRAN DE CONNEXION
   ========================================================================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 0, #1d2026 0, #16181d 60%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  border: none;
  border-radius: 16px;
  box-shadow: 0 30px 80px -28px rgba(0, 0, 0, .6);
  padding: 36px 32px;
}
.login-card .brand { display: flex; align-items: center; justify-content: center; gap: 13px; margin-bottom: 26px; }
.login-card h1 { font-size: 26px; }
.login-card .sub { color: var(--ink-faint); font-size: 13px; margin-top: 2px; }
.login-card .field { margin-bottom: 16px; }
.login-error {
  background: var(--terra-bg);
  color: var(--terra);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Élément signature : balayage radar */
.radar-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  position: relative;
  flex: none;
  background:
    radial-gradient(circle, transparent 0 30%, rgba(91,140,122,.10) 31% 32%, transparent 33%),
    radial-gradient(circle, transparent 0 60%, rgba(91,140,122,.10) 61% 62%, transparent 63%);
  border: 1.5px solid var(--sage);
  overflow: hidden;
}
.radar-mark::before {
  content: "";
  position: absolute; inset: -2px;
  background: conic-gradient(from 0deg, rgba(91,140,122,.55), transparent 70%);
  animation: sweep 3.4s linear infinite;
}
.radar-mark::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px; margin: -2.5px;
  background: var(--sage); border-radius: 50%;
}
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .radar-mark::before { animation: none; }
}

/* =========================================================================
   STRUCTURE APPLICATION
   ========================================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 26px;
  background: rgba(250,248,243,.86);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 11px; }
.topbar .brand h1 { font-size: 19px; }
.topbar .brand .tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-faint); text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.topbar .who { text-align: right; line-height: 1.25; }
.topbar .who .name { font-size: 13px; font-weight: 600; }
.role-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  background: var(--slate-bg); color: var(--slate);
}
.role-admin   { background: var(--amber-bg); color: var(--amber); }
.role-accounting { background: var(--sage-bg); color: var(--sage); }

.nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 61px; z-index: 40;
}
.nav button {
  border: none; background: none;
  padding: 13px 14px;
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.nav button:hover { color: var(--ink); }
.nav button.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }

.view { max-width: 1140px; margin: 0 auto; padding: 30px 26px 80px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head h2 { font-size: 28px; }
.view-head .controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.view-head .controls > div { min-width: 130px; }

/* =========================================================================
   CARTES KPI
   ========================================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.kpi .label { font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }
.kpi .value { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
.kpi .value .unit { font-family: var(--font-body); font-size: 15px; color: var(--ink-faint); font-weight: 500; margin-left: 3px; }
.kpi .sub { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); }
.kpi .spark { height: 34px; margin-top: 6px; }
.kpi.accent-sage  { border-top: 3px solid var(--sage); }
.kpi.accent-slate { border-top: 3px solid var(--slate); }
.kpi.accent-amber { border-top: 3px solid var(--amber); }
.kpi.accent-terra { border-top: 3px solid var(--terra); }
.kpi.accent-navy  { border-top: 3px solid var(--navy); }

.section { margin-top: 34px; }
.section > h3 { font-size: 19px; margin-bottom: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px;
}
.chart-box { position: relative; height: 280px; }

/* =========================================================================
   TABLEAUX
   ========================================================================= */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }
td.num, th.num { text-align: right; font-family: var(--font-mono); }
tr:last-child td { border-bottom: none; }
td input { padding: 6px 8px; }
.row-archived td:first-child { color: var(--ink-faint); }
.tag-archived { font-family: var(--font-mono); font-size: 10px; color: var(--terra); background: var(--terra-bg); padding: 1px 6px; border-radius: 999px; margin-left: 8px; letter-spacing: .05em; }

.table-scroll { overflow-x: auto; }
.entry-table th, .entry-table td { white-space: nowrap; }
.entry-table input { width: 92px; }

/* ---- Barres de progression objectifs ------------------------------------ */
.goal { margin-bottom: 18px; }
.goal .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.goal .top .g-label { font-weight: 600; font-size: 14px; }
.goal .top .g-val { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); }
.bar { height: 12px; background: var(--paper-2); border-radius: 999px; position: relative; overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.bar .fill-sage { background: var(--sage); }
.bar .fill-slate { background: var(--slate); }
.bar .fill-amber { background: var(--amber); }
.bar .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--navy); }
.goal .meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-faint); margin-top: 5px; font-family: var(--font-mono); }

/* =========================================================================
   MODALE
   ========================================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28,27,25,.42);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 520px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow: auto;
}
.modal-head { padding: 20px 24px 0; }
.modal-head h3 { font-size: 21px; }
.modal-body { padding: 18px 24px; }
.modal-foot { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---- Toast -------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--terra); }

/* ---- Divers ------------------------------------------------------------- */
.empty { text-align: center; color: var(--ink-faint); padding: 50px 20px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .view-head h2 { font-size: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .nav { padding: 0 10px; }
  .view { padding: 22px 16px 70px; }
}

/* ---- En-tête de section avec action (ex. import PDF) -------------------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.section-head h3 { font-size: 19px; margin: 0; }

/* ---- Modale large (aperçu d'importation) ------------------------------- */
.modal.modal-wide { max-width: 760px; }

/* ---- Encadré d'avertissement ------------------------------------------- */
.warn-box {
  background: var(--amber-bg); border: 1px solid var(--amber);
  color: var(--ink-soft); border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 13.5px; line-height: 1.5; margin-bottom: 14px;
}
.warn-box strong { color: var(--ink); }
.uEmail { width: 100%; }

/* ---- Logo Saraïlis avocats --------------------------------------------- */
.brand-logo { display: block; width: auto; }

/* Page de connexion : logo en bandeau, lockup centré */
/* Lockup de marque aligné sur l'app Académie : logo · séparateur · titre */
.brand--login {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: left;
  gap: 13px;
  margin-bottom: 26px;
}
.brand-logo--login { height: 34px; width: auto; display: block; }
.brand--login .brand-sep { width: 1px; height: 34px; background: var(--line-strong); flex-shrink: 0; }
.brand-acad {
  display: flex;
  flex-direction: column;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--login-coral);
  line-height: 1.05;
  text-align: left;
}
.brand-acad small {
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--login-muted);
  font-weight: 600;
  margin-top: 3px;
}

/* Champs et bouton de la carte de connexion (carte claire sur fond sombre) */
#login .login-card label {
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--login-label);
  margin-bottom: 6px;
}
#login .login-card input {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 15px;
  color: var(--ink);
}
#login .login-card input:focus { outline: 2px solid var(--login-wine); outline-offset: 0; border-color: transparent; }
#login .btn-primary {
  background: var(--login-wine);
  border-color: var(--login-wine);
  color: #fff;
  border-radius: 9px;
}
#login .btn-primary:hover { background: #8e2538; border-color: #8e2538; }

/* En-tête de l'application : logo + séparateur + libellé produit */
.topbar .brand { gap: 12px; }
.brand-logo--bar { height: 24px; }
.brand-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--line-strong);
}
.topbar .brand-text h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .brand-logo--bar { height: 21px; }
  .topbar .brand-sep,
  .topbar .brand-text { display: none; }
}

/* ---- Zone de dépôt du relevé PDF --------------------------------------- */
.dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dropzone > * { pointer-events: none; }   /* events ciblent toujours la zone */
.dropzone:hover { border-color: var(--navy); }
.dropzone:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.dropzone.drag {
  border-color: var(--sage);
  border-style: solid;
  background: var(--sage-bg);
  color: var(--ink);
}
.dropzone svg { width: 26px; height: 26px; flex: none; color: var(--ink-faint); }
.dropzone.drag svg { color: var(--sage); }
.dz-text { display: flex; flex-direction: column; line-height: 1.3; }
.dz-text strong { font-weight: 600; font-size: 14px; }
.dz-text span { font-size: 12.5px; color: var(--ink-faint); }

/* ---- Variation période-sur-période (cartes KPI) ------------------------ */
.kpi-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.kpi-delta .dl-arrow { font-size: 11px; }
.kpi-delta .dl {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
}
.kpi-delta.good { color: var(--sage); }
.kpi-delta.bad { color: var(--terra); }
.kpi-delta.neutral { color: var(--slate); }
.kpi-delta.flat,
.kpi-delta.na { color: var(--ink-faint); }

.period-banner {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.period-banner strong { color: var(--ink); font-weight: 600; }

/* ---- Icône d'info sur les tuiles KPI ----------------------------------- */
.kpi .label { display: inline-flex; align-items: center; }
.kpi-i {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  cursor: help;
  outline: none;
}
.kpi-i-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  font-style: normal;
  line-height: 12px;
  text-align: center;
}
.kpi-i:hover .kpi-i-dot,
.kpi-i:focus .kpi-i-dot { border-color: var(--navy); color: var(--navy); }

/* ---- Marque radar dans l'en-tête (taille ajustée) ---------------------- */
.radar-mark--bar { width: 26px; height: 26px; }

/* ---- Saisie hebdomadaire : sélecteur de mode + navigation mensuelle ---- */
.ctrl-slot { display: contents; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 140px; text-align: center; text-transform: capitalize; }
.month-nav .btn-sm { padding: 4px 10px; font-size: 16px; line-height: 1; }
#monthRows .rowState { color: var(--sage); font-weight: 700; }

/* ---- Navigation : groupe déroulant ------------------------------------- */
.nav-group { position: relative; display: inline-flex; }
.nav-group-btn { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.nav-caret { font-size: 10px; transition: transform .15s ease; }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  min-width: 226px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.nav-group.open .nav-dropdown { display: flex; }
.nav-dropdown .nav-sub {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  margin: 0;
  border: none;
  border-bottom: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.nav-dropdown .nav-sub:hover { background: var(--paper-2); color: var(--ink); }
.nav-dropdown .nav-sub.active { background: var(--paper-2); color: var(--navy); font-weight: 600; border-bottom: none; }

/* ---- Tuile KPI en alerte (ex. provision pour taxes insuffisante) ------- */
.kpi.kpi-alert {
  background: var(--terra-bg);
  border-color: var(--terra);
  border-top: 3px solid var(--terra);
}
.kpi.kpi-alert .label,
.kpi.kpi-alert .value,
.kpi.kpi-alert .sub { color: var(--terra); }

/* ---- Avis neutre sur l'écran de connexion (déconnexion auto, etc.) ----- */
.login-note {
  background: var(--paper-2, #F0ECE2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* =========================================================================
   RESPONSIVE — TABLETTE (iPad) & TÉLÉPHONE
   La barre supérieure (12px vertical) et l'offset sticky de la nav (61px)
   restent inchangés pour ne pas désaligner les éléments collés.
   ========================================================================= */

/* ---- Tablette et moins (≤ 1024px : iPad paysage et portrait) ----------- */
@media (max-width: 1024px) {
  .view { padding: 26px 20px 80px; }
  .chart-box { height: 260px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }
  /* 16px sur les champs : empêche le zoom automatique de Safari iOS au focus */
  input, select, textarea { font-size: 16px; }
}

/* ---- iPad portrait et petites tablettes (≤ 820px) ---------------------- */
@media (max-width: 820px) {
  .view-head h2 { font-size: 25px; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
  .modal.modal-wide { max-width: 92vw; }
}

/* ---- Téléphone (≤ 640px) ----------------------------------------------- */
@media (max-width: 640px) {
  /* Barre supérieure : une seule ligne, nom tronqué si trop long */
  .topbar { gap: 10px; }
  .topbar .who .name {
    max-width: 40vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  /* Navigation : onglets un peu plus compacts ; le menu déroulant ne déborde pas */
  .nav { gap: 2px; }
  .nav button, .nav-group-btn { padding: 12px 11px; white-space: nowrap; }
  .nav-dropdown { max-width: calc(100vw - 20px); }

  /* En-tête de vue : titre puis contrôles en pleine largeur */
  .view-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .view-head h2 { font-size: 22px; }
  .view-head .controls { width: 100%; }
  .view-head .controls > div,
  .view-head .controls .ctrl-slot > div { flex: 1 1 150px; min-width: 0; }

  /* KPI : une seule colonne */
  .kpi-grid { grid-template-columns: 1fr; }

  /* Graphiques plus courts pour l'écran vertical */
  .chart-box { height: 220px; }

  /* Tableaux : défilement horizontal + cellules compactes */
  .entry-table th, .entry-table td { padding: 8px 8px; font-size: 13px; }
  .entry-table input { width: 80px; }

  /* Sections et marges resserrées */
  .view { padding: 20px 14px 72px; }
  .section-head h3 { font-size: 17px; }

  /* Modales : marge de sécurité, défilement horizontal des tableaux internes */
  .modal-overlay { padding: 14px; }
  .modal { max-height: 92vh; }
  .modal-head { padding: 16px 18px 0; }
  .modal-head h3 { font-size: 19px; }
  .modal-body { padding: 14px 18px; overflow-x: auto; }
  .modal-foot { padding: 12px 18px 18px; }

  /* Navigation mensuelle (Saisie & Administration) : label plus court */
  .month-nav strong { min-width: 120px; }
}

/* ---- Très petit téléphone (≤ 380px) ------------------------------------ */
@media (max-width: 380px) {
  .topbar { gap: 8px; }
  .topbar .who .name { max-width: 32vw; }
  .month-nav strong { min-width: 100px; }
  .view-head .controls { gap: 8px; }
}

/* ---- Tuile KPI « au vert » (ex. escomptes & mauvaises créances = 0) ---- */
.kpi.kpi-good {
  background: var(--sage-bg);
  border-color: var(--sage);
  border-top: 3px solid var(--sage);
}
.kpi.kpi-good .label,
.kpi.kpi-good .value,
.kpi.kpi-good .sub { color: var(--sage); }

/* ---- Titre RadarCheck avec marque radar à gauche ----------------------- */
.dash-title { display: flex; align-items: center; gap: 13px; }
.radar-mark--title { width: 34px; height: 34px; }

/* ---- Champ en lecture seule (ex. inventaire en saisie hebdomadaire) ---- */
input.ro {
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: default;
  border-style: dashed;
}
input.ro:focus { outline: none; border-color: var(--line-strong); }
