/* Kanttia — Feuille de style web premium (style Vercel / Linear / Raycast) */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Palette Claire Premium (Style Vercel / Linear / Raycast Light) */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface2: #f4f4f5;
  --surface3: #e4e4e7;
  
  --primary: #09090b;
  --primary-dark: #27272a;
  --primary-light: rgba(9, 9, 11, 0.05);
  --primary-glow: rgba(9, 9, 11, 0.15);

  --secondary: #27272a;
  --secondary-light: rgba(39, 39, 42, 0.08);

  --success: #10b981;
  --success-dark: #059669;
  --success-light: rgba(16, 185, 129, 0.1);

  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-light: rgba(245, 158, 11, 0.1);

  --danger: #ef4444;
  --danger-dark: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.1);

  --info: #3b82f6;
  
  --border: #e4e4e7;
  --border-hover: #d4d4d8;
  --border-focus: #09090b;

  --text: #09090b;
  --text-muted: #52525b;  /* AA sur blanc (≈ 6.4:1) */
  --text-dim: #71717a;    /* texte secondaire (≈ 4:1) */

  /* Couleurs catégorielles (data-viz) — source unique, miroir de CHART_COLORS en JS */
  --cat-mo: #6366f1;
  --cat-appros: #10b981;
  --cat-st: #8b5cf6;
  --cat-materiel: #f59e0b;

  --sidebar-bg: #ffffff;
  --sidebar-text: #71717a;
  --sidebar-hover: #f4f4f5;
  --sidebar-active: #09090b;
  --sidebar-active-bg: #f4f4f5;
  --sidebar-border: #e4e4e7;

  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 18px;
  
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --font-sans: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--secondary);
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Accessibilité : anneau de focus clavier visible et cohérent (sans gêner la souris) */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.hidden {
  display: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ---------- APP SHELL ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* Linear-style Sidebar */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
}

.sidebar .logo {
  padding: 24px 20px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--sidebar-border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .logo span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-left: 2px;
}

.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  margin: 3px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 550;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.85;
}
.sidebar nav a svg {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.7;
  transition: all 0.2s ease;
}
.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--text);
  opacity: 1;
}
.sidebar nav a:hover svg {
  opacity: 1;
}
.sidebar nav a.active svg {
  opacity: 1;
  color: var(--primary);
}
.sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--text);
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.sidebar .signout {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar .signout a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted) !important;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.sidebar .signout a:hover {
  color: var(--danger) !important;
  transform: translateX(2px);
}

