/* ===================================================================
   AMICALE FSEGT — Enterprise Tailwind Design System
   Featuring Inter, Plus Jakarta Sans & Tailwind UI Design Tokens
   =================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Tailwind Palette Colors */
  --primary:        #0f172a; /* slate-900 */
  --primary-light:  #1e293b; /* slate-800 */
  --primary-accent: #2563eb; /* blue-600 */
  --accent:         #f59e0b; /* amber-500 */
  --accent-light:   #fef3c7; /* amber-100 */
  --success:        #10b981; /* emerald-500 */
  --success-light:  #d1fae5; /* emerald-100 */
  --danger:         #ef4444; /* red-500 */
  --danger-light:   #fee2e2; /* red-100 */
  --warning:        #f59e0b; /* amber-500 */
  --info:           #0ea5e9; /* sky-500 */
  --info-light:     #e0f2fe; /* sky-100 */
  --purple:         #8b5cf6; /* violet-500 */
  --purple-light:   #ede9fe; /* violet-100 */
  --bg:             #f8fafc; /* slate-50 */
  --card:           #ffffff;
  --border:         #e2e8f0; /* slate-200 */
  --border-subtle:  #f1f5f9; /* slate-100 */
  --text:           #0f172a; /* slate-900 */
  --text-muted:     #64748b; /* slate-500 */
  --sidebar-w:      270px;
  --radius:         14px;
  --radius-sm:      8px;
  --radius-pill:    9999px;

  /* Tailwind Shadows */
  --shadow-xs:      0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm:      0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md:      0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:      0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl:      0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --ring-focus:     0 0 0 3px rgba(37, 99, 235, 0.18);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy */
h1, h2, h3, h4, .page-title, .logo-text, .brand-text {
  font-family: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--primary);
}

/* Tabular numbers for financial precision */
.stat-value,
.reconcil-val,
.calc-value,
td.fw-bold,
td.text-success,
td.text-danger,
.total-row td {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: #1d4ed8;
}

/* Sleek Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ================================================================
   LOGIN PAGE (Tailwind Pro Design)
   ================================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 15% 0%,   rgba(37,99,235,.15)  0%, transparent 60%),
    radial-gradient(ellipse at 85% 100%, rgba(245,158,11,.12) 0%, transparent 60%),
    linear-gradient(135deg, #090d16 0%, #0f172a 60%, #0c1527 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.login-wrap {
  width: 100%;
  max-width: 440px;
  padding: 24px;
  position: relative;
  z-index: 2;
}
.login-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(226, 232, 240, 0.8);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.logo-mark, .brand-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #f59e0b 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}
.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.logo-text span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}
.sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ================================================================
   APP LAYOUT
   ================================================================ */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ================================================================
   SIDEBAR (Tailwind Modern SaaS Style)
   ================================================================ */
.sidebar {
  background: #090d16;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 50;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.brand-text {
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.brand-text span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 1.5px;
}
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569; /* slate-600 */
  padding: 12px 14px 4px;
  margin-top: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  color: #94a3b8; /* slate-400 */
  font-size: 13px;
  font-weight: 500;
  border-radius: 9px;
  transition: all 0.15s ease;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}
.nav-item.active {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa; /* blue-400 */
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}
.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.nav-label {
  flex: 1;
}
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.user-avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  font-size: 14px;
  flex-shrink: 0;
}
.user-name {
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
}
.logout-link {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}
.logout-link:hover {
  color: #f87171;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}
.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}
.page-title span {
  font-size: 20px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.content {
  padding: 24px 28px;
  flex: 1;
}

/* ================================================================
   CARDS (Tailwind Pro Style)
   ================================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.card h2, .card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.card h3, .card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* ================================================================
   STATS GRID (Tailwind UI Inspired)
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  border-radius: 14px;
  padding: 20px 22px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  font-size: 26px;
  margin-bottom: 8px;
  line-height: 1;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 5px;
  letter-spacing: 0.01em;
}

/* Tailwind Palette Gradients */
.stat-caisse    { background: linear-gradient(135deg, #059669 0%, #10b981 100%); } /* emerald */
.stat-banque    { background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%); } /* sky */
.stat-members   { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); } /* indigo */
.stat-suppliers { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); } /* amber */
.stat-purchases { background: linear-gradient(135deg, #ea580c 0%, #f97316 100%); } /* orange */
.stat-danger    { background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%); } /* red */
.stat-primary   { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); } /* slate */

