/* ============================================================
   COMPTA.CSS — ZenoiaIQ Accounting Portal
   Build 703v52
   ============================================================ */

:root {
  --c-bg: #F8F7FC;
  --c-surface: #FFFFFF;
  --c-surface-alt: #F1EFF8;
  --c-border: #E8E5F0;
  --c-text: #1A1632;
  --c-text-muted: #6B6685;
  --c-text-light: #9C97B2;
  --c-purple: #7C3AED;
  --c-purple-dark: #6D28D9;
  --c-purple-soft: rgba(124,58,237,0.08);
  --c-green: #10B981;
  --c-green-soft: rgba(16,185,129,0.08);
  --c-red: #EF4444;
  --c-red-soft: rgba(239,68,68,0.06);
  --c-orange: #F59E0B;
  --c-orange-soft: rgba(245,158,11,0.08);
  --c-blue: #3B82F6;
  --c-blue-soft: rgba(59,130,246,0.08);
  --c-shadow-sm: 0 1px 3px rgba(26,22,50,0.06);
  --c-shadow-md: 0 4px 12px rgba(26,22,50,0.06);
  --c-shadow-lg: 0 8px 24px rgba(26,22,50,0.10);
  --c-radius: 14px;
  --c-radius-sm: 10px;
  --c-radius-xs: 6px;
  --c-sidebar-w: 230px;
  --c-sidebar-collapsed: 62px;
  --c-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 14px; }
body {
  font-family: var(--c-font);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth Screen ── */
.c-auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--c-text);
}
.c-auth-box {
  text-align: center;
  padding: 48px;
  max-width: 400px;
}
.c-auth-logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--c-purple);
  color: #fff;
  font-size: 26px; font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.c-auth-logo--red { background: var(--c-red); }
.c-auth-title {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.c-auth-title span {
  font-weight: 400;
  opacity: 0.5;
  font-size: 16px;
  margin-left: 4px;
}
.c-auth-desc {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 24px;
}
.c-auth-msg {
  color: var(--c-red);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 12px;
}
.c-auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.c-auth-loading p {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}
.c-auth-link {
  display: inline-block;
  margin-top: 24px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  text-decoration: none;
}
.c-auth-link:hover { color: rgba(255,255,255,0.7); }

.c-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--c-purple);
  border-radius: 50%;
  animation: c-spin 0.8s linear infinite;
}
@keyframes c-spin { to { transform: rotate(360deg); } }

/* ── App Shell ── */
.c-app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.c-sidebar {
  width: var(--c-sidebar-w);
  background: var(--c-text);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.25s ease;
  box-shadow: 2px 0 12px rgba(26,22,50,0.12);
  flex-shrink: 0;
  z-index: 20;
}
.c-sidebar.collapsed { width: var(--c-sidebar-collapsed); }
.c-sidebar.collapsed .c-sidebar__brand,
.c-sidebar.collapsed .c-sidebar__company,
.c-sidebar.collapsed .c-sidebar__user,
.c-sidebar.collapsed .c-sidebar__version,
.c-sidebar.collapsed .c-sidebar__collapse,
.c-sidebar.collapsed .c-nav-label { display: none; }
.c-sidebar.collapsed .c-sidebar__header { justify-content: center; padding: 14px 0; }
.c-sidebar.collapsed .c-nav-item { justify-content: center; padding: 11px 0; }

.c-sidebar__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.c-sidebar__logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--c-purple);
  color: #fff;
  font-size: 15px; font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.c-sidebar__brand { flex: 1; min-width: 0; }
.c-sidebar__brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.c-sidebar__brand-sub { font-weight: 400; opacity: 0.4; font-size: 11px; margin-left: 4px; }
.c-sidebar__collapse {
  background: none; border: none; color: rgba(255,255,255,0.3); cursor: pointer;
  padding: 4px; border-radius: 4px; transition: color 0.15s;
}
.c-sidebar__collapse:hover { color: rgba(255,255,255,0.7); }

