/* ═══════════════════════════════════════════════════════════
   EMMGestion — Feuille de style principale
   Palette : Bleu marine #1a3a6b / Bleu vif #2563eb / Blanc
   ═══════════════════════════════════════════════════════════ */

:root {
  --blue-dark:    #1a3a6b;
  --blue-main:    #2563eb;
  --blue-light:   #3b82f6;
  --blue-pale:    #dbeafe;
  --blue-border:  #bfdbfe;
  --white:        #ffffff;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-400:     #94a3b8;
  --gray-600:     #475569;
  --gray-800:     #1e293b;
  --green:        #16a34a;
  --green-light:  #dcfce7;
  --orange:       #ea580c;
  --orange-light: #ffedd5;
  --red:          #dc2626;
  --red-light:    #fee2e2;
  --purple:       #7c3aed;
  --purple-light: #ede9fe;

  --header-h:     60px;
  --ticker-h:     36px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
  --radius:       8px;
  --radius-lg:    12px;
  --transition:   .2s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Barlow', sans-serif; color: var(--gray-800); background: var(--gray-50); }
a { text-decoration: none; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: .95rem; }

/* ── TICKER (bandeau défilant) ────────────────────────────── */
.ticker-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--ticker-h);
  background: var(--blue-dark);
  display: flex; align-items: center; gap: 12px;
  overflow: hidden;
}
.ticker-label {
  flex-shrink: 0;
  padding: 0 16px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .7rem; font-weight: 700; letter-spacing: .12em;
  color: var(--blue-pale);
  border-right: 1px solid rgba(255,255,255,.15);
  height: 100%; display: flex; align-items: center;
}
.ticker-wrapper {
  flex: 1; overflow: hidden; height: 100%;
  display: flex; align-items: center;
}
.ticker-text {
  display: inline-block;
  white-space: nowrap;
  color: var(--white);
  font-size: .88rem; font-weight: 500;
  animation: ticker-scroll 35s linear infinite;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ── HEADER ───────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: var(--ticker-h);
  left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 2px solid var(--blue-pale);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 0;
  padding: 0 20px;
}
.header-brand { flex-shrink: 0; margin-right: 32px; }
.brand-logo { display: flex; align-items: baseline; gap: 0; line-height: 1; }
.brand-emm {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem; font-weight: 700; letter-spacing: .04em;
  color: var(--blue-dark);
}
.brand-gestion {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem; font-weight: 600; letter-spacing: .04em;
  color: var(--blue-main);
}
.header-nav {
  display: flex; align-items: center; gap: 4px; flex: 1;
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: .88rem; font-weight: 500;
  color: var(--gray-600);
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--blue-pale); color: var(--blue-main); }
.nav-link.active { background: var(--blue-pale); color: var(--blue-dark); font-weight: 600; }
.nav-link svg { width: 16px; height: 16px; }

.header-user {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
}
.user-name { font-size: .88rem; font-weight: 600; color: var(--gray-800); }
.user-role {
  font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 20px; text-transform: uppercase;
}
.user-role.admin { background: var(--blue-dark); color: var(--white); }
.user-role.employe { background: var(--gray-200); color: var(--gray-600); }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 6px;
  color: var(--gray-600);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--blue-pale); color: var(--blue-main); }
.btn-logout:hover { background: var(--red-light); color: var(--red); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  padding: 6px; margin-left: 8px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--gray-600); border-radius: 2px;
  transition: var(--transition);
}

/* ── MAIN LAYOUT ──────────────────────────────────────────── */
.layout-app .app-main {
  margin-top: calc(var(--ticker-h) + var(--header-h));
  min-height: calc(100vh - var(--ticker-h) - var(--header-h));
  padding: 28px 0;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.7rem; font-weight: 700; color: var(--blue-dark);
  letter-spacing: .02em;
}
.page-sub { font-size: .88rem; color: var(--gray-400); margin-top: 2px; }
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem; font-weight: 700; color: var(--blue-dark);
  letter-spacing: .04em; text-transform: uppercase;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue-pale);
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-form { padding: 28px; }
.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem; font-weight: 700; color: var(--blue-dark);
  margin-bottom: 20px;
}

