/* ═══════════════════════════════════════════════════════════════
   AIRMEDIA FILMS — IDENTITÉ VISUELLE COMPLÈTE
   ═══════════════════════════════════════════════════════════════ */

/* ─── VARIABLES ─── */
:root {
  --gold: #C9A84C;
  --gold-dark: #9A7209;
  --gold-mid: #B8960C;
  --gold-gradient: linear-gradient(to left, #9A7209, #B8960C, #C9A84C);
  --cream: #FAF6EE;
  --cream-input: #FAF6EE;
  --sidebar-bg: #EDE5D8;
  --white: #FFFFFF;
  --text-dark: #1a1a2e;
  --text-mid: #4a4a6a;
  --text-light: #8a8aaa;
  --border-light: #e8e0d0;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: 'Inter', sans-serif; }
h1, h2, h3, .logo-name { font-family: 'Cormorant Garamond', serif; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2350 50%, #1a1a2e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; margin-bottom: 28px;
}
.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 600;
  text-align: center; color: var(--text-dark);
  margin-bottom: 6px;
}
.login-subtitle {
  text-align: center; color: var(--text-light);
  font-size: 0.88rem; margin-bottom: 28px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-mid); }
.input-with-icon {
  position: relative;
}
.input-with-icon i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gold); font-size: 0.85rem;
}
.input-with-icon input {
  width: 100%; padding: 11px 14px 11px 36px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--cream-input);
  font-size: 0.95rem; color: var(--text-dark);
  transition: border-color 0.2s;
}
.input-with-icon input:focus {
  outline: none; border-color: var(--gold);
}
.login-error {
  background: #FEF2F2; border: 1px solid #FECACA;
  color: #DC2626; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 0.85rem;
}
.btn-login {
  background: var(--gold-gradient);
  color: white; border-radius: var(--radius-sm);
  padding: 12px; font-weight: 600; font-size: 0.95rem;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
}
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   LOGO
   ═══════════════════════════════════════════════════════════════ */
.logo-block {
  display: flex; align-items: center; gap: 12px;
}
.logo-icon {
  width: 44px; height: 44px;
  background: var(--gold-gradient);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem;
  flex-shrink: 0;
}
.logo-icon-sm { width: 36px; height: 36px; font-size: 0.9rem; border-radius: 10px; }
.logo-text {
  display: flex; flex-direction: column;
  line-height: 1.1;
}
.logo-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; font-weight: 600;
  color: var(--text-dark); letter-spacing: 0.01em;
}
.logo-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.38em;
  background: var(--gold-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  align-self: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex; min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-mid);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.88rem; }
.nav-item:hover { background: rgba(201,168,76,0.08); color: var(--text-dark); }
.nav-item.active {
  background: rgba(201,168,76,0.14);
  color: var(--gold-dark);
  border-left: 3px solid var(--gold);
  padding-left: 9px;
}
.nav-sub { padding-left: 32px; font-size: 0.85rem; }
.nav-sub.active { padding-left: 29px; }
.nav-logout { color: var(--text-mid); }
.nav-logout:hover { background: rgba(201,168,76,0.08); color: var(--gold-dark); }
.sidebar-footer {
  padding: 12px 12px 20px;
  border-top: 1px solid var(--border-light);
}

/* ─── MOBILE HEADER ─── */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 60px; z-index: 99;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  padding: 0 16px; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.hamburger {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-dark);
  font-size: 1rem;
}
.hamburger:hover { background: rgba(201,168,76,0.1); }
.mobile-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 99;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; padding: 32px;
  min-height: 100vh;
  background: var(--cream);
}

/* ─── PAGE ─── */
.page { display: none; }
.page.active { display: block; }

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 600;
  color: var(--text-dark);
}
.page-title i { font-size: 1.5rem; margin-right: 10px; color: var(--gold); }

