/* =====================================================================
   e-Xchange — design system
   Black navigation sidebar + light workspace + pure gold accents.
   Every colour is a token defined in :root (single source of truth);
   components never hard-code theme colours.
   Gold (#FFD700) is a FILL / indicator colour only: it is unreadable as
   text on white (1.4:1), so gold-coloured text uses --gold-ink (5.8:1).
   ===================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* ---------------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------------- */
:root {
    /* Sidebar (the only dark surface) */
    --sidebar-bg: #111111;
    --sidebar-hover: #1A1A1A;
    --sidebar-active: #1F1F1F;
    --sidebar-text: #F5F5F5;
    --sidebar-muted: #A3A3A3;
    --sidebar-faint: #737373;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --sidebar-scroll: #2A2A2A;

    /* Workspace */
    --page-bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-muted: #F9FAFB;
    --surface-sunken: #F1F2F4;
    --row-hover: #FAFAFB;
    --text-primary: #171717;
    --text-secondary: #6B7280;
    --text-faint: #9CA3AF;
    --text-strong: #111111;          /* text on gold */
    --text-inverse: #FFFFFF;         /* text on dark / red fills */
    --border: #E5E7EB;
    --border-strong: #D1D5DB;
    --input-border: #D1D5DB;
    --input-border-hover: #B8BEC7;
    --scrollbar: #D1D5DB;
    --backdrop: #0A0A0A;

    /* Brand: pure gold */
    --gold: #FFD700;
    --gold-hover: #E6C200;
    --gold-active: #CCAD00;
    --gold-strong: #A68A00;          /* gold graphics on white (>= 3:1): chart bars, focus border */
    --gold-ink: #7A6300;             /* gold text on white (WCAG AA 5.8:1) */
    --gold-ink-hover: #5E4C00;
    --gold-tint: #FFFBE6;
    --gold-tint-strong: #FBEFB0;
    --gold-rgb: 255, 215, 0;

    /* Semantic: base colour (fills, icons, borders) + ink (small text, AA) */
    --success: #16A34A; --success-ink: #15803D; --success-bg: #F0FDF4; --success-border: #BBF7D0; --success-rgb: 22, 163, 74;
    --danger: #DC2626;  --danger-ink: #B91C1C;  --danger-bg: #FEF2F2;  --danger-border: #FECACA;  --danger-rgb: 220, 38, 38;
    --danger-hover: #B91C1C; --danger-active: #991B1B;
    --warning: #D97706; --warning-ink: #B45309; --warning-bg: #FFFBEB; --warning-border: #FDE68A; --warning-rgb: 217, 119, 6;
    --info: #2563EB;    --info-ink: #1D4ED8;    --info-bg: #EFF6FF;    --info-border: #BFDBFE;    --info-rgb: 37, 99, 235;
    --neutral-ink: #374151;

    /* Charts (read by js/report.js) */
    --chart-bar: var(--gold-strong);
    --chart-bar-hover: var(--gold-ink);
    --chart-grid: #EEF0F3;
    --chart-bar-alt: #374151;    /* second series (purchases): dark slate, distinct from gold in lightness */

    /* Shape & depth: restrained */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 10px;
    --shadow-xs: 0 1px 2px rgba(17, 17, 17, 0.04);
    --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
    --shadow-md: 0 8px 24px -8px rgba(17, 17, 17, 0.14);
    --shadow-lg: 0 20px 48px -16px rgba(17, 17, 17, 0.24);
    --ring: 0 0 0 3px rgba(var(--gold-rgb), 0.35);
    --ring-danger: 0 0 0 3px rgba(var(--danger-rgb), 0.15);

    /* Layout */
    --sidebar-w: 256px;
    --topbar-h: 60px;
    --gutter: clamp(16px, 2.2vw, 32px);
    --control-h: 38px;
    --control-h-sm: 32px;

    /* Typography: Inter only, one scale */
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --display: var(--font);
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --fs-2xs: 0.6875rem;   /* 11px — overlines */
    --fs-xs: 0.75rem;      /* 12px */
    --fs-sm: 0.8125rem;    /* 13px */
    --fs-base: 0.875rem;   /* 14px — body, tables, inputs */
    --fs-md: 1rem;         /* 16px — card titles */
    --fs-lg: 1.25rem;      /* 20px — KPI values */
    --fs-xl: 1.5rem;       /* 24px — page titles */

    /* Motion */
    --ease: cubic-bezier(.2, .7, .2, 1);
    --t: 160ms;

    /* Legacy aliases used by inline styles in views */
    --x-gold: var(--gold);
    --x-gold-rgb: var(--gold-rgb);
    --x-success: var(--success); --x-success-rgb: var(--success-rgb);
    --x-danger: var(--danger);   --x-danger-rgb: var(--danger-rgb);
    --x-warning: var(--warning); --x-warning-rgb: var(--warning-rgb);
    --x-info: var(--info);       --x-info-rgb: var(--info-rgb);

    /* Bootstrap bridge */
    --bs-body-bg: var(--page-bg);
    --bs-body-color: var(--text-primary);
    --bs-body-font-family: var(--font);
    --bs-body-font-size: var(--fs-base);
    --bs-body-line-height: 1.5;
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-bg: var(--surface-muted);
    --bs-secondary-bg: var(--surface-sunken);
    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-emphasis-color: var(--text-primary);
    --bs-heading-color: var(--text-primary);
    --bs-link-color: var(--gold-ink);
    --bs-link-color-rgb: 122, 99, 0;
    --bs-link-hover-color: var(--gold-ink-hover);
    --bs-link-hover-color-rgb: 94, 76, 0;
    --bs-primary: var(--gold);
    --bs-primary-rgb: var(--gold-rgb);
    --bs-success: var(--success);
    --bs-success-rgb: var(--success-rgb);
    --bs-danger: var(--danger);
    --bs-danger-rgb: var(--danger-rgb);
    --bs-warning: var(--warning);
    --bs-warning-rgb: var(--warning-rgb);
    --bs-info: var(--info);
    --bs-info-rgb: var(--info-rgb);
    --bs-focus-ring-color: rgba(var(--gold-rgb), 0.35);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-code-color: var(--gold-ink);
    color-scheme: light;
}

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--page-bg);
    color: var(--text-primary);
    font-size: var(--fs-base);
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}
::selection { background: rgba(var(--gold-rgb), 0.4); color: var(--text-strong); }
h1, h2, h3, h4, h5, h6, .x-display { font-family: var(--font); letter-spacing: -0.015em; font-weight: 650; }
a { text-decoration: none; transition: color var(--t) var(--ease); }
.num, .x-num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "cv11"; }
.text-muted, .x-muted { color: var(--text-secondary) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-gold, .text-gold-soft { color: var(--gold-ink) !important; }
.text-success { color: var(--success-ink) !important; }
.text-danger { color: var(--danger-ink) !important; }
.text-warning { color: var(--warning-ink) !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.x-eyebrow, .small-caps {
    font-size: var(--fs-2xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}
hr { border-color: var(--border); opacity: 1; }
:focus-visible { outline: 2px solid var(--gold-strong); outline-offset: 2px; }
.visually-hidden-focusable:focus { position: fixed !important; top: 8px; left: 8px; z-index: 2000; background: var(--gold); color: var(--text-strong); padding: 8px 14px; border-radius: var(--radius); }

* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 10px; border: 3px solid var(--page-bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------------
   Shell
   --------------------------------------------------------------------- */
.x-shell { display: flex; min-height: 100vh; }
.x-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--page-bg); }
.x-content { padding: 24px var(--gutter) 40px; flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; min-width: 0; }
.x-footer { padding: 14px var(--gutter); color: var(--text-faint); font-size: var(--fs-xs); border-top: 1px solid var(--border); background: var(--surface); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------------
   Sidebar (dark scope)
   --------------------------------------------------------------------- */
.x-sidebar {
    --bs-offcanvas-width: 272px;
    --bs-offcanvas-bg: var(--sidebar-bg);
    --bs-offcanvas-color: var(--sidebar-text);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    scrollbar-color: var(--sidebar-scroll) transparent;
}
.x-sidebar *::-webkit-scrollbar-thumb { background: var(--sidebar-scroll); border-color: var(--sidebar-bg); }
@media (min-width: 992px) {
    /* Bootstrap forces .offcanvas-lg to a transparent background (!important) on desktop. */
    .x-sidebar { position: sticky; top: 0; width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); height: 100vh; display: flex; flex-direction: column; background-color: var(--sidebar-bg) !important; }
    .x-sidebar .offcanvas-body { display: flex; flex-direction: column; overflow-y: auto; padding: 0; flex: 1; }
}
@media (max-width: 991.98px) {
    .x-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; }
}
.x-brand { display: flex; align-items: center; gap: 12px; min-height: var(--topbar-h); padding: 24px 20px; color: var(--sidebar-text); border-bottom: 1px solid var(--sidebar-border); flex: 0 0 auto; }
.x-brand:hover { color: var(--sidebar-text); }
.x-brand img { width: 32px; height: 32px; border-radius: var(--radius); object-fit: contain; }
.x-brand-name { font-weight: 700; font-size: var(--fs-md); letter-spacing: -0.01em; line-height: 1.1; color: var(--sidebar-text); }
.x-brand-sub { font-size: 0.625rem; color: var(--sidebar-muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 3px; }

.x-nav { padding: 16px 12px 20px; flex: 1; }
.x-nav-group { font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sidebar-faint); font-weight: 600; padding: 24px 16px 8px; margin-top: 16px; border-top: 1px solid var(--sidebar-border); }
.x-nav-link {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px;
    padding: 13px 16px; margin: 2px 0; border-radius: var(--radius); border: 0; background: transparent;
    color: var(--sidebar-muted); font-size: var(--fs-base); font-weight: 500; text-align: left; line-height: 1.3;
    transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.x-nav-link i { font-size: 1rem; color: var(--sidebar-muted); width: 18px; text-align: center; flex: 0 0 18px; transition: color var(--t) var(--ease); }
.x-nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.x-nav-link:hover i { color: var(--sidebar-text); }
.x-nav-link.active { background: var(--sidebar-active); color: var(--sidebar-text); font-weight: 600; }
.x-nav-link.active i { color: var(--gold); }
.x-nav-link.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--gold);
}
.x-nav-link .x-nav-chevron { margin-left: auto; width: auto; flex: 0 0 auto; font-size: .7rem; color: var(--sidebar-faint); transition: transform var(--t) var(--ease); }
.x-nav-parent[aria-expanded="true"] .x-nav-chevron { transform: rotate(180deg); }
.x-nav-sub { position: relative; padding: 2px 0 8px 34px; }
.x-nav-sub::before { content: ""; position: absolute; left: 24px; top: 4px; bottom: 10px; width: 1px; background: var(--sidebar-border); }
.x-nav-sublink { position: relative; display: block; padding: 10px 16px; margin: 2px 0; border-radius: var(--radius); color: var(--sidebar-muted); font-size: var(--fs-sm); font-weight: 500; transition: background-color var(--t) var(--ease), color var(--t) var(--ease); }
.x-nav-sublink:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.x-nav-sublink.active { color: var(--sidebar-text); font-weight: 600; background: var(--sidebar-active); }
.x-nav-sublink.active::before { content: ""; position: absolute; left: -11px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--gold); }
.x-nav-badge { margin-left: auto; font-size: var(--fs-2xs); font-weight: 600; padding: 1px 6px; border-radius: 0; background: var(--gold); color: var(--text-strong); }
.x-sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--sidebar-border); flex: 0 0 auto; position: sticky; bottom: 0; z-index: 1; background: var(--sidebar-bg); }  /* Déconnexion always visible; the menu scrolls above it */
.x-logout { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 13px 16px; border-radius: var(--radius); border: 0; background: transparent; color: var(--sidebar-muted); font-size: var(--fs-base); font-weight: 500; text-align: left; transition: background-color var(--t) var(--ease), color var(--t) var(--ease); }
.x-logout:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.x-logout i { width: 18px; text-align: center; font-size: 1rem; }
@media (max-height: 760px) {
    .x-brand { padding: 16px 20px; }
    .x-nav { padding-top: 10px; }
    .x-nav-link, .x-logout { min-height: 38px; padding-top: 9px; padding-bottom: 9px; }
    .x-nav-sublink { padding-top: 7px; padding-bottom: 7px; }
    .x-nav-group { padding-top: 16px; margin-top: 10px; }
    .x-sidebar-footer { padding-top: 10px; padding-bottom: 10px; }
}