/* Main Area & Blur Topbar */
.main {
  flex: 1;
  min-width: 0; /* permet au contenu large (tableau pointage) de scroller au lieu d'étirer la page */
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.topbar .user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}
.topbar .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.content {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- KPI CARDS ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.kpi:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.kpi .lbl {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.kpi .val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.kpi .val.sm {
  font-size: 20px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Highlighted KPIs */
.kpi.green {
  border-color: rgba(16, 185, 129, 0.25);
  background: radial-gradient(120px circle at top right, rgba(16, 185, 129, 0.08), transparent), var(--surface);
}
.kpi.green .val {
  color: var(--success);
}
.kpi.red {
  border-color: rgba(239, 68, 68, 0.25);
  background: radial-gradient(120px circle at top right, rgba(239, 68, 68, 0.08), transparent), var(--surface);
}
.kpi.red .val {
  color: var(--danger);
}
.kpi.amber {
  border-color: rgba(245, 158, 11, 0.25);
  background: radial-gradient(120px circle at top right, rgba(245, 158, 11, 0.08), transparent), var(--surface);
}
.kpi.amber .val {
  color: var(--warning);
}

/* Métrique phare du dashboard — point focal « comment va mon entreprise ? » */
.kpi-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-hero.pos { border-left-color: var(--success); }
.kpi-hero.neg { border-left-color: var(--danger); }
.kpi-hero .lbl {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.kpi-hero .hero-val {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi-hero.pos .hero-val { color: var(--success-dark); }
.kpi-hero.neg .hero-val { color: var(--danger-dark); }
.kpi-hero .hero-sub {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-top: 2px;
}
@media (max-width: 600px) {
  .kpi-hero .hero-val { font-size: 32px; }
}

/* ---------- CARDS & TABLES ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}
.card-head h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  padding: 24px;
  overflow-x: auto;
}

/* Toolbars */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar input, .toolbar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: var(--surface2);
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.toolbar .grow {
  flex: 1;
  min-width: 200px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
}
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

.row-num-th {
  width: 32px;
  min-width: 32px;
  color: var(--text-muted);
  font-weight: 500;
  user-select: none;
}
.row-num {
  color: var(--text-muted);
  font-size: 11px;
  padding-right: 8px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: var(--text-muted);
  padding: 52px 24px;
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.01);
}
.empty::before {
  content: "";
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 30% 30%, var(--surface3), var(--surface2));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}

/* Glowing dark badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.icon-btn:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-hover);
  transform: scale(1.05);
}
.icon-btn.del:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

/* ---------- TABS ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tab {
  padding: 12px 18px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface2);
  border-color: var(--border-hover);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.btn-info:hover {
  background: var(--info);
  color: #fff;
  border-color: var(--info);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger-dark);
  transform: translateY(-1px);
}
.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
  background: var(--success-dark);
  transform: translateY(-1px);
}
.btn-light {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-light:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* ---------- MODALS (Glassmorphism) ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: scaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
}
.modal-foot {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Fields & Inputs */
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- SPINNER & TOASTS ---------- */
.spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  margin: 60px auto;
}

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.toast.ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}
.toast.err {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

/* ---------- SIDEBAR GROUPS ---------- */
.nav-group {
  margin-bottom: 24px;
}
.nav-group-title {
  padding: 0 18px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  opacity: 0.8;
}

/* ---------- KANBAN BOARD ---------- */
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.board-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.board-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.board-column {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 500px;
}
.board-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.board-column-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.board-column-header h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.board-column-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}
.board-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: grab;
}
.board-card:active {
  cursor: grabbing;
}
.board-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}
.board-cards.dragover {
  background: var(--surface2);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}
.board-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.board-card-desc {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.board-card-assignee, .board-card-date {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-card-progress {
  background: var(--surface3);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.board-card-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.board-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}
.board-card-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-dim);
  font-size: 12.5px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.01);
}

/* ---------- DOCUMENT CONFIG DOUBLE PANEL ---------- */
.config-container {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}
.config-form-card {
  margin-bottom: 0;
}
.config-preview-card {
  position: sticky;
  top: 88px;
  margin-bottom: 0;
}
.doc-preview {
  background: #ffffff;
  color: #0f1117;
  padding: 24px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1), 0 8px 30px rgba(0,0,0,0.08);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
  transition: all 0.3s ease;
}
.doc-header {
  padding: 12px;
  margin: -24px -24px 16px -24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-size: 12px;
}
.doc-company {
  font-weight: 900;
}
.doc-type {
  opacity: 0.9;
}
.doc-details {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 10px;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  color: #1f2937;
  margin-bottom: 20px;
}
.doc-table th {
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
}
.doc-table td {
  padding: 8px;
  border-bottom: 1px solid #f3f4f6;
}
.doc-footer {
  margin-top: auto;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 9px;
  color: #4b5563;
}
.doc-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 38px;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.04);
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ---------- CHARGES PROGRESS GAUGES ---------- */
.gauge-container {
  margin-bottom: 16px;
}
.gauge-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.gauge-label-row span:first-child {
  color: var(--text);
}
.gauge-bar {
  background: var(--surface3);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}
.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ---------- BOTTOM NAVIGATION BAR ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: none; /* Hidden on desktop */
  justify-content: space-around;
  align-items: center;
  z-index: 998;
  padding: 0 8px;
  box-shadow: 0 -4px 20px rgba(9, 9, 11, 0.04);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  padding: 4px 0;
  position: relative;
}
.bottom-nav-item svg {
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}
.bottom-nav-item:hover svg,
.bottom-nav-item.active svg {
  color: var(--primary);
  transform: translateY(-1px);
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--primary);
}
.bottom-nav-item.active::after {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  margin-top: 1px;
}

