/* =====================================================
   ARIA — Interface SaaS
   ===================================================== */

/* System font stack - no external request */

:root {
  /* Light theme — inspiré Rise CRM, harmonisé clair */
  --bg:           #f4f5f8;
  --surface:      #ffffff;
  --surface-2:    #f8f9fb;
  --sidebar-bg:   #ffffff;
  --header-bg:    #ffffff;
  --card-bg:      #ffffff;

  --border:       #e6e8ee;
  --border-md:    #d4d7df;

  --text:         #1f2330;
  --text-2:       #4a5060;
  --text-3:       #8a90a0;

  --accent:       #5b73e8;
  --accent-hover: #2850f0;
  --accent-dim:   rgba(91,115,232,.10);

  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,.10);
  --orange:       #f5a623;
  --orange-dim:   rgba(245,166,35,.10);
  --blue:         #5b73e8;
  --blue-dim:     rgba(91,115,232,.10);
  --green:        #1fcb8a;
  --green-dim:    rgba(31,203,138,.10);

  --imprimerie:   #0ea5e9;
  --agence:       #8b5cf6;
  --atelier:      #f97316;
  --association:  #1fcb8a;
  --cyan:         #0ea5e9;
  --amber:        #ffc107;

  --sidebar-width:           250px;
  --sidebar-width-collapsed: 64px;
  --header-height:           60px;
  --bottom-nav-height:       60px;

  --radius:        6px;
  --radius-sm:     4px;
  --shadow-sm:     rgba(0,0,0,.03) 0 0 16px 0;
  --shadow:        rgba(0,0,0,.08) 0 4px 24px 0;

  --font-ui:   'Inter', -apple-system, 'system-ui', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

/* ── Dark mode (inspiré Rise CRM) ── */
html[data-theme="dark"] {
  --bg:         #232830;
  --surface:    #2c323b;
  --surface-2:  #353b46;
  --sidebar-bg: #2c323b;
  --header-bg:  #2c323b;
  --card-bg:    #2c323b;

  --border:     #3a414c;
  --border-md:  #4a5260;

  --text:       #c7ccd9;
  --text-2:     #9aa0b0;
  --text-3:     #7a7f8c;

  --accent:       #5b73e8;
  --accent-hover: #7d92f0;
  --accent-dim:   rgba(91,115,232,.18);

  --red-dim:    rgba(239,68,68,.18);
  --orange-dim: rgba(245,166,35,.18);
  --blue-dim:   rgba(91,115,232,.18);
  --green:      #1fcb8a;
  --green-dim:  rgba(31,203,138,.15);

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow:     0 6px 24px rgba(0,0,0,.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 10px; }

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: rgba(0,0,0,.03) 2px 0 8px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo */
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0 .75rem 0 0;
  min-height: 60px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  flex: 1;
}

.sidebar-logo-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  letter-spacing: -.02em;
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  letter-spacing: -.02em;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
}

.sidebar-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1.5rem .3rem;
}

.sidebar-nav-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sidebar-nav-settings {
  font-size: .9rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color .15s;
}
.sidebar-nav-settings:hover { color: var(--accent); }

.sidebar-nav ul { list-style: none; padding: 0 .75rem; }

.sidebar-nav-item a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 12px 24px;
  border-radius: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  transition: background .15s, color .15s;
  height: 48px;
  border-right: 2px solid transparent;
}

.sidebar-nav-item a:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-nav-item a.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 400;
  border-right: 2px solid var(--accent);
}

.sidebar-nav-item a i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

/* Footer user */
.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--sidebar-bg);
}

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: .4rem .5rem;
  transition: background .15s;
}
.sidebar-footer-user:hover { background: var(--bg); }

.sidebar-footer-info { display: flex; flex-direction: column; min-width: 0; }

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #00c48c 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sidebar-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-sub {
  font-size: .7rem;
  color: var(--text-3);
  white-space: nowrap;
}

.sidebar-logout {
  color: var(--text-3);
  text-decoration: none;
  font-size: 1rem;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  padding: .35rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logout:hover { color: var(--accent); background: var(--accent-dim); }

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 2rem 2.25rem;
  padding-top: calc(var(--header-height) + 2rem);
}

.main-content:has(.crm-layout) { padding: 0; }