/* ---------------------------------------------------------------------
   Top bar: Search → Caisse + XOF balance → Date → User
   --------------------------------------------------------------------- */
.x-topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter);
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.x-burger, .x-icon-btn {
    position: relative; width: var(--control-h); height: var(--control-h); border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface); color: var(--text-primary);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex: 0 0 auto;
    transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
.x-burger { font-size: 1.25rem; }
.x-icon-btn:hover, .x-icon-btn[aria-expanded="true"], .x-burger:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.x-search { position: relative; flex: 0 1 360px; min-width: 200px; }
.x-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .875rem; pointer-events: none; }
.x-search input {
    width: 100%; height: var(--control-h); padding: 0 12px 0 36px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-muted); color: var(--text-primary); font-size: var(--fs-sm);
    transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.x-search input::placeholder { color: var(--text-faint); }
.x-search input:focus { outline: none; border-color: var(--gold-strong); background: var(--surface); box-shadow: var(--ring); }
.x-top-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
/* Single register « Caisse » + current XOF balance (informational) */
/* Header indicators: « Caisse : X XOF » · « Dépenses du jour : Y XOF » — label and value on one line */
.x-topbar-kpis { display: flex; align-items: center; gap: 20px; padding-left: 16px; border-left: 1px solid var(--border); flex: 0 0 auto; }
.x-topbar-kpi { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.2; }
.x-topbar-kpi + .x-topbar-kpi { padding-left: 20px; border-left: 1px solid var(--border); }
.x-topbar-kpi i { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--gold-tint); color: var(--gold-ink); font-size: .85rem; flex: 0 0 auto; }
.x-topbar-kpi .lbl { font-size: var(--fs-sm); color: var(--text-secondary); font-weight: 500; }
.x-topbar-kpi .amt { font-size: var(--fs-base); font-weight: 650; color: var(--text-primary); letter-spacing: -0.005em; }
/* The indicators never shrink: room is freed around them as the screen narrows
   (long date ≥ 1600px, icons and profile name ≥ 1400px, search field ≥ 1200px — its icon otherwise). */