.c-sidebar__company {
  padding: 4px 16px 12px;
  font-size: 11px;
  opacity: 0.4;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-sidebar__divider {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 0 12px 6px;
}
.c-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* Nav items */
.c-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  font-family: var(--c-font);
  white-space: nowrap;
}
.c-nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
}
.c-nav-item.active {
  background: rgba(124,58,237,0.18);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--c-purple);
}
.c-nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.c-nav-icon svg { display: block; }

.c-sidebar__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.c-sidebar__user {
  font-size: 11px;
  opacity: 0.5;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-sidebar__version { font-size: 10px; opacity: 0.25; }

/* ── Main ── */
.c-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.c-main__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px 0;
}
.c-main__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.c-main__sync { font-size: 11px; color: var(--c-text-light); }

.c-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.c-breadcrumb__root { color: var(--c-text-light); }
.c-breadcrumb__sep { color: var(--c-text-light); opacity: 0.4; }
.c-breadcrumb__current { font-weight: 600; color: var(--c-text-muted); }

.c-content {
  flex: 1;
  padding: 20px 32px 40px;
}

/* ── Cards ── */
.c-card {
  background: var(--c-surface);
  border-radius: var(--c-radius);
  border: 1px solid var(--c-border);
  padding: 20px 24px;
  box-shadow: var(--c-shadow-sm);
}
.c-card--flush { padding: 0; }
.c-card--flush .c-card__body { padding: 0 24px 20px; }

/* ── Section Title ── */
.c-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.c-section-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
}