/* ─── YEAR SELECTOR ─── */
.year-selector {
  display: flex; align-items: center; gap: 8px;
}
.year-btn {
  width: 32px; height: 32px;
  background: var(--white); border: 1.5px solid var(--border-light);
  border-radius: 8px; color: var(--text-mid);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.year-btn:hover { border-color: var(--gold); color: var(--gold); }
.year-display {
  font-weight: 600; font-size: 1.05rem;
  color: var(--text-dark); min-width: 48px; text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border-light);
}
.kpi-icon {
  width: 52px; height: 52px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.kpi-gold .kpi-icon { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #92400E; }
.kpi-blue .kpi-icon { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); color: #2563EB; }
.kpi-green .kpi-icon { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); color: #059669; }
.kpi-orange .kpi-icon { background: linear-gradient(135deg, #FFEDD5, #FED7AA); color: #92400E; }
.kpi-body { display: flex; flex-direction: column; }
.kpi-value {
  font-size: 1.55rem; font-weight: 700;
  color: var(--text-dark); letter-spacing: -0.02em;
  line-height: 1.1;
  order: 2;
}
.kpi-label { font-size: 0.8rem; color: var(--text-light); margin-bottom: 2px; order: 1; }

/* ═══════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════ */
.charts-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}
.charts-row-3 { grid-template-columns: repeat(3, 1fr); }
.charts-row-full { grid-template-columns: 1fr; }
.chart-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border-light);
}
.chart-card-header { margin-bottom: 16px; }
.chart-card-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem; font-weight: 600;
  color: var(--text-dark);
}
.chart-container { position: relative; }
.donut-container { display: flex; align-items: center; justify-content: center; }

/* Custom legends */
.chart-legend-custom {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.legend-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.78rem; color: var(--text-mid);
}
.legend-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.legend-value { font-weight: 600; color: var(--text-dark); }

