/* =====================================================================
   PatrimoSuite — feuille de style commune
   Jetons repris du prototype (thème sombre, oklch).
   ===================================================================== */

:root {
  /* Surfaces */
  --bg:          oklch(12% 0.018 250);
  --surface:     oklch(17% 0.018 250);
  --surface-2:   oklch(22% 0.014 250);
  --surface-3:   oklch(27% 0.012 250);
  --border:      oklch(28% 0.016 250);

  /* Texte */
  --fg:          oklch(95% 0.005 250);
  --muted:       oklch(58% 0.014 250);

  /* Sémantique */
  --accent:      oklch(72% 0.15 160);
  --accent-dim:  oklch(72% 0.15 160 / 0.14);
  --loss:        oklch(66% 0.18 25);
  --loss-dim:    oklch(66% 0.18 25 / 0.14);
  --warn:        oklch(80% 0.16 80);
  --warn-dim:    oklch(80% 0.16 80 / 0.14);
  --blue:        oklch(65% 0.17 258);
  --blue-dim:    oklch(65% 0.17 258 / 0.14);
  --purple:      oklch(65% 0.17 308);

  /* Couleur par module */
  --c-invest:    oklch(72% 0.15 160);
  --c-epargne:   oklch(65% 0.17 258);
  --c-crowd:     oklch(65% 0.17 308);
  --c-assur:     oklch(80% 0.16 80);
  --c-liquid:    oklch(66% 0.18 25);

  /* Mise en page */
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --r:           10px;
  --r-lg:        18px;

  /* Typographie */
  --ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* Mouvement */
  --t-fast: 0.15s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

a { color: var(--accent); }
code, .mono { font-family: var(--mono); }

/* ── Page centrée (connexion, installation, erreurs) ── */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.page-center::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(oklch(28% 0.016 250 / 0.4) 1px, transparent 1px),
    linear-gradient(90deg, oklch(28% 0.016 250 / 0.4) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px 32px 32px;
  box-shadow: 0 24px 64px oklch(0% 0 0 / 0.5);
}

.logo-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.logo-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  color: var(--bg);
  flex-shrink: 0;
}
.logo-name { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.logo-sub  { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }

.card-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.card-sub   { font-size: 13.5px; color: var(--muted); margin-bottom: 24px; }

.card-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}

/* ── Liste de contrôles (page d'installation) ── */
.checks { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.check {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 13.5px;
}
.check-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.check.ok   .check-icon { background: var(--accent-dim); color: var(--accent); }
.check.ko   .check-icon { background: var(--loss-dim);   color: var(--loss); }
.check.warn .check-icon { background: var(--warn-dim);   color: var(--warn); }
.check-detail { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }

.banner {
  margin-bottom: 20px; padding: 12px 14px;
  border-radius: var(--r); font-size: 13.5px; font-weight: 600;
}
.banner.ok { background: var(--accent-dim); color: var(--accent); }
.banner.ko { background: var(--loss-dim);   color: var(--loss); }

@media (max-width: 480px) {
  .card { padding: 28px 18px 22px; }
  .check { grid-template-columns: 22px 1fr; }
  .check-detail { grid-column: 2; text-align: left; }
}

/* =====================================================================
   Composants du prototype (liquidites.html)
   ===================================================================== */
body.app { display: flex; overflow-x: hidden; }
.app a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
  transition: transform 0.25s ease;
}
.sidebar-logo {
  padding: 18px 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sidebar .logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: oklch(12% 0.018 250); flex-shrink: 0;
}
.sidebar .logo-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar .logo-sub  { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); padding: 10px 10px 4px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-badge { margin-left: auto; background: var(--loss); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-pill { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.user-pill:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.user-more { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ── MAIN ────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ──────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
  position: sticky; top: 0; z-index: 100;
}
.hamburger { display: none; width: 34px; height: 34px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); align-items: center; justify-content: center; }
.topbar-title { font-size: 15px; font-weight: 700; flex: 1; }
.topbar-date  { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted); transition: color 0.14s, background 0.14s;
}
.icon-btn:hover { color: var(--fg); background: var(--surface-3); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── PAGE ────────────────────────────────────────────── */
.page { flex: 1; padding: 22px; display: flex; flex-direction: column; gap: 18px; }

/* ── BREADCRUMB ──────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.breadcrumb-sep { color: var(--border); }
.bc-link { color: var(--accent); cursor: pointer; }
.bc-link:hover { text-decoration: underline; }
.bc-cur { color: var(--fg); font-weight: 600; }

/* ── SECTION HEADER ──────────────────────────────────── */
.sec-hd { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.sec-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.sec-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: oklch(12% 0.018 250);
  font-size: 13px; font-weight: 700; padding: 8px 16px; border-radius: 8px;
  transition: opacity 0.14s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 8px;
  transition: background 0.14s;
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--loss-dim); color: var(--loss); border: 1px solid oklch(66% 0.18 25 / 0.25);
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 8px;
  transition: background 0.14s;
}
.btn-danger:hover { background: oklch(66% 0.18 25 / 0.22); }