/* ---------- BOTTOM SHEET GRAB HANDLE ---------- */
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  margin: 8px auto 16px auto;
  display: none; /* Hidden on desktop */
}

/* ---------- RESPONSIVE ---------- */
@media(max-width: 900px) {
  .bottom-nav {
    display: flex;
  }
  .bottom-sheet-handle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -260px; /* Hidden by default */
    width: 250px;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 30px rgba(9, 9, 11, 0.08);
  }
  .sidebar.open {
    transform: translateX(260px);
  }
  
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
  }
  .sidebar-backdrop.show {
    display: block;
  }

  .main {
    margin-left: 0 !important;
    padding-bottom: 74px !important; /* Space for bottom nav */
  }
  .app {
    flex-direction: column;
  }
  
  /* Topbar with hamburger button */
  .topbar {
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .topbar h1 {
    font-size: 16px;
    flex-grow: 1;
  }
  .topbar .menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
  }
  .topbar .menu-toggle-btn:hover {
    background: var(--surface2);
  }
  .topbar .user span {
    display: none !important; /* Hide name text to avoid clutter */
  }

  /* Horizontal Scrollable Tabs */
  .tabs {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 4px 16px 12px 16px !important;
    margin: 0 -16px 16px -16px !important;
    scrollbar-width: none !important; /* Firefox */
    -webkit-overflow-scrolling: touch !important;
  }
  .tabs::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
  }
  .tabs .tab {
    flex: 0 0 auto !important;
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
  }
  .tabs .tab.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(9, 9, 11, 0.12) !important;
  }

  /* Grid layouts */
  .kpis {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .grid2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .content {
    padding: 16px;
  }

  /* Tables larges non transformées (pointage, lignes) : scroll tactile.
     Les DataTables standard (.sortable-table) deviennent des cartes (voir 768px). */
  .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table:not(.sortable-table) {
    min-width: 600px;
  }

  /* Kanban Board Swipeable columns */
  .board-columns {
    display: grid;
    grid-template-columns: repeat(3, 85vw);
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .board-column {
    scroll-snap-align: start;
    min-height: 450px;
  }

  /* Modals as Native Bottom Sheets */
  .modal-bg {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    margin-top: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 90vh;
    animation: slideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  
  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Document preview double panel */
  .config-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .config-preview-card {
    position: static;
  }
}

@media(max-width: 600px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

/* ===== Help icons & field tooltips ===== */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 800;
  cursor: help;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1;
  border: none;
  font-style: normal;
  font-family: var(--font-sans);
  position: relative;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.help-icon:hover { background: var(--info); color: #fff; }
.help-icon::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  color: #fff;
  font-size: 11.5px;
  font-weight: 400;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 230px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  text-align: left;
  pointer-events: none;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.15s;
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--font-sans);
}
.help-icon::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #18181b;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.help-icon:hover::after, .help-icon:hover::before { opacity: 1; }

/* ===== Modal large (devis / facture multi-lignes) ===== */
.modal-lg {
  max-width: 820px;
  width: 96vw;
}
.modal-lg .modal-body {
  max-height: 72vh;
  overflow-y: auto;
  overflow-x: visible;
}
.modal-lg .modal-body .field label {
  overflow: visible;
}

/* ===== Table lignes articles ===== */
.lignes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lignes-table th {
  padding: 7px 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--surface2);
  border-bottom: 1.5px solid var(--border);
  text-align: left;
}
.lignes-table th.r, .lignes-table td.r { text-align: right; }
.lignes-table td {
  padding: 5px 5px;
  vertical-align: middle;
  border-bottom: 1px solid var(--surface3);
}
.lignes-table tbody tr:last-child td { border-bottom: none; }
.lignes-table input[type="text"],
.lignes-table input[type="number"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.lignes-table input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.lignes-totals {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}
.lignes-totals table {
  font-size: 13px;
  border-collapse: collapse;
  min-width: 270px;
}
.lignes-totals td { padding: 4px 14px; }
.lignes-totals td:last-child { text-align: right; font-weight: 600; }
.lignes-totals tr.ttc { border-top: 2px solid var(--border); }
.lignes-totals tr.ttc td { padding: 9px 14px; font-weight: 800; font-size: 14px; }

/* ===== Tutorial modal ===== */
.tuto-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 4px;
}
.tuto-section {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface3);
}
.tuto-section:last-child { border-bottom: none; }
.tuto-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.tuto-icon svg { display: block; }
.tuto-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.tuto-section p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}
.help-tuto-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 5px 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  margin-left: auto;
}
.help-tuto-btn:hover { color: var(--info); border-color: var(--info); background: rgba(59,130,246,0.05); }

