/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4F46E5;
  --primary-h: #4338CA;
  --primary-light: #EEF2FF;
  --sidebar-bg: #1E293B;
  --sidebar-hover: #2D3F55;
  --sidebar-active: #334155;
  --bg: #F1F5F9;
  --white: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-focus: #4F46E5;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --sidebar-w: 240px;
}

html, body { height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); overflow: hidden; }

/* ===== LAYOUT ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.brand-one  { color: #FBBF24; font-weight: 800; letter-spacing: .02em; }

.btn-new-invoice {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 12px 8px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-new-invoice:hover { background: var(--primary-h); }

.sidebar-section-title {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #64748B;
}

.sidebar-invoices {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}
.sidebar-empty { font-size: 12px; color: #64748B; text-align: center; padding: 20px 8px; line-height: 1.5; }

.sidebar-invoice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
}
.sidebar-invoice-item:hover { background: var(--sidebar-hover); }
.sidebar-invoice-item.active { background: var(--sidebar-active); }
.sii-info { flex: 1; min-width: 0; }
.sii-number { font-size: 12px; font-weight: 600; color: #E2E8F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sii-client { font-size: 11px; color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.sii-delete { background: none; border: none; color: #475569; cursor: pointer; padding: 3px; border-radius: 4px; flex-shrink: 0; }
.sii-delete:hover { color: var(--danger); background: rgba(239,68,68,.12); }

/* ===== MAIN ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Topbar */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.badge-draft { background: #FEF3C7; color: #92400E; }
.badge-saved { background: #D1FAE5; color: #065F46; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout { background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; padding: 2px; border-radius: 4px; }
.btn-logout:hover { color: #EF4444; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-link-danger { background: none; border: none; color: var(--danger); font-size: 12px; cursor: pointer; padding: 0; margin-top: 6px; display: block; text-decoration: underline; }
.btn-link-danger:hover { color: #B91C1C; }

/* ===== CONTENT SPLIT ===== */
.content-split {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
}

/* ===== FORM PANEL ===== */
.form-panel {
  width: clamp(360px, 42vw, 520px);
  flex-shrink: 1;
  border-right: 1px solid var(--border);
  overflow: visible;
  display: flex;
  flex-direction: column;
}
.form-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: visible;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: #FAFAFA;
  border-radius: 12px 12px 0 0;
}
.card-header h2 { font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .5px; }
.card-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }

/* Logo upload */
.logo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
  min-height: 80px;
}
.logo-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.logo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; }
#logo-preview { max-height: 80px; max-width: 200px; object-fit: contain; border-radius: 4px; }

/* Grid — CSS Grid for proper 2-column layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.span-1 { grid-column: span 1; }

label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.req { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.color-picker-wrap { display: flex; align-items: center; gap: 8px; }
input[type="color"] { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; cursor: pointer; background: none; }
#color-label { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* ===== ITEMS TABLE (form) ===== */

/* Scroll wrapper so items table can scroll horizontally on narrow panels */
.items-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.items-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  min-width: 480px;
}

#items-container { min-width: 480px; }

/* Items column sizes — total fixed: 52+60+68+88+88+48=404px + gaps 6*6=36px = 440px fits in 480px */
.icol-desc { flex: 1; min-width: 0; }
.icol-qty  { flex: 0 0 52px; text-align: center; }
.icol-unit { flex: 0 0 60px; text-align: center; }
.icol-tva  { flex: 0 0 68px; text-align: center; }
.icol-pu   { flex: 0 0 88px; text-align: right; }
.icol-ttc  { flex: 0 0 88px; text-align: right; }
.icol-act  { flex: 0 0 48px; }

/* Catalogue tag on item rows */
.cat-tag {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  background: var(--primary-light); color: var(--primary);
  border: 1px solid #C7D2FE; border-radius: 999px;
  padding: 1px 6px; margin-bottom: 4px;
  white-space: nowrap;
}
.icol-desc { display: flex; flex-direction: column; }
.icol-desc input { width: 100%; }