/* ── KPI STRIP ───────────────────────────────────────── */
.kpi-strip { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 18px; flex: 1; min-width: 140px;
}
.kpi-tile.accent { border-color: oklch(72% 0.15 160 / 0.35); }
.kpi-lbl  { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.kpi-val  { font-family: var(--mono); font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.025em; }
.kpi-hint { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.up   { color: var(--accent); }
.down { color: var(--loss); }
.neutral { color: var(--warn); }

/* ── BANK GRID ───────────────────────────────────────── */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.bank-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
  cursor: pointer; transition: border-color 0.14s, background 0.14s;
}
.bank-card:hover { border-color: var(--accent); background: var(--surface-2); }
.bank-card-hd { display: flex; align-items: center; gap: 12px; }
.bank-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.bank-logo.has-img { background: #fff; padding: 4px; overflow: hidden; }
.bank-logo.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bank-logo.sm.has-img { padding: 3px; }
.bank-logo[class*="bl-"] { font-size: 13px; letter-spacing: .02em; color: var(--bl); background: color-mix(in oklch, var(--bl) 16%, var(--surface-2)); border-color: color-mix(in oklch, var(--bl) 35%, var(--border)); }
.bank-logo.sm[class*="bl-"] { font-size: 10.5px; }
.bl-0 { --bl: oklch(72% 0.15 160); }
.bl-1 { --bl: oklch(68% 0.16 258); }
.bl-2 { --bl: oklch(68% 0.17 308); }
.bl-3 { --bl: oklch(78% 0.15 80); }
.bl-4 { --bl: oklch(68% 0.18 25); }
.bl-5 { --bl: oklch(74% 0.13 200); }
.bl-6 { --bl: oklch(72% 0.16 130); }
.bl-7 { --bl: oklch(70% 0.17 350); }
.logo-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-field .bank-logo { width: 48px; height: 48px; }
.logo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bank-name { font-size: 14px; font-weight: 700; }
.bank-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bank-card-actions { display: flex; gap: 6px; margin-left: auto; }
.act-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: color 0.14s, background 0.14s;
}
.act-btn:hover { color: var(--fg); background: var(--surface-3); }
.act-btn.danger:hover { color: var(--loss); background: var(--loss-dim); }
.act-btn svg { width: 13px; height: 13px; }
.bank-accounts-count { font-size: 11.5px; color: var(--muted); }
.bank-total { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.bank-card-ft { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.bank-open { font-size: 12px; color: var(--accent); display: flex; align-items: center; gap: 4px; }

/* ── PANEL ───────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.panel-hd { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.panel-title { font-size: 13px; font-weight: 700; }
.panel-body { padding: 0; }

/* ── TABLE ───────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 9px 16px; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
td { padding: 10px 16px; font-size: 12.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-mono { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.td-muted { font-size: 11px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; font-size: 10.5px;
  font-family: var(--mono); font-weight: 700; padding: 2px 7px; border-radius: 4px;
}
.pill.up     { background: var(--accent-dim); color: var(--accent); }
.pill.down   { background: var(--loss-dim);   color: var(--loss); }
.pill.warn   { background: var(--warn-dim);   color: var(--warn); }
.pill.blue   { background: var(--blue-dim);   color: var(--blue); }
.pill.neutral { background: var(--surface-3); color: var(--muted); }

/* ── TABS ────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.tab-btn {
  padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: background 0.14s, color 0.14s; user-select: none;
}
.tab-btn.active { background: var(--surface-3); color: var(--fg); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── ACCOUNT APERÇU ──────────────────────────────────── */
.apercu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
@media (max-width: 700px) { .apercu-grid { grid-template-columns: 1fr; } }
.info-block { background: var(--surface-2); border-radius: 8px; padding: 14px 16px; }
.info-lbl  { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.info-val  { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 4px; word-break: break-all; }
.info-val.large { font-size: 22px; }
.mini-chart-wrap { grid-column: 1 / -1; background: var(--surface-2); border-radius: 8px; padding: 14px 16px; }
.mini-chart-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 10px; }
.mini-chart-svg { width: 100%; height: 80px; display: block; overflow: visible; }

/* ── SEARCH / FILTER BAR ─────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--fg); padding: 7px 12px 7px 32px; font-size: 13px; outline: none;
  width: 220px; transition: border-color 0.14s;
}
.search-input:focus { border-color: var(--accent); }
.search-wrap { position: relative; }
.search-ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-ico svg { width: 14px; height: 14px; }
.filter-select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--fg); padding: 7px 10px; font-size: 13px; outline: none;
  cursor: pointer; transition: border-color 0.14s;
}
.filter-select:focus { border-color: var(--accent); }

/* ── TX CELL ─────────────────────────────────────────── */
.tx-cell { display: flex; align-items: center; gap: 9px; }
.tx-ico {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.tx-name { font-weight: 600; font-size: 12.5px; }
.tx-sub  { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

/* ── ROW ACTIONS ─────────────────────────────────────── */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ── MODAL ───────────────────────────────────────────── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 299; }
.overlay.show { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer;
}
.modal-close:hover { color: var(--fg); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-ft   { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.form-input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--fg); padding: 9px 12px; font-size: 13.5px; outline: none;
  transition: border-color 0.14s; width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11px; color: var(--muted); }

/* ── CONFIRM MODAL ───────────────────────────────────── */
.confirm-body { padding: 20px; }
.confirm-msg  { font-size: 14px; line-height: 1.5; color: var(--muted); }
.confirm-name { color: var(--fg); font-weight: 600; }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-ico { font-size: 32px; opacity: 0.5; }
.empty-txt { font-size: 13px; }

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 820px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 240px; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .page { padding: 14px; }
  .bank-grid { grid-template-columns: 1fr; }
  .kpi-strip { flex-direction: column; }
}
@media (max-width: 540px) {
  .form-row { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
}

/* =====================================================================
   Ajouts PatrimoSuite (étape 2)
   ===================================================================== */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico    { width: 15px; height: 15px; }
.ico-sm { width: 12px; height: 12px; }
.ico-lg { width: 34px; height: 34px; }
.app a.link, a.link { color: var(--accent); }
.app a.link:hover { text-decoration: underline; }

/* Menu : badge « étape à venir » */
.nav-soon { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; opacity: .8; }
.nav-item.active .nav-soon { color: var(--accent); border-color: oklch(72% 0.15 160 / 0.35); }
.user-txt { min-width: 0; }
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fond assombri derrière le menu mobile */
.overlay-nav { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; }
.overlay-nav.show { display: block; }

/* Sélecteur de patrimoine (barre supérieure) */
.patri-select, .patri-single {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0 4px 0 10px; height: 34px; color: var(--fg); font-size: 13px; font-weight: 600;
}
.patri-single { padding-right: 12px; }
.patri-select:focus-within { border-color: var(--accent); }
.patri-ico { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.patri-select select { background: transparent; border: 0; color: inherit; font-weight: 600; padding: 6px 6px 6px 0; outline: none; cursor: pointer; max-width: 220px; }
.patri-select option { background: var(--surface); color: var(--fg); }

/* Pied de page */
.app-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* Boutons : états */
.btn-primary:disabled, .btn-ghost:disabled, .btn-danger:disabled { opacity: .5; cursor: progress; }
.act-btn.warn:hover { color: var(--warn); background: var(--warn-dim); }
.act-btn.ok:hover   { color: var(--accent); background: var(--accent-dim); }
.act-btn.is-on      { color: var(--warn); }

/* Tableaux */
.tbl th.num, .tbl td.num { text-align: right; font-family: var(--mono); }
.tbl .actions-col { width: 1%; }
.tbl tr.is-archived td { color: var(--muted); }
.tbl tr.is-archived .tx-name { text-decoration: line-through; text-decoration-color: var(--border); }
.badge-defaut { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--warn); }
.badge-defaut svg { width: 11px; height: 11px; }

/* Pastilles de couleur (pas de style inline : CSP) */
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.sw-0 { --sw: oklch(72% 0.15 160); }
.sw-1 { --sw: oklch(65% 0.17 258); }
.sw-2 { --sw: oklch(65% 0.17 308); }
.sw-3 { --sw: oklch(80% 0.16 80); }
.sw-4 { --sw: oklch(66% 0.18 25); }
.sw-5 { --sw: oklch(70% 0.12 200); }
.dot[class*="sw-"] { background: var(--sw); }
fieldset.form-field { border: 0; min-width: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.swatch { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--sw); cursor: pointer; border: 2px solid transparent; }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch:has(input:checked) { border-color: var(--fg); box-shadow: 0 0 0 2px var(--surface) inset; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Formulaires : erreurs */
.form-error { font-size: 11.5px; color: var(--loss); min-height: 0; }
.form-error:empty { display: none; }
.form-input.is-invalid { border-color: var(--loss); }
select.form-input { cursor: pointer; }
.modal-sm { max-width: 420px; }

/* État vide */
.empty-title { font-size: 16px; font-weight: 700; color: var(--fg); }
.empty-ico { color: var(--muted); }

/* Feuille de route (dashboard provisoire) */
.roadmap { list-style: none; padding: 8px 18px 14px; display: flex; flex-direction: column; }
.roadmap li { padding: 9px 0 9px 26px; position: relative; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); }
.roadmap li:last-child { border-bottom: 0; }
.roadmap li::before { content: ''; position: absolute; left: 4px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; border: 2px solid var(--border); }
.roadmap li.done { color: var(--fg); }
.roadmap li.done::before { background: var(--accent); border-color: var(--accent); }
.roadmap strong { color: var(--fg); font-weight: 600; }

/* Notifications (PS.toast) */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 11px 14px; font-size: 13px; box-shadow: 0 12px 32px oklch(0% 0 0 / 0.45);
  animation: toast-in .18s ease-out;
}
.toast.error { border-left-color: var(--loss); }
.toast.warn  { border-left-color: var(--warn); }
.toast.hide  { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Page de contrôle dans la mise en page */
.app .checks { max-width: 760px; }
.app .banner { max-width: 760px; margin-bottom: 0; }

@media (max-width: 820px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-date { display: none; }
  .patri-select select { max-width: 130px; }
  .hide-sm { display: none; }
  .app-foot { padding: 12px 14px; }
}
@media (max-width: 480px) {
  .topbar-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .patri-single { display: none; }
  #btn-refresh { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Correctifs de mise en page (étape 2) */
.icon-btn.hamburger { display: none; }
.main { min-width: 0; }
.page { min-width: 0; }
.sec-hd > div { min-width: 0; }
.tx-cell { min-width: 0; }
.tbl td .tx-name { white-space: nowrap; }
@media (max-width: 820px) {
  .icon-btn.hamburger { display: flex; }
  .topbar-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .patri-select, .patri-single { flex-shrink: 0; }
  .badge-defaut { white-space: nowrap; }
}
.tbl-wrap { position: relative; }
.tbl th { position: relative; }
@media (max-width: 480px) {
  .tbl th, .tbl td { padding: 9px 8px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 12px; }
  .row-actions { gap: 3px; }
  .act-btn { width: 26px; height: 26px; }
  .badge-defaut .lbl { display: none; }
}

/* =====================================================================
   Étape 3 — connexion et Mon compte
   ===================================================================== */
.auth-card { max-width: 440px; }
.auth .card-sub { margin-bottom: 20px; line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.auth .form-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.auth .form-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 12px; color: var(--fg); font: inherit; font-size: 14px; outline: none; transition: border-color var(--t-fast);
}
.auth .form-input:focus { border-color: var(--accent); }
.input-wrap { position: relative; }
.form-input.has-toggle { padding-right: 42px; }
.input-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 6px; display: flex; }
.input-toggle:hover, .input-toggle.on { color: var(--fg); }
.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .25em; text-align: center; }
.btn-block { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14px; }
.auth .btn-primary { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: var(--bg); font-weight: 700; border: 0; border-radius: 9px; cursor: pointer; }
.auth .btn-primary:hover { opacity: .9; }
.auth .btn-primary:disabled { opacity: .55; cursor: progress; }
.auth .btn-ghost { display: inline-flex; align-items: center; background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; cursor: pointer; }
.alert { padding: 11px 13px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.45; }
.alert.error { background: var(--loss-dim); color: var(--loss); }
.alert.info  { background: var(--blue-dim); color: var(--fg); }
.check-line { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check-line input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.check-line small { color: var(--muted); font-size: 12px; }
.auth-help { margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-help summary { cursor: pointer; color: var(--fg); }
.auth-help p { margin-top: 8px; line-height: 1.5; }
.auth-help code { color: var(--fg); }
.card-foot .secure { display: inline-flex; align-items: center; gap: 5px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 18px; font-size: 13.5px; line-height: 1.5; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.steps .auth-form { margin-top: 10px; }
.qr-box { margin-top: 10px; width: 200px; max-width: 100%; aspect-ratio: 1; background: #fff; border-radius: 10px; padding: 6px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.secret-box { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret-box code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; letter-spacing: .06em; word-break: break-all; }

/* Barre latérale : compte + déconnexion */
.user-pill { padding: 6px 6px 6px 10px; }
.user-link { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.logout-form { margin-left: auto; }
.logout-form .icon-btn { width: 30px; height: 30px; }

/* Mon compte */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.panel-form { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; font-size: 13.5px; line-height: 1.5; }
.panel-form-inner { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.inline-fields { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-fields .grow { flex: 1; min-width: 160px; }
.inline-fields .code-input { font-size: 16px !important; }
.form-row .code-input { font-size: 16px !important; }
.btn-sm { padding: 5px 10px !important; font-size: 12px !important; }
.danger-zone { border-top: 1px solid var(--border); padding-top: 12px; }
.danger-zone summary { cursor: pointer; color: var(--loss); font-weight: 600; font-size: 13px; }
.info-line strong { font-family: var(--mono); }
.panel-empty { padding: 16px 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.simple-list { list-style: none; }
.simple-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.simple-list li:last-child { border-bottom: 0; }
.simple-list .pill { margin-right: 6px; }
.tx-cell .ico { color: var(--muted); flex-shrink: 0; }
.codes-panel { max-width: 640px; }
.codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; padding-left: 22px; font-family: var(--mono); }
.codes-grid code { font-size: 16px; letter-spacing: .08em; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

@media print {
  .sidebar, .topbar, .app-foot, .btn-row, .toasts { display: none !important; }
  body.app, .main { display: block; margin: 0; background: #fff; color: #000; }
  .panel { border: 1px solid #999; }
  .codes-grid code { color: #000; }
}

/* =====================================================================
   Étape 4 — Liquidités, import, catégories, institutions
   ===================================================================== */
.sw-6 { --sw: oklch(75% 0.14 120); }
.sw-7 { --sw: oklch(58% 0.014 250); }
.sw-8 { --sw: oklch(70% 0.13 50); }
.sw-9 { --sw: oklch(68% 0.16 340); }
.sw-10 { --sw: oklch(62% 0.08 220); }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-sm { display: none; }
.span-2 { grid-column: 1 / -1; }
.btn-row.center { justify-content: center; }
.ico-act { width: 13px; height: 13px; }
.alert.warn { background: var(--warn-dim); color: var(--fg); }
.rates-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check-line input { accent-color: var(--accent); width: 16px; height: 16px; }
.check-line.align-end { align-self: end; padding-bottom: 10px; }
textarea.form-input { resize: vertical; min-height: 60px; font-family: inherit; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--fg); margin: 10px 0 4px; }
.empty-state .btn-row { margin-top: 16px; }
.empty-state.small { padding: 22px 16px; }
.empty-state.small .btn-ghost { margin-top: 10px; display: inline-flex; }
svg.empty-ico { width: 36px; height: 36px; }
.panel-note { font-size: 12px; color: var(--muted); padding: 10px 18px 0; line-height: 1.5; }

/* Cartes banques et comptes */
.bank-card.static { cursor: default; }
.bank-card.static:hover { border-color: var(--border); background: var(--surface); }
.bank-logo.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 0 -10px;
  border-radius: 8px; color: inherit; text-decoration: none; transition: background var(--t-fast);
}
.acc-row:hover, .acc-row:focus-visible { background: var(--surface-2); }
.acc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acc-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-amt { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.acc-bal { font-family: var(--mono); font-size: 13.5px; font-weight: 700; }
.acc-eur { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.acc-chev { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }
.acc-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.breadcrumb { margin-bottom: -6px; }

/* Graphiques */
.chart { width: 100%; display: block; overflow: visible; }
.chart-line { height: 140px; }
.chart-bars { height: 150px; }
.ch-area { fill: var(--accent-dim); }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.ch-zero { stroke: var(--loss); stroke-dasharray: 3 3; stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 10px; font-family: var(--ui); }
.ch-in { fill: var(--accent); }
.ch-out { fill: var(--loss); }
.chart-range { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.chart-empty { font-size: 12px; color: var(--muted); padding: 18px 0; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.lg::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-in::before { background: var(--accent); }
.lg-out::before { background: var(--loss); }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.hbars li { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.hb-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bar { width: 100%; height: 8px; display: block; }
.hb-bg { fill: var(--surface-3); }
.hb-val { fill: var(--sw, var(--muted)); }
.hb-amt { font-family: var(--mono); font-size: 11.5px; font-weight: 600; text-align: right; white-space: nowrap; }
.hb-amt small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.info-txt { font-size: 13px; margin-top: 6px; line-height: 1.5; }
.info-val.small { font-size: 12.5px; }

/* Opérations */
.ops-filters { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ops-filters .search-wrap { flex: 1 1 220px; }
.ops-filters .search-input { width: 100%; }
.date-filter { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ops-sum { font-size: 11.5px; color: var(--muted); margin-left: auto; font-family: var(--mono); }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent-dim); font-size: 12.5px; font-weight: 600; flex-wrap: wrap; }
.bulk-bar[hidden] { display: none; }
/* L'attribut hidden l'emporte toujours sur le display des composants (boutons, lignes…) */
[hidden] { display: none !important; }
.chk-col { width: 34px; padding-right: 0 !important; }
.chk-col input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
tr.is-selected td { background: var(--surface-2); }
.tbl-ops .tx-name { display: flex; align-items: center; gap: 6px; white-space: normal !important; word-break: break-word; }
.tbl-ops td:nth-child(3) { min-width: 180px; }
.tbl-ops .pill svg { width: 11px; height: 11px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 180px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 10px 3px 8px; font-size: 11.5px; color: var(--fg); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-pill:hover { border-color: var(--accent); }
.cat-pill.none { color: var(--warn); border-style: dashed; }
.cat-pill .dot { width: 8px; height: 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; font-size: 12px; color: var(--muted); }
.pager:empty { display: none; }
.lock-ico svg { width: 11px; height: 11px; color: var(--muted); }

/* Import */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  margin: 16px; padding: 36px 20px; border: 2px dashed var(--border); border-radius: var(--r);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone.over { border-color: var(--accent); background: var(--accent-dim); }
.dropzone.busy { opacity: .6; pointer-events: none; cursor: progress; }
.drop-ico { width: 34px; height: 34px; color: var(--muted); }
.drop-title { font-size: 15px; font-weight: 700; }
.drop-sub { font-size: 12px; color: var(--muted); }
.file-btn { cursor: pointer; position: relative; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.howto { padding: 0 18px 16px; font-size: 12.5px; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--fg); font-weight: 600; }
.howto ul { margin: 10px 0 6px 18px; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.import-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
.import-head .form-input { margin: 6px 0 4px; }
#pv-warnings { padding: 0 16px; }
#pv-warnings .alert { margin-bottom: 10px; }
.import-counts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; }
.import-counts .td-muted { margin-left: auto; font-family: var(--mono); }
.pv-table { max-height: 460px; overflow-y: auto; border-top: 1px solid var(--border); }
.pv-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
tr.pv-doublon td { opacity: .5; }
tr.pv-erreur td { background: var(--loss-dim); }
tr.pv-autre_compte td { opacity: .7; }
.import-ft { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--border); }

/* Catégories */
.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.cat-layout code { background: var(--surface-2); border-radius: 4px; padding: 1px 6px; font-size: 12px; }

@media (max-width: 1100px) {
  .cat-layout { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .import-head { grid-template-columns: 1fr; }
  .ops-sum { margin-left: 0; width: 100%; }
  .acc-title .bank-logo { display: none; }
}
@media (max-width: 540px) {
  .show-sm { display: block; }
  .ellipsis { max-width: 140px; }
  .date-filter { flex: 1 1 45%; }
  .date-filter input { flex: 1; min-width: 0; }
  .hbars li { grid-template-columns: 1fr auto; }
  .hbars .hb-bar { grid-column: 1 / -1; grid-row: 2; }
  .chk-col { display: none; }
}
.bank-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.bank-card { min-width: 0; }
.chart-line { height: 120px; }
.chart-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 6px; }
.chart-x span:only-child { margin-left: auto; }
@media (max-width: 540px) { .chart-x span:nth-child(even):not(:last-child) { visibility: hidden; } }
.cat-layout code { white-space: nowrap; }
.mr-auto { margin-right: auto; }
@media (max-width: 540px) {
  .tbl-ops .ops-actions, .tbl-ops th.actions-col { display: none; }
  .tbl-ops tbody tr[data-id] { cursor: pointer; }
}

/* =====================================================================
   Étape 5 — Épargne
   ===================================================================== */
.progress { display: block; width: 100%; height: 6px; margin: 8px 0 6px; }
.progress.sm { display: inline-block; width: 70px; height: 6px; margin: 0 6px 0 0; vertical-align: middle; }
.pg-val { fill: var(--accent); }
.tbl-compact th, .tbl-compact td { padding: 7px 10px; }
.tbl-compact th:first-child, .tbl-compact td:first-child { padding-left: 0; }
.info-block .tbl-compact tbody tr:hover td { background: transparent; }
.foot-note { font-size: 11.5px; color: var(--muted); }
.more-fields { border-top: 1px solid var(--border); padding-top: 12px; }
.more-fields summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.more-fields[open] summary { margin-bottom: 12px; }
.more-fields > .form-row, .more-fields > .form-field { margin-bottom: 12px; }
#tab-fidelite .panel-note { padding-bottom: 12px; }
@media (max-width: 540px) {
  .progress.sm { width: 44px; }
}
.acc-sub.acc-prime { color: var(--accent); }
.kpi-val small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tab-btn { white-space: nowrap; flex-shrink: 0; }

/* =====================================================================
   Étape 6 — Investissements
   ===================================================================== */
.kpi-val.small-val { font-size: 15px; line-height: 1.5; }
.cash-line { display: block; }
.stale { color: var(--warn); }
.tbl-pos .tx-sub .pill { margin-left: 4px; font-size: 9.5px; padding: 1px 5px; }
.tbl-pos td.num .tx-sub { text-align: right; }
.tbl-pos .grp-hd th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  background: var(--surface-2); padding-top: 10px; padding-bottom: 6px; }
.tbl-pos .grp-total td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); font-size: 12.5px; }
.tbl-pos .grp-total td .tx-sub { font-weight: 400; }
.tbl-pos .grp-type td { background: transparent; color: var(--muted); }
.tbl-pos .grp-grand td { font-weight: 700; border-top: 2px solid var(--border); background: transparent; font-size: 13px; }
.tbl-pos .grp-type td.up { color: var(--accent); }
.tbl-pos .grp-type td.down { color: var(--loss); }
.pos-foot { padding: 8px 16px 0; margin: 0; }
.tbl-pos .tx-sub.ann { font-size: 10.5px; opacity: .85; }
.tbl-pos .tx-sub.ann.up { color: var(--accent); }
.tbl-pos .tx-sub.ann.down { color: var(--loss); }
.tbl-pos .pos-qte-sm { display: none; }
@media (max-width: 540px) {
  .tbl-pos .pos-qte { display: none; }
  .tbl-pos .pos-qte-sm { display: block; }
  .tbl-pos td .tx-name { white-space: normal; overflow-wrap: anywhere; }
  .tbl-pos td.num { font-size: 11.5px; white-space: nowrap; }
  .tbl-pos .grp-total td:first-child { font-size: 11.5px; }
}
.hints { margin: 0; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.hints-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.hint-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hint-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.hint-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hints-sub { margin: -4px 0 8px; }
.hints-foot { margin: 8px 0 0; }
.fx-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.picker { position: relative; display: flex; flex-direction: column; gap: 5px; }
.picker-list { list-style: none; margin: 0; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; }
.picker-list:not(.static) { position: absolute; top: 42px; left: 0; right: 0; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.picker-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); padding: 7px 9px; border-radius: 6px; cursor: pointer; font: inherit; }
.picker-list button:hover, .picker-list button:focus-visible { background: var(--surface-3); }
.picker-list button strong { font-size: 13px; }
.picker-list button span { font-size: 11px; color: var(--muted); }
.picker-empty { font-size: 12px; color: var(--muted); padding: 8px; }
.input-btn { display: flex; gap: 6px; align-items: center; }
.input-btn .form-input { flex: 1; min-width: 0; }
.source-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.source-box legend { padding: 0 6px; }
.danger-link { color: var(--loss); margin-top: 10px; font-size: 12.5px; }
.total-line { font-family: var(--mono); color: var(--fg); }
.total-line:empty { display: none; }
.total-line.error-line { color: var(--loss); }
[data-precompte] { font-size: 12px; margin-top: 4px; align-self: flex-start; }
[data-show][hidden], [data-show-source][hidden] { display: none !important; }
@media (max-width: 540px) {
  .tbl-pos .pos-actions, .tbl-pos th.actions-col { display: none; }
  .tbl-pos tbody tr[data-actif] { cursor: pointer; }
}
/* Page d'un titre */
.titre-grid { margin: 18px 0; }
.kv { margin: 0; padding: 6px 16px 14px; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); min-width: 0; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; text-align: right; white-space: nowrap; }
.kv dd small { font-size: 11px; margin-left: 4px; }
.kv .kv-total dt { color: var(--fg); font-weight: 600; }
.kv .kv-total dd { font-weight: 700; }
.kv .kv-total { border-top: 1px solid var(--muted); }
.compte-detail { margin-top: 18px; }
.compte-detail .panel-title { display: inline-flex; align-items: center; gap: 8px; }
.sub-title { margin: 0; padding: 12px 16px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tbl-titre td .tx-sub { white-space: normal; }
.tbl-titre .ops-actions { width: 1%; }
.lot-solde td { opacity: .55; }
.lot-solde td.ops-actions { opacity: 1; }
.pos-name-link { color: inherit; text-decoration: none; }
.pos-name-link:hover, .pos-name-link:focus-visible { text-decoration: underline; color: var(--accent); }
@media (max-width: 540px) {
  .kv dd { white-space: normal; }
  .tbl-titre .ops-actions, .tbl-titre th.actions-col { display: none; }
  .compte-detail tbody tr[data-op] { cursor: pointer; }
  .compte-detail .panel-hd { flex-wrap: wrap; gap: 8px; }
}
.compte-detail .panel-hd .btn-row, .titre-grid ~ .panel .panel-hd { gap: 8px; }
.tbl-titre td.num .tx-sub { text-align: right; }
@media (max-width: 540px) {
  .tbl-titre th, .tbl-titre td { padding-left: 8px; padding-right: 8px; }
  .tbl-titre th { letter-spacing: .04em; }
}
.tbl-titre th { white-space: normal; vertical-align: bottom; }
.tbl-titre th, .tbl-titre td { padding-left: 10px; padding-right: 10px; }
.tbl-titre th:first-child, .tbl-titre td:first-child { padding-left: 16px; }
.only-sm { display: none; }
@media (max-width: 540px) {
  .only-sm { display: block; }
  .tbl-titre th, .tbl-titre td { padding-left: 6px; padding-right: 6px; }
  .tbl-titre th:first-child, .tbl-titre td:first-child { padding-left: 12px; }
}
/* Chèques & avantages */
.kpi-val.warn, .tx-sub.warn, td.warn { color: var(--warn); }
.acc-sub.acc-warn { color: var(--warn); }
.chq-grid { margin-top: 18px; }
.chq-grid .panel-body { padding: 14px 16px 16px; }
.year-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.year-nav .chip { font-family: var(--mono); font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); text-decoration: none; }
.year-nav .chip:hover { color: var(--fg); border-color: var(--accent); }
.year-nav .chip.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.year-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px 0; font-size: 12.5px; }
#tab-lots .panel-note { padding-bottom: 10px; }
.tbl-lots .lot-solde td { opacity: .6; }
.kpi-hint .warn { color: var(--warn); }
.lots-group { border-top: 1px solid var(--border); margin-top: 10px; }
.lots-group > summary { cursor: pointer; padding: 10px 18px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.lots-group > summary:hover { color: var(--fg); }
.exp-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; border-bottom: 1px dashed var(--border); }
.exp-btn:hover, .exp-btn:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
.exp-btn .ico-xs { width: 11px; height: 11px; opacity: .6; }
/* Crowdfunding */
.grade { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 17px; background: var(--accent-dim); color: var(--accent); vertical-align: 1px; }
.cf-vues { margin: 18px 0 12px; }
.cf-groupe { margin-bottom: 18px; }
.cf-pf { display: inline-flex; align-items: center; gap: 8px; }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover, .link-plain:focus-visible { color: var(--accent); text-decoration: underline; }
.tbl-ech .ech-paye td { color: var(--muted); }
.tbl-ech .ech-paye td strong { color: var(--muted); font-weight: 600; }
.tbl-ech .ech-next td { background: var(--accent-dim); }
.kv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 28px; }
.kv-cols > div:last-child { border-bottom: 1px solid var(--border); }
.cf-note { padding-bottom: 14px; }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row:has(> .form-field-sm) { grid-template-columns: 1fr 110px; }
.tbl-cf-import .filter-select { max-width: 260px; }
@media (max-width: 540px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .tbl-cf-import .filter-select { max-width: 150px; }
}
.tbl-ech .pill { white-space: nowrap; }
@media (max-width: 540px) {
  .tbl-ech .ops-actions, .tbl-ech th.actions-col { display: none; }
  .tbl-ech tbody tr { cursor: pointer; }
  .tbl-ech th, .tbl-ech td { padding-left: 6px; padding-right: 6px; }
}
/* Assurances & pension */
.ag-groupe { margin-bottom: 18px; }
.tbl-ag .tx-name { display: flex; align-items: center; gap: 8px; }
.ag-chart { margin: 0 16px 16px; }
.ag-note { padding-bottom: 14px; }
.center-note { text-align: center; font-size: 12.5px; margin: 6px 0 18px; }
[data-show-type][hidden], [data-new-only][hidden] { display: none; }
@media (max-width: 540px) {
  .tbl-ag-rel .ops-actions, .tbl-ag-rel th.actions-col, .tbl-ag-ver .ops-actions, .tbl-ag-ver th.actions-col { display: none; }
  .tbl-ag-rel tbody tr, .tbl-ag-ver tbody tr { cursor: pointer; }
}
.ag-help .howto { padding-top: 14px; }
/* Tableau de bord : tuiles en grille (8 tuiles) */
.kpi-strip.dash-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dash-kpis .kpi-val { overflow-wrap: anywhere; }
@media (max-width: 860px) { .kpi-strip.dash-kpis { grid-template-columns: 1fr; } }
.tbl-ag-import .ag-rel { font-size: 12px; line-height: 1.6; }
.tbl-ag-rel td .tx-sub { font-family: var(--ui); white-space: normal; max-width: 520px; }
@media (max-width: 540px) {
  .tbl-ag-import .filter-select { width: 118px; max-width: 118px; min-width: 0; }
  .tbl-ag-import th, .tbl-ag-import td { padding-left: 6px; padding-right: 6px; }
}
.tbl-ag-import td .tx-name, .tbl-ag-import td .tx-sub { white-space: normal; }
/* Tableau de bord */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; gap: 16px; margin: 16px 0; }
.dash-grid > .panel { margin: 0; }
.dash-chart { margin: 14px 16px 4px; }
.dash-evol { margin-top: 16px; }
.dash-alloc .panel-body { padding: 14px 16px 16px; }
.dash-modules { margin-top: 16px; }
.kpi-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.kpi-link:hover, .kpi-link:focus-visible { border-color: var(--accent); }
.kpi-lbl .dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; }
.count-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--warn-dim); color: var(--warn); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); }
.alert-item:first-child { border-top: 0; }
.alert-item .pill { flex-shrink: 0; margin-top: 1px; white-space: nowrap; }
.alert-txt { flex: 1; min-width: 0; font-size: 13px; }
.alert-txt .tx-sub { white-space: normal; }
#alertes-ignorees summary { cursor: pointer; list-style: none; }
#alertes-ignorees .alert-item { opacity: .75; }
@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } }
.panel-hd .link { font-size: 12.5px; }
@media (max-width: 860px) {
  .kpi-strip.dash-modules { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-modules .kpi-tile { padding: 12px 14px; }
  .dash-modules .kpi-val { font-size: 17px; }
  .dash-modules .kpi-lbl { font-size: 10px; }
}
/* Graphique empilé (patrimoine) */
.stk { padding: 4px 0 0; }
.stk-body { display: flex; gap: 8px; }
.stk-y { display: flex; flex-direction: column; justify-content: space-between; width: 52px; flex-shrink: 0; height: 240px; margin: -6px 0; text-align: right; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.stk-y span { line-height: 12px; }
.stk-plot { position: relative; flex: 1; min-width: 0; height: 240px; touch-action: pan-y; cursor: crosshair; }
.stk-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.stk-grid { stroke: var(--border); stroke-width: 1; }
.stk-zero { stroke: var(--muted); stroke-width: 1; }
.stk-area { fill: var(--sw); fill-opacity: .42; stroke: none; }
.stk-total { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; }
.stk-estime { stroke-dasharray: 5 4; opacity: .7; }
.stk-x { position: relative; height: 18px; margin: 6px 0 0 60px; font-size: 10.5px; color: var(--muted); }
.stk-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.stk-x span:first-child { transform: none; }
.stk-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); pointer-events: none; }
.stk-tip { position: absolute; top: 6px; margin-left: 12px; min-width: 210px; max-width: 260px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); box-shadow: 0 6px 20px rgb(0 0 0 / .35); font-size: 12px; pointer-events: none; z-index: 2; }
.stk-tip.left { transform: translateX(-100%); margin-left: -12px; }
.stk-tip-d { color: var(--muted); font-size: 11px; }
.stk-tip-t { font-family: var(--mono); font-size: 15px; font-weight: 700; margin: 2px 0 6px; }
.stk-tip-t small { font-size: 11px; font-weight: 500; margin-left: 4px; }
.stk-tip ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.stk-tip li { display: flex; align-items: center; gap: 6px; }
.stk-tip li span { flex: 1; color: var(--muted); }
.stk-tip li b { font-family: var(--mono); font-weight: 600; font-size: 11.5px; }
.stk-tip li .dot { width: 8px; height: 8px; }
.stk-tip-n { margin-top: 6px; color: var(--warn); font-size: 11px; }
.stk .chart-legend { flex-wrap: wrap; margin: 8px 0 0 60px; }
.stk .chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.stk .chart-legend .dot { width: 8px; height: 8px; }
.periodes { display: flex; gap: 4px; }
.periodes .chip { padding: 2px 9px; font-size: 11.5px; }
@media (max-width: 540px) {
  .stk-y { width: 42px; }
  .stk-x, .stk .chart-legend { margin-left: 50px; }
  .stk-plot, .stk-y { height: 200px; }
  .stk-tip { min-width: 180px; }
}
.dash-controle { padding-top: 4px; } .dash-controle summary { color: var(--warn); display: inline-flex; align-items: center; gap: 6px; } .dash-controle .tbl-wrap { margin-top: 8px; }
.bk-grid { align-items: stretch; } .bk-body { padding: 14px 16px 16px; } .bk-note { padding: 0 0 10px; } .bk-howto { padding: 0 0 12px; } .bk-howto ol { margin: 10px 0 6px 18px; display: flex; flex-direction: column; gap: 5px; line-height: 1.5; } .bk-dl { transform: rotate(180deg); } .bk-grid .panel { display: flex; flex-direction: column; } @media (max-width: 960px) { .bk-grid { grid-template-columns: 1fr; } }
/* Fiscalité */
.fis-src { display: inline-block; margin: 2px 4px 0 0; padding: 0 6px; border-radius: 999px; font-size: 10.5px; line-height: 17px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.fis-src.warn { background: var(--warn-dim); color: var(--warn); }
.tbl-fis td .tx-sub { white-space: normal; }
.fis-cours { max-width: 130px; text-align: right; margin-left: auto; }
.fis-sim .kv dd.up { color: var(--gain, var(--accent)); }
.fis-grid { align-items: start; }
@media (max-width: 960px) { .fis-grid { grid-template-columns: 1fr; } }
.ipp-pre { min-width: 190px; padding-top: 6px; padding-bottom: 6px; }
.ipp-note { padding: 0 18px 14px; }
@media (max-width: 540px) { .ipp-pre { min-width: 0; width: 100%; } }
/* Arbitrage */
.tbl-arb .arb-cible { width: 74px; text-align: right; margin-left: auto; padding-top: 5px; padding-bottom: 5px; }
.tbl-arb tr.arb-exclu td { color: var(--muted); }
.tbl-arb tfoot td { font-weight: 600; }
.arb-bar { position: relative; height: 10px; min-width: 120px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.arb-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--sw); border-radius: 5px; }
.arb-band { position: absolute; top: 0; bottom: 0; background: var(--fg); opacity: .12; }
.arb-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--fg); }
.arb-reglages { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; padding: 12px 18px 4px; }
.arb-reglages .form-field { margin: 0; min-width: 160px; }
.arb-note, .arb-err { padding: 0 18px 14px; }
.arb-err:empty { display: none; }
.arb-actions { list-style: none; margin: 0; padding: 0; }
.arb-actions > li { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.arb-actions > li:first-child { border-top: 0; }
.arb-act-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tbl-arb-v { margin-top: 4px; }
.arb-taxe { margin: 0; }
.arb-sans { padding: 12px 18px 16px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.arb-mini { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.arb-mini li { display: flex; justify-content: space-between; gap: 12px; }
.dbl-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px 16px; }
.dbl-alert { margin: 0 18px 10px; }