/* ── KPI Row ── */
.c-kpi-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.c-kpi {
  flex: 1;
  min-width: 155px;
}
.c-kpi__label {
  font-size: 11px;
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.c-kpi__value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}
.c-kpi__value small { font-size: 13px; font-weight: 500; color: var(--c-text-muted); }
.c-kpi__delta {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

/* ── Table ── */
.c-table-wrap { overflow-x: auto; }
.c-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.c-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--c-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--c-surface);
}
.c-table th.right, .c-table td.right { text-align: right; }
.c-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  color: var(--c-text);
  white-space: nowrap;
}
.c-table tbody tr { transition: background 0.12s; cursor: default; }
.c-table tbody tr:hover { background: var(--c-surface-alt); }
.c-table tbody tr.clickable { cursor: pointer; }
.c-table .c-cell-main { font-weight: 500; }
.c-table .c-cell-sub { font-size: 11px; color: var(--c-text-muted); }
.c-table .c-cell-amount { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Badges ── */
.c-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.c-badge--purple { background: var(--c-purple-soft); color: var(--c-purple-dark); }
.c-badge--green { background: var(--c-green-soft); color: #047857; }
.c-badge--red { background: var(--c-red-soft); color: #DC2626; }
.c-badge--orange { background: var(--c-orange-soft); color: #B45309; }
.c-badge--blue { background: var(--c-blue-soft); color: #1D4ED8; }
.c-badge--gray { background: var(--c-surface-alt); color: var(--c-text-muted); }

/* Status dot */
.c-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.c-dot--green { background: var(--c-green); }
.c-dot--orange { background: var(--c-orange); }
.c-dot--red { background: var(--c-red); }
.c-dot--blue { background: var(--c-blue); }
.c-dot--gray { background: var(--c-text-light); }

/* ── Buttons ── */
.c-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--c-font);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
}
.c-btn--primary { background: var(--c-purple); color: #fff; border-color: var(--c-purple); }
.c-btn--primary:hover { background: var(--c-purple-dark); }
.c-btn--secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border); }
.c-btn--secondary:hover { background: var(--c-surface-alt); }
.c-btn--success { background: var(--c-green); color: #fff; }
.c-btn--danger { background: var(--c-red); color: #fff; }
.c-btn--sm { padding: 5px 14px; font-size: 12px; }
.c-btn--icon { padding: 6px 8px; }

/* ── Forms ── */
.c-input, .c-select, .c-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  font-size: 13px;
  font-family: var(--c-font);
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color 0.15s;
}
.c-input:focus, .c-select:focus, .c-textarea:focus {
  outline: none;
  border-color: var(--c-purple);
  box-shadow: 0 0 0 3px var(--c-purple-soft);
}
.c-select--sm { width: auto; padding: 5px 10px; font-size: 12px; }
.c-textarea { resize: vertical; min-height: 80px; }
.c-label {
  display: block;
  font-size: 11px;
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.c-field { margin-bottom: 14px; }
.c-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.c-checkbox input { accent-color: var(--c-purple); }

/* ── Grid ── */
.c-grid { display: grid; gap: 16px; }
.c-grid--2 { grid-template-columns: 1fr 1fr; }
.c-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.c-grid--4 { grid-template-columns: repeat(4, 1fr); }
.c-flex { display: flex; gap: 16px; }
.c-flex--wrap { flex-wrap: wrap; }

/* ── Alert boxes ── */
.c-alert {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.c-alert--orange { background: var(--c-orange-soft); border: 1px solid rgba(245,158,11,0.2); }
.c-alert--red { background: var(--c-red-soft); border: 1px solid rgba(239,68,68,0.2); }
.c-alert--green { background: var(--c-green-soft); border: 1px solid rgba(16,185,129,0.2); }
.c-alert--blue { background: var(--c-blue-soft); border: 1px solid rgba(59,130,246,0.2); }
.c-alert strong { font-weight: 600; }

/* ── Monospace block (AFC form) ── */
.c-mono {
  font-family: 'DM Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 2.2;
  background: var(--c-surface-alt);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
}
.c-mono .c-mono__title { font-weight: 700; margin-bottom: 4px; }
.c-mono .c-mono__total {
  font-weight: 600;
  border-top: 1px solid var(--c-border);
  padding-top: 4px; margin-top: 4px;
}
.c-mono .c-mono__grand {
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--c-purple);
  padding-top: 8px; margin-top: 8px;
  color: var(--c-purple);
}
.c-mono .c-mono__credit { color: var(--c-green); }

/* ── Charts ── */
.c-chart-container { margin: 8px 0; }
.c-chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--c-text-muted);
}
.c-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Modal ── */
.c-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,22,50,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: c-fade-in 0.2s ease;
}
.c-modal {
  background: var(--c-surface);
  border-radius: 16px;
  box-shadow: var(--c-shadow-lg);
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: c-slide-up 0.25s ease;
}
.c-modal__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}
.c-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
@keyframes c-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes c-slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Empty state ── */
.c-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--c-text-muted);
}
.c-empty__icon { font-size: 32px; margin-bottom: 12px; opacity: 0.3; }
.c-empty__text { font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .c-grid--3 { grid-template-columns: 1fr 1fr; }
  .c-content { padding: 16px 20px 32px; }
  .c-main__header { padding: 12px 20px 0; }
}
@media (max-width: 768px) {
  .c-grid--2, .c-grid--3 { grid-template-columns: 1fr; }
  .c-kpi-row { flex-direction: column; }
  .c-sidebar { position: fixed; z-index: 50; }
}

/* ── Utility ── */
.text-green { color: var(--c-green) !important; }
.text-red { color: var(--c-red) !important; }
.text-orange { color: var(--c-orange) !important; }
.text-blue { color: var(--c-blue) !important; }
.text-purple { color: var(--c-purple) !important; }
.text-muted { color: var(--c-text-muted) !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.mono { font-family: 'DM Mono', 'SF Mono', monospace; }
.tabular { font-variant-numeric: tabular-nums; }

/* Étape 4: Forms */
.c-form-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px 16px;margin-top:12px}
.c-hint{font-size:11px;color:var(--c-text-muted);margin-top:2px;display:block}