.x-date-short { display: none; }
@media (max-width: 1599.98px) { .x-date-long { display: none; } .x-date-short { display: inline; } }
@media (max-width: 1399.98px) {
    .x-topbar-kpis { gap: 14px; }
    .x-topbar-kpi + .x-topbar-kpi { padding-left: 14px; }
    .x-topbar-kpi i { display: none; }
    .x-profile-meta { display: none !important; }
}
@media (max-width: 767.98px) {
    /* stacked: one indicator per line, each still « label : value » */
    .x-topbar-kpis { flex-direction: column; align-items: flex-start; gap: 2px; padding-left: 0; border-left: 0; }
    .x-topbar-kpi + .x-topbar-kpi { padding-left: 0; border-left: 0; }
    .x-topbar-kpi { gap: 5px; }
    .x-topbar-kpi .lbl { font-size: var(--fs-2xs); }
    .x-topbar-kpi .amt { font-size: var(--fs-sm); }
}
.x-topbar-date { font-size: var(--fs-sm); color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.x-topbar-date + .dropdown { padding-left: 16px; border-left: 1px solid var(--border); }
@media (max-width: 575.98px) { .x-topbar { gap: 10px; } .x-top-actions { gap: 10px; } .x-topbar-date { display: none; } .x-topbar-date + .dropdown { padding-left: 0; border-left: 0; } }
.x-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--surface); }
.x-avatar {
    width: 34px; height: 34px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center;
    background: var(--sidebar-bg); color: var(--gold); font-weight: 700; font-size: var(--fs-xs); letter-spacing: .02em; flex: 0 0 auto;
}
.x-avatar.lg { width: 52px; height: 52px; border-radius: var(--radius-lg); font-size: var(--fs-md); }
.x-profile-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--text-primary); padding: 3px 6px 3px 3px; border-radius: var(--radius); transition: background-color var(--t) var(--ease); }
.x-profile-btn:hover, .x-profile-btn[aria-expanded="true"] { background: var(--surface-muted); }
.x-profile-meta { text-align: left; line-height: 1.2; }
.x-profile-meta strong { display: block; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.x-profile-meta span { font-size: var(--fs-2xs); color: var(--text-secondary); }

/* Dropdowns */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text-primary);
    --bs-dropdown-link-hover-bg: var(--surface-muted);
    --bs-dropdown-link-hover-color: var(--text-primary);
    --bs-dropdown-link-active-bg: var(--gold-tint);
    --bs-dropdown-link-active-color: var(--text-primary);
    --bs-dropdown-divider-bg: var(--border);
    --bs-dropdown-header-color: var(--text-secondary);
    border-radius: var(--radius-lg); padding: 6px; box-shadow: var(--shadow-md); font-size: var(--fs-base);
}
.dropdown-item { border-radius: var(--radius-sm); padding: 7px 10px; font-size: var(--fs-base); display: flex; align-items: center; gap: 10px; transition: background-color var(--t) var(--ease); }
.dropdown-item i { color: var(--text-secondary); }
.dropdown-item.text-danger, .dropdown-item.text-danger i { color: var(--danger-ink) !important; }
.x-notif-menu { width: min(380px, calc(100vw - 32px)); padding: 0; overflow: hidden; }
.x-notif-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.x-notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: var(--fs-sm); }
.x-notif-item:last-child { border-bottom: 0; }
.x-notif-item:hover { background: var(--surface-muted); color: var(--text-secondary); }
.x-notif-icon { width: 32px; height: 32px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* ---------------------------------------------------------------------
   Page header
   --------------------------------------------------------------------- */
.x-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.x-page-head > div:first-child { min-width: 0; }
.x-page-title { font-size: var(--fs-xl); font-weight: 650; margin: 0; line-height: 1.2; letter-spacing: -0.02em; color: var(--text-primary); }
.x-page-sub { color: var(--text-secondary); margin: 4px 0 0; font-size: var(--fs-base); }
.x-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: 6px; flex-wrap: wrap; }
.x-breadcrumb a { color: var(--text-secondary); }
.x-breadcrumb a:hover { color: var(--text-primary); }
.x-breadcrumb i { font-size: .625rem; opacity: .6; }
.x-page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------------
   Buttons — primary: gold fill + dark text; secondary: white + border;
   destructive: red (never gold)
   --------------------------------------------------------------------- */