/* ── DASHBOARD GRID ───────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.dash-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.dash-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dash-card-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-card-icon svg { width: 22px; height: 22px; }
.dash-card-blue .dash-card-icon  { background: var(--blue-pale); color: var(--blue-main); }
.dash-card-green .dash-card-icon { background: var(--green-light); color: var(--green); }
.dash-card-orange .dash-card-icon{ background: var(--orange-light); color: var(--orange); }
.dash-card-purple .dash-card-icon{ background: var(--purple-light); color: var(--purple); }
.dash-card-body { display: flex; flex-direction: column; }
.dash-card-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.8rem; font-weight: 700; color: var(--blue-dark); line-height: 1;
}
.dash-card-label { font-size: .8rem; color: var(--gray-400); margin-top: 4px; }

/* ── DIRECTIVES ───────────────────────────────────────────── */
.directives-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.directive-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--blue-main);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: flex-start; gap: 14px;
}
.directive-personal { border-left-color: var(--orange); }
.directive-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  color: var(--gray-400); text-transform: uppercase;
  flex-shrink: 0; padding-top: 2px;
}
.directive-badge svg { width: 14px; height: 14px; }
.directive-contenu { flex: 1; font-size: .9rem; line-height: 1.5; }
.directive-date { font-size: .78rem; color: var(--gray-400); flex-shrink: 0; }

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: .88rem; font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer; border: none;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--blue-main); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.btn-secondary { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-full { width: 100%; justify-content: center; padding: 11px; font-size: 1rem; }

.btn-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.btn-action svg { width: 15px; height: 15px; }
.btn-edit       { color: var(--blue-main); } .btn-edit:hover       { background: var(--blue-pale); }
.btn-deactivate { color: var(--orange); }    .btn-deactivate:hover { background: var(--orange-light); }
.btn-activate   { color: var(--green); }     .btn-activate:hover   { background: var(--green-light); }
.btn-delete     { color: var(--red); }       .btn-delete:hover     { background: var(--red-light); }

/* ── FORMULAIRES ──────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: .83rem; font-weight: 600; color: var(--gray-600); }
.required { color: var(--red); }
.form-hint { font-size: .78rem; color: var(--gray-400); margin-top: 3px; }
.form-optional { font-size: .78rem; font-weight: 400; color: var(--gray-400); }
.form-section-title {
  font-size: .85rem; font-weight: 700; color: var(--blue-dark);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 24px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-200);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-main);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-disabled { background: var(--gray-100); color: var(--gray-400); cursor: not-allowed; }
.input-password { position: relative; }
.input-password input { padding-right: 40px; }
.toggle-pwd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); display: flex;
}
.toggle-pwd svg { width: 16px; height: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--gray-600); }
.form-check input[type="checkbox"] { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gray-200); }
textarea { resize: vertical; min-height: 80px; }

/* ── TABLEAUX ──────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table thead { background: var(--gray-50); border-bottom: 2px solid var(--blue-pale); }
.table th { padding: 11px 16px; text-align: left; font-size: .78rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .06em; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }
.row-inactive { opacity: .55; }
.table-empty { text-align: center; color: var(--gray-400); padding: 32px !important; }
.actions { display: flex; gap: 4px; align-items: center; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.badge-admin    { background: var(--blue-dark); color: var(--white); }
.badge-employe  { background: var(--blue-pale); color: var(--blue-dark); }
.badge-active   { background: var(--green-light); color: var(--green); }
.badge-inactive { background: var(--gray-100); color: var(--gray-400); }
.badge-all      { background: var(--blue-pale); color: var(--blue-dark); }

/* ── ALERTS ───────────────────────────────────────────────── */
.flash-messages { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.alert {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .88rem; font-weight: 500;
}
.alert-close { font-size: 1.1rem; color: currentColor; opacity: .6; cursor: pointer; background: none; border: none; }
.alert-success  { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }
.alert-danger   { background: var(--red-light); color: var(--red); border: 1px solid #fecaca; }
.alert-warning  { background: var(--orange-light); color: var(--orange); border: 1px solid #fed7aa; }
.alert-info     { background: var(--blue-pale); color: var(--blue-dark); border: 1px solid var(--blue-border); }

/* ── PAGE LOGIN ───────────────────────────────────────────── */
.layout-auth { background: var(--gray-50); }
.login-page {
  min-height: 100vh;
  display: flex;
}
.login-left {
  width: 380px; flex-shrink: 0;
  background: var(--blue-dark);
  display: flex; flex-direction: column;
  padding: 48px 40px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; top: -80px; right: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(37,99,235,.2);
}
.login-left::after {
  content: '';
  position: absolute; bottom: -60px; left: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.login-brand { flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 1; }
.login-logo { display: flex; align-items: baseline; margin-bottom: 12px; }
.login-logo .brand-emm { font-size: 2.4rem; color: var(--white); }
.login-logo .brand-gestion { font-size: 2.4rem; color: var(--blue-light); }
.login-tagline { color: rgba(255,255,255,.6); font-size: .9rem; line-height: 1.5; }
.login-deco { display: flex; flex-direction: column; gap: 8px; margin-top: 40px; }
.deco-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); }
.deco-bar:nth-child(1) { width: 60%; }
.deco-bar:nth-child(2) { width: 40%; }
.deco-bar:nth-child(3) { width: 80%; }
.login-footer-brand {
  position: relative; z-index: 1;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem; font-weight: 700; letter-spacing: .15em;
  color: rgba(255,255,255,.35); text-transform: uppercase;
}
.login-right {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%; max-width: 420px;
}
.login-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 700; color: var(--blue-dark);
  margin-bottom: 6px;
}
.login-sub { font-size: .88rem; color: var(--gray-400); margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-left { display: none; }
  .login-right { padding: 24px; }
  .header-nav { display: none; }
  .header-nav.open { display: flex; flex-direction: column; position: fixed; top: calc(var(--ticker-h) + var(--header-h)); left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 12px; gap: 4px; z-index: 99; box-shadow: var(--shadow-md); }
  .nav-toggle { display: flex; }
  .user-name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: 1; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-wrap: wrap; }
  .container { padding: 0 16px; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-card-value { font-size: 1.5rem; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 2 — Catalogue, Tiers, Navigation dropdowns
   ═══════════════════════════════════════════════════════════ */

/* ── Navigation dropdowns ────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; display: flex; align-items: center; gap: 6px; }
.nav-dropdown-btn .chevron { width: 14px; height: 14px; transition: transform var(--transition); }
.nav-dropdown:hover .chevron { transform: rotate(180deg); }
.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 180px; z-index: 200; overflow: hidden;
  margin-top: 4px;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-item {
  display: block; padding: 10px 16px;
  font-size: .88rem; color: var(--gray-600);
  transition: background var(--transition), color var(--transition);
}
.dropdown-item:hover { background: var(--blue-pale); color: var(--blue-main); }

/* ── Header avec ticker ───────────────────────────────────── */
.app-header.with-ticker { top: var(--ticker-h); }
.layout-app .app-main { margin-top: calc(var(--ticker-h) + var(--header-h)); }

/* ── Filtres ─────────────────────────────────────────────── */
.filters-bar { margin-bottom: 16px; }
.filters-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-search { flex: 1; min-width: 200px; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .88rem; }
.filter-select { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .88rem; background: var(--white); }

/* ── Badges types articles ───────────────────────────────── */
.badge-physique { background: var(--blue-pale); color: var(--blue-dark); }
.badge-service  { background: var(--purple-light); color: var(--purple); }
.badge-kit      { background: var(--orange-light); color: var(--orange); }
.badge-code     { background: var(--gray-100); color: var(--gray-600); font-family: monospace; font-size: .8rem; }
.badge-pro      { background: var(--blue-pale); color: var(--blue-dark); }
.badge-part     { background: var(--gray-100); color: var(--gray-600); }
.badge-lg       { font-size: .85rem; padding: 5px 12px; }
.btn-view       { color: var(--purple); } .btn-view:hover { background: var(--purple-light); }

/* ── Formulaire grille 3 colonnes ────────────────────────── */
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Inline edit ─────────────────────────────────────────── */
.input-inline { border: 1px solid transparent; border-radius: 4px; padding: 4px 8px; background: transparent; width: 100%; font-size: .88rem; }
.input-inline.input-editing { border-color: var(--blue-main); background: var(--white); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.d-none { display: none !important; }

/* ── Article thumbnail ───────────────────────────────────── */
.article-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; margin-right: 8px; vertical-align: middle; }

/* ── Detail article ──────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.detail-photo { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: .75rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }

/* ── Kit composants ──────────────────────────────────────── */
.kit-composants { display: flex; flex-direction: column; gap: 8px; }
.kit-ligne { display: flex; gap: 8px; align-items: center; }
.kit-select { flex: 1; }
.kit-qte { width: 80px; flex-shrink: 0; }

/* ── Photo preview ───────────────────────────────────────── */
.photo-preview { margin: 8px 0; display: flex; align-items: center; gap: 10px; }
.photo-preview-img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--gray-200); }

/* ── Input with button ───────────────────────────────────── */
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

/* ── BCE status ──────────────────────────────────────────── */
.bce-status { margin-top: 6px; font-size: .83rem; }
.bce-success { color: var(--green); }
.bce-error   { color: var(--orange); }

/* ── Radio group ─────────────────────────────────────────── */
.radio-group { display: flex; gap: 20px; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.radio-label input[type="radio"] { width: auto; }

/* ── Liens externes ──────────────────────────────────────── */
.link-external { color: var(--blue-main); text-decoration: underline; font-size: .85rem; }

/* ── Responsive Phase 2 ──────────────────────────────────── */
@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .filters-form { flex-direction: column; }
  .filter-search, .filter-select { width: 100%; }
  .kit-ligne { flex-wrap: wrap; }
  .kit-select { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 3 — Pieces comptables
   ═══════════════════════════════════════════════════════════ */

/* ── Badges types pieces ─────────────────────────────────── */
.badge-achat      { background: #dbeafe; color: #1e40af; }
.badge-vente      { background: #dcfce7; color: #15803d; }
.badge-nc-fourn   { background: #ffedd5; color: #c2410c; }
.badge-nc-client  { background: #fce7f3; color: #be185d; }

/* ── Badges statut ───────────────────────────────────────── */
.badge-statut-en_attente { background: var(--orange-light); color: var(--orange); }
.badge-statut-validee    { background: var(--green-light); color: var(--green); }
.badge-statut-brouillon  { background: var(--gray-100); color: var(--gray-400); }

/* ── Banniere type piece ─────────────────────────────────── */
.piece-type-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-radius: var(--radius);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem; font-weight: 700; letter-spacing: .04em;
  margin-bottom: 20px;
}
.banner-facture_achat      { background: #dbeafe; color: #1e40af; border-left: 4px solid #1e40af; }
.banner-facture_vente      { background: #dcfce7; color: #15803d; border-left: 4px solid #15803d; }
.banner-note_credit_fournisseur { background: #ffedd5; color: #c2410c; border-left: 4px solid #c2410c; }
.banner-note_credit_client { background: #fce7f3; color: #be185d; border-left: 4px solid #be185d; }
.sens-badge {
  font-size: .78rem; padding: 2px 10px; border-radius: 20px;
  font-weight: 700; letter-spacing: .05em;
}
.sens-entree { background: var(--green-light); color: var(--green); }
.sens-sortie { background: var(--orange-light); color: var(--orange); }

/* ── Checklist ───────────────────────────────────────────── */
.checklist-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--gray-200); }
.checklist-section:last-of-type { border-bottom: none; }
.checklist-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--gray-400); margin-bottom: 10px;
}
.checklist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 6px; margin-bottom: 6px;
  font-size: .88rem;
}
.check-done { background: var(--green-light); color: var(--green); }
.check-todo { background: var(--gray-100); color: var(--gray-400); }
.check-icon { font-weight: 700; font-size: 1rem; width: 20px; text-align: center; }
.checklist-manual { cursor: pointer; background: var(--gray-50); color: var(--gray-600); }
.checklist-manual:hover { background: var(--blue-pale); }
.checklist-manual input[type="checkbox"] { width: auto; flex-shrink: 0; }
.checklist-global {
  padding: 10px 16px; border-radius: var(--radius);
  font-size: .88rem; font-weight: 600; margin-top: 16px;
}
.checklist-complete   { background: var(--green-light); color: var(--green); }
.checklist-incomplete { background: var(--orange-light); color: var(--orange); }

/* ── Mini checklist dans liste ───────────────────────────── */
.checklist-mini { display: flex; align-items: center; gap: 3px; }
.check-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.check-ok  { background: var(--green); }
.check-nok { background: var(--gray-200); }
.check-sep { width: 6px; }

/* ── Lignes piece ────────────────────────────────────────── */
.lignes-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ligne-piece {
  display: grid;
  grid-template-columns: 2fr 3fr 80px 110px 110px 36px;
  gap: 8px; align-items: end;
  padding: 12px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--radius);
}
.ligne-piece label { font-size: .75rem; font-weight: 600; color: var(--gray-400); margin-bottom: 4px; display: block; }
.ligne-montant { font-weight: 600; color: var(--blue-dark); background: var(--blue-pale); }
.lignes-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 8px;
}
.total-htva {
  font-size: 1rem; color: var(--gray-600);
}
.total-htva strong { font-size: 1.2rem; color: var(--blue-dark); }
.total-row td { background: var(--blue-pale); }
.montant { font-variant-numeric: tabular-nums; }

/* ── Boutons ─────────────────────────────────────────────── */
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-pdf { color: var(--red); } .btn-pdf:hover { background: var(--red-light); }

/* ── PDF current ─────────────────────────────────────────── */
.pdf-current {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--blue-pale);
  border-radius: 6px; font-size: .88rem; color: var(--blue-dark);
  margin-bottom: 8px;
}
.pdf-current a { font-weight: 600; color: var(--blue-main); text-decoration: underline; }

/* ── Responsive Phase 3 ──────────────────────────────────── */
@media (max-width: 768px) {
  .ligne-piece { grid-template-columns: 1fr 1fr; }
  .ligne-article, .ligne-desc { grid-column: 1 / -1; }
  .btn-group { flex-direction: column; }
}