/* ================================================================
   SECTION GRID
   ================================================================ */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.section-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.section-grid.cols-1 { grid-template-columns: 1fr; }

/* ================================================================
   ACCORDION FOURNISSEURS (Enterprise Polish)
   ================================================================ */
.supplier-accordion {
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.supplier-accordion:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}
.supplier-accordion.open {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px -2px rgba(37, 99, 235, 0.1);
}
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s ease;
  gap: 16px;
}
.accordion-header:hover {
  background: #f8fafc;
}
.supplier-accordion.open .accordion-header {
  background: #f0f7ff;
  border-bottom: 1px solid #dbeafe;
}
.acc-left {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
}
.acc-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.supplier-accordion.open .acc-icon {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}
.acc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.acc-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.acc-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.acc-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
}
.acc-metric {
  text-align: right;
  display: flex;
  flex-direction: column;
}
.acc-metric .lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.acc-metric .val {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}
.acc-chevron {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.supplier-accordion.open .acc-chevron {
  transform: rotate(180deg);
  background: #dbeafe;
  color: #2563eb;
}
.accordion-body {
  display: none;
  padding: 22px;
  background: #ffffff;
}
.supplier-accordion.open .accordion-body {
  display: block;
  animation: accordionIn 0.2s ease-out;
}
@keyframes accordionIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   ACCORDION SOLDE INITIAL N-1 (Caisse & Banque)
   ================================================================ */
.n1-accordion {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.n1-accordion:hover {
  border-color: #cbd5e1;
}
.n1-accordion.open {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px -2px rgba(37, 99, 235, 0.1);
}
.n1-accordion .accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  background: #f8fafc;
  transition: background 0.15s ease;
}
.n1-accordion.open .accordion-header {
  background: #f0f7ff;
  border-bottom: 1px solid #dbeafe;
}
.n1-accordion .accordion-body {
  display: none;
  padding: 20px;
  background: #ffffff;
}
.n1-accordion.open .accordion-body {
  display: block;
  animation: accordionIn 0.2s ease-out;
}
.n1-accordion .acc-chevron {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.n1-accordion.open .acc-chevron {
  transform: rotate(180deg);
  background: #dbeafe;
  color: #2563eb;
}

.supplier-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 20px;
  margin-bottom: 18px;
  font-size: 12.5px;
  background: #f8fafc;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.supplier-meta strong {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 5px;
}
.reconcil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.reconcil-item {
  text-align: center;
}
.reconcil-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}
.reconcil-val.positive { color: var(--success); }
.reconcil-val.negative { color: var(--danger); }
.reconcil-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.product-tag {
  background: #f0f7ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ================================================================
   TABLES (Tailwind UI Standard)
   ================================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
th {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b; /* slate-500 */
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: #334155; /* slate-700 */
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: #f8fafc;
}
.actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.total-row td {
  font-weight: 700;
  background: #f8fafc;
  border-top: 2px solid var(--border);
  color: var(--primary);
}

/* Journal Left Accent Borders */
tr.recette td:first-child { border-left: 3px solid var(--success); }
tr.depense td:first-child { border-left: 3px solid var(--danger); }
tr.report-m1 td { background: #fffbeb; }

/* ================================================================
   BUTTONS (Tailwind UI Enterprise Styling)
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.btn-accent {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
}
.btn-accent:hover {
  background: #d97706;
}
.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--primary);
}
.btn-success {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}
.btn-success:hover {
  background: #047857;
}
.btn-danger {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fecaca;
  box-shadow: var(--shadow-xs);
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}
.btn-sm {
  padding: 5px 11px;
  font-size: 11.5px;
  border-radius: 7px;
}
.btn-full {
  width: 100%;
}
.btn-icon {
  padding: 6px;
  border-radius: 8px;
}

/* ================================================================
   BADGES (Tailwind Inset Ring Treatment)
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}
.badge-success {
  background-color: #ecfdf5;
  color: #065f46;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.25);
}
.badge-danger {
  background-color: #fef2f2;
  color: #991b1b;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.25);
}
.badge-warning {
  background-color: #fffbeb;
  color: #92400e;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.25);
}
.badge-info {
  background-color: #f0f9ff;
  color: #075985;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.25);
}
.badge-gray {
  background-color: #f1f5f9;
  color: #475569;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}
.badge-purple {
  background-color: #f5f3ff;
  color: #5b21b6;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25);
}
.badge-accent {
  background-color: #fffbeb;
  color: #b45309;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35);
}
.badge-dark {
  background-color: #0f172a;
  color: #e2e8f0;
}

/* ================================================================
   FORMS (Tailwind Input Fields)
   ================================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155; /* slate-700 */
}
.field input,
.field select,
.field textarea {
  padding: 9px 13px;
  border: 1px solid #cbd5e1; /* slate-300 */
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: var(--ring-focus);
}
.field textarea {
  resize: vertical;
  min-height: 65px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
}
.alert-success { background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.alert-info    { background: #f0f9ff; color: #0369a1; border-left: 3px solid #0ea5e9; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }

/* ================================================================
   CALC PREVIEW
   ================================================================ */
.calc-preview {
  background: #f0f7ff;
  border-radius: 12px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
  border: 1px solid #bfdbfe;
}
.calc-item  { text-align: center; }
.calc-value { font-size: 16px; font-weight: 800; color: #1e40af; }
.calc-label { font-size: 11px; font-weight: 600; color: #64748b; margin-top: 2px; }

/* ================================================================
   QUICK ACTIONS (Dashboard)
   ================================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.quick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}
.quick-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.quick-btn-icon {
  font-size: 18px;
}

/* ================================================================
   FILTERS BAR
   ================================================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.filters-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.filters-bar input,
.filters-bar select {
  padding: 7px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12.5px;
  font-family: inherit;
  background: #f8fafc;
  color: var(--text);
  min-width: 120px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filters-bar input:focus,
.filters-bar select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: var(--ring-focus);
  background: #ffffff;
}
.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================================================
   MODALS
   ================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #ffffff;
  border-radius: 18px;
  padding: 26px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
  background: #fee2e2;
  color: #ef4444;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ================================================================
   IMPORT ZONE
   ================================================================ */
.import-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  background: #f8fafc;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.import-zone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

/* ================================================================
   UTILITIES
   ================================================================ */
.divider     { height: 1px; background: var(--border); margin: 16px 0; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-success{ color: #059669 !important; }
.text-danger { color: #dc2626 !important; }
.text-muted  { color: var(--text-muted); }
.fw-bold     { font-weight: 700; }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state p { font-size: 13px; margin-top: 4px; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .section-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .reconcil-grid { grid-template-columns: 1fr 1fr; }
  .calc-preview  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app-layout    { grid-template-columns: 1fr; }
  .sidebar       { display: none; }
  .section-grid  { grid-template-columns: 1fr; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .content       { padding: 18px 16px; }
  .topbar        { padding: 0 16px; }
}
@media (max-width: 600px) {
  .stats-grid    { grid-template-columns: 1fr; }
  .form-grid     { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .login-card    { padding: 28px 20px; }
}
/* ================================================================
   PAGINATION & MEMBERS TOOLBAR
   ================================================================ */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
  gap: 12px;
}
.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.pagination-info b {
  color: var(--primary);
  font-weight: 700;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  color: #475569;
  border: 1px solid var(--border);
  background: #ffffff;
  transition: all 0.15s ease;
  text-decoration: none;
  cursor: pointer;
}
.page-link:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: #cbd5e1;
}
.page-link.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}
.page-link.disabled {
  opacity: 0.4;
  pointer-events: none;
  background: #f8fafc;
  cursor: not-allowed;
}
.members-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
}
.search-input-wrap input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13px;
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}
.search-input-wrap input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: var(--ring-focus);
}
.search-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
}
.search-clear-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ================================================================
   LUCIDE ICONS & INTERACTIVE JOURNAL ROWS
   ================================================================ */
.lucide {
  display: inline-block;
  vertical-align: -0.16em;
  width: 1.18em;
  height: 1.18em;
  stroke-width: 2px;
}
.nav-icon .lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.1px;
}
.stat-icon .lucide {
  width: 28px;
  height: 28px;
  stroke-width: 2.2px;
}
.btn .lucide {
  width: 13.5px;
  height: 13.5px;
  stroke-width: 2.2px;
}
.badge .lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2.2px;
}
.quick-btn .lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}
.journal-table tr[data-clickable="1"] {
  cursor: pointer;
  transition: all 0.15s ease;
}
.journal-table tr[data-clickable="1"]:hover {
  background-color: #f0f7ff !important;
}
.journal-table tr[data-clickable="1"]:hover td:first-child {
  border-left-width: 5px;
}