/* ===== Encadré d'aide contextuelle en ligne (helpNote) ===== */
.help-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(59,130,246,0.07);
  border: 1px solid rgba(59,130,246,0.22);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 10px 30px 10px 12px;
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text);
  position: relative;
}
.help-note-ic { color: var(--info); flex-shrink: 0; margin-top: 1px; }
.help-note-body > strong:first-child { display: block; font-size: 12.5px; margin-bottom: 3px; color: var(--info); }
.help-note-body strong { color: var(--info); }
.help-note-body > div { color: var(--text-muted); line-height: 1.55; }
.help-note-body ol, .help-note-body ul { margin: 5px 0 0; padding-left: 18px; }
.help-note-body li { margin-bottom: 3px; }
.help-note-body code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.help-note-x {
  position: absolute; top: 5px; right: 7px;
  background: none; border: none; font-size: 20px; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 4px;
}
.help-note-x:hover { color: var(--danger); }

/* ===== Tutorial — section formules ===== */
/* Exemple pas à pas dans les guides */
.tuto-example {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
}
.tuto-example-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.tuto-steps {
  margin: 0;
  padding-left: 22px;
  counter-reset: tstep;
}
.tuto-steps li {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
  padding-left: 4px;
}
.tuto-steps li:last-child { margin-bottom: 0; }
.tuto-steps li::marker { font-weight: 800; color: var(--info); }
.tuto-example-result {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed rgba(59,130,246,0.3);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--success-dark, #15803d);
}
.tuto-example-result svg { flex-shrink: 0; margin-top: 2px; color: var(--success); }

.tuto-formulas-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}
.tuto-formulas-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.tuto-formula-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  margin-bottom: 8px;
}
.tuto-formula-box:last-child { margin-bottom: 0; }
.tuto-formula-name {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.tuto-formula-expr {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.4;
}
.tuto-formula-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
  font-style: italic;
}

/* ===== Feedback widget flottant ===== */
#fb-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1200;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
  transition: transform .15s, box-shadow .15s, background .15s;
}
#fb-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,.28); }
#fb-fab.active { background: var(--surface3); color: var(--text); }

#fb-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  z-index: 1199;
  width: 320px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  padding: 0 0 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.97);
  transition: opacity .2s, transform .2s;
}
#fb-panel.open { opacity: 1; pointer-events: all; transform: none; }

.fb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.fb-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}
.fb-close:hover { color: var(--text); }

.fb-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
}
.fb-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 6px 0;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.fb-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.fb-hint {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 16px 2px;
  margin: 0;
  line-height: 1.4;
}

#fb-panel textarea,
#fb-panel input[type="email"] {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
}
#fb-panel input[type="email"] { resize: none; margin-top: 6px; }
#fb-panel textarea:focus,
#fb-panel input[type="email"]:focus { outline: none; border-color: var(--primary); }

#fb-panel .btn { margin: 10px 16px 0; width: calc(100% - 32px); }