/* Item row — flex layout */
.item-row { display: flex; align-items: center; gap: 6px; padding: 8px 4px; border-bottom: 1px solid #F8FAFC; }
.item-row:last-child { border-bottom: none; }
.icol-act { display: flex; align-items: center; justify-content: flex-end; }
.icol-act button:hover { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-del-item:hover { color: var(--danger) !important; border-color: var(--danger) !important; }

/* Item row inputs match column sizes */
.item-row .icol-qty input  { width: 100%; text-align: center; }
.item-row .icol-unit input { width: 100%; text-align: center; font-size: 12px; }
.item-row .icol-tva select { width: 100%; font-size: 12px; padding: 8px 4px; }
.item-row .icol-pu input   { width: 100%; text-align: right; }
.item-row .icol-ttc        { font-size: 12px; font-weight: 600; color: var(--text); padding: 8px 10px; background: #F8FAFC; border-radius: 4px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; }

/* Items card header */
.items-card-header { display: flex; align-items: center; justify-content: space-between; }
.btn-cat-link {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--primary);
  padding: 4px 8px; border-radius: 4px;
  transition: background .12s;
}
.btn-cat-link:hover { background: var(--primary-light); }

/* Actions row below items */
.items-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.btn-add-item, .btn-from-catalogue {
  display: flex; align-items: center; gap: 6px;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.btn-add-item {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  flex: 1;
}
.btn-add-item:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.btn-from-catalogue {
  background: var(--primary-light);
  border: 1px solid #C7D2FE;
  color: var(--primary);
  font-weight: 600;
}
.btn-from-catalogue:hover { background: #DDD6FE; border-color: #A5B4FC; }

/* Sidebar catalogue button */
.btn-catalogue-sidebar {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 12px 8px;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  color: #94A3B8;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  width: calc(100% - 24px);
}
.btn-catalogue-sidebar:hover { background: var(--sidebar-hover); color: #E2E8F0; border-color: rgba(255,255,255,.2); }

/* TVA Exemption picker */
.tva-exemption-section { display: flex; flex-direction: column; gap: 8px; }
.tva-exemption-picker {
  margin-top: 2px;
  padding: 12px 14px;
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tva-exemption-picker label { color: #92400E; }
.tva-exemption-picker select { border-color: #FCD34D; background: #FFFBEB; }
.tva-exemption-picker select:focus { border-color: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.tva-exemption-info {
  font-size: 12px;
  color: #78350F;
  background: #FEF3C7;
  border-radius: 4px;
  padding: 8px 10px;
  line-height: 1.5;
}
.exemption-info-icon { margin-right: 4px; }

.discount-row { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.discount-fields { display: flex; align-items: center; gap: 6px; }
.discount-input { width: 80px; }

/* ===== PREVIEW PANEL ===== */
.preview-panel {
  flex: 1;
  background: #E8EDF3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.zoom-controls { display: flex; align-items: center; gap: 8px; }
.btn-zoom { background: var(--white); border: 1px solid var(--border); border-radius: 4px; width: 26px; height: 26px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all .12s; }
.btn-zoom:hover { background: var(--bg); color: var(--primary); }
#zoom-label { font-size: 12px; color: var(--text-muted); min-width: 36px; text-align: center; }

.preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 32px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#preview-scale-wrapper {
  transform-origin: top center;
  transition: transform .2s;
}

/* ===== INVOICE PAPER ===== */
.invoice-paper {
  width: 794px; /* A4 @ 96dpi */
  min-height: 1123px;
  background: var(--white);
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
  border-radius: 2px;
  padding: 56px 60px;
  font-family: var(--font);
  font-size: 13px;
  color: #1E293B;
  position: relative;
}

/* Invoice Header */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  gap: 20px;
}
.inv-logo-name { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.inv-logo { max-height: 70px; max-width: 180px; object-fit: contain; }
.inv-em-name { font-size: 18px; font-weight: 700; color: #1E293B; }
.inv-em-details { font-size: 11.5px; color: #64748B; line-height: 1.7; }

.inv-title-block { text-align: right; }
.inv-title-word {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  text-transform: uppercase;
}
.inv-number { font-size: 13px; font-weight: 600; color: #64748B; margin-top: 4px; }
.inv-dates { margin-top: 12px; font-size: 12px; color: #64748B; line-height: 1.8; text-align: right; }
.inv-dates strong { color: #1E293B; }

/* Divider */
.inv-divider { height: 3px; border-radius: 999px; margin: 28px 0; }

/* Client block */
.inv-parties { display: flex; justify-content: space-between; gap: 40px; margin-bottom: 32px; }
.inv-party { flex: 1; }
.inv-party-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #94A3B8; margin-bottom: 6px; }
.inv-party-name { font-size: 14px; font-weight: 700; color: #1E293B; margin-bottom: 4px; }
.inv-party-details { font-size: 12px; color: #64748B; line-height: 1.7; }

/* Object line */
.inv-object-line { font-size: 12.5px; color: #475569; margin-bottom: 24px; padding: 10px 14px; background: #F8FAFC; border-radius: 6px; border-left: 3px solid #CBD5E1; }
.inv-object-line strong { color: #1E293B; }

/* Items table */
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.inv-table thead tr { border-radius: 6px; }
.inv-table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #fff;
  text-align: left;
}
.inv-table th:last-child, .inv-table td.right { text-align: right; }
.inv-table th.center, .inv-table td.center { text-align: center; }
.inv-table tbody tr { border-bottom: 1px solid #F1F5F9; transition: background .1s; }
.inv-table tbody tr:last-child { border-bottom: none; }
.inv-table td { padding: 11px 12px; font-size: 12.5px; color: #374151; vertical-align: top; }
.inv-table td .item-desc-main { font-weight: 500; color: #1E293B; }
.inv-table td .item-desc-sub { font-size: 11px; color: #94A3B8; margin-top: 2px; }

/* Totals */
.inv-totals-wrap { display: flex; justify-content: flex-end; margin-top: 8px; }
.inv-totals { width: 280px; }
.inv-total-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 12.5px; color: #64748B; border-bottom: 1px solid #F1F5F9; }
.inv-total-row:last-child { border-bottom: none; }
.inv-total-row.subtotal { color: #374151; }
.inv-total-row.discount { color: var(--danger); }
.inv-total-row.tva-row { color: #374151; }
.inv-total-ttc {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px; font-weight: 700; color: #fff;
}

/* TVA summary */
.inv-tva-summary { margin-top: 4px; }
.inv-tva-summary-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.inv-tva-summary-table th { text-align: right; padding: 4px 8px; color: #94A3B8; font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; }
.inv-tva-summary-table th:first-child { text-align: left; }
.inv-tva-summary-table td { text-align: right; padding: 4px 8px; color: #374151; }
.inv-tva-summary-table td:first-child { text-align: left; }

/* Payment & Notes */
.inv-payment-section { margin-top: 32px; display: flex; gap: 24px; }
.inv-payment-block, .inv-notes-block { flex: 1; }
.inv-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #94A3B8; margin-bottom: 8px; }
.inv-payment-details { font-size: 12px; color: #475569; line-height: 1.8; }
.inv-notes-text { font-size: 12px; color: #475569; line-height: 1.7; font-style: italic; }

/* Legal mentions */
.inv-legal { margin-top: 32px; padding-top: 20px; border-top: 1px solid #E2E8F0; }
.inv-legal-text { font-size: 10.5px; color: #94A3B8; line-height: 1.7; }

/* Footer */
.inv-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 2px solid #F1F5F9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #CBD5E1;
}

/* Empty state */
.inv-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  color: #CBD5E1;
  gap: 12px;
}
.inv-empty-state svg { opacity: .4; }
.inv-empty-state p { font-size: 13px; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  transition: opacity .2s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: #065F46; }
.toast.error { background: #991B1B; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 680px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-hdr {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.modal-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 4px;
  flex-shrink: 0; display: flex; align-items: center;
  transition: color .12s, background .12s;
}
.modal-close-btn:hover { color: var(--danger); background: rgba(239,68,68,.08); }
.modal-bdy { flex: 1; overflow-y: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; }

/* Catalogue form */
.cat-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cat-form-section { background: #FAFBFF; border: 1px solid #E0E7FF; border-radius: var(--radius); padding: 16px; }
.cat-form-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-form-footer { display: flex; gap: 8px; margin-top: 14px; }

/* Catalogue list in modal */
.cat-list-section { flex: 1; }
.catalogue-list-modal { display: flex; flex-direction: column; gap: 8px; }
.cat-empty { font-size: 13px; color: var(--text-muted); text-align: center; padding: 24px; background: #F8FAFC; border-radius: var(--radius); border: 1px dashed var(--border); }
.cat-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.cat-card:hover { border-color: #C7D2FE; box-shadow: 0 2px 8px rgba(79,70,229,.08); }
.cat-card-info { flex: 1; min-width: 0; }
.cat-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.cat-card-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.cat-card-price { font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.cat-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-cat-action {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font-size: 11.5px; cursor: pointer; color: var(--text-muted);
  transition: all .12s;
}
.btn-cat-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-cat-action.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,.06); }

/* Catalogue picker */
.cat-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.cat-picker-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 480px;
  max-height: 70vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cat-picker-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text);
  flex-shrink: 0;
}
.cat-picker-search {
  border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 10px 16px;
  font-size: 13px; width: 100%;
  flex-shrink: 0;
}
.cat-picker-search:focus { outline: none; border-bottom-color: var(--primary); background: var(--primary-light); }
.cat-picker-list { flex: 1; overflow-y: auto; }
.cat-picker-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #F8FAFC;
  cursor: pointer;
  transition: background .1s;
  gap: 12px;
}
.cat-picker-item:hover { background: var(--primary-light); }
.cat-picker-item-info { flex: 1; min-width: 0; }
.cat-picker-item-name { font-size: 13px; font-weight: 600; color: var(--text); }
.cat-picker-item-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.cat-picker-item-price { font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.cat-picker-empty { text-align: center; padding: 30px 16px; color: var(--text-muted); font-size: 13px; }
.cat-picker-footer { padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.btn-link-small { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--primary); text-decoration: underline; padding: 0; }
.btn-link-small:hover { color: var(--primary-h); }

/* ===== AUTOCOMPLETE DROPDOWN — fixed positioning so never clipped by card overflow ===== */
.ac-dropdown {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 5000;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #F8FAFC;
  transition: background .1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--primary-light); color: var(--primary); }
.ac-item strong { font-weight: 600; }
.ac-cp { font-size: 11px; color: var(--text-light); font-family: var(--font-mono); }
.ac-loading, .ac-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== SIRET BADGE ===== */
.siret-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--text-muted);
}
.siret-badge--ok { background: #D1FAE5; color: #065F46; }
.siret-badge--error { background: #FEE2E2; color: #991B1B; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (max-width: 1200px) {
  :root { --sidebar-w: 200px; }
  .form-panel { width: clamp(320px, 44vw, 480px); }
}

@media (max-width: 960px) and (min-width: 769px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .form-panel { width: 50%; }
}

@media (max-width: 720px) {
  .content-split { flex-direction: column; overflow-y: auto; }
  .form-panel { width: 100%; flex-shrink: 0; overflow: visible; }
  .preview-panel { min-height: 500px; flex-shrink: 0; }
  .topbar-actions .btn-ghost { display: none; }
}

/* ===== PRINT ===== */
@media print {
  .app { display: block; }
  .sidebar, .topbar, .form-panel, .preview-toolbar { display: none !important; }
  .content-split { display: block; }
  .preview-panel { background: none; overflow: visible; }
  .preview-scroll { padding: 0; overflow: visible; }
  #preview-scale-wrapper { transform: none !important; }
  .invoice-paper { box-shadow: none; width: 100%; min-height: auto; padding: 20mm; }
  @page { size: A4; margin: 0; }
}

/* =============================================
   SIDEBAR NAV TABS
   ============================================= */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); }
.snav-tab { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: none; background: none; border-radius: var(--radius); color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; transition: background 0.12s, color 0.12s; }
.snav-tab:hover { background: var(--bg); color: var(--text); }
.snav-tab.active { background: #EEF2FF; color: var(--primary); font-weight: 600; }
.snav-tab svg { flex-shrink: 0; }

/* =============================================
   VIEW SYSTEM
   ============================================= */
.view-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#view-invoices > .content-split { flex: 1; }

/* =============================================
   URSSAF LAYOUT
   ============================================= */
.urssaf-layout { flex: 1; display: flex; gap: 20px; padding: 20px; overflow: auto; align-items: flex-start; }
.urssaf-sidebar { width: 272px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0; }
.urssaf-main { flex: 1; min-width: 0; }

/* =============================================
   CERFA TABLE
   ============================================= */
.cerfa-id-row { display: flex; gap: 12px; margin-bottom: 16px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.cerfa-id-cell { flex: 1; min-width: 0; }
.cerfa-id-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.cerfa-id-value { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cerfa-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.cerfa-table th { padding: 8px 12px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-muted); background: var(--bg); border-bottom: 2px solid var(--border); }
.cerfa-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.cerfa-table tfoot tr td { padding: 12px; background: var(--bg); font-size: 14px; border-top: 2px solid var(--border); border-bottom: none; }
.cerfa-ca-input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--white); }
.cerfa-ca-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.cerfa-rate { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.cerfa-amount { font-weight: 600; text-align: right; white-space: nowrap; }
.cerfa-cfp-row td { background: #FAFAFA; }
.cerfa-acre-badge { display: inline-block; background: #D1FAE5; color: #065F46; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; margin-left: 4px; vertical-align: middle; }
.cerfa-note { background: #FFF8E1; border: 1px solid #FCD34D; border-radius: var(--radius); padding: 8px 12px; font-size: 12px; margin-bottom: 12px; }
.cerfa-vl-section { background: #F0F9FF; border: 1px solid #BAE6FD; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.cerfa-vl-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #0369A1; }
.cerfa-legal-note { font-size: 11.5px; color: var(--text-muted); padding: 10px 12px; background: var(--bg); border-radius: var(--radius); line-height: 1.65; }

/* =============================================
   URSSAF ALERTS & THRESHOLD BARS
   ============================================= */
.urssaf-alert { padding: 10px 14px; border-radius: var(--radius); font-size: 12.5px; margin-bottom: 8px; line-height: 1.55; }
.alert-danger  { background: #FEF2F2; border: 1px solid #FCA5A5; color: #7F1D1D; }
.alert-warning { background: #FFFBEB; border: 1px solid #FCD34D; color: #78350F; }
.seuil-item { margin-bottom: 4px; }
.seuil-label { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.seuil-bar { height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.seuil-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.4s ease; }
.seuil-fill.warning { background: #F59E0B; }
.seuil-fill.danger  { background: #EF4444; }

/* =============================================
   URSSAF HISTORY
   ============================================= */
.urssaf-hist-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.urssaf-hist-item:last-child { border-bottom: none; }
.uhi-period  { font-weight: 600; font-size: 13px; min-width: 140px; color: var(--text); }
.uhi-details { flex: 1; font-size: 12.5px; color: var(--text-muted); }

/* =============================================
   COMING SOON VIEW (Impôts / TVA)
   ============================================= */
.coming-soon-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; gap: 14px; }
.coming-soon-icon { width: 88px; height: 88px; background: #EEF2FF; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); margin-bottom: 4px; }
.coming-soon-view h2 { font-size: 22px; font-weight: 700; color: var(--text); margin: 0; }
.coming-soon-view p  { font-size: 14px; color: var(--text-muted); max-width: 420px; line-height: 1.65; margin: 0; }
.coming-soon-badge { background: #EEF2FF; color: var(--primary); font-size: 12px; font-weight: 600; padding: 5px 14px; border-radius: 99px; }

/* =============================================
   FICHE ENTREPRISE
   ============================================= */
.entreprise-layout { flex: 1; display: flex; gap: 20px; padding: 20px; overflow: auto; align-items: flex-start; }
.entreprise-col    { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* TVA Regime options */
.cp-regime-options { display: flex; flex-direction: column; gap: 8px; }
.cp-regime-option  { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.cp-regime-option input[type="radio"] { margin-top: 2px; flex-shrink: 0; accent-color: var(--primary); }
.cp-regime-option:hover  { border-color: var(--primary); background: #F9FAFB; }
.cp-regime-option.active { border-color: var(--primary); background: #EEF2FF; }
.cp-regime-option-title  { font-size: 13px; font-weight: 600; color: var(--text); }
.cp-regime-option-desc   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* TVA regime detail box */
.cp-regime-detail { padding: 10px 14px; border: 1px solid; border-radius: var(--radius); font-size: 13px; line-height: 1.6; }

/* Seuils table */
.cp-seuils-table  { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding: 12px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.cp-seuil-row     { display: flex; justify-content: space-between; font-size: 13px; }
.cp-seuil-row span { color: var(--text-muted); }

/* Obligations list */
.cp-obligations-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.cp-obligations-list li { font-size: 13px; color: var(--text); line-height: 1.5; }

/* ============================================================
   TVA MODULE
   ============================================================ */

/* Scrollable container */
.tva-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

/* Dashboard row: gauge + KPIs */
.tva-dashboard { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }

/* Gauge card */
.tva-gauge-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 12px; }
#tva-gauge-svg svg { display: block; }
.tva-gauge-info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tva-gi-line { font-size: 12px; color: var(--text-muted); text-align: center; }
.tva-gi-line strong { color: var(--text); font-size: 14px; }

/* KPI cards grid */
.tva-kpi-wrap { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; }
.tva-kpi-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tva-kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.tva-kpi-card > div:last-child { font-size: 22px; font-weight: 700; color: var(--text); }
.tva-kpi-net-card { border-color: var(--primary); background: #EEF2FF; }
.tva-kpi-net-card > div:last-child { color: var(--primary); }
.tva-kpi-net-card.credit { border-color: #10B981; background: #ECFDF5; }
.tva-kpi-net-card.credit > div:last-child { color: #10B981; }
#tva-kpi-nette-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* Period row */
.tva-period-row { display: flex; align-items: center; gap: 10px; }
.tva-period-row label { font-size: 13px; font-weight: 500; color: var(--text); }
.tva-period-row select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Alert bar */
.tva-alert-banner { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.tva-alert-banner.warning { background: #FFFBEB; border: 1px solid #F59E0B; color: #92400E; }
.tva-alert-banner.danger  { background: #FEF2F2; border: 1px solid #EF4444; color: #991B1B; }
.tva-alert-banner.info    { background: #EFF6FF; border: 1px solid #3B82F6; color: #1E40AF; }

/* Sub-tabs */
.tva-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tva-tab  { padding: 9px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.tva-tab:hover  { color: var(--primary); }
.tva-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Panel */
.tva-panel { display: none; }
.tva-panel.active { display: block; }

/* Rate summary chips */
.tva-rate-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tva-rate-chip { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--border); color: var(--text); }

/* Collectée table */
.tva-table-wrap { overflow-x: auto; }
.tva-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tva-table-wrap th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1.5px solid var(--border); }
.tva-table-wrap td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.tva-table-wrap tr:last-child td { border-bottom: none; }
.tva-table-wrap tr:hover td { background: var(--bg); }

/* Encaissement status badges */
.enc-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 99px; }
.enc-ok    { background: #ECFDF5; color: #065F46; }
.enc-pend  { background: #FFFBEB; color: #92400E; cursor: pointer; text-decoration: underline; }
.enc-auto  { background: #EEF2FF; color: #3730A3; }

/* Franchise notice */
.tva-franchise-notice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px; text-align: center; color: var(--text-muted); }
.tva-franchise-notice .fn-icon { font-size: 40px; }
.tva-franchise-notice h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.tva-franchise-notice p  { font-size: 13px; margin: 0; max-width: 400px; }

/* Déductible form */
.tva-achat-form { display: grid; grid-template-columns: 1fr 1fr 1fr 120px auto; gap: 8px; align-items: end; margin-bottom: 14px; padding: 12px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }
.tva-achat-form input, .tva-achat-form select { width: 100%; box-sizing: border-box; }
.tva-achat-form label { font-size: 11px; font-weight: 500; color: var(--text-muted); display: block; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.ocr-btn { padding: 7px 12px; background: #EEF2FF; color: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ocr-btn:hover { background: var(--primary); color: #fff; }

/* OCR status */
.ocr-status { font-size: 12px; padding: 6px 10px; border-radius: var(--radius); margin-top: 6px; }
.ocr-loading { background: #EFF6FF; color: #1E40AF; }
.ocr-success { background: #ECFDF5; color: #065F46; }
.ocr-error   { background: #FEF2F2; color: #991B1B; }

/* CA3 form */
.ca3-form { font-size: 13px; }
.ca3-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
.ca3-logo { font-size: 18px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.ca3-logo span { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); letter-spacing: 0; }
.ca3-meta { text-align: right; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.ca3-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ca3-form table { width: 100%; border-collapse: collapse; }
.ca3-form td  { padding: 7px 8px; border: 1px solid var(--border); vertical-align: middle; }
.ca3-form th  { padding: 7px 8px; border: 1px solid var(--border); background: var(--bg); font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.ca3-code { display: inline-block; padding: 2px 7px; background: #1E3A8A; color: #fff; border-radius: 4px; font-size: 11px; font-weight: 700; font-family: monospace; letter-spacing: 0.05em; }
.ca3-row-due    td { background: #FFF7ED; font-weight: 600; }
.ca3-row-credit td { background: #ECFDF5; font-weight: 600; }
.ca3-result-box { margin-top: 16px; padding: 14px 18px; border-radius: var(--radius); text-align: center; }
.ca3-result-box.due    { background: #FFF7ED; border: 2px solid #F59E0B; }
.ca3-result-box.credit { background: #ECFDF5; border: 2px solid #10B981; }
.ca3-result-box.zero   { background: var(--bg); border: 1.5px solid var(--border); }
.ca3-result-box .cr-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ca3-result-box .cr-amount { font-size: 28px; font-weight: 800; margin: 4px 0; }
.ca3-result-box.due    .cr-amount { color: #D97706; }
.ca3-result-box.credit .cr-amount { color: #059669; }
.ca3-result-box.zero   .cr-amount { color: var(--text-muted); }
.ca3-result-box .cr-note { font-size: 12px; color: var(--text-muted); }
.ca3-footer { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }
.ca3-ded-row td input { width: 120px; padding: 5px 8px; border: 1px solid var(--primary); border-radius: var(--radius); font-size: 13px; text-align: right; }

/* Empty state */
.tva-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13px; }

/* Totals footer row */
.tva-totals-row td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }

/* Responsive: collapse gauge + KPIs on narrow */
@media (max-width: 700px) {
  .tva-dashboard { grid-template-columns: 1fr; }
  .tva-kpi-wrap  { grid-template-columns: 1fr 1fr; }
  .tva-achat-form { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   TVA MODULE — classes complémentaires (générées par le JS)
   ============================================================ */

/* KPI value (classe sur le div HTML) */
.tva-kpi-value { font-size: 22px; font-weight: 700; color: var(--text); }

/* Panel header + sub-titre + badge */
.tva-panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.tva-panel-header h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--text); }
.tva-panel-sub { font-size: 12px; color: var(--text-muted); margin: 0; }
.tva-total-badge { flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.tva-total-badge strong { color: var(--text); font-weight: 700; }

/* Gauge body */
.tva-gauge-body { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Period label + select */
.tva-period-label { font-size: 13px; font-weight: 500; color: var(--text); }
.tva-year-sel { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Form header inside déductible form */
.tva-achat-form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tva-achat-form-header h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }

/* Alert banners — noms générés par le JS */
.tva-alert-danger  { background: #FEF2F2; border: 1px solid #EF4444; color: #991B1B; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.tva-alert-warning { background: #FFFBEB; border: 1px solid #F59E0B; color: #92400E; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.tva-alert-ok      { background: #ECFDF5; border: 1px solid #10B981; color: #065F46; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.tva-alert-info    { background: #EFF6FF; border: 1px solid #3B82F6; color: #1E40AF; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }

/* Rate badge inside chip */
.tva-rate-badge { display: inline-block; background: var(--primary); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; font-weight: 700; margin-right: 4px; }
.tva-rate-chip  { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; font-size: 12px; color: var(--text); }

/* Pending row */
.tva-row-pending td { opacity: 0.5; font-style: italic; }

/* CA3 logo, header structure */
.ca3-logo-text    { background: #1E3A5F; color: #fff; padding: 8px 12px; font-size: 12px; font-weight: 700; text-align: center; line-height: 1.4; border-radius: var(--radius); }
.ca3-header-body  { flex: 1; }
.ca3-title        { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 2px; }
.ca3-subtitle     { font-size: 12px; color: var(--text-muted); margin: 0 0 4px; }
.ca3-table        { margin-bottom: 16px; }

/* CA3 result boxes — noms générés par le JS */
.ca3-result-due    { background: #FFF7ED; border: 2px solid #F59E0B; border-radius: var(--radius); padding: 14px 18px; margin-top: 16px; font-size: 14px; font-weight: 600; color: #92400E; }
.ca3-result-credit { background: #ECFDF5; border: 2px solid #10B981; border-radius: var(--radius); padding: 14px 18px; margin-top: 16px; font-size: 14px; font-weight: 600; color: #065F46; }
.ca3-result-due span, .ca3-result-credit span { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); margin-top: 4px; }

/* Utility text-align classes */
.ta-right  { text-align: right !important; }
.ta-center { text-align: center !important; }
.ta-left   { text-align: left !important; }

/* ============================================================
   DASHBOARD
   ============================================================ */

.dash-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

/* Header */
.dash-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dash-title  { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 2px; }
.dash-subtitle { font-size: 12px; color: var(--text-muted); margin: 0; }
.dash-year-wrap  { display: flex; align-items: center; gap: 8px; }
.dash-year-label { font-size: 13px; font-weight: 500; color: var(--text); }
.dash-year-sel   { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Row 1: gauges + KPIs */
.dash-row-top { display: grid; grid-template-columns: 190px 190px 1fr; gap: 14px; }

/* Gauge cards */
.dash-gauge-card { display: flex; flex-direction: column; align-items: center; padding: 18px 12px 14px; gap: 8px; }
.dash-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.dash-gauge-info { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.dash-gi-line { font-size: 11px; color: var(--text-muted); }
.dash-gi-line strong { color: var(--text); font-size: 12px; }

/* KPI grid */
.dash-kpis { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; }
.dash-kpi  { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.dash-kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.dash-kpi-val   { font-size: 20px; font-weight: 700; color: var(--text); margin-top: 2px; }
.dash-kpi-alert { border-top: 3px solid #EF4444; }

/* Alert bar */
.dash-alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 4px; }
.dash-alert-danger  { background: #FEF2F2; border: 1px solid #EF4444; color: #991B1B; }
.dash-alert-warning { background: #FFFBEB; border: 1px solid #F59E0B; color: #92400E; }

/* Row 2: charts */
.dash-row-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-chart-card { padding: 16px 18px; }
.dash-chart-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.dash-chart-title  { font-size: 13px; font-weight: 600; color: var(--text); }
.dash-chart-sub    { font-size: 11px; color: var(--text-muted); }
.dash-chart-wrap   { position: relative; height: 220px; }

/* Sidebar paid badge */
.sii-paid-btn { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: opacity 0.15s; }
.sii-paid-yes { background: #ECFDF5; color: #065F46; border-color: #10B981; }
.sii-paid-no  { background: #FFF7ED; color: #92400E; border-color: #F59E0B; }
.sii-paid-btn:hover { opacity: 0.75; }

/* Responsive */
@media (max-width: 860px) {
  .dash-row-top    { grid-template-columns: 1fr 1fr; }
  .dash-kpis       { grid-column: 1 / -1; }
  .dash-row-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .dash-row-top { grid-template-columns: 1fr; }
}

/* ============================================================
   FACTURES — sous-onglets (tab bar, liste, avoirs)
   ============================================================ */

/* Tab bar */
.inv-tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); background: #fff; padding: 0 20px; flex-shrink: 0; }
.inv-tab     { display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.inv-tab svg { flex-shrink: 0; }
.inv-tab:hover  { color: var(--primary); }
.inv-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Panels */
.inv-panel { flex-direction: column; overflow: hidden; }

/* Scrollable container */
.invlist-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }

/* KPI row */
.invlist-kpis { display: flex; gap: 12px; flex-wrap: wrap; }
.invlist-kpi  { flex: 1; min-width: 130px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.invlist-kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.invlist-kpi-val   { font-size: 20px; font-weight: 700; color: var(--text); }
.invlist-kpi-green { border-top: 3px solid #10B981; }
.invlist-kpi-green .invlist-kpi-val { color: #059669; }
.invlist-kpi-orange { border-top: 3px solid #F59E0B; }
.invlist-kpi-orange .invlist-kpi-val { color: #D97706; }

/* Filters bar */
.invlist-filters { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.invlist-search  { flex: 1; min-width: 180px; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.invlist-filter-group { display: flex; align-items: center; gap: 6px; }
.invlist-filter-label { font-size: 12px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.invlist-filter-sel   { padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Table */
.invlist-table-wrap { overflow-x: auto; }
.invlist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invlist-table th { text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1.5px solid var(--border); background: var(--bg); white-space: nowrap; }
.invlist-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.invlist-table tr:last-child td { border-bottom: none; }

/* Row colors */
.il-row-paid    { background: #F0FDF4; }
.il-row-pending { background: #fff; }
.il-row-pending:hover td { background: #FFFBEB; }
.il-row-paid:hover td    { background: #DCFCE7; }

/* Invoice number */
.il-inv-num { font-weight: 600; color: var(--text); }
.il-avoir-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; background: #FEF3C7; color: #92400E; border-radius: 99px; font-size: 10px; font-weight: 700; }

/* Type chip */
.il-type-chip { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: #EEF2FF; color: #3730A3; }

/* Status badges */
.il-status        { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.il-status-paid   { background: #ECFDF5; color: #065F46; }
.il-status-pending { background: #FFFBEB; color: #92400E; }

/* Action buttons */
.il-btn-edit, .il-btn-paid { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text-muted); transition: background 0.15s, color 0.15s; }
.il-btn-edit:hover   { background: var(--primary); color: #fff; border-color: var(--primary); }
.il-btn-paid:hover   { background: #10B981; color: #fff; border-color: #10B981; }
.il-btn-paid.active  { background: #ECFDF5; color: #059669; border-color: #10B981; }

/* Empty state */
.invlist-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Avoir form */
.avoir-form-header { display: flex; justify-content: space-between; align-items: center; }

/* ============================================================
   MODULE IMPÔTS — IR Micro-entreprise
   ============================================================ */

.ir-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

/* Header */
.ir-header { display: flex; justify-content: space-between; align-items: flex-start; }
.ir-title    { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 2px; }
.ir-subtitle { font-size: 12px; color: var(--text-muted); margin: 0; }
.ir-year-wrap  { display: flex; align-items: center; gap: 8px; }
.ir-year-label { font-size: 13px; font-weight: 500; color: var(--text); }
#ir-year-sel   { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: #fff; }

/* Disclaimer */
.ir-disclaimer { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #FFFBEB; border: 1px solid #F59E0B; border-radius: var(--radius); font-size: 12px; color: #92400E; }
.ir-disclaimer svg { flex-shrink: 0; }

/* Blocs */
.ir-bloc { padding: 18px 20px; }
.ir-bloc-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 14px; }

/* Données automatiques */
.ir-auto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ir-auto-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.ir-auto-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 4px; }
.ir-auto-val   { font-size: 16px; font-weight: 700; color: var(--text); }
.ir-auto-neg   .ir-auto-val { color: #EF4444; }
.ir-auto-highlight { border-color: var(--primary); background: #EEF2FF; }
.ir-auto-highlight .ir-auto-val { color: var(--primary); font-size: 18px; }
.ir-auto-span2 { grid-column: span 2; }

/* Versement libératoire banner */
.ir-vfl-banner { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 12px 14px; background: #ECFDF5; border: 1px solid #10B981; border-radius: var(--radius); font-size: 13px; color: #065F46; }
.ir-vfl-banner svg { flex-shrink: 0; margin-top: 2px; color: #10B981; }

/* Mode toggle */
.ir-mode-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: fit-content; margin-bottom: 16px; }
.ir-mode-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: #fff; border: none; cursor: pointer; transition: background 0.15s, color 0.15s; border-right: 1px solid var(--border); }
.ir-mode-btn:last-child { border-right: none; }
.ir-mode-btn:hover { background: var(--bg); color: var(--text); }
.ir-mode-btn.active { background: var(--primary); color: #fff; }

/* Fields */
.ir-fields { display: flex; flex-direction: column; gap: 12px; }
.ir-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ir-field-wrap { display: flex; flex-direction: column; gap: 4px; }
.ir-field-label { font-size: 13px; font-weight: 500; color: var(--text); }
.ir-field-hint  { font-size: 11px; color: var(--text-muted); }
.ir-field-wrap input { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-weight: 600; width: 100%; box-sizing: border-box; }
.ir-field-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.12); }

/* Résultats */
.ir-results-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ir-result-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; transition: border-color 0.3s; }
.ir-result-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.ir-result-val   { font-size: 22px; font-weight: 800; color: var(--text); transition: color 0.3s; }
.ir-result-main  { border-color: var(--primary); background: #F8F7FF; }

/* Barème expert */
.ir-bareme-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.ir-bar-table    { width: 100%; border-collapse: collapse; font-size: 13px; }
.ir-bar-table th { padding: 7px 10px; background: var(--bg); font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); border-bottom: 1.5px solid var(--border); }
.ir-bar-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.ir-bar-active td { color: var(--text); font-weight: 500; background: #FAFAFA; }
.ir-bar-table tfoot td { background: var(--bg); border-top: 2px solid var(--border); font-weight: 700; color: var(--text); }

/* Résumé textuel */
.ir-summary { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.ir-sum-line    { font-size: 13px; color: var(--text); padding: 8px 12px; background: var(--bg); border-radius: var(--radius); border-left: 3px solid var(--border); }
.ir-sum-ok      { border-left-color: #10B981; background: #F0FDF4; color: #065F46; }

/* Responsive */
@media (max-width: 800px) {
  .ir-auto-grid    { grid-template-columns: 1fr 1fr; }
  .ir-results-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .ir-auto-grid    { grid-template-columns: 1fr; }
  .ir-results-grid { grid-template-columns: 1fr; }
}

/* =============================================
   PLAN SYSTEM — UPGRADE UX
   ============================================= */

/* Nav locked state */
.snav-locked { opacity: .55; }
.snav-lock-icon { font-size: 10px; margin-left: auto; }

/* Sidebar invoice quota bar */
.invoice-quota-bar {
  margin: 4px 10px 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
}
.iqb-label {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  margin-bottom: 5px;
  font-weight: 500;
}
.iqb-track {
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.iqb-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width .4s ease, background .3s;
}
.iqb-fill-warning { background: var(--warning); }
.iqb-fill-danger  { background: var(--danger); }
.iqb-upgrade-btn {
  font-size: 10px;
  color: #FBBF24;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 700;
  display: none;
}
.invoice-quota-bar.quota-warn .iqb-upgrade-btn { display: block; }

/* Sidebar plan footer */
.sidebar-plan-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sidebar-plan-label { font-size: 11px; color: rgba(255,255,255,.4); }
.current-plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plan-free    { background: rgba(255,255,255,.1);   color: rgba(255,255,255,.55); }
.plan-starter { background: rgba(59,130,246,.22);   color: #93C5FD; }
.plan-one     { background: rgba(251,191,36,.2);    color: #FBBF24; }
.plan-upgrade-link {
  display: block;
  font-size: 11px;
  color: #FBBF24;
  cursor: pointer;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  transition: opacity .15s;
}
.plan-upgrade-link:hover { opacity: .8; }

/* Feature ONE badge (inline) */
.feature-one-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  background: linear-gradient(135deg,#FBBF24,#F59E0B);
  color: #78350F;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  margin-left: 4px;
  vertical-align: middle;
}

/* Dashboard charts gate */
.dash-charts-wrap { position: relative; }
.dash-charts-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.78);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  z-index: 10;
}
.dash-gate-inner {
  text-align: center;
  padding: 32px 28px;
  max-width: 380px;
}
.dash-gate-icon  { font-size: 44px; margin-bottom: 14px; }
.dash-gate-title {
  font-size: 17px;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 8px;
}
.dash-gate-desc {
  font-size: 13px;
  color: #94A3B8;
  margin-bottom: 20px;
  line-height: 1.55;
}
.dash-gate-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg,#FBBF24,#F59E0B);
  color: #78350F;
  border: none;
  border-radius: 9px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.dash-gate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(251,191,36,.45);
}
.dash-gate-trial { margin-top: 10px; font-size: 11px; color: #64748B; }

/* =============================================
   UPGRADE MODAL — Design premium violet / or
   ============================================= */
.upgrade-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,12,41,.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.upgrade-modal {
  background: #fff;
  border-radius: 22px;
  max-width: 580px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(99,102,241,.15),
    0 32px 64px rgba(79,70,229,.25),
    0 8px 24px rgba(0,0,0,.12);
  animation: modal-pop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modal-pop {
  from { transform: scale(.88) translateY(10px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* Bandeau violet en haut */
.upgrade-modal::before {
  content: '';
  display: block;
  height: 5px;
  background: linear-gradient(90deg, #6366F1, #8B5CF6, #FBBF24);
}

.upgrade-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(100,116,139,.08);
  border: 1px solid rgba(100,116,139,.12);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  z-index: 2;
}
.upgrade-modal-close:hover {
  background: rgba(79,70,229,.1);
  border-color: rgba(79,70,229,.25);
  color: var(--primary);
}

/* Header zone */
.upgrade-modal-header {
  padding: 26px 28px 0;
  text-align: center;
}
.upgrade-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
  border-radius: 16px;
  font-size: 26px;
  margin-bottom: 14px;
  border: 1px solid rgba(99,102,241,.2);
}
.upgrade-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.upgrade-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 380px;
  margin: 0 auto 22px;
}

/* Cards zone */
.upgrade-modal-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 20px;
  margin-bottom: 18px;
}

/* Card STARTER */
.upgrade-plan {
  border-radius: 16px;
  padding: 20px 18px 18px;
  position: relative;
  transition: transform .2s, box-shadow .2s;
  background: #fff;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 2px rgba(99,102,241,.18),
    0 4px 16px rgba(99,102,241,.08);
}
.upgrade-plan:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px rgba(99,102,241,.4),
    0 12px 28px rgba(99,102,241,.18);
}

/* Card ONE */
.upgrade-plan-one {
  box-shadow:
    0 0 0 2px rgba(251,191,36,.5),
    0 4px 20px rgba(251,191,36,.15);
  background: linear-gradient(170deg, #FEFCE8 0%, #FFF9E6 50%, #fff 100%);
}
.upgrade-plan-one:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px #FBBF24,
    0 12px 30px rgba(251,191,36,.28);
}

/* Badge recommandé */
.upgrade-plan-recommended {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: .04em;
  box-shadow: 0 2px 8px rgba(251,191,36,.4);
  text-transform: uppercase;
}

/* Plan header inside card */
.upgrade-plan-name {
  font-size: 11px;
  font-weight: 800;
  color: #6366F1;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.upgrade-plan-name::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
}
.upgrade-plan-one .upgrade-plan-name {
  color: #D97706;
}
.upgrade-plan-one .upgrade-plan-name::before {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
}

.upgrade-plan-price {
  font-size: 32px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
  letter-spacing: -.03em;
}
.upgrade-plan-price span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.upgrade-plan-annual {
  font-size: 10.5px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 14px;
}

/* Séparateur */
.upgrade-plan-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,.15), transparent);
  margin: 12px 0;
}
.upgrade-plan-one .upgrade-plan-sep {
  background: linear-gradient(90deg, transparent, rgba(251,191,36,.25), transparent);
}

/* Features list */
.upgrade-plan-features {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 7px;
  line-height: 1.4;
}
.upgrade-plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 0;
}
.upgrade-plan-features li::before {
  content: '';
  flex-shrink: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3 8l3.5 3.5L13 5'/%3E%3C/svg%3E");
  background-size: cover;
  margin-top: 1px;
}
.upgrade-plan-one .upgrade-plan-features li::before {
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3 8l3.5 3.5L13 5'/%3E%3C/svg%3E");
  background-size: cover;
}

/* Buttons */
.upgrade-plan-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #6366F1;
  background: transparent;
  color: #6366F1;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .01em;
}
.upgrade-plan-btn:hover {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,.35);
  transform: translateY(-1px);
}
.upgrade-plan-btn-one {
  background: linear-gradient(135deg, #F59E0B, #FBBF24 60%, #F59E0B);
  border-color: transparent;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.upgrade-plan-btn-one:hover {
  background: linear-gradient(135deg, #D97706, #F59E0B 60%, #D97706);
  box-shadow: 0 6px 20px rgba(251,191,36,.45);
  transform: translateY(-2px);
}

/* Footer */
.upgrade-modal-footer {
  padding: 0 20px 20px;
  text-align: center;
}
.upgrade-trial {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* Plan success toast */
.plan-success-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1E293B;
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  z-index: 99999;
  opacity: 0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
  pointer-events: none;
}
.plan-success-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =============================================
   SETTINGS — Bouton sidebar bas
   ============================================= */
.sidebar-settings-wrap {
  padding: 6px 10px 4px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.snav-settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,.55);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
.snav-settings-btn:hover,
.snav-settings-btn.active {
  background: var(--sidebar-active);
  color: #fff;
}

/* =============================================
   SETTINGS — Layout principal
   ============================================= */
#view-settings { background: var(--bg); }

.set-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 0 16px;
}
.set-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 0 16px 10px;
}
.set-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.set-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  width: 100%;
}
.set-nav-item:hover  { background: var(--bg); color: var(--text); }
.set-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.set-nav-item.active svg { stroke: var(--primary); }

.set-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* =============================================
   SETTINGS — Panel header
   ============================================= */
.set-panel { max-width: 720px; }
.set-panel-header { margin-bottom: 20px; }
.set-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -.02em;
}
.set-panel-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* =============================================
   SETTINGS — Cards
   ============================================= */
.set-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.set-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.set-card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }
.set-card-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.set-card-danger {
  border-color: rgba(239,68,68,.2);
  background: #FFF8F8;
}

/* =============================================
   SETTINGS — Grilles & champs
   ============================================= */
.set-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.set-grid-1 { display: flex; flex-direction: column; gap: 14px; }
.set-field-full { grid-column: 1 / -1; }

.set-field { display: flex; flex-direction: column; gap: 5px; }
.set-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.set-field input,
.set-field select,
.set-field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  resize: vertical;
}
.set-field input:focus,
.set-field select:focus,
.set-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

/* =============================================
   SETTINGS — Boutons
   ============================================= */
.set-btn-save {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.set-btn-save:hover { background: var(--primary-h); transform: translateY(-1px); }

.set-btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.set-btn-outline:hover:not(:disabled) { background: var(--primary); color: #fff; }
.set-btn-outline:disabled { opacity: .4; cursor: not-allowed; }

.set-btn-danger-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.set-btn-danger-outline:hover { background: var(--danger); color: #fff; }

.set-btn-upgrade {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg,#6366F1,#8B5CF6);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.set-btn-upgrade:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.35); }

.set-btn-one {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg,#F59E0B,#FBBF24);
  color: #78350F;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.set-btn-one:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(251,191,36,.4); }

/* =============================================
   SETTINGS — Toggles
   ============================================= */
.set-toggle-list { display: flex; flex-direction: column; gap: 0; }
.set-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.set-toggle-row:last-child { border-bottom: none; }
.set-toggle-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.set-toggle-desc  { font-size: 12px; color: var(--text-muted); }

.set-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.set-toggle input { opacity: 0; width: 0; height: 0; }
.set-toggle-slider {
  position: absolute; inset: 0;
  background: #CBD5E1;
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.set-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.set-toggle input:checked + .set-toggle-slider { background: var(--primary); }
.set-toggle input:checked + .set-toggle-slider::before { transform: translateX(18px); }

/* =============================================
   SETTINGS — Radio group
   ============================================= */
.set-radio-group { display: flex; flex-direction: column; gap: 8px; }
.set-radio {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.set-radio input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; }

/* =============================================
   SETTINGS — Color picker
   ============================================= */
.set-color-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
}
.set-color-wrap input[type="color"] {
  width: 28px; height: 28px;
  border: none; padding: 0;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}
.set-color-wrap span { font-size: 13px; font-family: var(--font-mono); color: var(--text-muted); }

/* =============================================
   SETTINGS — Abonnement
   ============================================= */
.set-abo-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.set-abo-info { display: flex; flex-direction: column; gap: 6px; }
.set-abo-desc { font-size: 12px; color: var(--text-muted); }
.set-abo-plans-preview { display: flex; flex-direction: column; gap: 10px; }
.set-abo-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
}
.set-abo-plan-row-one { border-color: rgba(251,191,36,.4); background: #FFFBEB; }
.set-abo-plan-features-mini { font-size: 12px; color: var(--text-muted); flex: 1; margin: 0 12px; }
.set-abo-badge-one {
  display: inline-block;
  padding: 2px 7px;
  background: linear-gradient(135deg,#FBBF24,#F59E0B);
  color: #78350F;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  margin-left: 6px;
}

/* =============================================
   SETTINGS — Zone dangereuse
   ============================================= */
.set-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.set-danger-label { font-size: 13px; font-weight: 600; color: var(--danger); margin-bottom: 2px; }
.set-danger-desc  { font-size: 12px; color: var(--text-muted); }

/* =============================================
   SETTINGS — Sécurité sessions
   ============================================= */
.set-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}
.set-session-info { display: flex; align-items: center; gap: 10px; }
.set-session-device { font-size: 13px; font-weight: 600; color: var(--text); }
.set-session-meta   { font-size: 12px; color: var(--text-muted); }
.set-session-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #D1FAE5;
  color: #065F46;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.set-badge-soon {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* =============================================
   SETTINGS — FAQ
   ============================================= */
.set-faq { display: flex; flex-direction: column; gap: 4px; }
.set-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.set-faq-item summary {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  transition: background .15s;
}
.set-faq-item summary::after { content: '﹢'; font-size: 16px; color: var(--text-muted); }
.set-faq-item[open] summary::after { content: '－'; }
.set-faq-item summary:hover { background: var(--primary-light); }
.set-faq-item p {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

/* =============================================
   SETTINGS — Empty state
   ============================================= */
.set-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  color: var(--text-muted);
}
.set-empty-state p   { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.set-empty-state span { font-size: 12px; color: var(--text-light); }

/* Liens légaux */
.set-legal-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.set-legal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: background .15s, border-color .15s;
}
.set-legal-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* =============================================
   ABONNEMENT — Vue dédiée (view-abonnement)
   ============================================= */
.abo-view-header {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
  padding: 28px 32px 20px;
  flex-shrink: 0;
}
.abo-view-header-inner {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.abo-view-title { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.abo-view-subtitle { font-size: 13px; color: #C7D2FE; }
.abo-view-current-wrap { text-align: right; }
.abo-view-current-label { font-size: 11px; color: #C7D2FE; margin-bottom: 4px; font-weight: 500; }

.abo-billing-toggle {
  display: inline-flex; align-items: center; gap: 0;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 100px; padding: 3px;
}
.abo-toggle-btn {
  font-size: 12px; font-weight: 600;
  padding: 6px 18px; border-radius: 100px;
  border: none; cursor: pointer;
  background: transparent; color: rgba(255,255,255,.7);
  transition: all .2s; display: flex; align-items: center; gap: 6px;
}
.abo-toggle-btn.active { background: #fff; color: var(--primary); }
.abo-save-pill {
  background: #10B981; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 100px;
}

.abo-view-body {
  padding: 28px 32px 32px;
  flex: 1;
}
.abo-view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

/* ── Cards ── */
.abo-v-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.abo-v-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,.10); }

.abo-v-card-recommended {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.abo-v-card-one {
  border-color: #FBBF24;
  box-shadow: 0 0 0 3px rgba(251,191,36,.12);
}

/* Colored top bar */
.abo-v-card-bar { height: 4px; width: 100%; flex-shrink: 0; }
.bar-free    { background: #CBD5E1; }
.bar-starter { background: linear-gradient(90deg, #4F46E5, #818CF8); }
.bar-one     { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

/* Active ring overlay */
.abo-v-active-ring {
  background: rgba(16,185,129,.08);
  border: 1.5px solid #10B981;
  border-radius: 14px;
  position: absolute; inset: 4px;
  pointer-events: none;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 10px 12px;
}
.abo-v-active-ring span {
  background: #10B981; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 10px; border-radius: 100px;
}
.avo-ring-gold { background: rgba(251,191,36,.08); border-color: #FBBF24; }
.avo-ring-gold span { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

/* Badge top */
.abo-v-badge-top {
  margin: 14px 16px -4px;
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 700;
  background: var(--primary-light); color: var(--primary);
  padding: 3px 12px; border-radius: 100px;
}
.badge-gold-top { background: #FEF3C7; color: #92400E; }

/* Top section */
.abo-v-top { padding: 14px 18px 12px; }
.abo-v-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 8px;
}
.label-free    { color: #94A3B8; }
.label-starter { color: var(--primary); }
.label-one     { color: #92400E; }

.abo-v-price {
  display: flex; align-items: flex-end; gap: 2px;
  line-height: 1; margin-bottom: 4px;
}
.abo-v-amount {
  font-size: 40px; font-weight: 800; color: var(--text);
}
.abo-v-currency {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.abo-v-period { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.abo-v-annual-note {
  font-size: 11px; color: #10B981; font-weight: 600; min-height: 16px;
  margin-bottom: 2px;
}
.abo-v-tagline { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.abo-v-divider { height: 1px; background: var(--border); margin: 0 18px; }

/* Features */
.abo-v-features {
  list-style: none;
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 9px;
  flex: 1;
}
.abo-v-features li {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px;
}
/* SVG icon in feature list */
.fi {
  width: 14px; height: 14px;
  flex-shrink: 0; stroke-width: 2;
}
.feat-ok       { color: var(--text); }
.feat-ok .fi   { stroke: var(--primary); }
.feat-no       { color: #94A3B8; }
.feat-no .fi   { stroke: #CBD5E1; }
.feat-gold     { color: #92400E; }
.feat-gold .fi { stroke: #D97706; }
.feat-gold strong { color: #78350F; }

/* ── Comparison table ── */
.abo-compare-wrap {
  margin-top: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.abo-compare-title {
  padding: 14px 20px;
  font-size: 13px; font-weight: 700; color: var(--text);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.abo-compare-table {
  width: 100%; border-collapse: collapse;
  background: var(--white);
}
.abo-compare-table th {
  padding: 10px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; text-align: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.abo-compare-table th.col-feat { text-align: left; color: var(--text-muted); }
.abo-compare-table th.col-free    { color: #64748B; }
.abo-compare-table th.col-starter { color: var(--primary); }
.abo-compare-table th.col-one     { color: #92400E; }
.abo-compare-table td {
  padding: 9px 16px;
  font-size: 13px; color: var(--text);
  border-top: 1px solid var(--border);
  text-align: center;
}
.abo-compare-table td:first-child { text-align: left; color: var(--text); font-size: 12.5px; }
.abo-compare-table tbody tr:hover { background: #FAFBFC; }

/* Category rows */
.cmp-cat td {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; text-align: left !important;
  padding: 7px 16px;
  display: table-cell;
}
.cmp-cat td svg { vertical-align: middle; margin-right: 6px; stroke: var(--primary); }

/* Check / Cross icons */
.cmp-ok, .cmp-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
}
.cmp-ok {
  background: #EEF2FF;
}
.cmp-ok::before {
  content: '';
  display: block; width: 10px; height: 6px;
  border-left: 2px solid #4F46E5; border-bottom: 2px solid #4F46E5;
  transform: rotate(-45deg) translate(1px, -1px);
}
.cmp-no {
  background: #FEF2F2;
}
.cmp-no::before,
.cmp-no::after {
  content: '';
  position: absolute;
  width: 10px; height: 2px;
  background: #EF4444; border-radius: 1px;
}
.cmp-no { position: relative; }
.cmp-no::before { transform: rotate(45deg); }
.cmp-no::after  { transform: rotate(-45deg); }

/* Pills */
.cmp-pill {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 100px;
}
.pill-muted   { background: #F1F5F9; color: #64748B; }
.pill-primary { background: var(--primary-light); color: var(--primary); }
.pill-gold    { background: #FEF3C7; color: #92400E; }

/* CTA button */
.abo-v-btn {
  display: block; width: calc(100% - 32px);
  margin: 0 16px 16px;
  padding: 11px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  border: none; cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-v-free    { background: #F1F5F9; color: #475569; }
.btn-v-free:hover { background: #E2E8F0; }
.btn-v-starter { background: var(--primary); color: #fff; box-shadow: 0 2px 10px rgba(79,70,229,.3); }
.btn-v-starter:hover { background: var(--primary-h); box-shadow: 0 4px 16px rgba(79,70,229,.4); }
.btn-v-one     { background: linear-gradient(135deg, #F59E0B, #FBBF24); color: #fff; box-shadow: 0 2px 10px rgba(251,191,36,.3); }
.btn-v-one:hover { filter: brightness(1.06); box-shadow: 0 4px 16px rgba(251,191,36,.4); }
.abo-v-btn:disabled { opacity: .55; cursor: default; filter: none; transform: none; box-shadow: none; }

.abo-view-note {
  text-align: center; font-size: 12.5px; color: var(--text-muted);
  margin-top: 4px;
}

/* Sidebar abonnement button accent */
.snav-abo-btn {
  color: #FBBF24 !important;
}
.snav-abo-btn:hover, .snav-abo-btn.active { background: rgba(251,191,36,.12) !important; color: #FBBF24 !important; }

@media (max-width: 900px) {
  .abo-view-grid { grid-template-columns: 1fr; max-width: 420px; }
  .abo-view-body { padding: 20px 16px; }
  .abo-view-header { padding: 20px 16px 16px; }
}

/* =============================================
   ABONNEMENT — Pricing cards intégrées
   ============================================= */
.abo-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 4px;
}
.abo-plan-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 16px;
  position: relative;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.abo-plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.abo-plan-card.active-plan {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.abo-card-gold { border-color: #FBBF24; }
.abo-card-gold.active-plan { box-shadow: 0 0 0 3px rgba(251,191,36,.15); }

.abo-plan-current-tag {
  position: absolute; top: -11px; left: 12px;
  background: var(--success); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 100px;
}
.abo-plan-badge-top {
  font-size: 11px; font-weight: 700;
  color: var(--primary); background: var(--primary-light);
  padding: 2px 10px; border-radius: 100px;
  display: inline-block; align-self: flex-start;
}
.abo-plan-badge-top.badge-gold { color: #92400E; background: #FEF3C7; }

.abo-plan-icon { font-size: 24px; line-height: 1; }

.abo-plan-name { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.abo-plan-name.free-name    { color: var(--text-muted); }
.abo-plan-name.starter-name { color: var(--primary); }
.abo-plan-name.one-name     { color: #92400E; }

.abo-plan-price {
  font-size: 30px; font-weight: 800; color: var(--text); line-height: 1;
}
.abo-plan-period { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.abo-plan-features {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
  margin: 4px 0 8px;
}
.abo-plan-features li {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12.5px; color: var(--text);
}
.abo-plan-features li::before {
  content: '✓'; flex-shrink: 0; width: 16px; height: 16px;
  background: #D1FAE5; color: #065F46;
  border-radius: 50%; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.abo-plan-features li.no { color: var(--text-muted); }
.abo-plan-features li.no::before {
  content: '✗'; background: #F1F5F9; color: #CBD5E1;
}
.abo-plan-features li.star::before {
  content: '★'; background: #FEF3C7; color: #92400E;
}

.abo-plan-btn {
  display: block; width: 100%;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all .15s;
}
.abo-plan-btn.btn-free    { background: #F1F5F9; color: var(--text); }
.abo-plan-btn.btn-free:hover { background: var(--border); }
.abo-plan-btn.btn-starter { background: var(--primary); color: #fff; }
.abo-plan-btn.btn-starter:hover { background: var(--primary-h); }
.abo-plan-btn.btn-one     { background: linear-gradient(135deg, #F59E0B, #FBBF24); color: #fff; }
.abo-plan-btn.btn-one:hover { filter: brightness(1.05); }
.abo-plan-btn:disabled    { opacity: .5; cursor: default; }

.abo-stripe-note {
  font-size: 12px; color: var(--text-muted);
  text-align: center; margin-top: 12px;
}

/* Responsive */
@media (max-width: 900px) {
  .abo-pricing-grid { grid-template-columns: 1fr; }
}

/* Settings sidebar toggle button (mobile) */
.set-sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 4px;
}
.set-sidebar-toggle:hover { background: var(--border); }

/* Responsive settings */
@media (max-width: 700px) {
  .set-sidebar { width: 160px; }
  .set-main    { padding: 16px; }
  .set-grid-2  { grid-template-columns: 1fr; }
  .set-abo-current  { flex-direction: column; align-items: flex-start; }
  .set-abo-plan-row { flex-direction: column; align-items: flex-start; }
}

/* =============================================
   RESPONSIVE MOBILE — ≤ 768px
   ============================================= */

/* ── Hamburger button ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--radius);
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .2s;
}
.hamburger-btn:hover { background: var(--bg); }

/* ── Backdrop ── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 190;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

@media (max-width: 768px) {

  /* Show hamburger */
  .hamburger-btn { display: flex; }

  /* ── Sidebar slides in from left ── */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w, 240px) !important;
    height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }

  /* ── Main takes full width ── */
  .main { width: 100%; }

  /* ── Topbar compact ── */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-actions { gap: 6px; }

  /* Hide text on action buttons, keep icons */
  .topbar-actions .btn span,
  .topbar-actions .btn svg + * { display: none; }
  .topbar-actions .btn { padding: 7px 9px; }
  .topbar-actions .btn svg { margin: 0; }

  /* Hide username, keep avatar */
  .user-name { display: none; }
  .topbar-user { padding: 4px; }

  /* ── Invoice view: stack vertically ── */
  .content-split { flex-direction: column; overflow-y: auto; }

  .form-panel {
    width: 100% !important;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  /* Hide PDF preview on mobile (accessible via PDF download) */
  .preview-panel { display: none !important; }

  /* ── View sections scroll properly ── */
  .view-section { overflow-y: auto; }

  /* ── Dashboard: single column ── */
  .dash-row-top    { flex-direction: column; }
  .dash-stat-card  { min-width: 0; }
  .dash-row-bottom { flex-direction: column; }
  .dash-chart-block { min-width: 0; }

  /* ── Entreprise ── */
  .ent-grid-2 { grid-template-columns: 1fr !important; }

  /* ── URSSAF ── */
  .urssaf-grid { grid-template-columns: 1fr !important; }
  .urssaf-hist-row { flex-direction: column; gap: 8px; }

  /* ── Impôts ── */
  .impot-grid { grid-template-columns: 1fr !important; }
  .impot-mode-tabs { flex-wrap: wrap; }

  /* ── TVA ── */
  .tva-grid { grid-template-columns: 1fr !important; }

  /* ── Settings: stack sidebar on top ── */
  #view-settings { flex-direction: column !important; }
  .set-sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .set-sidebar {
    width: 100% !important;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 56px;
    overflow: hidden;
    transition: max-height .25s;
  }
  .set-sidebar.expanded { max-height: 480px; }
  .set-nav { flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 4px; }
  .set-nav-item { padding: 7px 12px; font-size: 12px; }
  .set-main { overflow-y: auto; }
  .set-grid-2 { grid-template-columns: 1fr; }

  /* ── Modals ── */
  .modal-box { margin: 12px; width: calc(100% - 24px) !important; max-width: none !important; }
  .upgrade-modal { width: calc(100% - 24px) !important; max-width: none !important; }

  /* ── Sidebar plan footer: compact ── */
  .plan-upgrade-link { font-size: 11px; }

  /* ── Invoice quota bar: smaller ── */
  .invoice-quota-bar { margin: 0 8px 8px; }
}

@media (max-width: 480px) {
  /* Extra small: hide some topbar buttons */
  .topbar-actions .btn-ghost:not(:last-of-type) { display: none; }

  /* Form panel padding */
  .form-scroll { padding: 10px; }

  /* Cards tighter */
  .card-header { padding: 10px 14px 8px; }
  .card-body   { padding: 12px 14px; }

  /* Section views */
  .view-section > * { padding: 12px; }
}