.btn {
    --bs-btn-font-weight: 600; --bs-btn-padding-y: 0; --bs-btn-padding-x: 14px; --bs-btn-border-radius: var(--radius);
    --bs-btn-font-size: var(--fs-base); --bs-btn-line-height: 1.2;
    min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
    transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:focus-visible { box-shadow: var(--ring); outline: 0; }
.btn-lg { --bs-btn-padding-x: 20px; --bs-btn-font-size: var(--fs-md); min-height: 44px; }
.btn-sm { --bs-btn-padding-x: 10px; --bs-btn-font-size: var(--fs-sm); --bs-btn-border-radius: var(--radius-sm); min-height: var(--control-h-sm); gap: 6px; }
.btn-gold {
    --bs-btn-color: var(--text-strong); --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold);
    --bs-btn-hover-color: var(--text-strong); --bs-btn-hover-bg: var(--gold-hover); --bs-btn-hover-border-color: var(--gold-hover);
    --bs-btn-active-color: var(--text-strong); --bs-btn-active-bg: var(--gold-active); --bs-btn-active-border-color: var(--gold-active);
    --bs-btn-disabled-color: var(--text-secondary); --bs-btn-disabled-bg: var(--gold-tint-strong); --bs-btn-disabled-border-color: var(--gold-tint-strong); --bs-btn-disabled-opacity: 1;
    --bs-btn-focus-shadow-rgb: var(--gold-rgb);
}
.btn-ghost, .btn-outline-secondary, .btn-light {
    --bs-btn-color: var(--text-primary); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text-primary); --bs-btn-hover-bg: var(--surface-muted); --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--text-primary); --bs-btn-active-bg: var(--surface-sunken); --bs-btn-active-border-color: var(--border-strong);
    --bs-btn-disabled-color: var(--text-faint); --bs-btn-disabled-bg: var(--surface-muted); --bs-btn-disabled-border-color: var(--border);
}
.btn-outline-gold {
    --bs-btn-color: var(--text-primary); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--gold-strong);
    --bs-btn-hover-color: var(--text-strong); --bs-btn-hover-bg: var(--gold); --bs-btn-hover-border-color: var(--gold);
    --bs-btn-active-color: var(--text-strong); --bs-btn-active-bg: var(--gold-hover); --bs-btn-active-border-color: var(--gold-hover);
}
.btn-danger-soft {
    --bs-btn-color: var(--danger-ink); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--danger-border);
    --bs-btn-hover-color: var(--danger-ink); --bs-btn-hover-bg: var(--danger-bg); --bs-btn-hover-border-color: var(--danger-border);
    --bs-btn-active-color: var(--text-inverse); --bs-btn-active-bg: var(--danger); --bs-btn-active-border-color: var(--danger);
}
.btn-danger {
    --bs-btn-color: var(--text-inverse); --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
    --bs-btn-hover-color: var(--text-inverse); --bs-btn-hover-bg: var(--danger-hover); --bs-btn-hover-border-color: var(--danger-hover);
    --bs-btn-active-color: var(--text-inverse); --bs-btn-active-bg: var(--danger-active); --bs-btn-active-border-color: var(--danger-active);
    --bs-btn-focus-shadow-rgb: var(--danger-rgb);
}
.btn-danger:focus-visible, .btn-danger-soft:focus-visible { box-shadow: var(--ring-danger); }
.btn-link { --bs-btn-color: var(--gold-ink); --bs-btn-hover-color: var(--gold-ink-hover); min-height: 0; }
.btn-icon { width: var(--control-h-sm); min-height: var(--control-h-sm); height: var(--control-h-sm); padding: 0 !important; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(17, 17, 17, .2); border-top-color: var(--text-strong); animation: x-spin .7s linear infinite; }
@keyframes x-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.x-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.x-card.flat { box-shadow: none; }
.x-card-body { padding: 20px; }
.x-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px 0; }
.x-card-head + .x-card-body { padding-top: 14px; }
.x-card-title { font-size: var(--fs-md); font-weight: 650; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; color: var(--text-primary); }
.x-card-title i { color: var(--text-secondary); font-size: 1rem; }
.x-card-sub { color: var(--text-secondary); font-size: var(--fs-sm); margin: 2px 0 0; }
.x-card.accent { box-shadow: inset 3px 0 0 var(--gold), var(--shadow-xs); }
.x-card-link { color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.x-card-link:hover { color: var(--text-primary); }

/* Totals panel (stocks) — flat, no decoration */
.x-hero { position: relative; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow-xs); }
.x-hero-value { font-weight: 700; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.1; letter-spacing: -0.025em; margin: 10px 0 6px; font-variant-numeric: tabular-nums; word-break: break-word; color: var(--text-primary); }
.x-hero-value .unit { font-size: .45em; color: var(--text-secondary); letter-spacing: .02em; margin-left: 6px; font-weight: 600; }
.x-hero-sub { color: var(--text-secondary); font-size: var(--fs-base); }
.x-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.x-hero-stat .label { font-size: var(--fs-2xs); color: var(--text-secondary); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.x-hero-stat .value { font-weight: 650; font-size: var(--fs-md); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* KPI */
.x-kpi { height: 100%; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.x-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.x-kpi-label { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }
.x-kpi-icon { width: 30px; height: 30px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; background: var(--gold-tint); color: var(--gold-ink); flex: 0 0 auto; font-size: .9rem; }
.x-kpi-value { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; word-break: break-word; color: var(--text-primary); }
.x-kpi-value .unit { font-size: .6em; color: var(--text-secondary); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.x-kpi-foot { font-size: var(--fs-xs); color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.x-trend { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 0; font-weight: 600; font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; }
.x-trend.up { background: var(--success-bg); color: var(--success-ink); }
.x-trend.down { background: var(--danger-bg); color: var(--danger-ink); }
.x-trend.flat { background: var(--surface-sunken); color: var(--text-secondary); }

/* Currency cards (stocks) */
.x-currency { position: relative; height: 100%; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; color: var(--text-primary); transition: border-color var(--t) var(--ease); }
.x-currency:hover { border-color: var(--border-strong); color: var(--text-primary); }
.x-currency .code { font-weight: 700; font-size: var(--fs-md); letter-spacing: .02em; }
.x-currency .flag { font-size: 1rem; }
.x-currency .name { color: var(--text-secondary); font-size: var(--fs-xs); }
.x-currency .amount { font-weight: 650; font-size: var(--fs-lg); letter-spacing: -0.02em; margin-top: 12px; font-variant-numeric: tabular-nums; word-break: break-word; }
.x-currency .valuation { color: var(--text-secondary); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; margin-top: 2px; }
.x-currency .rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.x-currency .rates .l { font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.x-currency .rates .v { font-weight: 600; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.x-meter { height: 4px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; margin-top: 12px; }
.x-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--gold-strong); }
.x-meter.warn > span { background: var(--warning); }
.x-meter.danger > span { background: var(--danger); }

/* ---------------------------------------------------------------------
   Badges — ONE global definition for every status label in the application.
   Rectangular (border-radius: 0), compact, medium weight, no gradient,
   no shadow, no decorative dot: the text carries the meaning, the colour
   only reinforces it. Semantic variants use the palette tokens (soft
   background + dark ink, WCAG AA).
   --------------------------------------------------------------------- */
.x-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px; border-radius: 0; border: 1px solid transparent;
    font-size: var(--fs-xs); font-weight: 500; line-height: 1.35; letter-spacing: 0.01em;
    white-space: nowrap; vertical-align: middle; box-shadow: none; background-image: none;
}
.x-badge > i { font-size: .85em; }
.x-badge.success { color: var(--success-ink); background: var(--success-bg); border-color: var(--success-border); }
.x-badge.danger  { color: var(--danger-ink);  background: var(--danger-bg);  border-color: var(--danger-border); }
.x-badge.warning { color: var(--warning-ink); background: var(--warning-bg); border-color: var(--warning-border); }
.x-badge.info    { color: var(--info-ink);    background: var(--info-bg);    border-color: var(--info-border); }
.x-badge.neutral { color: var(--neutral-ink); background: var(--surface-sunken); border-color: var(--border); }
.x-badge.gold    { color: var(--gold-ink);    background: var(--gold-tint);  border-color: var(--gold-tint-strong); }
/* Badge-like labels share the same square shape */
.x-badge, .x-nav-badge, .x-trend, .x-pill-cur, .x-chip, .badge { border-radius: 0 !important; }
.x-code { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-primary); font-weight: 600; letter-spacing: 0; }
/* Shared currency identifier « [flag] CODE » (Ui::currency / CurrencyIcon) */
.x-curid { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; white-space: nowrap; line-height: 1.2; }
.x-curid-icon { width: 20px; height: 15px; flex: 0 0 20px; display: inline-block; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.x-curid-icon.is-emoji { box-shadow: none; font-size: 15px; line-height: 15px; text-align: center; }
.x-curid-code { font-weight: 600; letter-spacing: .02em; color: var(--text-primary); }
.x-cur .x-curid { min-width: 72px; }   /* codes line up in currency tables */
/* Currency <select>: icon of the selected currency inside the field (app.js) */
.form-select.x-cur-select.has-icon { background-image: var(--cur-icon), var(--bs-form-select-bg-img); background-repeat: no-repeat, no-repeat;
    background-position: 12px center, right 12px center; background-size: 20px 15px, 14px 10px; padding-left: 42px; }
.x-pill-cur { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 2px 8px; border-radius: 0; background: var(--surface-sunken); border: 1px solid var(--border); font-weight: 700; font-size: var(--fs-xs); letter-spacing: .04em; color: var(--text-primary); }

/* ---------------------------------------------------------------------
   Tables — white body, light header, horizontal dividers only
   --------------------------------------------------------------------- */
.x-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.x-table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--row-hover);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-striped-bg: transparent;
    margin: 0; font-size: var(--fs-base); white-space: nowrap;
}
.x-table > :not(caption) > * > * { border-bottom-width: 1px; }
/* Shared header of every application table: roomier (15px × 18px), light-gray band, weight 600,
   stronger bottom rule separating it from the rows. Data rows keep their compact height. */
.x-table thead th { font-size: var(--fs-2xs); line-height: 1.35; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--text-secondary); background: var(--surface-muted); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border-strong); padding: 15px 18px; vertical-align: middle; white-space: nowrap; }
@media (max-width: 575.98px) { .x-table thead th { padding: 12px 14px; } }
.x-table tbody td { padding: 11px 16px; vertical-align: middle; border-color: var(--border); }
.x-table.table-hover > tbody > tr { transition: background-color var(--t) var(--ease); }
.x-table tbody tr:last-child td { border-bottom: 0; }
.x-table td.num, .x-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.x-table td.text-end .btn, .x-table td:last-child > .btn { vertical-align: middle; }
.x-table .primary { color: var(--text-primary); font-weight: 600; }
.x-table td.wrap { white-space: normal; min-width: 160px; }
.x-table tfoot td { padding: 11px 16px; border-top: 1px solid var(--border-strong); font-weight: 650; background: var(--surface-muted); }
.x-table tr.is-cancelled td { color: var(--text-faint); }
.x-table tr.is-cancelled td .strike { text-decoration: line-through; }
.x-table a.row-link { color: inherit; }
.x-table a.row-link.x-code { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.x-table a.row-link:hover { color: var(--gold-ink); }
/* Currency tables (Devises, Gestion de stocks, Taux de change, rapports, tableau de bord):
   codes and names left-aligned, codes in a fixed-width pill so they line up,
   numbers right-aligned in tabular figures, unit set apart from the figure. */
.x-cur { display: inline-flex; align-items: center; gap: 10px; min-width: 0; vertical-align: middle; }
.x-cur-name { color: var(--text-secondary); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.x-table-cur th, .x-table-cur td { text-align: left; }
.x-table-cur td.num, .x-table-cur th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.x-table-cur td.text-end, .x-table-cur th.text-end { text-align: right; }
.x-table-cur tbody td { border-bottom: 1px solid var(--border); }
.x-table-cur thead th:first-child, .x-table-cur tbody td:first-child { padding-left: 20px; }
.x-table-cur thead th:last-child, .x-table-cur tbody td:last-child { padding-right: 20px; }
.x-table-cur .x-cur-name-col { color: var(--text-secondary); }
.x-unit { margin-left: .35em; color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 500; }
@media (max-width: 767.98px) {
    .x-table-cur.stack-sm thead th:first-child, .x-table-cur.stack-sm tbody td:first-child { padding-left: 0; }
    .x-table-cur.stack-sm thead th:last-child, .x-table-cur.stack-sm tbody td:last-child { padding-right: 0; }
    .x-table-cur.stack-sm tbody td { text-align: right; }
    .x-table-cur.stack-sm tbody td::before { margin-right: auto; }   /* label left; figure and unit kept together on the right */
    .x-table-cur.stack-sm tbody td > .x-unit { margin-left: -12px; }
    .x-cur-name { max-width: 140px; }
}

/* « Exporter » dropdown (CSV / Excel) */
.x-export { display: inline-block; }
.x-export .dropdown-item i { width: 1.2em; margin-right: 6px; color: var(--text-secondary); }

.x-amount-in { color: var(--success-ink); }
.x-amount-out { color: var(--text-primary); }
.x-flow { display: inline-flex; align-items: center; gap: 8px; }
.x-flow i { color: var(--text-secondary); font-size: .8rem; }

@media (max-width: 767.98px) {
    .x-table.stack-sm { white-space: normal; }
    .x-table.stack-sm thead { display: none; }
    .x-table.stack-sm tbody tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .x-table.stack-sm tbody tr:last-child { border-bottom: 0; }
    .x-table.stack-sm tbody td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 0; border: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
    .x-table.stack-sm tbody td::before { content: attr(data-label); color: var(--text-secondary); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; text-align: left; flex: 0 0 auto; }
    .x-table.stack-sm tbody td[data-label=""]::before { display: none; }
    .x-table.stack-sm tbody td:empty { display: none; } /* e.g. the unused Entrée / Sortie side of a movement */
    .x-table.stack-sm tbody td[data-label=""] { justify-content: flex-end; padding-top: 8px; }
    .x-table.stack-sm tfoot { display: block; }
    .x-table.stack-sm tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 12px 16px; }
    .x-table.stack-sm tfoot td { border: 0; padding: 4px 0; }
}

/* ---------------------------------------------------------------------
   Forms — one control height, subtle gold focus
   --------------------------------------------------------------------- */
.form-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-text { color: var(--text-secondary); font-size: var(--fs-xs); margin-top: 4px; }
.form-control, .form-select {
    --bs-border-color: var(--input-border);
    min-height: var(--control-h);
    background-color: var(--surface); border: 1px solid var(--input-border); color: var(--text-primary);
    border-radius: var(--radius); padding: 7px 12px; font-size: var(--fs-base); line-height: 1.4; box-shadow: none;
    transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
/* Long-text fields (motif, détails, commentaires…): full width, 4 rows, vertical resize only */
textarea.form-control { min-height: 120px; resize: vertical; line-height: 1.5; }
.form-select { padding-right: 34px; background-position: right 12px center; background-size: 14px 10px; }
.form-control-sm, .form-select-sm { min-height: var(--control-h-sm); padding-top: 4px; padding-bottom: 4px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.form-control-lg { min-height: 44px; font-size: var(--fs-md); }
.form-control::placeholder { color: var(--text-faint); }
.form-control:hover:not(:focus):not(:disabled):not([readonly]), .form-select:hover:not(:focus):not(:disabled) { border-color: var(--input-border-hover); }
.form-control:focus, .form-select:focus { background-color: var(--surface); color: var(--text-primary); border-color: var(--gold-strong); box-shadow: var(--ring); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--surface-muted); color: var(--text-secondary); }
.form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); background-image: none; padding-right: 12px; }
.form-select.is-invalid { padding-right: 34px; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: var(--ring-danger); border-color: var(--danger); }
.invalid-feedback { color: var(--danger-ink); font-size: var(--fs-xs); }
.form-check-input { background-color: var(--surface); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--sidebar-bg); border-color: var(--sidebar-bg); }
.form-check-input:focus { box-shadow: var(--ring); border-color: var(--gold-strong); }
.form-switch .form-check-input:checked { background-color: var(--gold); border-color: var(--gold-strong); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23111111'/%3e%3c/svg%3e"); }
.form-check-label { font-size: var(--fs-base); }
.input-group-text { background: var(--surface-muted); border-color: var(--input-border); color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 600; border-radius: var(--radius); }
.input-group > .form-control:focus { z-index: 5; }
.x-form-section { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.x-form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.x-form-section-title { font-weight: 650; font-size: var(--fs-md); margin-bottom: 2px; }
.x-form-section-sub { color: var(--text-secondary); font-size: var(--fs-sm); margin-bottom: 16px; }

.x-filters { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.x-filters .form-control, .x-filters .form-select { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: var(--fs-sm); }
.x-filters .btn { min-height: 34px; }
.x-filters .form-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: 4px; }

/* ---------------------------------------------------------------------
   Exchange operation form (counter)
   --------------------------------------------------------------------- */
.x-exform { max-width: 960px; }
.x-exform-title { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--text-secondary); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.x-exform-amount { font-size: var(--fs-md); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.x-exform-amount[readonly] { background: var(--surface-muted); color: var(--text-primary); }
.x-exform .input-group-text { min-width: 60px; justify-content: center; font-weight: 700; color: var(--text-primary); }
.x-exform-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px 20px; align-items: center; margin: 20px 0 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.x-exform-summary dt { font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.x-exform-summary dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.x-exform-summary dd.x-exform-xof { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.015em; color: var(--text-primary); }
.x-exform-override { padding: 14px 16px; border: 1px solid var(--gold-tint-strong); border-left: 3px solid var(--gold); border-radius: var(--radius); background: var(--gold-tint); }
.x-exform-customer summary { cursor: pointer; font-size: var(--fs-base); font-weight: 600; color: var(--text-secondary); list-style: none; transition: color var(--t) var(--ease); }
.x-exform-customer summary:hover { color: var(--text-primary); }
.x-exform-customer summary::before { content: "+"; display: inline-block; width: 16px; font-weight: 700; color: var(--text-primary); }
.x-exform-customer[open] summary::before { content: "−"; }
.x-exform-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-muted); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 767.98px) {
    .x-exform-summary { grid-template-columns: 1fr 1fr; }
    .x-exform-status { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
    .x-exform-footer { flex-direction: column-reverse; padding: 12px 16px; }
    .x-exform-footer .btn { width: 100%; }
}
.x-alert-stock { border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-ink); font-size: var(--fs-sm); }
.x-alert-stock strong { color: var(--danger-ink); }
.x-alert-stock dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; font-variant-numeric: tabular-nums; max-width: 320px; }
.x-alert-stock dt { font-weight: 500; color: var(--danger-ink); }
.x-alert-stock dd { margin: 0; text-align: right; font-weight: 700; color: var(--text-primary); }
.x-alert-stock dd.text-danger { color: var(--danger-ink) !important; }
.x-summary { position: sticky; top: calc(var(--topbar-h) + 16px); }
@media (max-width: 1279.98px) { .x-summary { position: static; } }

/* Confirmation dialog */
.x-confirm-flow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--surface-muted); border: 1px solid var(--border); }
.x-confirm-flow .side .l { font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.x-confirm-flow .side .v { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.015em; margin-top: 4px; font-variant-numeric: tabular-nums; word-break: break-word; }
.x-confirm-flow .side.give { padding-left: 14px; border-left: 3px solid var(--gold); }
.x-confirm-flow .arrow { color: var(--text-secondary); font-size: 1.25rem; }
@media (max-width: 575.98px) { .x-confirm-flow { grid-template-columns: 1fr; text-align: center; } .x-confirm-flow .arrow { transform: rotate(90deg); } .x-confirm-flow .side.give { border-left: 0; padding-left: 0; } }
.x-dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; margin: 0; font-size: var(--fs-base); }
.x-dl dt { color: var(--text-secondary); font-weight: 500; }
.x-dl dd { margin: 0; text-align: right; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; word-break: break-word; }