@keyframes confirmModalPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ================================================================
   PREMIUM UI ENHANCEMENTS — Professional Upgrade Pack
   ================================================================ */

/* Animated gradient sidebar brand */
.sidebar-brand {
  background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(245,158,11,0.08));
  border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}
.brand-mark {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #f59e0b 100%) !important;
  box-shadow: 0 4px 15px rgba(37,99,235,0.4), 0 0 0 1px rgba(255,255,255,0.1) !important;
  animation: brandPulse 4s ease-in-out infinite;
}
@keyframes brandPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(37,99,235,0.4), 0 0 0 1px rgba(255,255,255,0.1); }
  50% { box-shadow: 0 6px 20px rgba(37,99,235,0.6), 0 0 0 1px rgba(255,255,255,0.15); }
}

/* Enhanced nav items */
.nav-item {
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1) !important;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08) !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.08);
  transform: translateX(4px) !important;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(37,99,235,0.08)) !important;
  border-color: rgba(59,130,246,0.3);
}
.nav-item.active::before {
  background: linear-gradient(to bottom, #60a5fa, #3b82f6) !important;
  box-shadow: 0 0 12px rgba(59,130,246,0.8) !important;
}

/* Nav divider */
.nav-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.07), transparent);
  margin: 8px 14px;
}