/* Source bars */
.source-bars-container { padding: 4px 0; }
.source-bar-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; font-size: 0.82rem;
}
.source-bar-label {
  display: flex; align-items: center; gap: 7px;
  width: 200px; flex-shrink: 0; color: var(--text-mid);
  overflow: hidden; white-space: nowrap;
}
.source-bar-label .legend-dot { flex-shrink: 0; }
.source-bar-track {
  flex: 1; height: 8px; background: #F0EAD8;
  border-radius: 4px; overflow: hidden;
}
.source-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.source-bar-pct { font-weight: 700; color: var(--text-dark); min-width: 38px; text-align: right; }
.source-bar-count { font-weight: 400; color: var(--text-light); min-width: 24px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   SYNTHÈSE ANNUELLE
   ═══════════════════════════════════════════════════════════════ */
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem; font-weight: 600;
  color: var(--text-dark); margin: 24px 0 14px;
}
.synthesis-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 10px; margin-bottom: 24px;
}
.synth-card {
  border-radius: 10px;
  padding: 12px 15px 13px;
  text-align: left;
}
.synth-label {
  font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 7px;
  line-height: 1.3;
}
.synth-value {
  font-size: 1.3rem; font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Bloc 1 — Demandes : ambre doré */
.synth-gold {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1.5px solid #FCD34D;
}
.synth-gold .synth-label { color: #92400E; }
.synth-gold .synth-value { color: #78350F; }

/* Bloc 2 — Taux confirmation : lime vif (bien distinct du menthe) */
.synth-green {
  background: linear-gradient(135deg, #F7FEE7 0%, #ECFCCB 100%);
  border: 1.5px solid #65A30D;
}
.synth-green .synth-label { color: #3F6212; }
.synth-green .synth-value { color: #365314; }

/* Bloc 3 — Délai moyen : bleu indigo */
.synth-blue {
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 1.5px solid #4338CA;
}
.synth-blue .synth-label { color: #3730A3; }
.synth-blue .synth-value { color: #312E81; }

/* Bloc 4 — Total encaissé : menthe émeraude */
.synth-greenlight {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border: 1.5px solid #059669;
}
.synth-greenlight .synth-label { color: #065F46; }
.synth-greenlight .synth-value { color: #064E3B; }

/* Bloc 5 — Total restant : orange pêche */
.synth-cream {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
  border: 1.5px solid #FDBA74;
}
.synth-cream .synth-label { color: #9A3412; }
.synth-cream .synth-value { color: #7C2D12; }

/* Bloc 6 — Bénéfice net : rose framboise */
.synth-pink {
  background: linear-gradient(135deg, #FFF1F2 0%, #FFE4E6 100%);
  border: 1.5px solid #E11D48;
}
.synth-pink .synth-label { color: #9F1239; }
.synth-pink .synth-value { color: #881337; }

/* ═══════════════════════════════════════════════════════════════
   PROCHAINS MARIAGES
   ═══════════════════════════════════════════════════════════════ */
.upcoming-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.upcoming-item {
  background: var(--white); border-radius: var(--radius-sm);
  padding: 14px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); border: 1.5px solid var(--border-light);
}
.upcoming-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gold-gradient); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.82rem; flex-shrink: 0;
  letter-spacing: 0.5px;
}
.upcoming-info { flex: 1; min-width: 0; }
.upcoming-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; font-weight: 600; color: var(--text-dark);
}
.upcoming-meta { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.upcoming-meta i { margin-right: 4px; }
.upcoming-badge {
  background: var(--gold-gradient); color: white;
  border-radius: 20px; padding: 3px 12px;
  font-size: 0.78rem; font-weight: 700;
  white-space: nowrap;
}
.upcoming-amount { font-weight: 600; font-size: 0.92rem; color: var(--text-mid); text-align: right; }
.upcoming-empty {
  text-align: center; color: var(--text-light);
  font-size: 0.9rem; padding: 24px;
  background: var(--white); border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
}

/* ═══════════════════════════════════════════════════════════════
   MES COUPLES
   ═══════════════════════════════════════════════════════════════ */
.filters-bar {
  display: flex; gap: 12px; margin-bottom: 24px;
  flex-wrap: wrap; align-items: center;
}
.filter-search {
  position: relative; flex: 1; min-width: 200px;
}
.filter-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: 0.85rem;
}
.filter-search input {
  width: 100%; padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--border-light); border-radius: var(--radius-sm);
  background: var(--white); font-size: 0.88rem; color: var(--text-dark);
  transition: border-color 0.2s;
}
.filter-search input:focus { outline: none; border-color: var(--gold); }
.filter-select {
  padding: 10px 14px; border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm); background: var(--white);
  font-size: 0.88rem; color: var(--text-dark);
  cursor: pointer; transition: border-color 0.2s; min-width: 160px;
}
.filter-select:focus { outline: none; border-color: var(--gold); }

/* Couples grid */
.couples-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.couple-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border-light);
  cursor: pointer; transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}
.couple-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.couple-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px;
}
.couple-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem; font-weight: 600;
  color: var(--text-dark); line-height: 1.2;
}
.card-actions { display: flex; gap: 6px; }
.card-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; transition: background 0.15s, color 0.15s;
  z-index: 2; position: relative;
}
.card-btn-edit { color: var(--gold-dark); background: #FFF8E7; border: 1.5px solid #E8D9A0; }
.card-btn-edit:hover { background: #FFF0C0; }
.card-btn-delete { color: #DC2626; background: #FEF2F2; border: 1.5px solid #FECACA; }
.card-btn-delete:hover { background: #FECACA; }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-attente { background: #FFF3CD; color: #B45309; border: 1px solid #FDE68A; }
.badge-confirme { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.badge-decline { background: #FCE4E4; color: #7F1D1D; border: 1px solid #FECACA; }

.couple-meta { margin: 10px 0; }
.meta-line {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.82rem; color: var(--text-mid); margin-bottom: 5px;
}
.meta-line i { color: var(--gold); width: 14px; font-size: 0.78rem; }

/* Financial blocs on card */
.card-finance-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-top: 12px;
}
.finance-bloc {
  border-radius: 8px; padding: 8px 10px; text-align: center;
}
.finance-bloc-label { font-size: 0.68rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.finance-bloc-value { font-size: 0.92rem; font-weight: 500; color: var(--text-dark); margin-top: 2px; }
.fb-ca { background: #FDF8ED; border: 1.5px solid #E8DCC0; }
.fb-enc { background: #E4F7EE; border: 1.5px solid #B8E6D0; }
.fb-rest { background: #FFF0E0; border: 1.5px solid #F0D8B8; }

/* Empty state */
.empty-state {
  grid-column: 1/-1; text-align: center; padding: 48px 24px;
  color: var(--text-light);
}
.empty-state i { font-size: 3rem; color: var(--border-light); display: block; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; }

/* ═══════════════════════════════════════════════════════════════
   FICHE COUPLE (TABS)
   ═══════════════════════════════════════════════════════════════ */
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}
.detail-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 600;
  color: var(--text-dark);
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tabs */
.tabs-wrapper {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1.5px solid var(--border-light);
  margin-bottom: 20px; overflow: hidden;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}
.tabs-nav {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--sidebar-bg);
  padding: 6px 4px; gap: 0;
}
.tab-btn {
  padding: 10px 8px; text-align: center;
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-mid);
  border-radius: 10px;
  margin: 4px 3px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.tab-btn:hover { background: rgba(201,168,76,0.08); color: var(--gold-dark); }
.tab-btn.active {
  background: var(--gold-gradient);
  color: white;
  font-weight: 600;
}
.tab-btn i { margin-right: 6px; }
.tab-content { display: none; padding: 24px; }
.tab-content.active { display: block; }

/* Form sections (onglets fiche couple) */
.form-section {
  margin-bottom: 28px;
}
.form-section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; font-weight: 400;
  color: var(--text-dark);
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border-light);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.form-section-title i { color: var(--gold); font-size: 0.95rem; }

/* Form cards (page Nouveau couple) */
.new-form-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  padding: 22px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.form-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; font-weight: 400;
  color: var(--text-dark);
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border-light);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.form-card-title i { color: var(--gold); font-size: 0.95rem; }
.new-form-actions {
  display: flex; gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 8px 0 24px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-col-span-2 { grid-column: span 2; }
.form-col-span-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.78rem; font-weight: 400;
  color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.04em;
}
.form-label .required { color: #DC2626; margin-left: 3px; }
.form-input, .form-select, .form-textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--cream-input);
  font-size: 0.9rem; color: var(--text-dark);
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--gold);
}
.form-input[readonly], .form-input:disabled {
  background: var(--cream); color: var(--text-mid);
  cursor: default; border-color: var(--border-light);
}
.form-textarea { resize: vertical; min-height: 100px; }

/* Read mode */
.read-value {
  padding: 9px 12px;
  background: var(--cream);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--text-dark);
  min-height: 38px; word-break: break-word;
}

/* Checkbox row */
.checkbox-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer;
}
.checkbox-label {
  font-size: 0.82rem;
  color: var(--text-mid);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Delay badge */
.delay-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #FFF8E7; border: 1.5px solid #E8D9A0;
  border-radius: 20px; padding: 4px 12px;
  font-size: 0.82rem; font-weight: 600; color: var(--gold-dark);
  margin-top: 8px;
}

/* Financial summary blocs */
.finance-summary-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: 8px;
}
.fin-recap {
  border-radius: 8px; padding: 12px 14px; text-align: center;
}
.fin-recap-label { font-size: 0.72rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fin-recap-value { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.fr-enc { background: #FDF8ED; border: 1.5px solid #E8DCC0; }
.fr-enc .fin-recap-value { color: var(--gold-dark); }
.fr-rest { background: #FFF0E0; border: 1.5px solid #F0D8B8; }
.fr-rest .fin-recap-value { color: #C2410C; }
.fr-ben { background: #E4F7EE; border: 1.5px solid #B8E6D0; }
.fr-ben .fin-recap-value { color: #065F46; }

/* URSSAF line */
.urssaf-row {
  background: linear-gradient(135deg, #FFFDF5 0%, #FFF8E1 100%);
  border: 1.5px solid #E8D9A0;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.urssaf-header {
  margin-bottom: 16px;
}
.urssaf-title {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text-dark);
  letter-spacing: 0.01em;
}
.urssaf-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}
.urssaf-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: end;
}
.urssaf-field-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.urssaf-cotisation-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FDF5E4;
  border: 1.5px solid #E8D9A0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.88rem;
  color: #B45309;
  font-weight: 600;
  gap: 8px;
  /* aligne la hauteur avec l'input voisin */
  height: 40px;
  box-sizing: border-box;
}
.urssaf-cotisation-box .cotisation-label {
  color: #B45309;
  font-size: 0.82rem;
  font-style: normal;
}
.urssaf-cotisation-box .cotisation-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #B45309;
}
/* ancien .urssaf-cotisation conservé pour compat. lecture seule detail */
.urssaf-cotisation { font-size: 0.9rem; font-weight: 600; color: #B45309; }

.urssaf-fields .form-input {
  height: 40px;
  box-sizing: border-box;
  padding: 0 12px;
}

/* Charges lines */
.charge-line {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.charge-line input { flex: 1; }
.charge-line .charge-select { flex: 1; min-width: 0; }
.charge-line .charge-custom-label { flex: 1; min-width: 0; }
.charge-line .charge-amount { width: 120px; flex-shrink: 0; }
.charge-delete-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: #FEF2F2; color: #DC2626;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; flex-shrink: 0;
  border: 1.5px solid #FECACA; transition: background 0.15s;
}
.charge-delete-btn:hover { background: #FECACA; }

.charges-separator { border: none; border-top: 1px solid var(--border-light); margin: 12px 0; }
.charges-total {
  background: var(--gold-gradient); color: white;
  border-radius: 8px; padding: 9px 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  border: 1.5px solid #9A7209;
}
.charges-total-label { font-weight: 500; font-size: 0.85rem; }
.charges-total-value { font-weight: 600; font-size: 0.95rem; }

/* Providers grid */
.providers-grid { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.providers-grid th {
  font-size: 0.73rem; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0 8px 8px; text-align: left;
}
.providers-grid td { padding: 4px 8px; }
.prov-role-cell {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--text-dark);
  white-space: nowrap;
}

/* Contacts list */
.contacts-list { display: flex; flex-direction: column; gap: 12px; }
.contact-item {
  background: var(--cream); border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 14px;
}

/* Planning table */
.planning-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.planning-table th {
  font-size: 0.73rem; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0 8px 10px; text-align: left;
}
.planning-table th:nth-child(1) { padding-right: 0; }
.planning-table th:nth-child(2) { padding-left: 4px; }
.planning-table td { padding: 4px 8px; vertical-align: top; }
.planning-table td:nth-child(1) { padding-right: 0; }
.planning-table td:nth-child(2) { padding-left: 4px; }
.planning-notes-field { min-height: 70px; resize: vertical; }
.plan-step-cell {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--text-dark);
  white-space: nowrap; min-width: 160px; padding-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 0.87rem; font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  cursor: pointer;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gold { background: var(--gold-gradient); color: white; border: none; }
.btn-outline {
  background: transparent; color: var(--text-mid);
  border: 1.5px solid var(--border-light);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dark); opacity: 1; }
.btn-danger { background: #DC2626; color: white; border: none; }
.btn-danger-outline {
  background: transparent; color: #DC2626;
  border: 1.5px solid #FECACA;
}
.btn-danger-outline:hover { background: #FEF2F2; opacity: 1; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-add-charge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 400; color: var(--gold-dark);
  background: #FFFFFF; border: 1.5px solid var(--gold);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  margin-top: 8px;
}
.btn-add-charge:hover { background: #FFF8E7; border-color: var(--gold-dark); }
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text-mid); font-weight: 500;
  padding: 7px 0; cursor: pointer;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--gold-dark); }

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(60,55,40,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
}
.modal-box {
  background: var(--white); border-radius: 16px;
  padding: 36px 32px; width: 100%; max-width: 400px;
  text-align: center; box-shadow: var(--shadow-lg);
}
.modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #FEF2F2; color: #DC2626;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin: 0 auto 16px;
}
.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem; font-weight: 600;
  color: var(--text-dark); margin-bottom: 8px;
}
.modal-msg { font-size: 0.88rem; color: var(--text-mid); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--white); border-radius: var(--radius-sm);
  padding: 12px 18px; box-shadow: var(--shadow-md);
  border-left: 4px solid var(--gold);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.88rem; font-weight: 500; color: var(--text-dark);
  max-width: 320px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease forwards;
}
.toast.success { border-color: #10B981; }
.toast.error { border-color: #DC2626; }
.toast.info { border-color: #3B82F6; }
.toast i { font-size: 1rem; }
.toast.success i { color: #10B981; }
.toast.error i { color: #DC2626; }
.toast.info i { color: #3B82F6; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════════════
   DATALIST SUGGESTIONS
   ═══════════════════════════════════════════════════════════════ */
datalist { display: none; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLETTE LARGE (≤ 1100px)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .synthesis-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .charts-row-3 { grid-template-columns: 1fr 1fr; }
  .tabs-wrapper, .detail-header { max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLETTE (≤ 900px) — iPad landscape
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .charts-row-3 { grid-template-columns: 1fr; }
  :root { --sidebar-w: 210px; }
  .main-content { padding: 28px 20px 24px; }
  .form-card { padding: 18px 20px; }
  .urssaf-fields { grid-template-columns: 1fr; gap: 10px; }
  .finance-summary-row { grid-template-columns: 1fr; gap: 10px; }
  .planning-table th:nth-child(3),
  .planning-table td:nth-child(3) { min-width: 140px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLETTE PORTRAIT (≤ 768px) — iPad portrait / grandes phablettes
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar masqué, ouverture par overlay */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .mobile-header { display: flex; }

  /* Contenu principal */
  .main-content {
    margin-left: 0;
    padding: 76px 14px 32px;
  }

  /* Grilles dashboard */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .synthesis-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row, .charts-row-3 { grid-template-columns: 1fr; }

  /* Formulaires */
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-col-span-2, .form-col-span-3 { grid-column: span 1; }
  .form-card { padding: 16px; }
  .form-card, .new-form-header, .new-form-actions { max-width: 100%; }

  /* Finance */
  .card-finance-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .finance-summary-row { grid-template-columns: 1fr; gap: 8px; }
  .urssaf-fields { grid-template-columns: 1fr; gap: 10px; }
  .urssaf-cotisation-box { justify-content: space-between; }
  .charges-total { flex-direction: row; padding: 8px 12px; }

  /* Fiche couple */
  .detail-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .detail-actions { width: 100%; justify-content: flex-end; }
  .tabs-wrapper, .detail-header { max-width: 100%; }
  .tabs-nav { grid-template-columns: repeat(3, 1fr); font-size: 0.78rem; }
  .tab-btn { padding: 8px 4px; }

  /* Planning */
  .planning-table { font-size: 0.82rem; }
  .planning-table th, .planning-table td { padding: 4px 6px; }

  /* Divers */
  .source-bar-label { width: 110px; font-size: 0.78rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-title { font-size: 1.6rem; }
  .modal-box { margin: 20px; width: calc(100% - 40px); }
  .new-form-actions { justify-content: stretch; }
  .new-form-actions .btn { flex: 1; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 480px) — iPhone
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .main-content { padding: 70px 10px 28px; }

  /* KPI : 1 colonne sur petits écrans */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 12px 10px; }
  .kpi-icon { width: 44px; height: 44px; font-size: 1.1rem; }
  .kpi-value { font-size: 1.3rem; }

  /* Synthèse */
  .synthesis-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .synth-card { padding: 12px 10px; }

  /* Formulaires */
  .form-card { padding: 14px 12px; }
  .tabs-nav { grid-template-columns: repeat(2, 1fr); font-size: 0.75rem; }
  .tab-btn { padding: 7px 2px; }

  /* Finance */
  .card-finance-row { grid-template-columns: 1fr; gap: 8px; }
  .fin-recap { padding: 10px 12px; }

  /* Planning — masquer colonne Lieu sur très petit écran */
  .planning-table th:nth-child(3),
  .planning-table td:nth-child(3) { display: none; }

  /* Boutons actions */
  .detail-actions .btn { font-size: 0.78rem; padding: 7px 10px; }
  .new-form-actions .btn { font-size: 0.8rem; }

  /* Modal */
  .modal-box { margin: 10px; width: calc(100% - 20px); padding: 20px 14px; }

  /* Misc */
  .page-title { font-size: 1.4rem; }
  .source-bar-label { width: 90px; }
  .source-bar-track { flex: 1; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TRÈS PETIT MOBILE (≤ 375px) — iPhone SE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 375px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { flex-direction: row; align-items: center; gap: 12px; text-align: left; }
  .tabs-nav { grid-template-columns: repeat(2, 1fr); }
  .synthesis-grid { grid-template-columns: 1fr; }
}