/* Detail pages */
.x-detail-hero { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; }
.x-detail-hero .amt { font-weight: 700; font-size: clamp(1.25rem, 1.05rem + .9vw, 1.6rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; word-break: break-word; }
.x-detail-hero .arrow { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); background: var(--surface); }
@media (max-width: 575.98px) { .x-detail-hero { grid-template-columns: 1fr; } .x-detail-hero .arrow { transform: rotate(90deg); } }
.x-props { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 16px; }
.x-prop { padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.x-prop .l { font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.x-prop .v { margin-top: 3px; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-word; }

.x-timeline { list-style: none; padding: 0; margin: 0; }
.x-timeline li { position: relative; padding: 0 0 16px 26px; }
.x-timeline li::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.x-timeline li:last-child::before { display: none; }
.x-timeline .dot { position: absolute; left: 0; top: 4px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--gold-strong); background: var(--surface); }
.x-timeline .dot.in { border-color: var(--success); }
.x-timeline .dot.out { border-color: var(--danger); }

/* ---------------------------------------------------------------------
   Empty / loading
   --------------------------------------------------------------------- */
.x-empty { text-align: center; padding: 40px 20px; }
.x-empty-icon { width: 48px; height: 48px; border-radius: var(--radius-lg); margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--text-secondary); background: var(--surface-sunken); }
.x-empty h3 { font-size: var(--fs-md); font-weight: 650; margin-bottom: 4px; }
.x-empty p { color: var(--text-secondary); font-size: var(--fs-base); max-width: 420px; margin: 0 auto; }
.x-empty-line { margin: 0; padding: 24px 20px; text-align: center; color: var(--text-secondary); font-size: var(--fs-base); }
.x-skeleton { background: var(--surface-sunken); border-radius: var(--radius); animation: x-pulse 1.2s ease-in-out infinite; }
@keyframes x-pulse { 50% { opacity: .55; } }
.x-chart-box { position: relative; height: 280px; }
.x-chart-box.sm { height: 240px; }
.x-chart-box.lg { height: 400px; }
.x-chart-box canvas { position: relative; z-index: 1; }
.x-chart-box .x-skeleton { position: absolute; inset: 0; }
.x-chart-box.loaded .x-skeleton { display: none; }
.x-chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; color: var(--text-secondary); font-size: var(--fs-base); }
.x-chart-empty.d-none { display: none !important; }
.x-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: var(--text-secondary); }
.x-legend span { display: inline-flex; align-items: center; gap: 7px; }
.x-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------------------------------------------------------------
   Alerts
   --------------------------------------------------------------------- */