/* Premium topbar */
.topbar {
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04) !important;
}

/* Topbar user chip */
.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 12px 5px 6px;
  transition: all 0.15s ease;
  text-decoration: none;
  color: var(--text);
}
.topbar-user-chip:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.user-name-chip {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
}

/* Premium stat card */
.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.2) !important;
}

/* Card accent top borders */
.card-accent-blue   { border-top: 3px solid #2563eb; }
.card-accent-green  { border-top: 3px solid #10b981; }
.card-accent-amber  { border-top: 3px solid #f59e0b; }
.card-accent-red    { border-top: 3px solid #ef4444; }
.card-accent-purple { border-top: 3px solid #8b5cf6; }

/* Glow buttons */
.btn-primary { box-shadow: 0 1px 2px rgba(37,99,235,0.2), 0 4px 12px rgba(37,99,235,0.15) !important; }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(37,99,235,0.35) !important; }
.btn-success { box-shadow: 0 1px 2px rgba(16,185,129,0.2), 0 4px 12px rgba(16,185,129,0.12) !important; }
.btn-success:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.3) !important; }

/* Animated page entry */
.content { animation: pageIn 0.3s ease-out; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* KPI Block */
.kpi-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: default;
}
a.kpi-block { text-decoration: none; cursor: pointer; }
.kpi-block:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}
.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.kpi-icon-wrap.blue   { background: #eff6ff; color: #2563eb; }
.kpi-icon-wrap.green  { background: #ecfdf5; color: #059669; }
.kpi-icon-wrap.orange { background: #fff7ed; color: #ea580c; }
.kpi-icon-wrap.red    { background: #fef2f2; color: #dc2626; }
.kpi-icon-wrap.purple { background: #f5f3ff; color: #7c3aed; }
.kpi-icon-wrap.teal   { background: #f0fdfa; color: #0d9488; }
.kpi-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Print improvements */
@media print {
  .sidebar { display: none !important; }
  .topbar  { display: none !important; }
  .print-hide { display: none !important; }
  .main-content { min-height: auto !important; }
  .content { padding: 0 !important; animation: none !important; }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; page-break-inside: avoid; }
  body { font-size: 12px; }
  table { font-size: 11px; }
}
.mobile-nav-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dark);
  padding: 8px;
  margin-right: 12px;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 80;
}
@media (max-width: 900px) {
  .mobile-nav-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { 
    display: flex; 
    transform: translateX(-100%); 
    transition: transform 0.3s ease; 
    z-index: 90; 
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
}


/* ================================================================
   RESPONSIVE MOBILE — Complement
   ================================================================ */

/* Hamburger button */
.mobile-nav-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dark);
  padding: 6px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-nav-btn:hover { background: #f1f5f9; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 80;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

@media (max-width: 900px) {
  /* Show hamburger */
  .mobile-nav-btn { display: inline-flex; }

  /* Sidebar slides in from left */
  .sidebar {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 270px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar.open { transform: translateX(0); }

  /* Tables: scroll horizontally */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* Topbar adjustments */
  .topbar { padding: 0 14px; }
  .topbar .page-title { font-size: 15px; }

  /* Filters bar wraps nicely */
  .filters-bar { flex-wrap: wrap; gap: 8px; }
  .filters-bar label { min-width: 140px; flex: 1; }

  /* Main content */
  .main-content { min-width: 0; }
}

@media (max-width: 500px) {
  .topbar-user-chip .user-name-chip { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
}