#fb-status {
  padding: 6px 16px 0;
  font-size: 12.5px;
  min-height: 20px;
}
.fb-success { color: #22c55e; font-weight: 600; }

/* Lien feedback en bas des tutoriels */
.tuto-feedback-row {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tuto-feedback-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tuto-feedback-link:hover { opacity: .8; }

/* Bannière démo (app) */
.demo-banner {
  background: linear-gradient(90deg, rgba(245,158,11,.12), rgba(234,88,12,.08));
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 10px;
  padding: 10px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text);
}
.demo-banner strong { color: #f59e0b; }
.demo-banner button {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.demo-banner button:hover { background: #d97706; }

/* ===== Icônes inline (alignement vertical dans le texte) ===== */
.ico {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}
.card-head h2 .ico { vertical-align: -0.16em; }
.flag-ci {
  display: inline-block;
  vertical-align: -0.18em;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}

/* ===== Accueil personnalisé (dashboard) ===== */
.greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  animation: greetIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes greetIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.greeting-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}
.greeting-sub {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text-muted);
}
.greeting-sub strong { color: var(--text); font-weight: 700; }
.greeting-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  white-space: nowrap;
}

/* ===== Skeleton loaders (chargement premium) ===== */
.sk-wrap { animation: fadeIn 0.2s ease both; }
.sk-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.sk {
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  border-radius: 7px;
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { border-radius: 6px; }
.sk-block { width: 100%; border-radius: 9px; }

/* ===== Bannière démo : icône SVG alignée ===== */
.demo-banner button .ico,
.demo-banner button svg { vertical-align: -0.16em; }

/* ===== Polish formulaires & modals ===== */
/* Chevron custom pour les <select> (cohérence cross-navigateur) */
.field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
.toolbar select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}
/* Icônes inline dans les boutons (alignement) */
.btn svg { flex-shrink: 0; }

@media(max-width: 768px) {
  /* Footer modal : boutons pleine largeur, cible tactile confortable */
  .modal-foot {
    flex-direction: column-reverse;
    gap: 10px;
  }
  .modal-foot .btn {
    width: 100%;
    justify-content: center;
    padding: 13px;
  }
  /* Champs plus grands au doigt (évite le zoom iOS : >=16px) */
  .field input, .field select, .field textarea {
    font-size: 16px;
  }

  /* ===== DataTables → cartes empilées (cœur de la refonte mobile) ===== */
  .sortable-table { min-width: 0 !important; }
  .sortable-table thead { display: none; }                 /* en-têtes inutiles en mode carte */
  .sortable-table,
  .sortable-table tbody,
  .sortable-table tr,
  .sortable-table td { display: block; width: 100%; }
  .sortable-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 4px 14px;
    box-shadow: var(--shadow);
  }
  .sortable-table tr:hover { background: var(--surface); }  /* annule le hover de ligne desktop */
  .sortable-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: 14px;
    white-space: normal;
  }
  .sortable-table td:last-child { border-bottom: none; }
  .sortable-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
    white-space: nowrap;
  }
  /* Numéro de ligne : masqué en mode carte (inutile dans la vue empilée) */
  .sortable-table td.row-num { display: none; }
  /* Cellule numérique : valeur alignée à droite, en mono */
  .sortable-table td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  /* Ligne d'actions : boutons groupés à droite, sans label */
  .sortable-table td.td-actions {
    justify-content: flex-end;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 6px;
  }
  .sortable-table td.td-actions::before { display: none; }
  .sortable-table td.td-actions .actions { display: flex; gap: 8px; }
  /* Cibles tactiles plus grandes pour les boutons d'action dans les cartes */
  .sortable-table td.td-actions .icon-btn { width: 38px; height: 38px; }

  /* Greeting compacté */
  .greeting { margin-bottom: 18px; }
  .greeting-title { font-size: 22px; }
  .greeting-date { font-size: 11.5px; padding: 6px 12px; }

  /* Toolbar (recherche/filtres) : empilée, pleine largeur */
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { width: 100%; flex: 1 1 100%; min-width: 0; }
  .toolbar .grow { min-width: 0; }

  /* Card head : titre + bouton d'ajout sur 2 lignes si besoin */
  .card-head { flex-wrap: wrap; gap: 10px; padding: 16px; }
  .card-head h2 { font-size: 14px; }
  .card-body { padding: 16px; }

  /* FAB feedback : remonté au-dessus de la bottom-nav */
  #fb-fab { bottom: 80px; right: 18px; }
  #fb-panel { bottom: 142px; right: 12px; width: calc(100vw - 24px); max-width: 340px; }

  /* Lignes devis/facture : chaque article devient une mini-carte empilée */
  .lignes-table { min-width: 0 !important; }
  .lignes-table thead { display: none; }
  .lignes-table, .lignes-table tbody, .lignes-table tr, .lignes-table td { display: block; width: 100%; }
  .lignes-table tr.ligne-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--surface2);
    position: relative;
  }
  .lignes-table tr.ligne-row td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0 !important;
  }
  .lignes-table tr.ligne-row td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .lignes-table tr.ligne-row td input {
    flex: 1;
    max-width: none !important;
    min-width: 0 !important;
    text-align: right;
    font-size: 16px;  /* anti-zoom iOS */
  }
  .lignes-table td.l-ht { font-weight: 700; }
  .lignes-table td.l-del-cell { justify-content: flex-end; }
  .lignes-table td.l-del-cell::before { content: ""; }    /* pas de label pour la suppression */
  .lignes-table td.l-del-cell .icon-btn { width: 36px; height: 36px; }

  /* KPI value un peu plus petite */
  .kpi { padding: 16px 18px; }
  .kpi .val { font-size: 24px; }
}