.x-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-base); color: var(--text-primary); }
.x-alert > i { font-size: 1rem; margin-top: 1px; flex: 0 0 auto; }
.x-alert strong { color: inherit; }
.x-alert.gold { border-color: var(--gold-tint-strong); background: var(--gold-tint); color: var(--text-primary); }
.x-alert.gold > i { color: var(--gold-ink); }
.x-alert.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--text-primary); }
.x-alert.warning > i { color: var(--warning); }
.x-alert.danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--text-primary); }
.x-alert.danger > i { color: var(--danger); }
.x-alert.success { border-color: var(--success-border); background: var(--success-bg); color: var(--text-primary); }
.x-alert.success > i { color: var(--success); }
.x-alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Lists */
.x-list { list-style: none; margin: 0; padding: 0; }
.x-list-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.x-list-item:last-child { border-bottom: 0; }
@media (min-width: 1200px) { .x-list.x-cols-2 { columns: 2; column-gap: 40px; } .x-list.x-cols-2 .x-list-item { break-inside: avoid; } }
.x-list-item .grow { flex: 1; min-width: 0; }
.x-list-item .title { font-weight: 600; color: var(--text-primary); }
.x-list-item .meta { font-size: var(--fs-xs); color: var(--text-secondary); }

/* Differences */
.x-diff-zero { color: var(--success-ink); }
.x-diff-neg { color: var(--danger-ink); font-weight: 700; }
.x-diff-pos { color: var(--warning-ink); font-weight: 700; }
tr.has-diff td { background: var(--danger-bg) !important; }
.x-count-input { max-width: 190px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; }

/* Segmented control / tabs */
.x-segmented { display: inline-flex; padding: 3px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.x-segmented a, .x-segmented button, .x-segmented label { padding: 6px 14px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 600; border: 0; background: transparent; cursor: pointer; white-space: nowrap; transition: background-color var(--t) var(--ease), color var(--t) var(--ease); }
.x-segmented a:hover, .x-segmented button:hover, .x-segmented label:hover { color: var(--text-primary); }
.x-segmented .active, .x-segmented input:checked + label { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.x-segmented input:focus-visible + label { box-shadow: var(--ring); }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-active-color: var(--text-primary); --bs-nav-tabs-link-active-border-color: transparent transparent var(--gold); --bs-nav-tabs-link-hover-border-color: transparent; --bs-nav-link-color: var(--text-secondary); --bs-nav-link-hover-color: var(--text-primary); gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
.nav-tabs .nav-link { border-width: 0 0 2px; font-weight: 600; font-size: var(--fs-base); white-space: nowrap; }

/* Pagination */
.x-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-secondary); }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--text-primary); --bs-pagination-hover-bg: var(--surface-muted); --bs-pagination-hover-color: var(--text-primary); --bs-pagination-hover-border-color: var(--border-strong); --bs-pagination-active-bg: var(--sidebar-bg); --bs-pagination-active-border-color: var(--sidebar-bg); --bs-pagination-active-color: var(--text-inverse); --bs-pagination-disabled-bg: var(--surface-muted); --bs-pagination-disabled-color: var(--text-faint); --bs-pagination-disabled-border-color: var(--border); --bs-pagination-focus-box-shadow: var(--ring); --bs-pagination-font-size: var(--fs-sm); --bs-pagination-border-radius: var(--radius-sm); --bs-pagination-padding-x: 10px; --bs-pagination-padding-y: 5px; margin: 0; flex-wrap: wrap; }

/* Modals — compact header / body / footer */
.modal { --bs-modal-bg: var(--surface); --bs-modal-color: var(--text-primary); --bs-modal-border-color: var(--border); --bs-modal-border-radius: var(--radius-lg); --bs-modal-inner-border-radius: calc(var(--radius-lg) - 1px); --bs-modal-header-border-color: var(--border); --bs-modal-footer-border-color: var(--border); --bs-modal-padding: 20px; --bs-modal-margin: 16px; }
.modal-content { box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 20px; }
.modal-title { font-weight: 650; font-size: var(--fs-md); display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.modal-title i { color: var(--text-secondary); }
.modal-header .btn-close { width: 32px; height: 32px; padding: 0; margin: -6px -6px -6px auto; border-radius: var(--radius); background-size: 12px; opacity: .55; transition: opacity var(--t) var(--ease), background-color var(--t) var(--ease); }
.modal-header .btn-close:hover { opacity: 1; background-color: var(--surface-muted); }
.modal-header .btn-close:focus { box-shadow: var(--ring); }
.modal-footer { padding: 12px 20px; gap: 8px; background: var(--surface-muted); border-bottom-left-radius: var(--bs-modal-inner-border-radius); border-bottom-right-radius: var(--bs-modal-inner-border-radius); }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-bg: var(--backdrop); --bs-backdrop-opacity: .45; }
.modal.fade .modal-dialog { transition: transform 180ms var(--ease), opacity 180ms var(--ease); transform: translateY(8px); }
.modal.show .modal-dialog { transform: none; }
@media (max-width: 575.98px) { .modal-footer .btn { flex: 1 1 auto; } }

/* Toasts */
.x-toasts { position: fixed; top: 16px; right: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.x-toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text-primary); box-shadow: var(--shadow-md); font-size: var(--fs-base); animation: x-toast-in 180ms var(--ease); }
.x-toast.hide { animation: x-toast-out 180ms var(--ease) forwards; }
.x-toast i { font-size: 1rem; margin-top: 1px; }
.x-toast.success { box-shadow: inset 3px 0 0 var(--success), var(--shadow-md); } .x-toast.success i { color: var(--success); }
.x-toast.error { box-shadow: inset 3px 0 0 var(--danger), var(--shadow-md); } .x-toast.error i { color: var(--danger); }
.x-toast.warning { box-shadow: inset 3px 0 0 var(--warning), var(--shadow-md); } .x-toast.warning i { color: var(--warning); }
.x-toast.info { box-shadow: inset 3px 0 0 var(--gold), var(--shadow-md); } .x-toast.info i { color: var(--gold-ink); }
.x-toast .close { margin-left: auto; background: transparent; border: 0; color: var(--text-faint); padding: 0 0 0 8px; }
.x-toast .close:hover { color: var(--text-primary); }
@keyframes x-toast-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes x-toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---------------------------------------------------------------------
   Authentication: one compact form, centered on a white page
   --------------------------------------------------------------------- */