/* ══════════════════════════════════════════
   CARTES
══════════════════════════════════════════ */
.aria-card {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.aria-card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.aria-card-body { padding: 1.25rem; }

/* Compat dashboard */
.jarvis-card {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .15s;
}
.jarvis-card:hover { box-shadow: var(--shadow); }

/* ── Métriques ── */
.metric-card { text-decoration: none; display: block; }
.metric-card .aria-card-body { text-align: center; padding: 1.25rem 1rem; }
.metric-icon { font-size: 1.3rem; margin-bottom: .35rem; display: block; }
.metric-count { font-size: 1.75rem; font-weight: 700; line-height: 1; margin-bottom: .2rem; color: var(--text); }
.metric-label { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

.struct-imprimerie  { --s-color: var(--imprimerie); }
.struct-agence      { --s-color: var(--agence); }
.struct-atelier     { --s-color: var(--atelier); }
.struct-association { --s-color: var(--association); }
.struct-autre       { --s-color: var(--text-3); }
.struct-total       { --s-color: var(--accent); }
.metric-card .metric-icon,
.metric-card .metric-count { color: var(--s-color); }

/* ══════════════════════════════════════════
   BOUTONS
══════════════════════════════════════════ */
.btn-aria {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--card-bg);
  border: 1px solid var(--border-md);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  padding: .375rem .75rem;
  height: 38px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.5;
}
.btn-aria:hover { background: #f5f5f5; color: var(--text); }
.btn-aria:focus { box-shadow: rgba(0,158,105,.25) 0 0 0 0.2rem; outline: 0; }

.btn-aria-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-aria-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }

.btn-aria-danger  { background: var(--red-dim);    border-color: #fca5a5; color: var(--red); }
.btn-aria-warning { background: var(--orange-dim); border-color: #fcd34d; color: #92400e; }

/* ══════════════════════════════════════════
   FORMULAIRES
══════════════════════════════════════════ */
.form-group-aria { margin-bottom: 1rem; }

.form-label-aria {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: .35rem;
}

.form-input-aria,
input[type="text"].form-input-aria,
input[type="email"].form-input-aria,
textarea.form-input-aria {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-md);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: .375rem .75rem;
  height: 38px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
textarea.form-input-aria { height: auto; }
.form-input-aria:focus { border-color: var(--accent); box-shadow: rgba(0,158,105,.25) 0 0 0 0.2rem; }
.form-input-aria::placeholder { color: var(--text-3); }

/* ══════════════════════════════════════════
   TABLEAUX
══════════════════════════════════════════ */
table.aria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
table.aria-table th {
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
table.aria-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
table.aria-table tr:last-child td { border-bottom: none; }
table.aria-table tbody tr:hover td { background: var(--bg); }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .72rem;
  font-weight: 500;
  padding: .2rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-green  { background: rgba(0,158,105,.1);  color: #007d54; }
.badge-blue   { background: var(--blue-dim);     color: #1d4ed8; }
.badge-orange { background: var(--orange-dim);   color: #92400e; }
.badge-red    { background: var(--red-dim);       color: #b91c1c; }
.badge-gray   { background: var(--bg);            color: var(--text-3); border: 1px solid var(--border); }

.aria-badge {
  display: inline-flex;
  align-items: center;
  font-size: .72rem;
  font-weight: 500;
  padding: .2rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}

/* ══════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.page-subtitle { font-size: .8rem; color: var(--text-3); margin-top: .15rem; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--text-3);
  margin-bottom: .4rem;
}
.breadcrumb a { color: var(--text-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { font-size: .65rem; }

/* ══════════════════════════════════════════
   CONNEXION
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.login-box { width: 100%; max-width: 400px; }

.login-frame {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 2rem; }

.login-logo-mark {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: .75rem;
}

.login-logo-sub { font-size: .85rem; font-weight: 600; color: var(--text-2); }

.login-divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

.btn-login {
  width: 100%;
  background: var(--accent);
  border: none;
  color: white;
  font-family: var(--font-ui);
  font-size: .9rem;
  font-weight: 600;
  padding: .65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  margin-top: .5rem;
}
.btn-login:hover { background: var(--accent-hover); }

.alert-aria-error {
  background: var(--red-dim);
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-size: .825rem;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem;
}

/* ══════════════════════════════════════════
   FLASH / ALERTES
══════════════════════════════════════════ */
.aria-flash {
  background: var(--blue-dim);
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-size: .825rem;
  margin-bottom: .75rem;
  display: flex; align-items: center; justify-content: space-between;
}
.aria-flash-success { background: var(--green-dim); border-color: #6ee7b7; color: #065f46; }

/* ══════════════════════════════════════════
   ONGLETS
══════════════════════════════════════════ */
.aria-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.aria-tab {
  font-size: .825rem;
  font-weight: 500;
  color: var(--text-3);
  padding: .6rem 1rem;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
}
.aria-tab:hover { color: var(--text-2); }
.aria-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════════
   ÉVÉNEMENTS / EMAILS
══════════════════════════════════════════ */
.event-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.event-row:last-child { border-bottom: none; }
.event-row:hover { background: var(--bg); }
.event-time { font-size: .75rem; color: var(--text-3); min-width: 42px; padding-top: 2px; font-weight: 500; }
.event-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.event-title { font-size: .85rem; font-weight: 500; color: var(--text); }
.event-cal { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

.email-row {
  display: flex; gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
  text-decoration: none; color: inherit;
}
.email-row:hover { background: var(--bg); }
.email-row.unread { border-left: 3px solid var(--accent); }
.email-struct-dot { width: 3px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.email-from { font-size: .85rem; font-weight: 600; color: var(--text); }
.email-subject { font-size: .8rem; color: var(--text-2); }
.email-date { font-size: .72rem; color: var(--text-3); white-space: nowrap; }

/* ══════════════════════════════════════════
   BRIEF
══════════════════════════════════════════ */
.brief-md { line-height: 1.7; font-size: .875rem; color: var(--text-2); }
.brief-md h1, .brief-md h2, .brief-md h3 {
  font-size: .82rem; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .05em;
  margin-top: 1rem; margin-bottom: .35rem;
  padding-bottom: .3rem; border-bottom: 1px solid var(--border);
}
.brief-md ul { padding-left: 1.2rem; margin-bottom: .5rem; }
.brief-md li { margin-bottom: .2rem; }
.brief-md strong { color: var(--text); }
.brief-md p { margin-bottom: .4rem; }

/* ══════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════ */
.jarvis-header-line {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.hud-c {
  position: absolute; width: 10px; height: 10px;
  border-style: solid; border-color: var(--border);
}
.hud-c-tl { top: 0; left: 0; border-width: 1px 0 0 1px; }
.hud-c-br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.hud-big { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.hud-label { font-size: .65rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.jarvis-scanline { display: none; }

/* Arcs animés (conservés mais invisibles en light) */
@keyframes arc-spin { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -151; } }
@keyframes arc-spin-rev { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 113; } }
.arc-spin { animation: arc-spin 4s linear infinite; }
.arc-spin-rev { animation: arc-spin-rev 3s linear infinite; }

/* ══════════════════════════════════════════
   SECTION TITLE
══════════════════════════════════════════ */
.section-title {
  font-size: .75rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ══════════════════════════════════════════
   SPINNER / HTMX
══════════════════════════════════════════ */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.spinner-aria {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp .25s ease forwards; }

/* ══════════════════════════════════════════
   MOBILE HEADER / OVERLAY
══════════════════════════════════════════ */
.mobile-header { display: none; }
.aria-nav { display: none; }

.sidebar-close-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--text-3);
  padding: .3rem .4rem; border-radius: var(--radius-sm);
  line-height: 1; transition: color .15s;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { color: var(--text); background: var(--bg); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.3); z-index: 99;
  opacity: 0; transition: opacity .25s;
}
.sidebar-overlay.open { opacity: 1; }
body.sidebar-open { overflow: hidden; }

/* ══════════════════════════════════════════
   CRM LAYOUT
══════════════════════════════════════════ */
.crm-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar CRM */
.crm-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: .75rem .5rem;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scrollbar-width: thin;
}

.crm-main {
  padding: 1.75rem 2rem;
  padding-top: calc(var(--header-height) + 1.25rem);
  min-width: 0;
  background: var(--bg);
}

.crm-nav-sep { height: 1px; background: var(--border); margin: .5rem .25rem; }

.crm-nav-label {
  font-size: .65rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: .3rem .6rem .15rem;
}

.crm-nav-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 400;
  text-decoration: none; color: var(--text-2);
  transition: all .15s;
  margin-bottom: .05rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crm-nav-item:hover { background: var(--bg); color: var(--text); }
.crm-nav-item.active {
  background: var(--crm-color, var(--accent));
  color: #ffffff;
  font-weight: 500;
}
.crm-nav-item.active:hover { filter: brightness(.88); background: var(--crm-color, var(--accent)); color: #ffffff; }

.crm-nav-struct {
  display: flex; align-items: center; gap: .4rem;
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  font-size: .76rem; text-decoration: none; color: var(--text-3);
  transition: all .15s; margin-bottom: .04rem;
}
.crm-nav-struct:hover { color: var(--text-2); background: var(--bg); }
.crm-nav-struct.current { color: var(--crm-color, var(--accent)); font-weight: 600; }

.crm-nav-group { display: block; }

/* Sidebar header / footer dans CRM */
.crm-sidebar-header { padding: .25rem .25rem .5rem; }
.crm-sidebar-footer { padding-top: .25rem; }

/* Cartes et inputs dans CRM */
.crm-layout .aria-card { box-shadow: none; }
.crm-layout .btn-aria { background: var(--card-bg); }

.crm-layout select,
.crm-layout input[type="text"],
.crm-layout input[type="number"],
.crm-layout input[type="date"],
.crm-layout input[type="email"],
.crm-layout input[type="tel"],
.crm-layout textarea {
  background: var(--card-bg);
  border: 1px solid var(--border-md);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .875rem;
  padding: .5rem .75rem;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.crm-layout select:focus,
.crm-layout input:focus,
.crm-layout textarea:focus {
  border-color: var(--crm-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--crm-color, var(--accent)) 10%, transparent);
  outline: none;
}
.crm-layout input::placeholder,
.crm-layout textarea::placeholder { color: var(--text-3); }
.crm-layout select option { background: var(--card-bg); color: var(--text); }

/* Tableaux CRM */
.crm-layout table { color: var(--text); }
.crm-layout th { color: var(--text-3) !important; }
.crm-layout tbody tr:hover td { background: var(--bg) !important; }

/* Onglets CRM */
.crm-layout .aria-tabs { border-bottom-color: var(--border); }
.crm-layout .aria-tab { color: var(--text-3); }
.crm-layout .aria-tab:hover { color: var(--text-2); }
.crm-layout .aria-tab.active {
  color: var(--crm-color, var(--accent));
  border-bottom-color: var(--crm-color, var(--accent));
}

/* Badges dans CRM */
.crm-layout .aria-badge {
  font-size: .68rem; padding: .18rem .55rem;
  border-radius: 99px; font-weight: 500;
}

/* ══════════════════════════════════════════
   MOBILE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .app-layout { flex-direction: column; }

  .mobile-header {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 150;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.1rem;
  }
  .mobile-header-brand {
    display: flex; align-items: center; gap: .5rem; text-decoration: none;
  }
  .mobile-menu-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.4rem; color: var(--text);
    padding: .2rem .4rem; border-radius: var(--radius-sm);
    line-height: 1;
  }

  .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 200; width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.open { pointer-events: auto; }

  .main-content { margin-left: 0; padding: 1rem; padding-top: calc(var(--header-height) + 1rem); width: 100%; }
  .main-content:has(.crm-layout) { padding: 0; }

  .crm-layout { grid-template-columns: 1fr; align-content: start; min-height: 0; }
  .crm-sidebar { height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 0; }
  .crm-sidebar-header, .crm-sidebar-footer { display: none !important; }
  .crm-nav-sep, .crm-nav-label { display: none; }
  .crm-nav-group { display: flex; flex-direction: row; overflow-x: auto; padding: .3rem .5rem; gap: .2rem; border-bottom: 1px solid var(--border); scrollbar-width: none; }
  .crm-nav-group::-webkit-scrollbar { display: none; }
  .crm-nav-item { flex-shrink: 0; font-size: .77rem; padding: .4rem .65rem; margin-bottom: 0; }
  .crm-nav-struct { display: none; }
  .crm-main { padding: 1rem; }

  .dashboard-grid-2 { grid-template-columns: 1fr !important; }
  .dashboard-grid-agenda { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════
   UTILITAIRES — évitent les style="" inline
══════════════════════════════════════════ */

/* Mono font */
.mono { font-family: var(--font-mono); }

/* Couleurs texte */
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-3); }
.text-sub     { color: var(--text-2); }
.text-green   { color: #00e676; }
.text-red     { color: var(--red); }
.text-amber   { color: #f59e0b; }
.text-cyan    { color: #06b6d4; }
.text-purple  { color: #a855f7; }

/* Tailles de texte */
.text-xs  { font-size: .65rem; }
.text-sm  { font-size: .75rem; }
.text-md  { font-size: .85rem; }
.text-lg  { font-size: 1rem; }
.text-xl  { font-size: 1.2rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }
.fw-700   { font-weight: 700; }
.fw-600   { font-weight: 600; }
.fw-500   { font-weight: 500; }
.ls-wide  { letter-spacing: .1em; }
.ls-wider { letter-spacing: .15em; }
.uppercase { text-transform: uppercase; }

/* Flex */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-1   { flex: 1; min-width: 0; }
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: .25rem; }
.gap-sm { gap: .5rem; }
.gap-md { gap: .75rem; }
.gap-lg { gap: 1rem; }
.gap-xl { gap: 1.5rem; }

/* Spacing */
.p-0    { padding: 0; }
.p-sm   { padding: .5rem; }
.p-md   { padding: 1rem; }
.p-lg   { padding: 1.25rem; }
.px-md  { padding-left: 1rem; padding-right: 1rem; }
.py-sm  { padding-top: .5rem; padding-bottom: .5rem; }
.mt-sm  { margin-top: .5rem; }
.mt-md  { margin-top: 1rem; }
.mb-sm  { margin-bottom: .5rem; }
.mb-md  { margin-bottom: 1rem; }
.mb-lg  { margin-bottom: 1.5rem; }

/* Largeur */
.w-full { width: 100%; }

/* Grilles communes */
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3  { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-4  { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: .75rem; }
/* Grid responsive moved to main mobile block */

/* Bordures */
.border-b  { border-bottom: 1px solid var(--border); }
.border-t  { border-top: 1px solid var(--border); }
.rounded   { border-radius: var(--radius); }
.overflow-hidden { overflow: hidden; }

/* Card sections */
.card-section-header {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Barre de progression */
.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}

/* Label mono (étiquette section) */
.label-mono {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-3);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}

/* Statut dot */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.green  { background: #00e676; }
.status-dot.amber  { background: #f59e0b; }
.status-dot.red    { background: #ef4444; }
.status-dot.blue   { background: #0ea5e9; }

/* Tableau simple sans classe */
.table-aria {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.table-aria th {
  padding: .5rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
}
.table-aria td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table-aria tr:last-child td { border-bottom: none; }
.table-aria tbody tr:hover td { background: var(--bg); }

/* ══════════════════════════════════════════
   PRODUCTION — classes dédiées
══════════════════════════════════════════ */
.prod-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.prod-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: .25rem;
}
.prod-kpi-label {
  font-family: var(--font-mono);
  font-size: .6rem;
  color: var(--text-3);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}

/* Type de bouteille */
.type-plate       { color: var(--accent, #00b4d8); }
.type-fines-bulles{ color: #06b6d4; }
.type-petillante  { color: #a855f7; }

/* ══════════════════════════════════════════
   CRM — COMPOSANTS RÉUTILISABLES
══════════════════════════════════════════ */

/* Page header */
.crm-ph       { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.2rem; flex-wrap:wrap; gap:.75rem }
.crm-surtitle { font-size:.82rem; color:var(--text-3); margin-bottom:.3rem; text-transform:none; letter-spacing:0; font-family:inherit; opacity:1 }
.crm-h1       { font-size:1.5rem; font-weight:700; color:var(--text); margin:0; line-height:1.2; letter-spacing:-.01em }
.crm-count    { font-family:var(--font-mono); font-size:.85rem; margin-left:.4rem }

/* KPI grid */
.crm-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:1rem; margin-bottom:1.25rem }
.crm-kpi  {
  position: relative;
  padding: 1.1rem 1.15rem 1.1rem 5rem;
  min-height: 92px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15,17,21,.03);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.crm-kpi:hover { box-shadow: 0 6px 18px rgba(15,17,21,.08); transform: translateY(-1px); }
.crm-kpi-label {
  font-family: var(--font-mono);
  font-size: .6rem;
  color: var(--text-3);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .25rem;
}
.crm-kpi-label > i:first-child {
  position: absolute;
  left: 1rem; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(91,115,232,.12);
  color: var(--accent);
  font-size: 1.4rem !important;
  margin: 0 !important;
}
.crm-kpi-val   { font-size: 1.65rem; font-weight: 700; line-height: 1.15; color: var(--text); }
.crm-kpi-sub   { font-size: .7rem; color: var(--text-3); margin-top: .2rem; }

.crm-kpi-green { border-color: rgba(0,230,118,.25) }
.crm-kpi-green .crm-kpi-val { color:#00e676 }
.crm-kpi-green .crm-kpi-label > i:first-child { background: rgba(0,230,118,.13); color:#00e676; }

.crm-kpi-amber { border-color: rgba(245,158,11,.25) }
.crm-kpi-amber .crm-kpi-val { color: var(--amber) }
.crm-kpi-amber .crm-kpi-label > i:first-child { background: rgba(245,158,11,.13); color: var(--amber); }

.crm-kpi-red   { border-color: rgba(239,68,68,.25) }
.crm-kpi-red   .crm-kpi-val { color:#ef4444 }
.crm-kpi-red .crm-kpi-label > i:first-child { background: rgba(239,68,68,.13); color:#ef4444; }

.crm-kpi-cyan  { border-color: rgba(6,182,212,.25) }
.crm-kpi-cyan  .crm-kpi-val { color: var(--cyan) }
.crm-kpi-cyan .crm-kpi-label > i:first-child { background: rgba(6,182,212,.13); color: var(--cyan); }

/* Filter bar */
.crm-filters { display:flex; gap:.35rem; flex-wrap:wrap; margin-bottom:1rem; align-items:center }
.btn-aria.crm-fb { font-size:.72rem; height:auto; padding:.3rem .65rem; line-height:1.4 }

/* Search bar inside filters */
.crm-search { display:flex; gap:.4rem; flex:1; min-width:200px }

/* List card */
.crm-list    { padding:0 !important; overflow:hidden }
.crm-list-th { padding:.5rem 1rem; border-bottom:1px solid var(--border); display:grid; gap:.5rem; font-family:var(--font-mono); font-size:.65rem; color:var(--text-2); letter-spacing:.1em; text-transform:uppercase; align-items:center }
.crm-list-row { padding:.6rem 1rem; border-bottom:1px solid var(--border); display:grid; gap:.5rem; align-items:center; transition:background .15s }
.crm-list-row:hover { background:var(--bg) }
.crm-list-plain { padding:.6rem 1rem; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:.75rem; transition:background .15s }
.crm-list-plain:hover { background:var(--bg) }
.crm-list-empty  { padding:2rem; text-align:center; font-family:var(--font-mono); font-size:.72rem; color:var(--text-3); letter-spacing:.05em }
.crm-list-footer { padding:.65rem 1rem; display:flex; justify-content:flex-end; gap:2rem; border-top:1px solid var(--border); flex-wrap:wrap }

/* Grid templates for list rows */
.gc-contacts { grid-template-columns:2fr 1.5fr 1fr 1fr 90px }
.gc-devis    { grid-template-columns:100px 2fr 1.5fr 80px 100px 80px 90px }
.gc-factures { grid-template-columns:100px 2fr 1.5fr 80px 80px 100px 80px 90px }

/* Text in list */
.crm-name    { font-size:.82rem; font-weight:600; color:var(--text) }
.crm-sub     { font-size:.68rem; color:var(--text-3) }
.crm-note    { font-size:.72rem; color:var(--text-2) }
.crm-no      { font-family:var(--font-mono); font-size:.7rem }
.crm-amount  { font-family:var(--font-mono); font-size:.78rem; font-weight:600; color:var(--text) }
.crm-amount-lg { font-family:var(--font-mono); font-size:.88rem; font-weight:700 }
.crm-mono-xs { font-family:var(--font-mono); font-size:.65rem; color:var(--text-2) }
.crm-mono-sm { font-family:var(--font-mono); font-size:.72rem; color:var(--text-2) }

/* Avatar initiales */
.crm-avatar { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:.72rem; flex-shrink:0 }

/* Status badge compact */
.crm-badge        { font-family:var(--font-mono); font-size:.65rem; padding:.2rem .5rem; border-radius:2px; display:inline-block; white-space:nowrap; border:1px solid var(--border); background:var(--bg); color:var(--text-2) }
.crm-badge-green  { color:#00e676; background:rgba(0,230,118,.08); border-color:rgba(0,230,118,.3) }
.crm-badge-amber  { color:var(--amber); background:rgba(245,158,11,.08); border-color:rgba(245,158,11,.3) }
.crm-badge-red    { color:#ef4444; background:rgba(239,68,68,.08); border-color:rgba(239,68,68,.3) }
.crm-badge-cyan   { color:var(--cyan); background:rgba(14,165,233,.08); border-color:rgba(14,165,233,.3) }
.crm-badge-gray   { color:var(--text-2); background:var(--bg); border-color:var(--border) }

/* Status dot small */
.crm-dot        { width:6px; height:6px; border-radius:50%; flex-shrink:0; display:inline-block }
.crm-dot-green  { background:#00e676 }
.crm-dot-amber  { background:var(--amber) }
.crm-dot-red    { background:#ef4444 }

/* Section card header */
.crm-card-hd { padding:.65rem 1rem; border-bottom:1px solid var(--border); font-family:var(--font-mono); font-size:.68rem; letter-spacing:.1em; text-transform:uppercase }

/* Progress */
.crm-prog     { height:3px; background:var(--border); border-radius:2px; overflow:hidden }
.crm-prog-bar { height:100%; transition:width .3s }

/* Modal */
.crm-modal { display:none; position:fixed; inset:0; z-index:9000; align-items:center; justify-content:center; background:rgba(0,0,0,.5); backdrop-filter:blur(3px) }
.crm-modal.open { display:flex }
.crm-modal-box    { background:var(--card-bg); border:1px solid var(--border); border-radius:8px; width:100%; max-width:400px; margin:1rem; overflow:hidden }
.crm-modal-box-md { max-width:480px }
.crm-modal-box-lg { max-width:560px }
.crm-modal-hd  { padding:.75rem 1rem; border-bottom:1px solid var(--border); font-family:var(--font-mono); font-size:.72rem; letter-spacing:.06em; display:flex; align-items:center; justify-content:space-between }
.crm-modal-bd  { padding:1rem }
.crm-modal-ft  { display:flex; justify-content:flex-end; gap:.5rem; padding:0 1rem 1rem }
.crm-modal-close { background:none; border:none; color:var(--text-2); font-size:1.2rem; cursor:pointer; line-height:1 }
.crm-modal-close:hover { color:var(--text) }
/* Coins déco sur modals avec couleur CRM */
.crm-modal-box-accent { position:relative; border:1px solid var(--border) }
.crm-modal-box-accent::before { content:; position:absolute; top:-1px; left:-1px; width:12px; height:12px; border-top:2px solid var(--crm-color,var(--accent)); border-left:2px solid var(--crm-color,var(--accent)); border-radius:2px 0 0 0; pointer-events:none }
.crm-modal-box-accent::after  { content:; position:absolute; bottom:-1px; right:-1px; width:12px; height:12px; border-bottom:2px solid var(--crm-color,var(--accent)); border-right:2px solid var(--crm-color,var(--accent)); border-radius:0 0 2px 0; pointer-events:none }

/* Empty state */
.crm-empty       { text-align:center; padding:4rem 2rem }
.crm-empty-icon  { font-size:2.5rem; opacity:.3; margin-bottom:1rem }
.crm-empty-label { font-family:var(--font-mono); font-size:.75rem; color:var(--text-3); letter-spacing:.15em }

/* Projet card */
.crm-proj-card { border-radius:var(--radius); overflow:hidden; transition:all .2s; cursor:pointer; background:var(--card-bg) }
.crm-proj-card:hover { box-shadow:var(--shadow) }
.crm-proj-top  { height:2px }
.crm-proj-body { padding:1rem }

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD — GRILLES RESPONSIVE
══════════════════════════════════════════════════════════════════════ */

.dash-g2   { display:grid; grid-template-columns:1fr 1fr; gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-g3   { display:grid; grid-template-columns:1fr 1fr 1fr; gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-g4   { display:grid; grid-template-columns:repeat(4,1fr); gap:.85rem; margin-bottom:.85rem; align-items:start }
.dash-g5   { display:grid; grid-template-columns:repeat(5,1fr); gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-gprod { display:grid; grid-template-columns:repeat(4,1fr); gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-gmaint { display:grid; grid-template-columns:repeat(3,1fr) 1fr 1fr; gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-gaw    { display:grid; grid-template-columns:repeat(3,1fr) 2fr; gap:.85rem; margin-bottom:1.5rem; align-items:start }
.dash-gasso  { display:grid; grid-template-columns:repeat(4,1fr) 1.5fr; gap:.85rem; margin-bottom:1.5rem; align-items:start }

/* Span full row */
.dash-full { grid-column:1/-1 }

/* Section titre */
.dash-section {
  border-left:3px solid var(--dash-color, var(--accent));
  padding-left:.75rem;
  margin-bottom:.85rem;
  margin-top:.5rem;
}
.dash-section-label {
  font-family:var(--font-mono);
  font-size:.62rem;
  letter-spacing:.15em;
  color:var(--dash-color, var(--accent));
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — BOTTOM NAVIGATION CRM
══════════════════════════════════════════════════════════════════════ */

/* Mobile sub-navigation (hidden on desktop) */
.crm-mobile-subnav { display: none; }

.crm-bottom-nav {
  display: none;
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (≤ 768px)
══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Grilles dashboard ─────────────────────────────────────────── */
  .dash-g2,
  .dash-g3      { grid-template-columns: 1fr !important; }
  .dash-g4,
  .dash-gprod   { grid-template-columns: 1fr 1fr !important; }
  .dash-g5      { grid-template-columns: 1fr 1fr !important; }
  .dash-gmaint  { grid-template-columns: 1fr 1fr !important; }
  .dash-gaw     { grid-template-columns: 1fr 1fr !important; }
  .dash-gasso   { grid-template-columns: 1fr 1fr !important; }
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr !important; }

  /* ── KPI grid ──────────────────────────────────────────────────── */
  .crm-kpis { grid-template-columns: 1fr 1fr !important; gap: .65rem; }
  .crm-kpi  { padding: .8rem .85rem .8rem 4rem; min-height: 78px; }
  .crm-kpi-label > i:first-child { left: .65rem; width: 40px; height: 40px; font-size: 1.15rem !important; border-radius: 10px; }
  .crm-kpi-val { font-size: 1.35rem; }

  /* ── Sections ──────────────────────────────────────────────────── */
  .dash-section { margin-top: 1rem; }

  /* ── En-tête dashboard ─────────────────────────────────────────── */
  .dash-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: .75rem !important;
  }
  .dash-actions {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .25rem;
    flex-wrap: nowrap !important;
  }
  .dash-actions::-webkit-scrollbar { display: none; }
  .dash-actions .btn-aria { flex-shrink: 0; }

  /* ── Cards full width ──────────────────────────────────────────── */
  .crm-main { padding: .75rem; padding-top: calc(var(--header-height) + .5rem); padding-bottom: 5.5rem; }

  /* ── Modals → bottom sheet ─────────────────────────────────────── */
  .modal-overlay { align-items: flex-end; }
  .modal-box {
    border-radius: 16px 16px 0 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* ── Quick actions header ─────────────────────────────────────── */
  .crm-ph { flex-direction: column; align-items: flex-start; }
  .crm-ph-actions { width:100%; overflow-x:auto; scrollbar-width:none; flex-wrap:nowrap !important; }
  .crm-ph-actions::-webkit-scrollbar { display:none; }

  /* ── Mobile sub-navigation (accès rapide en haut) ───────────── */
  /* Subnav sticky : on étend sur toute la largeur avec margin négatif + padding compensé */
  .crm-mobile-subnav {
    display: flex;
    overflow-x: auto;
    gap: .25rem;
    padding: .5rem .75rem;
    margin-left: -.75rem;
    margin-right: -.75rem;
    margin-top: -.75rem;
    margin-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: -webkit-sticky;
    position: sticky;
    top: 56px;
    z-index: 140;
  }
  .crm-mobile-subnav::-webkit-scrollbar { display: none; }
  .crm-mobile-subnav:empty { display: none; }

  .crm-mobile-subnav-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-shrink: 0;
    padding: .4rem .7rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all .15s;
  }
  .crm-mobile-subnav-item i { font-size: .82rem; }
  .crm-mobile-subnav-item:hover { color: var(--text); background: var(--bg); }
  .crm-mobile-subnav-item.active {
    color: var(--crm-color, var(--accent));
    background: color-mix(in srgb, var(--crm-color, var(--accent)) 8%, transparent);
    border-color: color-mix(in srgb, var(--crm-color, var(--accent)) 25%, transparent);
    font-weight: 600;
  }

  /* ── Bottom nav show ───────────────────────────────────────────── */
  .crm-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border);
    z-index: 110;
    padding: .3rem 0 calc(.3rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  }
  .crm-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding: .35rem .25rem;
    text-decoration: none;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: .52rem;
    letter-spacing: .03em;
    border-radius: 6px;
    margin: 0 .2rem;
    transition: color .15s, background .15s;
    min-width: 0;
  }
  .crm-bottom-nav-item i {
    font-size: 1.2rem;
    line-height: 1;
  }
  .crm-bottom-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .crm-bottom-nav-item.active {
    color: var(--crm-color, var(--accent));
    background: var(--crm-color, var(--accent))12;
  }
  .crm-bottom-nav-item:not(.active):hover {
    color: var(--text);
  }

  /* ── Masquer la nav CRM horizontale sur mobile si bottom nav présente */
  .crm-layout .crm-sidebar .crm-nav-group {
    display: none;
  }
  .crm-layout .crm-sidebar {
    border-bottom: none;
    padding: 0;
  }

  /* ══════════════════════════════════════════════════════════════════
     CRM MOBILE GLOBAL — Typographie, tactile, layout
     S'applique à TOUTES les entreprises et pages CRM
  ══════════════════════════════════════════════════════════════════ */

  /* ── Base typographique augmentée ──────────────────────────────── */
  .crm-main { font-size: .92rem; }

  .hud-label { font-size: .78rem !important; letter-spacing: .08em !important; }
  .hud-big   { font-size: 1.6rem !important; }

  .crm-kpi-label { font-size: .72rem; }
  .crm-kpi-sub   { font-size: .75rem; }
  .crm-kpi-val   { font-size: 1.4rem; }

  .crm-surtitle  { font-size: .78rem; }
  .crm-h1        { font-size: 1.35rem; }
  .crm-name      { font-size: .88rem; }
  .crm-sub       { font-size: .75rem; }
  .crm-note      { font-size: .78rem; }
  .crm-no        { font-size: .78rem; }
  .crm-amount    { font-size: .85rem; }
  .crm-amount-lg { font-size: .95rem; }
  .crm-mono-xs   { font-size: .72rem; }
  .crm-mono-sm   { font-size: .78rem; }
  .crm-badge     { font-size: .72rem; padding: .22rem .55rem; }
  .crm-card-hd   { font-size: .75rem; }
  .crm-list-th   { font-size: .72rem; }
  .crm-list-empty { font-size: .78rem; }
  .label-mono    { font-size: .72rem; }
  .prod-kpi-label { font-size: .72rem; }
  .card-section-header { font-size: .75rem; }
  .section-title { font-size: .82rem; }

  .crm-bottom-nav-item { font-size: .62rem; }
  .crm-bottom-nav-item i { font-size: 1.3rem; }

  /* ── Formulaires — zones tactiles 44px min ────────────────────── */
  .form-label-aria { font-size: .88rem !important; margin-bottom: .4rem !important; }

  .form-input-aria,
  input.form-input-aria,
  select.form-input-aria,
  textarea.form-input-aria,
  .crm-layout select,
  .crm-layout input[type="text"],
  .crm-layout input[type="number"],
  .crm-layout input[type="date"],
  .crm-layout input[type="time"],
  .crm-layout input[type="email"],
  .crm-layout input[type="tel"],
  .crm-layout textarea {
    font-size: 1rem !important;
    padding: .6rem .75rem !important;
    min-height: 44px !important;
  }

  .btn-aria {
    font-size: .88rem !important;
    padding: .55rem 1rem !important;
    min-height: 44px !important;
  }
  .btn-aria.crm-fb { font-size: .78rem !important; min-height: 36px !important; }

  input[type="radio"],
  input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
  }

  /* ── Grilles → responsive 1-2 colonnes ────────────────────────── */
  .rpt-grid { grid-template-columns: 1fr 1fr !important; }
  .rpt-2col { grid-template-columns: 1fr !important; }

  /* Inline grids avec 2+ colonnes → stack */
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns: 1fr 340px"],
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns: 1fr 380px"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* 4-col KPIs → 2x2 */
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* 3-col inline → stack */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* CRM list grids → stack on mobile */
  .gc-contacts,
  .gc-devis,
  .gc-factures { grid-template-columns: 1fr !important; gap: .25rem !important; }
  .crm-list-th.gc-contacts,
  .crm-list-th.gc-devis,
  .crm-list-th.gc-factures { display: none; }

  /* ── Tableaux ─────────────────────────────────────────────────── */
  table { font-size: .88rem !important; }
  th { font-size: .72rem !important; }
  th, td { padding: .55rem .5rem !important; }

  /* Overflow horizontal pour les grands tableaux */
  .aria-card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Cards ─────────────────────────────────────────────────────── */
  .aria-card { border-radius: 8px; }
  .crm-kpi { border-radius: 8px; }

  /* ── Inline font-size override (catch-all pour inline styles) ── */
  [style*="font-size:.5"][style*="rem"],
  [style*="font-size: .5"][style*="rem"] { font-size: .72rem !important; }
  [style*="font-size:.6"][style*="rem"]:not([style*="font-size:1.6"]),
  [style*="font-size: .6"][style*="rem"]:not([style*="font-size:1.6"]) { font-size: .78rem !important; }
  [style*="font-size:.7"][style*="rem"]:not([style*="font-size:1.7"]),
  [style*="font-size: .7"][style*="rem"]:not([style*="font-size:1.7"]) { font-size: .85rem !important; }

  /* ── Modals → bottom sheet ─────────────────────────────────────── */
  .crm-modal-box,
  .crm-modal-box-md,
  .crm-modal-box-lg,
  [id^="modal-"] > div:last-child {
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .crm-modal,
  [id^="modal-"] {
    align-items: flex-end !important;
  }

  /* ── Barres de progression plus épaisses ───────────────────────── */
  .progress-bar, .crm-prog { height: 8px; }

  /* ── Charts ────────────────────────────────────────────────────── */
  canvas { max-height: 200px !important; }

  /* ══════════════════════════════════════════════════════════════════
     DEVIS / FACTURES — Formulaire mobile
  ══════════════════════════════════════════════════════════════════ */

  /* Layout principal : sidebar récap sous le formulaire */
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns: 1fr 340px"] {
    grid-template-columns: 1fr !important;
  }

  /* Sidebar récap : plus sticky sur mobile */
  [style*="position:sticky;top:1rem"],
  [style*="position:sticky; top:1rem"] {
    position: static !important;
  }

  /* Lignes devis/factures : card-style */
  .ligne-row {
    display: flex !important;
    flex-direction: column !important;
    gap: .4rem !important;
    padding: .75rem !important;
    padding-right: 2.5rem !important;
    margin-bottom: .65rem !important;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    position: relative;
  }

  .ligne-row .form-input-aria {
    font-size: .92rem !important;
    padding: .5rem .65rem !important;
    min-height: 42px !important;
  }

  /* Champs numériques : garder le grid 3 cols */
  .ligne-fields {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: .35rem !important;
  }

  /* Labels mobiles visibles */
  .ligne-mob-label { display: block !important; }

  .ligne-row .ligne-total {
    font-size: .88rem !important;
    font-weight: 700 !important;
    padding: .4rem .25rem !important;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center !important;
  }

  /* Bouton supprimer → coin haut droit */
  .ligne-row > button[onclick^="removeLigne"],
  .ligne-row > button:last-child {
    position: absolute !important;
    top: .5rem;
    right: .5rem;
    width: 32px !important;
    height: 32px !important;
  }

  /* Entêtes colonnes lignes → masquer */
  [style*="grid-template-columns:1fr 70px 90px 90px 32px"]:not(.ligne-row) {
    display: none !important;
  }

  /* Récap card : ligne TTC bien visible */
  #recap-ttc { font-size: 1.2rem !important; }

  /* Boutons actions pleine largeur */
  .btn-aria[style*="width:100%"] {
    min-height: 48px !important;
    font-size: .92rem !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE TABLETTE (769px – 1024px)
══════════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  .dash-g3      { grid-template-columns: 1fr 1fr; }
  .dash-g5      { grid-template-columns: 1fr 1fr 1fr; }
  .dash-gmaint  { grid-template-columns: 1fr 1fr 1fr; }
  .dash-gaw     { grid-template-columns: 1fr 1fr 1fr; }
  .dash-gasso   { grid-template-columns: 1fr 1fr 1fr; }
  .crm-kpis     { grid-template-columns: repeat(2,1fr) !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   APP HEADER (style Rise CRM)
══════════════════════════════════════════════════════════════════════ */

.app-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 90;
  transition: left .25s ease;
  gap: .5rem;
}

body.sidebar-collapsed .app-header { left: var(--sidebar-width-collapsed); }

.app-header-left,
.app-header-right {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.app-header-spacer { flex: 1 1 auto; }

.app-header-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.app-header-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
}
.app-header-btn.primary {
  color: var(--accent);
}

.app-header-search {
  flex: 0 1 320px;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 .85rem;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.app-header-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .85rem;
  font-family: var(--font-ui);
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .25rem .65rem .25rem .35rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.app-header-user:hover { background: var(--accent-dim); }
.app-header-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .78rem;
}
.app-header-user .name {
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════
   SIDEBAR — mode collapsed (desktop)
══════════════════════════════════════════════════════════════════════ */

.sidebar { transition: width .25s ease; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-width-collapsed); }

body.sidebar-collapsed .sidebar .sidebar-logo-text,
body.sidebar-collapsed .sidebar .sidebar-nav-label,
body.sidebar-collapsed .sidebar .sidebar-nav-item a span:not(.badge),
body.sidebar-collapsed .sidebar .sidebar-nav-item a > *:not(i):not(.badge),
body.sidebar-collapsed .sidebar .sidebar-footer-info,
body.sidebar-collapsed .sidebar .sidebar-nav-settings,
body.sidebar-collapsed .sidebar .sidebar-close-btn,
body.sidebar-collapsed .sidebar [data-collapsed-hide] {
  display: none !important;
}
body.sidebar-collapsed .sidebar .sidebar-nav-item a {
  justify-content: center;
  padding: .55rem;
}
body.sidebar-collapsed .sidebar .sidebar-nav-item a i { font-size: 1.15rem; }
body.sidebar-collapsed .sidebar .sidebar-top { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar .sidebar-footer { padding: .5rem .25rem; flex-direction: column; gap: .35rem; }
body.sidebar-collapsed .sidebar .sidebar-footer-user { justify-content: center; }

/* Toggle thème dans la sidebar (mobile uniquement) */
.sidebar-theme-toggle { display: none; padding: .25rem .75rem 0; margin-top: auto; }
.sidebar-theme-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .65rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card-bg);
  color: var(--text-2); font-size: .8rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-theme-btn:hover { background: var(--bg); color: var(--text); }
.sidebar-theme-btn i { font-size: 1rem; }
@media (max-width: 768px) { .sidebar-theme-toggle { display: block; } }

/* Bouton "Signaler un bug" — épinglé en bas de la sidebar */
.sidebar-bug { margin-top: auto; padding: .6rem .75rem 1rem; position: relative; }
@media (max-width: 768px) { .sidebar-bug { margin-top: 0; } }
.sidebar-bug-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .5rem .65rem; border-radius: 6px;
  border: 1px solid rgba(239,68,68,.25); background: rgba(239,68,68,.06);
  color: #ef4444; font-family: var(--font-mono); font-size: .65rem; letter-spacing: .05em;
  cursor: pointer; transition: background .15s;
}
.sidebar-bug-btn:hover { background: rgba(239,68,68,.13); }
.sidebar-bug-btn i { font-size: .95rem; flex-shrink: 0; }
body.sidebar-collapsed .sidebar .sidebar-bug { padding: .6rem .25rem 1rem; }
body.sidebar-collapsed .sidebar .sidebar-bug-btn span { display: none; }
body.sidebar-collapsed .sidebar .sidebar-bug-btn { padding: .5rem; }
body.sidebar-collapsed .sidebar .sidebar-bug:hover::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: .4rem .65rem; border-radius: 6px; font-size: .78rem; white-space: nowrap;
  z-index: 200; box-shadow: var(--shadow-sm); pointer-events: none;
}

/* Tooltip au hover quand collapsed */
body.sidebar-collapsed .sidebar .sidebar-nav-item { position: relative; }
body.sidebar-collapsed .sidebar .sidebar-nav-item a[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .4rem .65rem;
  border-radius: 6px;
  font-size: .78rem;
  white-space: nowrap;
  z-index: 200;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

/* Décale le main-content quand on a un header desktop */
@media (min-width: 769px) {
  .main-content {
    padding-top: calc(var(--header-height) + .5rem);
  }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV (style Rise CRM)
══════════════════════════════════════════════════════════════════════ */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  z-index: 95;
  padding: 0 .25rem env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.mobile-bottom-nav-inner {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0,1fr);
  align-items: center;
  height: 100%;
  width: 100%;
}
.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: .35rem .25rem;
  font-size: .62rem;
  text-decoration: none;
  color: var(--text-3);
  transition: color .15s;
  min-width: 0;
}
.mobile-bottom-nav a i {
  font-size: 1.2rem;
  line-height: 1;
}
.mobile-bottom-nav a span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mobile-bottom-nav a.active,
.mobile-bottom-nav a:hover { color: var(--accent); }
.mobile-bottom-nav a.active i {
  background: var(--accent-dim);
  border-radius: 8px;
  padding: 4px 10px;
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE LAYOUT
══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .app-header {
    left: 0;
    padding: 0 .5rem;
    height: 56px;
  }
  .app-header-search {
    flex: 1 1 auto;
    height: 36px;
  }
  .app-header-user .name { display: none; }
  .app-header-btn.hide-mobile { display: none; }

  .mobile-bottom-nav { display: block; }

  .main-content {
    padding-top: 60px;
    padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    margin-left: 0 !important;
  }

  /* En mobile, la sidebar reste un drawer (déjà géré par .open) */
  .sidebar { width: 280px; }
  body.sidebar-collapsed .sidebar { width: 280px; }
  body.sidebar-collapsed .app-header { left: 0; }
}

/* ══════════════════════════════════════════════════════════════════════
   USER MENU (dropdown sous l'avatar header)
══════════════════════════════════════════════════════════════════════ */
.app-header-user-wrap, .app-header-quick-wrap { position: relative; }
.quick-menu { min-width: 240px; }
.app-header-user { background: none; border: none; cursor: pointer; font: inherit; }
.app-header-user:hover { background: var(--accent-dim); }
.user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,17,21,.18);
  padding: .35rem 0;
  z-index: 300;
  overflow: hidden;
}
.user-menu.open { display: block; animation: dashFade .15s ease; }
.user-menu-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1rem .7rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
}
.user-menu-head .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
}
.user-menu-name { font-size: .85rem; font-weight: 600; color: var(--accent); }
.user-menu-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 1rem;
  font-size: .8rem; color: var(--text-2);
  text-decoration: none;
  background: none; border: none; width: 100%;
  cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.user-menu-item:hover { background: var(--bg); color: var(--text); }
.user-menu-item i { font-size: .95rem; width: 18px; color: var(--text-3); }
.user-menu-logout { color: var(--text-2); }
.user-menu-sep { height: 1px; background: var(--border); margin: .35rem 0; }
.user-menu-colors {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .35rem;
  padding: .55rem 1rem;
}
.user-color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .12s, border-color .12s;
}
.user-color-swatch:hover { transform: scale(1.1); }
.user-color-swatch.active { border-color: var(--text); }

@media (max-width: 768px) {
  .user-menu {
    position: fixed;
    top: auto;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: .5rem;
    z-index: 250;
    box-shadow: 0 -12px 32px rgba(15,17,21,.22);
  }
  .user-menu-colors { grid-template-columns: repeat(7, 1fr); padding: .75rem 1rem; }
  .user-menu-item { padding: .8rem 1.1rem; font-size: .9rem; }
}

/* ══════════════════════════════════════════════════════════════════════
   MODAL (overlay générique)
══════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, .55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--text-2);
  padding: .15rem .45rem; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1rem 1.1rem; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .75rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
@media (max-width: 768px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { max-width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
}

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD TABS (style Rise CRM)
══════════════════════════════════════════════════════════════════════ */
.dash-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin: 0 0 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem 1rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.dash-tab i { font-size: .9rem; }
.dash-tab:hover { color: var(--text); }
.dash-tab.active {
  color: var(--crm-color, var(--accent));
  border-bottom-color: var(--crm-color, var(--accent));
}
.dash-tab-badge {
  font-family: var(--font-mono);
  font-size: .58rem;
  padding: .1rem .35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
}
.dash-tab.active .dash-tab-badge {
  background: var(--crm-color, var(--accent));
  color: #fff;
  border-color: transparent;
}
.dash-pane { display: none; }
.dash-pane.active { display: block; animation: dashFade .2s ease; }
@keyframes dashFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