/* ===== Modal de confirmation ===== */
.confirm-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 2px;
}
.confirm-ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.confirm-msg {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

/* ===== Effet Ikea : modale de personnalisation ===== */
.perso-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.perso-spark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light, #eef2ff);
  color: var(--primary, #4f46e5);
}
.perso-lead {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.perso-grid {
  display: flex;
  gap: 20px;
  align-items: stretch;
}
.perso-logo-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 2px dashed var(--border, #e5e7eb);
  border-radius: 12px;
  min-width: 150px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.perso-logo-zone:hover { border-color: var(--primary, #4f46e5); }
.perso-logo-preview {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft, #f9fafb);
  color: var(--text-muted, #9ca3af);
  overflow: hidden;
}
.perso-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.perso-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Logo dans la page Apparence */
.perso-logo-row { grid-column: 1 / -1; }
.perso-logo-row-zone {
  flex-direction: row;
  justify-content: flex-start;
  min-width: 0;
  cursor: default;
}
.perso-logo-row-zone .perso-logo-preview { width: 64px; height: 64px; }
@media (max-width: 600px) {
  .perso-grid { flex-direction: column; }
  .perso-logo-zone { min-width: 0; }
}

/* ===== Effet Ikea « partout » ===== */
/* Marque du client dans la sidebar */
#app-brand.has-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
#app-brand .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface, #fff);
  flex-shrink: 0;
}
#app-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
#app-brand .brand-text b {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#app-brand .brand-text span {
  font-size: 10px;
  color: var(--text-muted, #71717a);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Pastille / accent couleur par chantier */
.ch-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}
.ch-accent {
  display: inline-block;
  width: 5px;
  height: 22px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Carte « Votre espace » — complétion du profil */
.space-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--surface2, #f4f4f5);
  overflow: hidden;
  margin-bottom: 14px;
}
.space-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width .4s ease;
}
.space-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.space-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #e4e4e7);
  background: var(--surface, #fff);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.space-step:hover { border-color: var(--primary); background: var(--primary-light); }
.space-step.done { color: var(--text-muted, #71717a); border-style: dashed; }
.space-step .space-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid var(--border, #e4e4e7);
  color: #fff;
}
.space-step.done .space-check {
  background: var(--success, #10b981);
  border-color: var(--success, #10b981);
}
@media (max-width: 600px) {
  .space-steps { flex-direction: column; }
  .space-step { width: 100%; }
}

/* ===== Onboarding / Welcome plein écran ===== */
.onboarding-active .sidebar,
.onboarding-active .topbar,
.onboarding-active .bottom-nav,
.onboarding-active #fb-fab { display: none !important; }
.onboarding-active .main { margin: 0; }
.onboarding-active .content { padding: 0; max-width: none; }

.ob-wrap {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
  background: var(--surface, #fff);
}
.ob-aside {
  background: linear-gradient(160deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ob-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.01em;
  margin-bottom: 36px;
}
.ob-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.ob-lead {
  font-size: 15px;
  line-height: 1.6;
  opacity: .9;
  margin: 0 0 28px;
}
.ob-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.ob-bullets li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  opacity: .95;
}
.ob-bullets li svg { flex-shrink: 0; opacity: .85; }

.ob-panel {
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
}
.ob-step-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #71717a);
  margin-bottom: 18px;
}
.ob-form .field { margin-bottom: 14px; }
.ob-hint {
  font-size: 12.5px;
  color: var(--text-muted, #71717a);
  text-align: center;
  margin: 14px 0 0;
}

/* Écran de bienvenue (succès) */
.ob-welcome { grid-template-columns: 1fr; place-items: center; }
.ob-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px;
  max-width: 560px;
}
.ob-success-ic {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-light, rgba(16,185,129,.1));
  color: var(--success, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.ob-cta-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 860px) {
  .ob-wrap { grid-template-columns: 1fr; }
  .ob-aside { padding: 40px 28px; }
  .ob-title { font-size: 26px; }
  .ob-panel { padding: 36px 28px; }
  .ob-cta-row { flex-direction: column; width: 100%; }
  .ob-cta-row .btn { width: 100%; }
}

/* ===== En-têtes de tableau triables ===== */
.sortable-table thead th.th-sort {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.sortable-table thead th.th-sort:hover {
  color: var(--text);
  background: var(--surface3);
}
.sort-ind {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: -0.12em;
  color: var(--primary);
}
.sortable-table thead th[data-sort] {
  color: var(--text);
  background: var(--surface3);
}

/* ===== Sous-modules chantier — finition mobile ===== */
@media(max-width: 600px) {
  /* Lignes de saisie (bons de commande / bons de sortie) : empilées et lisibles */
  .bc-line-row, .bs-line-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    margin-bottom: 10px;
  }
  .bc-line-row > *:first-child,
  .bs-line-row > *:first-child {
    grid-column: 1 / -1;   /* désignation sur toute la largeur */
  }
  .bc-line-row input, .bs-line-row input {
    font-size: 16px !important;   /* anti-zoom iOS */
    padding: 9px !important;
  }
}
@media(max-width: 768px) {
  /* Tableaux bruts dans les modals (paiements ST, réserves) : scroll tactile net */
  .modal-body table:not(.sortable-table):not(.lignes-table) {
    display: block;
    width: max-content;
    min-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Matrice de permissions ─────────────────────────────────────────────────── */
.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  user-select: none;
}
.perm-item:hover { background: var(--hover); }
.perm-item input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Ergonomie du Pointage (Paint & Keyboard Navigation) ──────────────────── */
.pt-cell {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 800;
  font-size: 11.5px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.pt-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  z-index: 10;
}
.pt-cell:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  z-index: 11;
  transform: scale(1.1);
}

/* Styles pour la barre d'outils Pointage */
.btn-pt-tool {
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-pt-tool:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: var(--surface2);
}
.btn-pt-tool.active {
  border-width: 2px;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  transform: scale(0.96);
}

/* En-têtes cliquables pour sélection de colonne */
.pt-col-header {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-radius: 4px;
}
.pt-col-header:hover {
  background: var(--surface3);
  color: var(--primary);
}

/* Boutons d'action rapide à la ligne */
.pt-row-action {
  cursor: pointer;
  color: var(--text-dim);
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  margin-right: 6px;
}
.pt-row-action:hover {
  opacity: 1;
  color: var(--primary);
}