.x-login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--surface); }
.x-login-box { width: 100%; max-width: 360px; }
.x-login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.02em; color: var(--text-primary); }
.x-login-brand img { width: 40px; height: 40px; border-radius: var(--radius-lg); object-fit: contain; background: var(--sidebar-bg); }
.x-login-title { text-align: center; font-size: var(--fs-xs); font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); margin: 0 0 24px; }
.x-login .form-control { min-height: 44px; }
.x-login .btn { min-height: 44px; font-weight: 650; }

/* Error pages */
.x-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; text-align: center; background: var(--page-bg); }
.x-error-code { font-weight: 750; font-size: clamp(4rem, 3rem + 6vw, 6.5rem); line-height: 1; letter-spacing: -.05em; color: var(--text-primary); }
.x-error-code::after { content: ""; display: block; width: 48px; height: 4px; border-radius: 4px; background: var(--gold); margin: 14px auto 0; }

/* ---------------------------------------------------------------------
   Misc components
   --------------------------------------------------------------------- */
.x-divider-label { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; margin: 20px 0 12px; }
.x-divider-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.x-kbd { font-family: var(--mono); font-size: var(--fs-2xs); padding: 2px 6px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-muted); color: var(--text-secondary); }
.x-json { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; font-size: var(--fs-xs); color: var(--text-primary); white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: 0; }
.x-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.x-perm-group { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--surface-muted); }
.x-perm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.x-perm-row:last-child { border-bottom: 0; }
.x-perm-row select { width: auto; min-height: 30px; padding: 3px 28px 3px 8px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.x-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.x-stat { padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); min-width: 0; color: var(--text-primary); transition: border-color var(--t) var(--ease); }
a.x-stat:hover { border-color: var(--border-strong); color: var(--text-primary); }
.x-stat .l { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }
.x-stat .v { font-weight: 650; font-size: var(--fs-lg); margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; word-break: break-word; }
.x-stat .s { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }
.x-bar { height: 6px; background: var(--surface-sunken); border-radius: 99px; overflow: hidden; min-width: 80px; }
.x-bar span { display: block; height: 100%; background: var(--gold-strong); border-radius: inherit; }
.x-sticky-actions { position: sticky; bottom: 0; z-index: 5; background: var(--page-bg); border-top: 1px solid var(--border); padding: 12px 0 4px; margin-top: 8px; }
details > summary::-webkit-details-marker { display: none; }

@media (max-width: 575.98px) {
    .x-content { padding-top: 16px; padding-bottom: 32px; }
    .x-page-head { margin-bottom: 16px; }
    .x-page-title { font-size: var(--fs-lg); }
    .x-page-actions { width: 100%; }
    .x-page-actions .btn { flex: 1 1 auto; }
    .x-card-body { padding: 16px; }
    .x-card-head { padding: 14px 16px 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------------
   Print (in-app pages; dedicated documents use print.css)
   --------------------------------------------------------------------- */
@media print {
    .x-sidebar, .x-topbar, .x-footer, .x-page-actions, .x-toasts, .x-mobile-bar, .no-print, .x-filters, .x-pagination,     body, .x-main, .x-card, .x-kpi, .x-hero, .x-stat { background: var(--surface) !important; box-shadow: none !important; }
    .x-content { padding: 0; max-width: none; }
}

/* ---------------------------------------------------------------------
   Achat / Vente selector, banknote rows ("Billet × Quantité = Sous-total")
   --------------------------------------------------------------------- */
.x-optype { display: flex; }
.x-optype label { flex: 1 1 0; text-align: center; padding: 8px 14px; font-size: var(--fs-base); }
.x-optype input:checked + label { color: var(--text-primary); box-shadow: var(--shadow-sm), inset 0 -2px 0 var(--gold); }
.x-optype-help { font-size: var(--fs-sm); color: var(--text-secondary); }
.x-optype-badge { font-weight: 700; letter-spacing: .02em; color: var(--text-primary); }

.x-notes { display: grid; gap: 8px; }
.x-notes-rows { display: grid; gap: 6px; }
.x-notes-row { display: grid; grid-template-columns: minmax(0, 11rem) auto 6.5rem auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.x-notes-row .x-notes-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.x-notes-op { color: var(--text-secondary); font-weight: 600; text-align: center; }
.x-notes-sub { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.x-notes-held { grid-column: 1 / -1; margin-top: -4px; }
.x-notes-held:empty { display: none; }
.x-notes-rm { min-height: var(--control-h); padding: 0 10px; color: var(--text-secondary); }
.x-notes-rm:hover { color: var(--danger-ink); }
.x-notes-rm-placeholder { width: 36px; }
.x-notes-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.x-notes-total { font-size: var(--fs-base); }
.x-notes-total strong { font-size: var(--fs-md); }
@media (max-width: 575.98px) {
    .x-notes-row { grid-template-columns: minmax(0, 1fr) auto 4.5rem auto; row-gap: 4px; }
    .x-notes-row .x-notes-op:nth-of-type(2) { display: none; }
    .x-notes-sub { grid-column: 1 / 3; text-align: left; font-size: var(--fs-sm); color: var(--text-secondary); }
    .x-notes-rm, .x-notes-rm-placeholder { grid-column: 4; grid-row: 1; }
}

.x-notes-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.x-notes-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.x-notes-list li:last-child { border-bottom: 0; }
.x-notes-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.x-chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 0; border: 1px solid var(--border); background: var(--surface-muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.x-chip.muted { color: var(--text-secondary); border-style: dashed; }
.x-notes-row-detail td { padding-top: 0 !important; border-top: 0 !important; }

.x-inline-edit { display: inline-block; position: relative; text-align: left; }
.x-inline-edit summary { list-style: none; }
.x-inline-edit summary::-webkit-details-marker { display: none; }
.x-inline-edit-form { position: absolute; right: 0; z-index: 5; width: 240px; margin-top: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }

/* ---------------------------------------------------------------------
   Dashboard: compact KPI cards, form recap, confirmation list
   --------------------------------------------------------------------- */
.x-dash .x-page-head { margin-bottom: 20px; }
.x-section-label { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--text-secondary); margin: 0 0 10px; }
.x-statgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; } /* mobile: one card per row */
@media (min-width: 768px) { .x-statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }   /* tablet: two per row */
@media (min-width: 1200px) { .x-statgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }  /* desktop: three per row */
.x-statcell {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; align-content: start;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    padding: 14px 16px; min-width: 0; transition: border-color var(--t) var(--ease);
}
.x-statcell:hover { border-color: var(--border-strong); }
.x-statcell .l { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.x-statcell .l i { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: var(--radius-sm); background: var(--gold-tint); color: var(--gold-ink); font-size: .8rem; }
.x-statcell .v { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-statcell .v.text-danger { color: var(--danger-ink) !important; }
.x-statcell .s { font-size: var(--fs-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
    .x-statgrid { gap: 8px; }
    .x-statcell { padding: 12px; }
}

.x-recap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); padding: 12px 14px; }
.x-recap-title { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--text-secondary); margin-bottom: 8px; }
.x-recap-list { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.x-recap-list dt { font-weight: 500; color: var(--text-secondary); }
.x-recap-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.x-recap-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: var(--fs-sm); font-weight: 650; color: var(--text-secondary); }
.x-recap-total strong { font-size: var(--fs-lg); letter-spacing: -0.015em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) { .x-recap-list { grid-template-columns: 1fr; } .x-recap-list dd { margin-bottom: 4px; } }

.x-done-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 16px; font-size: var(--fs-base); }
.x-done-list dt { font-weight: 500; color: var(--text-secondary); }
.x-done-list dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Detail modal (history pages): two-column label/value grid + inline cancel */
.x-detail-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 10px 20px; margin: 0 0 8px; font-size: var(--fs-base); }
.x-detail-grid dt { font-weight: 500; color: var(--text-secondary); }
.x-detail-grid dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 767.98px) { .x-detail-grid { grid-template-columns: max-content minmax(0, 1fr); } }
#detailModal .modal-title .x-code { font-size: var(--fs-md); }
#detailModal .modal-footer { justify-content: flex-end; }
.x-cancel-box { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.x-cancel-box > summary { list-style: none; display: inline-flex; }
.x-cancel-box > summary::-webkit-details-marker { display: none; }
.x-cancel-box[open] > summary { margin-bottom: 4px; }

/* ---------------------------------------------------------------------
   Settings: stacked sections, two-column field grid (one column on mobile)
   --------------------------------------------------------------------- */
.x-settings { max-width: 1080px; }
.x-settings-section + .x-settings-section { margin-top: 16px; }
.x-settings .form-label { overflow-wrap: anywhere; }
.x-settings .form-select { text-overflow: ellipsis; }
.x-settings .form-text { line-height: 1.4; }
.x-settings .form-switch { padding-top: 2px; }
.x-setting-fixed { display: flex; align-items: center; gap: 8px; min-height: var(--control-h); padding: 7px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-muted); color: var(--text-primary); font-weight: 500; }
.x-setting-fixed i { color: var(--text-secondary); font-size: .85rem; }
.x-setting-logo { border-radius: var(--radius); object-fit: contain; background: var(--sidebar-bg); flex: 0 0 auto; }

