/* ==========================================================================
   SubZero-Link — feuille de style
   Direction : « cryo-précision » — navy profond, cristal glacé, accents
   cyan → indigo. Sidebar toujours sombre (signature), surfaces givrées.
   Polices : Sora (titres, chiffres clés), Plus Jakarta Sans (texte),
   JetBrains Mono (IP, références).
   ==========================================================================

   VOCABULAIRE DES COMPOSANTS (à réutiliser tel quel dans les templates)
   - Tons d'état (ExpiryState.tone / AlertSeverity.tone) :
       success | warning | danger | expired | muted | info
   - Page        : .page-head (.eyebrow, h1, p.sub) + .page-actions
   - Grilles     : .grid + .grid-2 | .grid-3 | .grid-4 | .grid-main (2/3 + 1/3) | .grid-side (+340px)
                   .stack (colonne gap 16) .row (.row--between .row--wrap) .grow .span-2
   - Cartes      : .card (+ .card--glow) > .card-head (h2 + .sub) | .card-body | .card-foot | .card-pad
                   .card--flush (body sans padding, pour tables/listes)
   - Boutons     : .btn (+ --primary | --ice | --ghost | --danger | --solid-danger | --wa | --wa-ghost)
                   tailles --sm | --xs, --icon (carré), --block ; .btn-group ; .icon-btn
                   spinner HTMX : <span class="spinner"></span> dans le bouton (visible pendant .htmx-request)
   - Icônes      : <svg class="i"><use th:href="@{/img/icons.svg#users}"/></svg>  (.i--xs|--sm|--lg|--xl)
   - Tuile icône : .tile (style="--c: #hex" pour la couleur d'entité, ex. ServiceType.color) --sm|--lg|--ice
   - Pastilles   : .pill.pill--{tone} > .dot  (compte à rebours d'échéance) ; .pill--lg
                   .badge (+ --accent|--success|--warning|--danger|--muted|--outline)
   - Avatar      : .avatar (style="--h: <0-359>", cf. ${@fmt.hue(name)}) --sm|--lg ; .avatars (pile)
   - Tableaux    : .table-wrap > table.table ; td.num (droite, tabulaire) ; td.actions > .btn-group
                   .cell-main (avatar/tuile + texte) a.title / .cell-title / .cell-sub ; .hide-sm
   - Filtres     : .filters (barre au-dessus d'une table : .input-group, .select, .spacer, .segmented)
   - Formulaires : .form-grid (2 col, .full) .form-section ; .field (+ .has-error) > label + .input|.select|.textarea
                   .field-error .hint (.is-auto) ; .input-group > .i.lead + .input + .addon ; .switch > input + .track
                   .stepper ; .segmented (a.is-active | label > input + span) ; .alert-box--{danger|warning|info|success}
   - Progression : .progress.progress--{tone} > span[style=width:x%] + .progress-meta
   - KPI         : .kpis > .card.kpi (.kpi-top .tile .kpi-label | .kpi-value small | .kpi-foot .trend--up|down|flat)
   - Modale      : dialog.modal (--sm|--lg) > .modal-head (.tile, h2, p, .close) + form > .modal-body + .modal-foot
   - Pagination  : fragments/ui :: pager(page)
   - Vide        : fragments/ui :: empty-state(icon, title, text)
   - Détail      : .hero (+ .meta, .hero-actions) ; .dl (dt/dd) ; .stat-strip ; .countdown-big ; .contact-btns > .contact-btn(.wa)
                   .list-plain > li ; .msg-preview
   - Infra       : .res-summary ; .res-grid > .card.res-card (.res-card-head .ring .res-stats .res-margin .mbar .res-foot)
   - Alertes     : .alert-row (.is-unread|.is-read, .tone-{tone}) > .sev-tile.tile + .title/.msg/.meta + .alert-actions
   - Frise       : ul.timeline > li.tl-item (.tl-date .tl-rail>.tl-node.tone-x .tl-main .tl-side .tl-actions)
   - Graphiques  : svg.viz ; .viz-legend ; .hbars ; .donut ; details.viz-table ; [data-tip] (infobulle JS)
   - Squelettes  : .skeleton .sk-line .sk-row ; résultats HTMX : #results (opacité pendant la requête)
   - Focus       : :focus-visible = contour 2px var(--accent) (≥ 3:1) ; ne jamais le retirer sans équivalent
   - Pas de style inline injecté par JS hors propriétés CSS (--toast-ms, position des infobulles)
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --ice-1: #7DF0FF;
  --ice-2: #38BDF8;
  --ice-3: #6366F1;
  --grad-ice: linear-gradient(135deg, #22D3EE 0%, #38BDF8 35%, #6366F1 100%);
  --grad-primary: linear-gradient(180deg, #5B60F0 0%, #4338CA 100%);

  --bg: #F2F5FA;
  --bg-wash: radial-gradient(1100px 480px at 78% -12%, rgba(56, 189, 248, .13), transparent 62%),
             radial-gradient(900px 420px at 8% -18%, rgba(99, 102, 241, .10), transparent 60%);
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F8;
  --surface-glass: rgba(255, 255, 255, .72);
  --border: #E3E8F1;
  --border-strong: #CDD5E3;
  --text: #0B1220;
  --text-2: #4A5872;
  --text-3: #5B6880; /* ≥ 4.9:1 sur --bg, --surface-2 et --surface-3 */
  --accent: #4F46E5;
  --accent-ink: #4338CA;
  --accent-soft: rgba(79, 70, 229, .09);
  --cyan: #0891B2;
  --focus: 0 0 0 3px rgba(99, 102, 241, .28);

  --success: #059669;  --success-soft: #E7F7F0; --success-ink: #047857;
  --warning: #D97706;  --warning-soft: #FEF5E3; --warning-ink: #9A5208;
  --danger: #E11D48;   --danger-soft: #FDECEF;  --danger-ink: #BE123C;
  --expired: #9F1239;  --expired-soft: #9F1239; --expired-ink: #FFFFFF;
  --info: #0284C7;     --info-soft: #E6F4FB;    --info-ink: #0369A1;
  --muted: #64748B;    --muted-soft: #EEF1F5;   --muted-ink: #475569;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .22), 0 8px 16px -8px rgba(15, 23, 42, .12);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, .6);

  /* Sidebar : toujours « nuit polaire » */
  --sb-bg: #0A1020;
  --sb-bg-2: #0E1630;
  --sb-border: rgba(148, 163, 184, .12);
  --sb-text: #AEB9CF;
  --sb-text-strong: #F1F5FF;
  --sb-hover: rgba(148, 163, 184, .08);
  --sb-active: rgba(125, 240, 255, .08);

  /* Données (palette validée CVD — skill dataviz) */
  --viz-income: #4F5BD5;
  --viz-expense: #EB6834;
  --viz-net: #0B1220;
  --viz-grid: #E6EBF3;
  --viz-axis: #66748C;
  --cat-1: #2A78D6; --cat-2: #EB6834; --cat-3: #1BAF7A; --cat-4: #EDA100;
  --cat-5: #E87BA4; --cat-6: #008300; --cat-7: #4A3AA7; --cat-8: #E34948;
  --cat-other: #8A93A3;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060A13;
  --bg-wash: radial-gradient(1000px 520px at 82% -14%, rgba(56, 189, 248, .11), transparent 62%),
             radial-gradient(900px 520px at 6% -24%, rgba(99, 102, 241, .20), transparent 60%);
  --surface: #0C1323;
  --surface-2: #101A2E;
  --surface-3: #15203A;
  --surface-glass: rgba(10, 16, 30, .72);
  --border: #1B2742;
  --border-strong: #2A3958;
  --text: #E8EEFA;
  --text-2: #A7B4CC;
  --text-3: #8191AC;
  --accent: #818CF8;
  --accent-ink: #A5B4FC;
  --accent-soft: rgba(129, 140, 248, .13);
  --cyan: #22D3EE;
  --focus: 0 0 0 3px rgba(129, 140, 248, .35);
  --success: #34D399;  --success-soft: rgba(52, 211, 153, .12); --success-ink: #6EE7B7;
  --warning: #FBBF24;  --warning-soft: rgba(251, 191, 36, .13); --warning-ink: #FCD34D;
  --danger: #FB7185;   --danger-soft: rgba(251, 113, 133, .13); --danger-ink: #FDA4AF;
  --expired: #E11D48;  --expired-soft: #BE123C;                 --expired-ink: #FFFFFF;
  --info: #38BDF8;     --info-soft: rgba(56, 189, 248, .12);    --info-ink: #7DD3FC;
  --muted: #8191AC;    --muted-soft: rgba(148, 163, 184, .1);   --muted-ink: #A7B4CC;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 28px 60px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(148, 163, 184, .08);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, .035);
  --sb-bg: #070C18;
  --sb-bg-2: #0B1326;
  --viz-income: #7C86F0;
  --viz-expense: #E0703F;
  --viz-net: #E8EEFA;
  --viz-grid: #1A2540;
  --viz-axis: #8191AC;
  --cat-1: #3987E5; --cat-2: #D95926; --cat-3: #199E70; --cat-4: #C98500;
  --cat-5: #D55181; --cat-6: #008300; --cat-7: #9085E9; --cat-8: #E66767;
  --cat-other: #6B7489;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #060A13;
    --bg-wash: radial-gradient(1000px 520px at 82% -14%, rgba(56, 189, 248, .11), transparent 62%),
               radial-gradient(900px 520px at 6% -24%, rgba(99, 102, 241, .20), transparent 60%);
    --surface: #0C1323;
    --surface-2: #101A2E;
    --surface-3: #15203A;
    --surface-glass: rgba(10, 16, 30, .72);
    --border: #1B2742;
    --border-strong: #2A3958;
    --text: #E8EEFA;
    --text-2: #A7B4CC;
    --text-3: #8191AC;
    --accent: #818CF8;
    --accent-ink: #A5B4FC;
    --accent-soft: rgba(129, 140, 248, .13);
    --cyan: #22D3EE;
    --focus: 0 0 0 3px rgba(129, 140, 248, .35);
    --success: #34D399;  --success-soft: rgba(52, 211, 153, .12); --success-ink: #6EE7B7;
    --warning: #FBBF24;  --warning-soft: rgba(251, 191, 36, .13); --warning-ink: #FCD34D;
    --danger: #FB7185;   --danger-soft: rgba(251, 113, 133, .13); --danger-ink: #FDA4AF;
    --expired: #E11D48;  --expired-soft: #BE123C;                 --expired-ink: #FFFFFF;
    --info: #38BDF8;     --info-soft: rgba(56, 189, 248, .12);    --info-ink: #7DD3FC;
    --muted: #8191AC;    --muted-soft: rgba(148, 163, 184, .1);   --muted-ink: #A7B4CC;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 28px 60px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(148, 163, 184, .08);
    --card-highlight: inset 0 1px 0 rgba(255, 255, 255, .035);
    --sb-bg: #070C18;
    --sb-bg-2: #0B1326;
    --viz-income: #7C86F0;
    --viz-expense: #E0703F;
    --viz-net: #E8EEFA;
    --viz-grid: #1A2540;
    --viz-axis: #8191AC;
    --cat-1: #3987E5; --cat-2: #D95926; --cat-3: #199E70; --cat-4: #C98500;
    --cat-5: #D55181; --cat-6: #008300; --cat-7: #9085E9; --cat-8: #E66767;
    --cat-other: #6B7489;
  }
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-wash), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; color: var(--text); }
h1 { font-size: 26px; font-weight: 600; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Anneau de focus net (≥ 3:1, WCAG 2.4.7 / 1.4.11) + halo doux en complément */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: rgba(56, 189, 248, .28); }
.num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.right { text-align: right; }
.center { text-align: center; }
.pos { color: var(--success-ink); }
.neg { color: var(--danger-ink); }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.gap-xs { gap: 4px; } .gap-sm { gap: 6px; } .gap-lg { gap: 18px; }
.mt-0 { margin-top: 0; } .mt-sm { margin-top: 8px; } .mt { margin-top: 16px; } .mt-lg { margin-top: 24px; }

