:root {
  --primary: #1a2744;
  --primary-dark: #111b33;
  --accent: #f5a623;
  --accent-dark: #e09000;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --gray: #6b7280;
  --bg: #f0f4f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* NAVBAR */
.navbar { background: var(--primary); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 60px; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-brand img { height: 36px; width: auto; }
.nav-brand span { color: white; font-weight: 700; font-size: 0.85rem; opacity: 0.7; letter-spacing: .05em; }
.nav-links { display: flex; align-items: center; gap: 0.5rem; }
.nav-links a { color: rgba(255,255,255,.85); text-decoration: none; padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 0.9rem; transition: background .2s; }
.nav-links a:hover, .nav-links a.active { background: var(--accent); color: white; }
.nav-user { color: rgba(255,255,255,.7); font-size: 0.85rem; padding: 0 0.5rem; }
.btn-logout { background: rgba(255,255,255,.1) !important; color: white !important; border: 1px solid rgba(255,255,255,.2) !important; }
.btn-logout:hover { background: var(--danger) !important; }

/* CONTAINER */
.container { max-width: 1280px; margin: 0 auto; padding: 2rem; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* KPI GRID */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--card); border-radius: 14px; padding: 1.4rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); border-left: 5px solid transparent; transition: transform .2s, box-shadow .2s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.kpi-blue { border-color: var(--primary); }
.kpi-green { border-color: var(--success); }
.kpi-orange { border-color: var(--accent); }
.kpi-purple { border-color: #7c3aed; }
.kpi-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

/* PROGRESS */
.progress-section { background: var(--card); border-radius: 14px; padding: 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem; }
.progress-bar { height: 14px; background: #e2e8f0; border-radius: 7px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 7px; transition: width .8s ease; }
.progress-success { background: linear-gradient(90deg, var(--success), #22c55e); }
.progress-warning { background: linear-gradient(90deg, var(--warning), var(--accent)); }
.progress-danger { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-accent { background: linear-gradient(90deg, var(--accent), #fbbf24); }
.mini-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.mini-fill { height: 100%; border-radius: 4px; }

/* JAUGE CIRCULAIRE */
.gauge-container { display: flex; flex-direction: column; align-items: center; }
.gauge-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* SECTION / CARD */
.section { background: var(--card); border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--primary); border-left: 4px solid var(--accent); padding-left: 0.75rem; }
.card { background: var(--card); border-radius: 14px; padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); border: 1px solid var(--border); }
.card h4 { margin-bottom: 1rem; font-size: 1rem; color: var(--primary); }

/* COMMERCIAL CARD */
.commercial-card { background: var(--card); border-radius: 14px; padding: 1.25rem; box-shadow: 0 2px 8px rgba(0,0,0,.08); border: 1px solid var(--border); cursor: pointer; transition: all .2s; text-decoration: none; color: inherit; display: block; }
.commercial-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); border-color: var(--accent); }
.commercial-name { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.75rem; }
.commercial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

/* MOTIVATION BANNER */
.motivation-banner { border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.875rem; font-weight: 600; }
.motivation-fire { background: linear-gradient(135deg, #fff7ed, #fed7aa); color: #9a3412; border-left: 4px solid var(--accent); }
.motivation-good { background: linear-gradient(135deg, #f0fdf4, #bbf7d0); color: #14532d; border-left: 4px solid var(--success); }
.motivation-warn { background: linear-gradient(135deg, #fffbeb, #fde68a); color: #78350f; border-left: 4px solid var(--warning); }
.motivation-start { background: linear-gradient(135deg, #eff6ff, #bfdbfe); color: #1e3a8a; border-left: 4px solid var(--primary); }

/* TABLE */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { background: var(--primary); color: white; padding: 0.75rem; text-align: left; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.table th:first-child { border-radius: 0; }
.table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: #f8fafc; }
.table tr.total-row td { background: #f1f5f9; font-weight: 700; border-top: 2px solid var(--border); }
.row-pending td { background: #fffbeb; }
.row-inactive td { opacity: 0.5; }

/* BADGES */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-accent { background: #fef3c7; color: #92400e; }

/* BUTTONS */
.btn { display: inline-block; padding: 0.5rem 1.1rem; border-radius: 8px; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all .2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; text-align: center; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; background: white; transition: border .2s; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,.15); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.form-card { background: var(--card); border-radius: 14px; padding: 2rem; max-width: 700px; margin: 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.checkbox-group { display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.checkbox-group label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.input-month { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; }

/* TABS */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 1.5rem; flex-wrap: wrap; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn { padding: 0.6rem 1.1rem; border: none; border-bottom: 3px solid transparent; background: transparent; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); transition: all .2s; margin-bottom: -2px; border-radius: 0; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* LOGIN */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, #2d4a8a 100%); }
.login-box { background: white; border-radius: 20px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box h1 { text-align: center; margin-bottom: 0.5rem; font-size: 1.5rem; color: var(--primary); }
.login-logo { display: block; margin: 0 auto 1rem; height: 50px; }
.login-sub { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: 0.9rem; }

/* ALERTS */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; }

/* MODAL */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-box { background: white; border-radius: 16px; padding: 2rem; width: 90%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin-bottom: 1.5rem; color: var(--primary); }

/* DANGER ZONE */
.danger-zone { background: #fff5f5; border: 2px solid #fed7d7; border-radius: 12px; padding: 2rem; }
.danger-zone h3 { color: var(--danger); margin-bottom: 0.5rem; }

/* CHART */
.chart-container { position: relative; height: 250px; margin-top: 1rem; }

/* MISC */
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-success { color: var(--success); margin-top: 0.5rem; font-size: 0.875rem; }
.text-warning { color: var(--warning); margin-top: 0.5rem; font-size: 0.875rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ACCENT HIGHLIGHT */
.highlight-accent { color: var(--accent); font-weight: 700; }
.highlight-primary { color: var(--primary); font-weight: 700; }

@media (max-width: 768px) {
  .container { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .navbar { padding: 0 1rem; }
  .nav-links { gap: 0.25rem; }
  .nav-links a { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
  .commercial-grid { grid-template-columns: 1fr; }
}