/* ---------------------------------------------------------------------
   Form pages (same standard as the Settings page): stacked full-width
   section cards, two-column grid on desktop, one column on mobile,
   compact action bar.
   --------------------------------------------------------------------- */
.x-formpage { max-width: 1080px; }
.x-formcard + .x-formcard, .x-formcard + .x-form-actions, .x-formpage > .x-alert + .x-formcard { margin-top: 16px; }
.x-formpage .form-label { overflow-wrap: anywhere; }
.x-formpage .form-select { text-overflow: ellipsis; }
.x-formpage .form-text { line-height: 1.4; }
.x-form-actions {
    position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.x-form-actions .x-form-actions-note { margin-right: auto; font-size: var(--fs-sm); color: var(--text-secondary); }
@media (max-width: 575.98px) {
    .x-form-actions { flex-direction: column-reverse; align-items: stretch; bottom: 8px; }
    .x-form-actions .btn { width: 100%; }
    .x-form-actions .x-form-actions-note { margin: 0; text-align: center; }
}
.x-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px; margin: 0; }
.x-preview-grid dt { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }
.x-preview-grid dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Caisse (XOF cash) */
.x-cash-balance { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.x-cash-in { color: var(--success-ink); }
.x-cash-out { color: var(--text-primary); }
.x-session-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-secondary); }

/* Signed amounts (Gestion de caisse): colour reinforces the + / − sign */
.x-amount-pos { color: var(--success-ink) !important; }
.x-amount-neg { color: var(--danger-ink) !important; }
.x-table tr.is-cancelled .x-amount-pos, .x-table tr.is-cancelled .x-amount-neg { color: var(--text-faint) !important; }
/* User-supplied multi-line text: line breaks kept (content always escaped server-side) */
.x-multiline { white-space: pre-line; overflow-wrap: anywhere; }

/* ===================== Situation de caisse ===================== */
.x-situation-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.x-situation-date { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.x-situation-date strong { font-size: var(--fs-md); font-weight: 650; color: var(--text-primary); }
.x-situation-pick { display: flex; align-items: center; gap: 8px; }
.x-situation-pick .form-control { width: auto; }
.x-sit-table { font-variant-numeric: tabular-nums; }
.x-sit-table thead th:first-child, .x-sit-table tbody td:first-child, .x-sit-table tfoot td:first-child { padding-left: 20px; }
.x-sit-table thead th:last-child, .x-sit-table tbody td:last-child, .x-sit-table tfoot td:last-child { padding-right: 20px; }
.x-sit-table td.num, .x-sit-table th.num { width: 22%; min-width: 150px; text-align: right; white-space: nowrap; }
.x-sit-table tbody td { border-bottom: 1px solid var(--border); }
.x-sit-label { display: block; font-weight: 550; color: var(--text-primary); }
.x-sit-hint { display: block; font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 400; white-space: normal; }
.x-sit-empty { color: var(--text-faint); }
.x-sit-opening td { background: var(--surface-muted); }
.x-sit-opening td.num { color: var(--text-secondary); }
.x-sit-table tfoot td { padding: 11px 16px; background: var(--surface); border-top: 1px solid var(--border); font-weight: 600; }
.x-sit-table tfoot .x-sit-total:first-child td { border-top: 1px solid var(--border-strong); }
.x-sit-table tfoot .x-sit-expected td { background: var(--surface-muted); border-top: 1px solid var(--border-strong); font-size: var(--fs-md); font-weight: 700; }
.x-sit-table tfoot .x-sit-expected .x-sit-hint { font-weight: 400; font-size: var(--fs-xs); }
.x-sit-details { padding: 0 20px 16px; font-size: var(--fs-sm); }
.x-sit-details li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.x-sit-details li:last-child { border-bottom: 0; }
.x-sit-details li strong { margin-left: auto; }
.x-cash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.x-cash-grid > div { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); background: var(--surface-muted); }
.x-cash-grid strong { font-size: var(--fs-lg, 1.25rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.x-readonly-amount { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: var(--control-h); padding: 8px 12px; border: 1px solid var(--border); background: var(--surface-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.x-amount-input { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.x-gap-pos { color: var(--success-ink); }
.x-gap-neg { color: var(--danger-ink); }
.x-gap-zero { color: var(--text-secondary); }
.x-gap-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-secondary); }
.x-confirm-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; font-size: var(--fs-base); }
.x-confirm-list dt { font-weight: 500; color: var(--text-secondary); }
.x-confirm-list dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) {
    .x-cash-grid { grid-template-columns: minmax(0, 1fr); }
    .x-sit-table td.num, .x-sit-table th.num { min-width: 112px; width: auto; }
    .x-sit-table thead th:first-child, .x-sit-table tbody td:first-child, .x-sit-table tfoot td:first-child { padding-left: 12px; }
    .x-sit-table thead th:last-child, .x-sit-table tbody td:last-child, .x-sit-table tfoot td:last-child { padding-right: 12px; }
    .x-sit-table { font-size: var(--fs-sm); }
    .x-situation-pick { width: 100%; }
    .x-situation-pick .form-control { flex: 1; }
}
.x-sit-actions { display: flex; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
@media (max-width: 575.98px) { .x-sit-actions .btn { width: 100%; } }
.x-sit-table tbody td:first-child, .x-sit-table tfoot td:first-child { white-space: normal; }
@media (max-width: 575.98px) {
    .x-sit-table td.num, .x-sit-table th.num { min-width: 0; padding-left: 6px; padding-right: 6px; font-size: var(--fs-xs); }
    .x-sit-table thead th { letter-spacing: .03em; }
    .x-sit-table .x-sit-hint { display: none; }
    .x-sit-table tfoot .x-sit-expected td { font-size: var(--fs-sm); }
    .x-sit-details li strong { margin-left: 0; }
}
@media (max-width: 575.98px) {
    .x-sit-table { table-layout: fixed; width: 100%; }
    .x-sit-table thead th:first-child { width: 38%; }
    .x-sit-table td.num, .x-sit-table th.num { width: 31%; }
    .x-sit-table thead th:first-child, .x-sit-table tbody td:first-child, .x-sit-table tfoot td:first-child { padding-left: 10px; padding-right: 4px; }
    .x-sit-table thead th:last-child, .x-sit-table tbody td:last-child, .x-sit-table tfoot td:last-child { padding-right: 10px; }
    .x-sit-table thead th.num { white-space: normal; }
}
@media (max-width: 575.98px) { .x-sit-table .x-sit-label, .x-sit-table tfoot td:first-child { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; } }
@media (min-width: 768px) { .x-hist-table thead th, .x-hist-table tbody td { padding-left: 10px; padding-right: 10px; } .x-hist-table thead th:first-child, .x-hist-table tbody td:first-child { padding-left: 16px; } .x-hist-table thead th:last-child, .x-hist-table tbody td:last-child { padding-right: 16px; } }

/* Reports: KPI row (4 or 5 indicators) */
.x-report-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.x-chart-table summary { cursor: pointer; }