/* Icônes du sprite */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; }
.i--sm { width: 15px; height: 15px; }
.i--xs { width: 13px; height: 13px; }
.i--lg { width: 22px; height: 22px; }
.i--xl { width: 28px; height: 28px; }

/* ------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .28s var(--ease); }
html.sb-collapsed .app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(99, 102, 241, .22), transparent 70%),
    radial-gradient(360px 300px at 100% 100%, rgba(34, 211, 238, .10), transparent 70%),
    linear-gradient(180deg, var(--sb-bg-2), var(--sb-bg));
  color: var(--sb-text);
  border-right: 1px solid var(--sb-border);
  overflow: hidden;
  z-index: 40;
}
.sidebar::after { /* givre : trame cristalline */
  content: ""; position: absolute; inset: auto 0 0 0; height: 320px; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48.5' viewBox='0 0 28 48.5'%3E%3Cpath d='M14 0v16.2M0 8.1l14 8.1 14-8.1M14 32.3v16.2M0 40.4l14-8.1 14 8.1M0 8.1v32.3M28 8.1v32.3' fill='none' stroke='%237DF0FF' stroke-opacity='.07' stroke-width='.8'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, transparent 100%);
}
.sb-brand { display: flex; align-items: center; gap: 11px; height: var(--topbar-h); padding: 0 20px; flex: none; }
.sb-brand .mark { width: 32px; height: 32px; flex: none; filter: drop-shadow(0 0 12px rgba(56, 189, 248, .35)); }
.sb-brand-text { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.03em; color: var(--sb-text-strong); white-space: nowrap; }
.sb-brand-text span { background: linear-gradient(90deg, #7DF0FF, #A5B4FC); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
.sb-brand-tag { display: block; font-family: var(--font-sans); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #6F7E9C; margin-top: -1px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; position: relative; z-index: 1; }
.sb-section { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #7C8AA8; padding: 16px 12px 6px; white-space: nowrap; }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--sb-text); font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.sb-link .i { color: #7E8BA8; transition: color .15s; }
.sb-link:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.sb-link:hover .i { color: #C7D2FE; }
.sb-link.is-active { background: var(--sb-active); color: #fff; box-shadow: inset 0 0 0 1px rgba(125, 240, 255, .08); }
.sb-link.is-active .i { color: var(--ice-1); filter: drop-shadow(0 0 6px rgba(125, 240, 255, .5)); }
.sb-link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--ice-1), var(--ice-3)); box-shadow: 0 0 12px rgba(56, 189, 248, .7);
}
.sb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: linear-gradient(135deg, #F43F5E, #E11D48); color: #fff; box-shadow: 0 0 0 3px rgba(225, 29, 72, .18);
}
.sb-badge:empty { display: none; }
.sb-foot { padding: 12px; border-top: 1px solid var(--sb-border); position: relative; z-index: 1; }
.sb-status {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px;
  background: rgba(125, 240, 255, .05); border: 1px solid rgba(125, 240, 255, .1); color: var(--sb-text); font-size: 12px;
}
.sb-status .pulse { width: 8px; height: 8px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: ping 2.4s infinite; flex: none; }
.sb-status strong { color: var(--sb-text-strong); font-weight: 600; display: block; font-size: 12.5px; }
.sb-collapse { margin-top: 8px; width: 100%; justify-content: flex-start; color: #7E8BA8; background: none; border: 0; height: 36px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 13px; }
.sb-collapse:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
html.sb-collapsed .sb-label, html.sb-collapsed .sb-brand-text, html.sb-collapsed .sb-section,
html.sb-collapsed .sb-status > div, html.sb-collapsed .sb-collapse span { display: none; }
html.sb-collapsed .sb-link { justify-content: center; padding: 0; }
html.sb-collapsed .sb-link .sb-badge { position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; font-size: 9.5px; padding: 0 4px; }
html.sb-collapsed .sb-brand { padding: 0; justify-content: center; }
html.sb-collapsed .sb-status { justify-content: center; padding: 10px 0; }
html.sb-collapsed .sb-collapse { justify-content: center; padding: 0; }
html.sb-collapsed .sb-collapse .i { transform: rotate(180deg); }

/* Main column */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.page { padding: 28px 28px 64px; max-width: 1440px; width: 100%; margin: 0 auto; animation: pageIn .45s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }

/* Global search */
.gsearch { position: relative; flex: 1; max-width: 520px; }
.gsearch-input {
  width: 100%; height: 40px; padding: 0 64px 0 40px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.gsearch-input::placeholder { color: var(--text-3); }
.gsearch-input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--focus); }
.gsearch > .i { position: absolute; left: 13px; top: 11px; color: var(--text-3); pointer-events: none; }
.gsearch kbd { position: absolute; right: 10px; top: 9px; }
kbd {
  display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 7px; border-radius: 6px;
  font: 600 11px var(--font-sans); color: var(--text-3); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 0 var(--border);
}
.gsearch-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 8px; max-height: 70vh; overflow: auto; display: none;
}
.gsearch.is-open .gsearch-results:not(:empty) { display: block; animation: pop .16s var(--ease); }
.sr-group { padding: 6px 8px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; color: var(--text); }
.sr-item:hover, .sr-item:focus-visible { background: var(--surface-2); color: var(--text); }
.sr-empty { padding: 22px; text-align: center; color: var(--text-3); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

/* Bell */
.bell { position: relative; }
.bell-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #F43F5E; border: 2px solid var(--surface); display: none; }
.bell-dot.is-on { display: block; }
.bell-dot.is-on::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #F43F5E; animation: ring 1.8s var(--ease) infinite; }
.bell.has-unread .icon-btn .i { animation: wiggle 3.6s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(12deg); } 94% { transform: rotate(-10deg); } 97% { transform: rotate(5deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: none; transform-origin: top right;
}
.dropdown.is-open { display: block; animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dropdown--bell { width: 380px; max-width: calc(100vw - 24px); }
.dd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.dd-foot { padding: 8px; border-top: 1px solid var(--border); }
.dd-foot a { display: flex; justify-content: center; gap: 6px; align-items: center; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.dd-foot a:hover { background: var(--surface-2); }
.dd-list { max-height: 380px; overflow: auto; padding: 6px; }
.dd-item { display: flex; gap: 12px; padding: 10px; border-radius: 12px; color: var(--text); align-items: flex-start; }
.dd-item:hover { background: var(--surface-2); color: var(--text); }
.dd-item .t { font-weight: 600; font-size: 13px; line-height: 1.35; }
.dd-item .m { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.dd-item.is-unread .t::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.dd-menu { padding: 6px; }
.dd-menu a, .dd-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); background: none; border: 0; cursor: pointer; font-weight: 500; text-align: left;
}
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-2); color: var(--text); }
.dd-menu .danger:hover { color: var(--danger-ink); background: var(--danger-soft); }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }

.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; background: none; border: 1px solid transparent; cursor: pointer; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta strong { display: block; font-size: 13px; font-weight: 600; }
.user-meta span { font-size: 11.5px; color: var(--text-3); }

/* ------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.page-head .eyebrow a { color: var(--text-3); }
.page-head .eyebrow a:hover { color: var(--accent); }
.page-head p.sub { color: var(--text-2); margin-top: 6px; max-width: 640px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.title-gradient { background: linear-gradient(100deg, var(--text) 30%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), box-shadow .15s, background .15s, border-color .15s, color .15s, filter .15s;
  text-decoration: none; user-select: none;
}
.btn:hover { border-color: var(--border-strong); color: var(--btn-fg); background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn .i { width: 16px; height: 16px; }
.btn--primary {
  --btn-fg: #fff; border-color: transparent; background: var(--grad-primary);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 6px 16px -6px rgba(79, 70, 229, .6), 0 0 0 1px rgba(67, 56, 202, .5);
}
.btn--primary:hover { background: var(--grad-primary); filter: brightness(1.08); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 10px 22px -8px rgba(56, 189, 248, .7), 0 0 0 1px rgba(67, 56, 202, .5); }
.btn--ice { --btn-fg: #04121F; border-color: transparent; background: linear-gradient(135deg, #7DF0FF, #38BDF8 55%, #818CF8); box-shadow: 0 8px 20px -8px rgba(56, 189, 248, .8); }
.btn--ice:hover { background: linear-gradient(135deg, #7DF0FF, #38BDF8 55%, #818CF8); filter: brightness(1.06); color: #04121F; }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn--danger { --btn-fg: var(--danger-ink); }
.btn--danger:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger-ink); }
.btn--solid-danger { --btn-fg: #fff; --btn-bg: #E11D48; border-color: transparent; }
.btn--solid-danger:hover { background: #BE123C; color: #fff; }
.btn--wa { --btn-fg: #fff; --btn-bg: #128C4A; border-color: transparent; } /* blanc sur #128C4A ≥ 4.5:1 */
.btn--wa:hover { background: #0E7A40; color: #fff; }
.btn--sm { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn--sm .i { width: 14px; height: 14px; }
.btn--xs { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn--icon { width: 38px; padding: 0; }
.btn--sm.btn--icon { width: 32px; }
.btn--xs.btn--icon { width: 28px; }
.btn--block { width: 100%; }
.btn .spinner { display: none; }
.btn.htmx-request .spinner { display: inline-block; }
.btn.htmx-request .i:not(.spinner) { display: none; }
.btn-group { display: inline-flex; gap: 4px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--card-highlight); min-width: 0;
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; font-weight: 400; font-family: var(--font-sans); letter-spacing: 0; }
.card-body { padding: 16px 20px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card--flush .card-body { padding: 0; }
.card--glow { position: relative; overflow: hidden; }
.card--glow::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(56, 189, 248, .7), rgba(99, 102, 241, .7), transparent); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
.span-2 { grid-column: span 2; }

/* Tuile d'icône teintée (couleur d'entité via --c) */
.tile {
  --c: var(--accent);
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent);
}
.tile--sm { width: 30px; height: 30px; border-radius: 9px; }
.tile--sm .i { width: 15px; height: 15px; }
.tile--lg { width: 52px; height: 52px; border-radius: 15px; }
.tile--lg .i { width: 24px; height: 24px; }
.tile--ice { color: #fff; background: var(--grad-ice); box-shadow: 0 8px 20px -8px rgba(56, 189, 248, .7); }

/* ------------------------------------------------------------------- KPI */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 20px; }
.kpi { padding: 16px 16px 14px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; animation: rise .5s var(--ease) both; }
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; }
.kpi:nth-child(4) { animation-delay: .12s; } .kpi:nth-child(5) { animation-delay: .16s; } .kpi:nth-child(6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.kpi-value { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 3px; font-family: var(--font-sans); }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; font-size: 12px; color: var(--text-3); }
.kpi--hero { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 60%); }
.kpi--alert .kpi-value { color: var(--danger-ink); }
.kpi .spark { width: 96px; height: 32px; flex: none; }
.kpi .spark path.l { fill: none; stroke: var(--viz-income); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.kpi .spark path.a { fill: url(#spark-fade); opacity: .9; }
.kpi .spark circle { fill: var(--viz-income); stroke: var(--surface); stroke-width: 2; }
.kpi .spark--expense path.l { stroke: var(--viz-expense); }
.kpi .spark--expense circle { fill: var(--viz-expense); }
.trend { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend .i { width: 13px; height: 13px; }
.trend--up { color: var(--success-ink); background: var(--success-soft); }
.trend--down { color: var(--danger-ink); background: var(--danger-soft); }
.trend--flat { color: var(--muted-ink); background: var(--muted-soft); }

/* ----------------------------------------------------- pills & badges */
.pill {
  --tone: var(--muted); --tone-soft: var(--muted-soft); --tone-ink: var(--muted-ink);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--tone-ink); background: var(--tone-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); flex: none; }
.pill--success { --tone: var(--success); --tone-soft: var(--success-soft); --tone-ink: var(--success-ink); }
.pill--warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-ink: var(--warning-ink); }
.pill--danger { --tone: var(--danger); --tone-soft: var(--danger-soft); --tone-ink: var(--danger-ink); }
.pill--danger .dot { animation: blink 1.4s ease-in-out infinite; }
.pill--expired { --tone: #fff; --tone-soft: var(--expired-soft); --tone-ink: var(--expired-ink); box-shadow: 0 4px 12px -4px rgba(225, 29, 72, .55); }
.pill--expired .dot { background: #fff; }
.pill--info { --tone: var(--info); --tone-soft: var(--info-soft); --tone-ink: var(--info-ink); }
.pill--muted { --tone: var(--muted); --tone-soft: var(--muted-soft); --tone-ink: var(--muted-ink); }
.pill--lg { height: 30px; padding: 0 13px 0 11px; font-size: 13px; }
@keyframes blink { 50% { opacity: .35; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--text-2); background: var(--surface-3);
}
.badge .i { width: 12px; height: 12px; }
.badge--accent { color: var(--accent-ink); background: var(--accent-soft); }
.badge--success { color: var(--success-ink); background: var(--success-soft); }
.badge--warning { color: var(--warning-ink); background: var(--warning-soft); }
.badge--danger { color: var(--danger-ink); background: var(--danger-soft); }
.badge--muted { color: var(--muted-ink); background: var(--muted-soft); }
.badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }

/* --------------------------------------------------------------- avatar */
.avatar {
  --h: 220;
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: -.02em;
  color: hsl(var(--h) 60% 32%); background: linear-gradient(140deg, hsl(var(--h) 85% 92%), hsl(calc(var(--h) + 40) 80% 86%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 50% / .15);
}
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 90% 85%); background: linear-gradient(140deg, hsl(var(--h) 45% 24%), hsl(calc(var(--h) + 40) 45% 18%)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: hsl(var(--h) 90% 85%); background: linear-gradient(140deg, hsl(var(--h) 45% 24%), hsl(calc(var(--h) + 40) 45% 18%)); } }
.avatar--sm { width: 30px; height: 30px; font-size: 11.5px; border-radius: 9px; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar--me { color: #fff !important; background: var(--grad-ice) !important; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s; font-size: 14px;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366748C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select--sm, .input--sm { height: 34px; font-size: 13px; border-radius: 10px; }
input[type="date"].input { padding-right: 8px; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 64px; }
.input-group .addon { position: absolute; right: 12px; font-size: 12.5px; font-weight: 600; color: var(--text-3); pointer-events: none; }
.input-group .i.lead { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.input-group .i.lead + .input { padding-left: 38px; }
.field-error { color: var(--danger-ink); font-size: 12px; font-weight: 500; display: flex; gap: 5px; align-items: center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
.hint { font-size: 12px; color: var(--text-3); }
.hint.is-auto { color: var(--info-ink); display: inline-flex; align-items: center; gap: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.alert-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; align-items: flex-start; }
.alert-box .i { margin-top: 1px; }
.alert-box--danger { background: var(--danger-soft); color: var(--danger-ink); }
.alert-box--warning { background: var(--warning-soft); color: var(--warning-ink); }
.alert-box--info { background: var(--info-soft); color: var(--info-ink); }
.alert-box--success { background: var(--success-soft); color: var(--success-ink); }

/* Interrupteur & cases */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 13.5px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .22s var(--ease); }
.switch input:checked ~ .track { background: linear-gradient(135deg, #38BDF8, #6366F1); }
.switch input:checked ~ .track::after { transform: translateX(16px); }
.switch input:focus-visible ~ .track { box-shadow: var(--focus); }

/* Segmented control (onglets / types) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented a, .segmented label, .segmented button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 9px;
  font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; border: 0; background: none; white-space: nowrap;
}
.segmented a:hover, .segmented label:hover, .segmented button:hover { color: var(--text); }
.segmented .is-active, .segmented input:checked + span {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 9px; margin: 0 -13px; }
.segmented .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }

/* Barre de filtres */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.filters .input-group { flex: 1 1 240px; max-width: 360px; }
.filters .select { width: auto; min-width: 150px; }
.filters .spacer { flex: 1; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 3.5%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions .btn-group { opacity: .55; transition: opacity .15s; }
.table tr:hover .actions .btn-group, .table .actions .btn-group:focus-within { opacity: 1; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main a.title, .cell-title { font-weight: 600; color: var(--text); }
.cell-main a.title:hover { color: var(--accent); }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.row-link { cursor: pointer; }

/* Progression de période */
.progress { --tone: var(--accent); height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width .6s var(--ease); }
.progress--success { --tone: linear-gradient(90deg, #34D399, #10B981); }
.progress--warning { --tone: linear-gradient(90deg, #FCD34D, #F59E0B); }
.progress--danger { --tone: linear-gradient(90deg, #FB7185, #E11D48); }
.progress--expired { --tone: #9F1239; }
.progress--muted { --tone: var(--muted); }
.progress--info, .progress--accent { --tone: var(--grad-ice); }
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { font-size: 12.5px; color: var(--text-3); }
.pager-btns { display: flex; gap: 4px; align-items: center; }
.pager-btns .btn.is-current { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* États vides */
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-art { width: 120px; height: 96px; margin-bottom: 4px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--text-3); max-width: 360px; }
.empty--sm { padding: 28px 16px; }

/* Squelettes */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 10px; }

/* Résultats HTMX : transitions */
#results { transition: opacity .2s; }
#results.htmx-request, .is-loading { opacity: .55; }
.htmx-added { animation: fadeUp .3s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } }
tr.htmx-swapping, .htmx-swapping.fade-out { opacity: 0; transition: opacity .25s; }

/* Barre de progression globale (requêtes HTMX) */
#hx-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 1000; pointer-events: none; }
#hx-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7DF0FF, #38BDF8, #818CF8); box-shadow: 0 0 10px rgba(56, 189, 248, .8); opacity: 0; transition: width .4s var(--ease), opacity .3s; }
#hx-progress.is-active span { width: 75%; opacity: 1; transition: width 6s cubic-bezier(.1, .7, .1, 1), opacity .1s; }
#hx-progress.is-done span { width: 100%; opacity: 0; transition: width .2s, opacity .4s .2s; }

/* ----------------------------------------------------------------- modal */
dialog.modal {
  width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden; display: flex; flex-direction: column;
}
dialog.modal:not([open]) { display: none; }
dialog.modal--lg { width: min(760px, calc(100vw - 24px)); }
dialog.modal--sm { width: min(440px, calc(100vw - 24px)); }
dialog.modal[open] { animation: modalIn .26s var(--ease); }
dialog.modal::backdrop { background: rgba(4, 8, 18, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fadeIn .2s; }
dialog.modal.is-closing { animation: modalOut .18s ease-in forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fadeIn { from { opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); position: relative; }
.modal-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-ice); opacity: .9; }
.modal-head h2 { font-size: 18px; }
.modal-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.modal-head .close { margin-left: auto; margin-top: -4px; margin-right: -6px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.modal form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.confirm-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger-ink); flex: none; }

/* ----------------------------------------------------------------- toasts */
.toasts { position: fixed; top: 76px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  --tone: var(--success); pointer-events: auto; position: relative; overflow: hidden;
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: toastIn .4s var(--ease) both;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--tone); opacity: .35; transform-origin: left; animation: toastTimer var(--toast-ms, 4800ms) linear forwards; }
.toast .tile { --c: var(--tone); width: 30px; height: 30px; border-radius: 9px; }
.toast .tile .i { width: 16px; height: 16px; }
.toast-msg { flex: 1; font-size: 13.5px; font-weight: 500; padding-top: 5px; line-height: 1.4; }
.toast-close { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: var(--surface-2); }
.toast--error { --tone: var(--danger); }
.toast--warning { --tone: var(--warning); }
.toast--info { --tone: var(--info); }
.toast.is-leaving { animation: toastOut .25s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
@keyframes toastTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Infobulles des graphiques */
.viz-tip {
  position: fixed; z-index: 3000; pointer-events: none; min-width: 170px; max-width: 280px;
  padding: 10px 12px; border-radius: 12px; font-size: 12.5px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.viz-tip.is-on { opacity: 1; transform: none; }
.viz-tip .tt { font-weight: 700; margin-bottom: 6px; color: var(--text); }
.viz-tip .tr { display: flex; align-items: center; gap: 8px; color: var(--text-2); padding: 1px 0; }
.viz-tip .tr b { margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 12px; }
.viz-tip .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.viz-tip .sw--line { height: 2px; border-radius: 1px; }
[data-tip] { cursor: default; }

/* ----------------------------------------------------------------- charts */
.viz { width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
.viz text { font-size: 11px; fill: var(--viz-axis); font-variant-numeric: tabular-nums; }
.viz .grid-line { stroke: var(--viz-grid); stroke-width: 1; }
.viz .zero-line { stroke: var(--border-strong); stroke-width: 1; }
.viz .bar-income { fill: var(--viz-income); }
.viz .bar-expense { fill: var(--viz-expense); }
.viz .net-line { fill: none; stroke: var(--viz-net); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .net-dot { fill: var(--viz-net); stroke: var(--surface); stroke-width: 2; }
.viz .hit { fill: transparent; }
.viz .hit:hover, .viz .hit.is-hover { fill: color-mix(in srgb, var(--accent) 6%, transparent); }
.viz .forecast .bar-income { fill: url(#hatch-income); stroke: var(--viz-income); stroke-width: 1.2; }
.viz .forecast .bar-expense { fill: url(#hatch-expense); stroke: var(--viz-expense); stroke-width: 1.2; }
.viz .forecast .net-line { stroke-dasharray: 5 4; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.viz-legend span { display: inline-flex; align-items: center; gap: 7px; }
.viz-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.viz-legend .sw--line { width: 16px; height: 2px; border-radius: 1px; background: var(--viz-net); }
.viz-legend .sw--hatch { background: repeating-linear-gradient(45deg, var(--viz-income) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1.2px var(--viz-income); }
.sw-income { background: var(--viz-income); }
.sw-expense { background: var(--viz-expense); }
.sw-net { background: var(--viz-net); }
.sw-cat-1 { background: var(--cat-1); } .sw-cat-2 { background: var(--cat-2); } .sw-cat-3 { background: var(--cat-3); }
.sw-cat-4 { background: var(--cat-4); } .sw-cat-5 { background: var(--cat-5); } .sw-cat-6 { background: var(--cat-6); }
.sw-cat-7 { background: var(--cat-7); } .sw-cat-8 { background: var(--cat-8); } .sw-cat-other { background: var(--cat-other); }
.st-cat-1 { stroke: var(--cat-1); } .st-cat-2 { stroke: var(--cat-2); } .st-cat-3 { stroke: var(--cat-3); }
.st-cat-4 { stroke: var(--cat-4); } .st-cat-5 { stroke: var(--cat-5); } .st-cat-6 { stroke: var(--cat-6); }
.st-cat-7 { stroke: var(--cat-7); } .st-cat-8 { stroke: var(--cat-8); } .st-cat-other { stroke: var(--cat-other); }
.donut-wrap { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: center; justify-content: center; }
.donut-wrap .legend-list { flex: 1 1 240px; min-width: 0; }
.donut { width: 180px; height: 180px; flex: none; }
.donut circle.seg { fill: none; transition: stroke-width .15s; }
.donut circle.seg:hover { stroke-width: 26; }
.donut circle.track { fill: none; stroke: var(--surface-3); }
.donut .c-label { font-size: 11px; fill: var(--text-3); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.donut .c-value { font-family: var(--font-display); font-size: 15px; fill: var(--text); font-weight: 600; }
.legend-list { display: flex; flex-direction: column; gap: 4px; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 9px; font-size: 13px; }
.legend-row:hover { background: var(--surface-2); }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-row .pct { color: var(--text-3); font-variant-numeric: tabular-nums; width: 52px; text-align: right; font-size: 12px; }
.viz-table { margin-top: 12px; }
.viz-table summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; list-style: none; padding: 4px 0; }
.viz-table summary::-webkit-details-marker { display: none; }
.viz-table summary:hover { color: var(--accent); }
.viz-table[open] summary .i { transform: rotate(180deg); }
.viz-table table { margin-top: 8px; }

/* Barres horizontales (HTML) */
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.hbar-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; }
.hbar-head .name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.hbar-track { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-fill.income { background: var(--viz-income); }
.hbar-fill.expense { background: var(--viz-expense); }
.hbar-pair { display: flex; flex-direction: column; gap: 3px; }
.hbar-pair .hbar-track { height: 7px; background: transparent; }
.hbar-pair .hbar-track::before { content: ""; position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); }
.margin-chip { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.margin-chip.pos { background: var(--success-soft); }
.margin-chip.neg { background: var(--danger-soft); }

/* -------------------------------------------------------- frise échéances */
.timeline { list-style: none; margin: 0; padding: 8px 0; position: relative; }
.tl-item { position: relative; display: grid; grid-template-columns: 54px 22px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 10px 20px; transition: background .15s; }
.tl-item:hover { background: var(--surface-2); }
.tl-date { text-align: center; line-height: 1; padding: 6px 0; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.tl-item:hover .tl-date { background: var(--surface); }
.tl-date .d { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.03em; display: block; }
.tl-date .m { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.tl-rail { position: relative; height: 100%; display: grid; place-items: center; }
.tl-rail::before { content: ""; position: absolute; top: -10px; bottom: -10px; left: 50%; width: 2px; transform: translateX(-50%); background: var(--border); }
.tl-item:first-child .tl-rail::before { top: 50%; }
.tl-item:last-child .tl-rail::before { bottom: 50%; }
.tl-node { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--tone, var(--success)); box-shadow: 0 0 0 4px var(--surface); }
.tl-item:hover .tl-node { box-shadow: 0 0 0 4px var(--surface-2); }
.tl-node.tone-warning { --tone: var(--warning); } .tl-node.tone-danger { --tone: var(--danger); } .tl-node.tone-expired { --tone: var(--expired); background: var(--expired); }
.tl-node.tone-success { --tone: var(--success); } .tl-node.tone-muted { --tone: var(--muted); }
.tl-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tl-title { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-title a { color: inherit; }
.tl-title a:hover { color: var(--accent); }
.tl-sub { font-size: 12px; color: var(--text-3); }
.tl-side { display: flex; align-items: center; gap: 8px; }
.tl-actions { display: flex; gap: 4px; opacity: 0; transform: translateX(4px); transition: opacity .15s, transform .15s; }
.tl-item:hover .tl-actions, .tl-actions:focus-within { opacity: 1; transform: none; }

/* --------------------------------------------------- alertes (liste) */
.alert-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: flex-start; padding: 16px 20px; border-bottom: 1px solid var(--border); position: relative; transition: background .15s; }
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: var(--surface-2); }
.alert-row.is-unread::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone, var(--accent)); }
.alert-row.tone-warning { --tone: var(--warning); } .alert-row.tone-danger { --tone: var(--danger); }
.alert-row.tone-expired { --tone: var(--expired); } .alert-row.tone-info { --tone: var(--info); }
.alert-row.is-read { opacity: .78; }
.alert-row .title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-row .msg { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.alert-row .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--text-3); align-items: center; }
.alert-row .meta span { display: inline-flex; align-items: center; gap: 5px; }
.alert-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sev-tile { --c: var(--info); }
.sev-tile.tone-warning { --c: var(--warning); } .sev-tile.tone-danger { --c: var(--danger); } .sev-tile.tone-expired { --c: var(--expired); } .sev-tile.tone-info { --c: var(--info); }

/* ------------------------------------------------------- infrastructure */
.res-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; overflow: hidden; }
.res-summary > div { padding: 18px 20px; border-right: 1px solid var(--border); }
.res-summary > div:last-child { border-right: 0; }
.res-summary .v { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.res-card { display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; animation: rise .45s var(--ease) both; }
.res-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), var(--card-highlight); border-color: var(--border-strong); }
.res-card-head { display: flex; gap: 14px; padding: 18px 18px 14px; align-items: flex-start; }
.res-card-head .name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.02em; color: var(--text); }
.res-card-head .name:hover { color: var(--accent); }
.res-ref { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.ring { width: 64px; height: 64px; margin-left: auto; flex: none; position: relative; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring .bg { fill: none; stroke: var(--surface-3); stroke-width: 6; }
.ring .fg { fill: none; stroke-width: 6; stroke-linecap: round; stroke: var(--success); transition: stroke-dashoffset .8s var(--ease); }
.ring.tone-warning .fg { stroke: var(--warning); } .ring.tone-danger .fg { stroke: var(--danger); } .ring.tone-expired .fg { stroke: var(--expired); } .ring.tone-muted .fg { stroke: var(--muted); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ring .lbl b { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring .lbl span { font-size: 9.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.res-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.res-stats > div { padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
.res-stats > div:last-child { border-right: 0; }
.res-stats .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.res-stats .v { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-margin { padding: 14px 18px 16px; }
.mbar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3); margin: 8px 0 6px; overflow: visible; }
.mbar .rev { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--viz-income); }
.mbar .cost { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--viz-expense); box-shadow: 0 0 0 2px var(--surface); }
.mbar-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); gap: 8px; }
.mbar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mbar-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.res-risk { margin: 0 18px 14px; }
.res-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.avatars { display: flex; }
.avatars .avatar { width: 26px; height: 26px; font-size: 10px; border-radius: 8px; box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }

/* ------------------------------------------------------------- detail */
.hero {
  position: relative; overflow: hidden; padding: 24px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(56, 189, 248, .12), transparent 70%),
    radial-gradient(500px 220px at 0% 100%, rgba(99, 102, 241, .10), transparent 70%), var(--surface);
}
.hero h1 { font-size: 24px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-2); font-size: 13px; margin-top: 8px; }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px 16px; font-size: 13.5px; }
.dl dt { color: var(--text-3); font-weight: 500; }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-strip > div { padding: 16px 20px; border-right: 1px solid var(--border); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .k { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat-strip .v { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.countdown-big { text-align: center; padding: 22px 16px; }
.countdown-big .n { font-family: var(--font-display); font-size: 48px; font-weight: 600; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown-big .n.tone-warning { color: var(--warning-ink); } .countdown-big .n.tone-danger, .countdown-big .n.tone-expired { color: var(--danger-ink); }
.countdown-big .n.tone-success { background: var(--grad-ice); -webkit-background-clip: text; background-clip: text; color: transparent; }
.contact-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.contact-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; transition: all .15s; }
.contact-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); background: var(--surface); }
.contact-btn.wa { color: #15803D; }
:root[data-theme="dark"] .contact-btn.wa { color: #4ADE80; }
.contact-btn.is-disabled { opacity: .45; pointer-events: none; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-plain > li:last-child { border-bottom: 0; }
.msg-preview { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* Récap de renouvellement */
.renew-preview { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, #38BDF8 8%, var(--surface-2)), color-mix(in srgb, #6366F1 8%, var(--surface-2))); border: 1px solid var(--border); }
.renew-preview .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.renew-preview .v { font-family: var(--font-display); font-weight: 600; font-size: 17px; margin-top: 3px; letter-spacing: -.02em; }
.renew-preview .v.new { color: var(--accent-ink); }
.renew-preview .arrow { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--accent); }
.stepper { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 11px; overflow: hidden; height: 40px; background: var(--surface); }
.stepper button { width: 40px; height: 100%; border: 0; background: var(--surface-2); cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.stepper button:hover { color: var(--text); background: var(--surface-3); }
.stepper input { flex: 1; min-width: 0; height: 100%; border: 0; text-align: center; font-weight: 700; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper input:focus { outline: none; }
.stepper:focus-within { border-color: var(--accent); box-shadow: var(--focus); }

/* ------------------------------------------------------------- reports */
.report-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.period-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.period-custom { display: none; gap: 8px; align-items: center; }
.period-custom.is-on { display: flex; }
.report-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; overflow: hidden; }
.report-kpis > div { padding: 18px 20px; border-right: 1px solid var(--border); position: relative; }
.report-kpis > div:last-child { border-right: 0; }
.report-kpis .k { font-size: 12px; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.report-kpis .v { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-kpis .v small { font-size: 11.5px; color: var(--text-3); font-weight: 500; font-family: var(--font-sans); letter-spacing: 0; }
.report-kpis .note { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.report-kpis .hero-k { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); }
.gauge { height: 6px; border-radius: 999px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.gauge span { display: block; height: 100%; border-radius: inherit; background: var(--grad-ice); }
.insight { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.insight strong { color: var(--text); }
.rank { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); flex: none; }
.rank--1 { background: linear-gradient(135deg, #7DF0FF, #818CF8); color: #04121F; }
.print-head { display: none; }

/* ------------------------------------------------------------ settings */
.channel { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.channel:last-child { border-bottom: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.off { background: var(--muted); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.thresholds { display: flex; flex-wrap: wrap; gap: 8px; }
.threshold { display: inline-flex; flex-direction: column; align-items: center; min-width: 58px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.threshold b { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.threshold span { font-size: 10.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.code-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: var(--sb-bg); color: #C7D2FE; font-family: var(--font-mono); font-size: 12.5px; overflow-x: auto; }
.code-box .method { color: #7DF0FF; font-weight: 600; }
.mobile-card { position: relative; overflow: hidden; color: #DCE4F5; background: radial-gradient(400px 200px at 100% 0%, rgba(56, 189, 248, .25), transparent 70%), linear-gradient(160deg, #0E1630, #070C18); border-color: rgba(125, 240, 255, .14); }
.mobile-card h2, .mobile-card h3 { color: #fff; }
.mobile-card .muted { color: #8D9BB8; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--bg); }
.auth-brand {
  position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; color: #DCE4F5;
  background:
    radial-gradient(700px 420px at 20% 10%, rgba(99, 102, 241, .35), transparent 65%),
    radial-gradient(600px 500px at 90% 90%, rgba(34, 211, 238, .22), transparent 65%),
    linear-gradient(160deg, #0E1630 0%, #060A13 100%);
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; opacity: .9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48.5' viewBox='0 0 28 48.5'%3E%3Cpath d='M14 0v16.2M0 8.1l14 8.1 14-8.1M14 32.3v16.2M0 40.4l14-8.1 14 8.1M0 8.1v32.3M28 8.1v32.3' fill='none' stroke='%237DF0FF' stroke-opacity='.06' stroke-width='.8'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(circle at 60% 50%, #000 0%, transparent 75%); mask-image: radial-gradient(circle at 60% 50%, #000 0%, transparent 75%);
}
.auth-brand > * { position: relative; }
.auth-logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff; letter-spacing: -.03em; }
.auth-logo span span { background: linear-gradient(90deg, #7DF0FF, #A5B4FC); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
.auth-crystal { position: absolute; right: -90px; top: 50%; width: 520px; height: 520px; transform: translateY(-50%); opacity: .9; pointer-events: none; }
.auth-crystal svg { width: 100%; height: 100%; animation: drift 60s linear infinite; filter: drop-shadow(0 0 40px rgba(56, 189, 248, .35)); }
@keyframes drift { to { transform: rotate(360deg); } }
.auth-copy { margin-top: auto; max-width: 460px; }
.auth-copy h1 { color: #fff; font-size: 40px; line-height: 1.08; letter-spacing: -.04em; font-weight: 600; }
.auth-copy h1 em { font-style: normal; background: linear-gradient(90deg, #7DF0FF, #818CF8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-copy p { color: #A7B4CC; margin-top: 14px; font-size: 15px; }
.auth-feats { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-feats li { display: flex; gap: 12px; align-items: center; color: #C9D3E8; font-size: 14px; }
.auth-feats .tile { --c: #7DF0FF; width: 32px; height: 32px; border-radius: 10px; }
.auth-foot { margin-top: 40px; font-size: 12px; color: #6F7E9C; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--bg-wash), var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 26px; letter-spacing: -.03em; }
.auth-card .sub { color: var(--text-2); margin-top: 6px; }
.auth-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .input { height: 46px; border-radius: 12px; }
.auth-card .btn { height: 46px; border-radius: 12px; font-size: 14.5px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; }

/* --------------------------------------------------------------- errors */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; text-align: center; background: var(--bg-wash), var(--bg); }
.error-page .art { width: min(340px, 80vw); margin: 0 auto 8px; }
.error-page .code { font-family: var(--font-display); font-size: 88px; font-weight: 700; letter-spacing: -.06em; line-height: 1; background: var(--grad-ice); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { font-size: 24px; margin-top: 8px; }
.error-page p { color: var(--text-2); margin: 10px auto 24px; max-width: 440px; }

/* ----------------------------------------------------------- responsive */
.sb-overlay { display: none; }
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-kpis > div:nth-child(3) { border-right: 0; }
  .report-kpis > div:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 1180px) {
  .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-summary > div:nth-child(2) { border-right: 0; }
  .res-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 1024px) {
  .app, html.sb-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  html.sb-open .sidebar { transform: none; }
  html.sb-collapsed .sb-label, html.sb-collapsed .sb-brand-text, html.sb-collapsed .sb-section, html.sb-collapsed .sb-status > div { display: revert; }
  html.sb-collapsed .sb-link { justify-content: flex-start; padding: 0 12px; }
  html.sb-collapsed .sb-brand { padding: 0 20px; justify-content: flex-start; }
  .sb-collapse { display: none !important; }
  .sb-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(4, 8, 18, .5); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  html.sb-open .sb-overlay { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-grid; }
  .page { padding: 20px 16px 56px; }
  .user-meta { display: none; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 28px 24px; min-height: auto; }
  .auth-crystal { width: 300px; height: 300px; right: -80px; top: 40px; transform: none; opacity: .5; }
  .auth-copy { margin-top: 40px; }
  .auth-copy h1 { font-size: 30px; }
  .auth-feats, .auth-foot { display: none; }
}
@media (max-width: 720px) {
  h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 12px 12px; }
  .kpi-value { font-size: 19px; }
  .kpi .spark { display: none; }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-kpis > div { border-bottom: 1px solid var(--border); }
  .report-kpis > div:nth-child(2n) { border-right: 0; }
  .report-kpis > div:nth-child(3) { border-right: 1px solid var(--border); }
  .grid-4, .grid-6 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .donut-wrap .legend-list { width: 100%; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip > div:nth-child(2) { border-right: 0; }
  .stat-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .tl-item { grid-template-columns: 48px 16px minmax(0, 1fr); padding: 10px 14px; row-gap: 8px; }
  .tl-side { grid-column: 3; justify-content: space-between; }
  .tl-actions { opacity: 1; transform: none; }
  .gsearch kbd { display: none; }
  .gsearch-input { padding-right: 12px; }
  .filters .select, .filters .input-group { flex: 1 1 100%; max-width: none; }
  .res-grid { grid-template-columns: minmax(0, 1fr); }
  .alert-row { grid-template-columns: auto minmax(0, 1fr); }
  .alert-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .hero { padding: 18px; }
  .hero-actions { margin-left: 0; width: 100%; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .table .hide-sm { display: none; }
  .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ print */
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-2: #F7F9FC; --surface-3: #EEF2F8; --border: #DDE3EC; --border-strong: #CDD5E3;
    --text: #0B1220; --text-2: #4A5872; --text-3: #66748C; --viz-net: #0B1220; --viz-grid: #E6EBF3; --viz-axis: #66748C;
    --viz-income: #4F5BD5; --viz-expense: #EB6834; --accent: #4F46E5; --accent-ink: #4338CA;
    --cat-1: #2A78D6; --cat-2: #EB6834; --cat-3: #1BAF7A; --cat-4: #EDA100; --cat-5: #E87BA4; --cat-6: #008300; --cat-7: #4A3AA7; --cat-8: #E34948;
  }
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; font-size: 11.5px; }
  .sidebar, .topbar, .no-print, .toasts, #hx-progress, .page-actions, .period-bar, .viz-table summary, .btn { display: none !important; }
  .app { display: block; }
  .page { padding: 0; max-width: none; animation: none; }
  .card { box-shadow: none !important; break-inside: avoid; }
  .grid-main { grid-template-columns: 1.5fr 1fr; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .report-kpis { grid-template-columns: repeat(6, 1fr); }
  .report-kpis > div { border-bottom: 0 !important; }
  .print-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #0B1220; padding-bottom: 10px; margin-bottom: 16px; }
  .viz-table[open] table { display: table; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; animation: none !important; }
}

/* compléments graphiques */
.viz .net-line, .viz .net-dot, .viz .tick-label { pointer-events: none; }
.viz g.col:focus { outline: none; }
.viz g.col:focus-visible .hit { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.kpi .spark--expense path.a, .kpi .spark--net path.a { display: none; }
.kpi .spark--net path.l { stroke: var(--viz-net); stroke-width: 1.6; }
.kpi .spark--net circle { fill: var(--viz-net); }
.chart-box { position: relative; }
.month-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.month-split .k { font-size: 12px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.month-split .v { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--surface-3); margin-top: 14px; }
.split-bar span { display: block; height: 100%; }
.split-bar .inc { background: var(--viz-income); border-radius: 999px 0 0 999px; }
.split-bar .exp { background: var(--viz-expense); border-radius: 0 999px 999px 0; }
.greet-date { text-transform: none; }
.health { display: flex; align-items: center; gap: 16px; }
.health-ring { width: 84px; height: 84px; flex: none; position: relative; }
.health-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.health-ring .bg { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.health-ring .fg { fill: none; stroke: url(#health-grad); stroke-width: 8; stroke-linecap: round; }
.health-ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.03em; }
.health-ring .lbl small { display: block; font-size: 9.5px; font-family: var(--font-sans); color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

/* correctifs */
.mark { width: 32px; height: 32px; flex: none; }
.auth-logo .mark { width: 36px; height: 36px; filter: drop-shadow(0 0 12px rgba(56, 189, 248, .45)); }
.print-head .mark { width: 34px; height: 34px; }
.auth-crystal { right: -170px; opacity: .38; }
.tl-side { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .tl-actions .lbl { display: none; }
  .tl-actions .btn { width: 30px; padding: 0; }
  .auth-crystal { opacity: .25; }
}
.dd-item .t, .dd-item .m { display: block; }

/* ==========================================================================
   Correctifs d'audit : accessibilité, responsive, thème
   ========================================================================== */

/* Champs : l'anneau de focus remplace le halo (pas de double cadre) */
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.stepper input:focus-visible, .gsearch-input:focus-visible { outline: none; }
.stepper:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.gsearch-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Radios segmentés et interrupteurs : le vrai champ est invisible, on marque la partie visible */
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Lien d'évitement visible au focus clavier */
.sr-only:focus, .sr-only:focus-visible {
  position: fixed; left: 12px; top: 12px; z-index: 3000; width: auto; height: auto; margin: 0;
  clip: auto; overflow: visible; padding: 8px 12px; border-radius: 8px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}

/* WhatsApp : couleur lisible dans les deux thèmes (y compris thème sombre de l'OS) */
.contact-btn.wa, .btn--wa-ghost { color: #15803D; }
:root[data-theme="dark"] .contact-btn.wa, :root[data-theme="dark"] .btn--wa-ghost { color: #4ADE80; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .contact-btn.wa, :root:not([data-theme="light"]) .btn--wa-ghost { color: #4ADE80; }
}
/* Actions de contact indisponibles : <span> non interactif */
span.contact-btn.is-disabled { cursor: not-allowed; }

/* Finances : réinitialisation des filtres (dans le fragment #results) */
.fin-reset { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 14px 0; }

/* Sélecteur de période : bouton « Appliquer » affiché après un choix au clavier */
[data-period-picker] [data-period-apply] { margin-left: 8px; }

/* Tiroir mobile fermé : hors de l'ordre de tabulation et invisible (app.js pose aussi inert) */
@media (max-width: 1024px) {
  .sidebar { visibility: hidden; transition: transform .3s var(--ease), visibility 0s linear .3s; }
  html.sb-open .sidebar { visibility: visible; transition: transform .3s var(--ease), visibility 0s; }
}

/* Écrans tactiles : actions de tableau toujours visibles (pas de survol) */
@media (hover: none) {
  .table .actions .btn-group { opacity: 1; }
}

@media (max-width: 720px) {
  /* Cloche : panneau fixé dans la largeur de l'écran */
  .dropdown--bell { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 4px); width: auto; max-width: none; }
  /* Tableaux : cellules plus compactes, sous-textes sur plusieurs lignes, actions collées à droite */
  .table td { padding: 10px; }
  .table th { padding: 10px; }
  .table .cell-sub.nowrap, .table td .cell-sub { white-space: normal; }
  .table .actions { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(15, 23, 42, .18); }
  .table .actions .btn-group { opacity: 1; }
  /* Modales : feuille plein écran, pied toujours visible au-dessus du clavier */
  dialog.modal, dialog.modal--lg { width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
}

