/* ===== MEION — Dark Mode · Mobile-First ===== */

:root {
    --bg: #0d0e13;
    --bg-card: #16181f;
    --bg-card-hover: #1c1f28;
    --bg-input: #1c1f28;
    --bg-elevated: #1a1c24;

    --sidebar-bg: #111318;

    --border: #22252e;
    --border-light: #2a2d38;

    --text: #e8e9ed;
    --text-secondary: #8b8fa3;
    --text-muted: #565a6e;

    --accent: #c9a55c;
    --accent-light: #dbb86e;
    --accent-bg: rgba(201,165,92,0.10);
    --accent-glow: rgba(201,165,92,0.06);

    --green: #2dd4a0;
    --green-bg: rgba(45,212,160,0.10);
    --red: #f06060;
    --red-bg: rgba(240,96,96,0.08);
    --orange: #f5a623;
    --orange-bg: rgba(245,166,35,0.10);
    --blue: #5b9fe6;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bottomnav-h: 62px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; touch-action: none; }

a { color: var(--accent-light); text-decoration: none; }

/* ===== Mobile Layout ===== */

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom));
}

.sidebar { display: none; }

/* ===== Bottom Nav ===== */

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(var(--bottomnav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 100;
}

.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 14px; color: var(--text-muted);
    text-decoration: none; font-size: 0.62rem; font-weight: 500;
    min-width: 56px; transition: color 0.15s ease;
}

.bottom-nav-item.active { color: var(--accent-light); }

/* ===== Top Bar ===== */

.top-bar {
    padding: 16px; display: flex; align-items: center; gap: 12px;
    background: var(--bg); position: sticky; top: 0; z-index: 50;
}

.page-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.4px; flex: 1; }
.top-bar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.top-bar-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.7rem; color: #111; text-decoration: none; flex-shrink: 0;
    list-style: none; cursor: pointer; border: none;
}
.top-bar-avatar::-webkit-details-marker { display: none; }

.top-user-menu { position: relative; }
.top-user-menu summary { list-style: none; }
.top-user-menu summary::-webkit-details-marker { display: none; }
.top-user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 150px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    padding: 6px;
    display: none;
    z-index: 120;
}
.top-user-menu[open] .top-user-menu-panel { display: flex; flex-direction: column; gap: 4px; }
.top-user-menu-link {
    appearance: none;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
}
.top-user-menu-link:hover {
    background: var(--bg-input);
    color: var(--text);
}
.top-user-menu-button { font-family: var(--font); cursor: pointer; }

.top-notif-menu { position: relative; }
.top-notif-menu summary { list-style: none; }
.top-notif-menu summary::-webkit-details-marker { display: none; }
.top-notif-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}
.top-notif-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 1px solid var(--bg);
}
.top-notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, 70vh);
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    padding: 8px;
    display: none;
    z-index: 150;
}
.top-notif-menu[open] .top-notif-panel { display: block; }
.top-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 2px 2px 6px;
}
.top-notif-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 6px;
}
.top-notif-item strong { color: var(--text); font-size: 0.76rem; }
.top-notif-item span { font-size: 0.72rem; }
.top-notif-source {
    color: var(--text-muted);
    font-size: 0.66rem !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.top-notif-item.severity-high { border-color: rgba(240,96,96,0.45); }
.top-notif-item.severity-medium { border-color: rgba(245,166,35,0.45); }
.top-notif-item.severity-low { border-color: rgba(91,159,230,0.45); }
.top-notif-empty {
    color: var(--text-secondary);
    font-size: 0.76rem;
    padding: 8px;
}

.mobile-more { position: relative; }
.mobile-more summary { list-style: none; }
.mobile-more summary::-webkit-details-marker { display: none; }
.mobile-more-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 10px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 -16px 35px rgba(0,0,0,0.35);
    padding: 8px;
    display: none;
    z-index: 140;
}
.mobile-more[open] .mobile-more-panel { display: flex; flex-direction: column; gap: 4px; }
.mobile-more-panel a,
.mobile-more-panel button {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    font-family: var(--font);
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
}
.mobile-more-panel a:hover,
.mobile-more-panel button:hover {
    background: var(--bg-input);
    color: var(--text);
}

.main-content { flex: 1; display: flex; flex-direction: column; }
.content { padding: 0 16px 24px; flex: 1; }

/* ===== Flash ===== */

.flash-messages { padding: 8px 16px 0; }

.flash {
    padding: 10px 14px; border-radius: var(--radius); font-size: 0.82rem; margin-bottom: 10px;
}

.flash-error { background: var(--red-bg); color: var(--red); }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-info { background: var(--accent-bg); color: var(--accent-light); }

/* ===== Billing Banner ===== */

.billing-banner {
    margin: 10px 16px 0;
    padding: 12px 14px;
    border: 1px solid rgba(245, 166, 35, 0.28);
    border-radius: var(--radius);
    background: var(--orange-bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.billing-banner strong {
    display: block;
    font-size: 0.84rem;
    margin-bottom: 2px;
}

.billing-banner span {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.billing-banner a {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #111;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.billing-banner-canceled,
.billing-banner-unpaid {
    border-color: rgba(240, 96, 96, 0.3);
    background: var(--red-bg);
}

/* ===== Support Ticket Modal ===== */

.support-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    background: rgba(0,0,0,0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.support-modal-overlay[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

.support-modal {
    width: min(100%, 520px);
    max-height: min(720px, calc(100dvh - 24px));
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 70px rgba(0,0,0,0.42);
    transform: translateY(18px);
    transition: transform 0.16s ease;
}

.support-modal-overlay[aria-hidden="false"] .support-modal { transform: translateY(0); }

.support-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--border);
}

.support-modal-header span {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.support-modal-header h2 {
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: 0;
}

.support-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.support-modal-close:hover { color: var(--text); border-color: var(--accent); }

.support-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 18px;
}

.support-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.support-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.support-form label span {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
}

.support-form input,
.support-form select,
.support-form textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.86rem;
    padding: 11px 12px;
    outline: none;
}

.support-form textarea {
    resize: vertical;
    min-height: 126px;
}

.support-form input:focus,
.support-form select:focus,
.support-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.support-form input::placeholder,
.support-form textarea::placeholder { color: var(--text-muted); }

.support-form-hint {
    margin-top: -2px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.support-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 4px;
}

/* ===== Cards ===== */

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px;
}
@media (max-width: 400px) {
    .card { padding: 12px; margin-bottom: 12px; }
}

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header h2 { font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.card-badge {
    font-size: 0.65rem; color: var(--text-muted); background: var(--bg-input);
    padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}

/* ===== KPIs ===== */

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }

.kpi-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 14px 16px;
}

.kpi-card-link {
    display: block; text-decoration: none; color: inherit;
    cursor: pointer; transition: border-color 0.2s, transform 0.15s;
}
.kpi-card-link:hover {
    border-color: var(--accent); transform: translateY(-1px);
}

.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-label { font-size: 0.7rem; color: var(--text-secondary); font-weight: 500; }

.kpi-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.kpi-icon svg { width: 15px; height: 15px; }
.kpi-icon-balance { background: var(--accent-bg); color: var(--accent); }
.kpi-icon-income { background: var(--green-bg); color: var(--green); }
.kpi-icon-expense { background: var(--red-bg); color: var(--red); }
.kpi-icon-recurring { background: var(--orange-bg); color: var(--orange); }
.kpi-icon-invoice { background: var(--accent-bg); color: var(--accent); }
.kpi-card-soon {
    opacity: 0.55;
    cursor: default;
    border-style: dashed;
}

.kpi-value { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 2px; line-height: 1.2; }
.kpi-unit { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }
.kpi-sub { font-size: 0.68rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ===== Badges ===== */

.badge { display: inline-flex; padding: 1px 7px; border-radius: 20px; font-size: 0.65rem; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-neutral { background: var(--bg-input); color: var(--text-muted); }

/* ===== Charts ===== */

.charts-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.chart-card { padding-bottom: 12px; }
.chart-container { position: relative; width: 100%; min-width: 0; height: 220px; }
.chart-container-doughnut { height: 260px; }
.chart-container-polar { height: 280px; }

/* ===== Transactions (mobile cards) ===== */

.tx-list { display: flex; flex-direction: column; }

.tx-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }

.tx-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.75rem;
}
.tx-icon-credit { background: var(--green-bg); color: var(--green); }
.tx-icon-debit { background: var(--red-bg); color: var(--red); }

.tx-details { flex: 1; min-width: 0; overflow: hidden; }
.tx-name {
    font-size: 0.82rem; font-weight: 500; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; display: flex; align-items: center; gap: 5px;
}
.tx-meta {
    font-size: 0.65rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
    margin-top: 2px; overflow: hidden;
}
.tx-amount { font-size: 0.85rem; font-weight: 600; white-space: nowrap; flex-shrink: 0; text-align: right; }

.recurring-badge { width: 14px; height: 14px; border-radius: 50%; background: var(--orange-bg); color: var(--orange); font-size: 0.5rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.category-tag {
    font-size: 0.62rem; padding: 1px 6px; border-radius: 20px;
    background: var(--bg-input); color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 180px; display: inline-block; vertical-align: middle;
}
@media (max-width: 400px) {
    .category-tag { max-width: 120px; }
    .tx-name { font-size: 0.78rem; }
    .tx-amount { font-size: 0.8rem; }
    .tx-icon { width: 28px; height: 28px; font-size: 0.7rem; }
    .tx-item { gap: 8px; padding: 8px 0; }
}
@media (min-width: 900px) {
    .category-tag { max-width: none; }
    .tx-icon { width: 36px; height: 36px; font-size: 0.8rem; }
    .tx-item { gap: 12px; padding: 12px 0; }
    .tx-name { font-size: 0.85rem; }
    .tx-amount { font-size: 0.9rem; }
}

.table-wrapper { display: none; }

/* ===== Utils ===== */

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }

/* ===== Buttons ===== */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius); font-family: var(--font);
    font-size: 0.85rem; font-weight: 500; border: none; cursor: pointer; transition: all 0.15s ease;
}

.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #111; font-weight: 600; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 7px 10px; font-size: 0.8rem; }
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }
.btn-full { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }

.tx-cat-link {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--border); border-radius: var(--radius);
    white-space: nowrap; flex-shrink: 0;
}
.tx-cat-link svg { opacity: .6; }
@media (max-width: 600px) {
    .tx-cat-link span { display: none; }
    .tx-cat-link { padding: 6px 8px; }
}

/* ===== Search ===== */

.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0 12px; flex: 1; max-width: 100%;
    transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; width: 16px; height: 16px; }

.search-input {
    background: none; border: none; color: var(--text); font-family: var(--font);
    font-size: 0.85rem; padding: 9px 0; width: 100%; outline: none;
}
.search-input::placeholder { color: var(--text-muted); }

/* ===== Unified Transactions Toolbar ===== */

.tx-toolbar { margin-bottom: 10px; }

.tx-toolbar-row {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.tx-toolbar-row::-webkit-scrollbar { display: none; }

.tx-toolbar-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 2px;
}

.filter-btn {
    padding: 5px 11px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.filter-btn:hover { border-color: var(--text-muted); color: var(--text); }
.filter-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-light); }

.tx-btn-more { padding: 5px 8px; }
.tx-btn-more.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-light); }

.tx-toolbar-extra[hidden] { display: none !important; }
.tx-toolbar-extra {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
}
.tx-toolbar-extra-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.tx-extra-field {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.tx-extra-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.tx-extra-input {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.72rem;
    width: 130px;
    box-sizing: border-box;
}
.tx-extra-input:focus { outline: none; border-color: var(--accent); }

.tx-extra-select {
    padding: 5px 26px 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.tx-extra-select:hover { border-color: var(--text-muted); color: var(--text); }
.tx-extra-select:focus { outline: none; border-color: var(--accent); }

@media (max-width: 480px) {
    .filter-btn { padding: 4px 9px; font-size: 0.68rem; }
    .tx-toolbar-row { gap: 4px; }
    .tx-toolbar-sep { height: 14px; }
    .tx-btn-more { padding: 4px 7px; }
    .tx-toolbar-extra { padding: 6px 8px; margin-top: 6px; }
    .tx-toolbar-extra-row { gap: 6px; }
    .tx-extra-input { width: 115px; font-size: 0.68rem; padding: 4px 6px; }
    .tx-extra-label { font-size: 0.62rem; }
    .tx-extra-select { font-size: 0.68rem; padding: 4px 22px 4px 8px; max-width: 140px; }
}

/* ===== Analytics ===== */

.scope-switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 14px;
}

.scope-switcher::-webkit-scrollbar { display: none; }

.scope-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 0.70rem;
    font-weight: 500;
    text-decoration: none;
    min-height: 30px;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .scope-pill { padding: 4px 8px; font-size: 0.65rem; min-height: 28px; }
    .scope-switcher { gap: 5px; margin-bottom: 10px; }
}

.scope-pill.active {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-bg);
}

.scope-pill-btn {
    cursor: pointer;
    font-family: var(--font);
}

.scope-switcher form { margin: 0; }
.period-switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 14px;
}
.period-switcher::-webkit-scrollbar { display: none; }

.card-badge-link {
    border: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.card-badge-link:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.scope-card { margin-bottom: 12px; }

/* ── Analytics KPI row ──────────────────────────── */
.an-kpi-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.an-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.an-kpi-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.an-kpi-value { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.an-kpi-sub { font-size: 0.7rem; color: var(--text-muted); }

.an-kpi-btn {
    text-align: left;
    font-family: var(--font);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.an-kpi-btn:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.an-kpi-btn:active { transform: translateY(1px); }

.an-vat-btn {
    text-align: left;
    font-family: var(--font);
    color: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.an-vat-btn:hover { border-color: var(--accent); }

/* ── Analytics 2-col grid ──────────────────────── */
.an-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── TVA Card ──────────────────────────────────── */
.an-vat-card h2 svg,
.an-pnl-card h2 svg { vertical-align: -3px; margin-right: 6px; opacity: 0.7; }

.an-vat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.an-vat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: var(--bg-elevated, var(--bg-card-hover));
    border-radius: var(--radius);
}
.an-vat-label { font-size: 0.72rem; color: var(--text-muted); }
.an-vat-value { font-size: 1.1rem; font-weight: 700; }
.an-vat-hint { font-size: 0.65rem; color: var(--text-muted); }

.an-vat-position {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.an-vat-position-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}
.an-vat-position-value { font-size: 1.15rem; font-weight: 700; }

.an-vat-surplus {
    background: var(--red-bg);
    border: 1px solid rgba(240,96,96,0.2);
}
.an-vat-surplus .an-vat-position-label { color: var(--red); }
.an-vat-surplus .an-vat-position-label svg { stroke: var(--red); }
.an-vat-surplus .an-vat-position-value { color: var(--red); }

.an-vat-credit {
    background: var(--green-bg);
    border: 1px solid rgba(45,212,160,0.2);
}
.an-vat-credit .an-vat-position-label { color: var(--green); }
.an-vat-credit .an-vat-position-label svg { stroke: var(--green); }
.an-vat-credit .an-vat-position-value { color: var(--green); }

.an-vat-disclaimer {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.4;
    opacity: 0.8;
}

/* ── Analytics detail drawer — tx rows ── */
.an-detail-tx-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.an-detail-tx-row[data-an-tx-id] { cursor: pointer; }
.an-detail-tx-row[data-an-tx-id]:hover { background: var(--hover-bg, rgba(255,255,255,0.04)); }
[data-theme="light"] .an-detail-tx-row[data-an-tx-id]:hover { background: rgba(0,0,0,0.03); }

/* ── Coherence card ── */
.an-coherence-card {
    margin-bottom: 16px;
    overflow: hidden;
}
.an-coherence-header {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 14px 18px;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
}
.an-coherence-header:hover {
    background: var(--hover-bg, rgba(255,255,255,0.04));
}
.an-coherence-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.an-coherence-title-row h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    margin: 0;
}
.an-coherence-score-badge {
    font-size: 0.82rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.score-good { background: rgba(34,197,94,0.15); color: #22c55e; }
.score-warn { background: rgba(245,158,11,0.15); color: #f59e0b; }
.score-bad  { background: rgba(239,68,68,0.15); color: #ef4444; }
.an-coherence-summary {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.an-coherence-chevron {
    transition: transform 0.2s;
    margin-left: auto;
}
.an-coherence-header.open .an-coherence-chevron {
    transform: rotate(180deg);
}

.an-coherence-body {
    padding: 0 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.an-coherence-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.45;
}
.an-alert-ok   { background: rgba(34,197,94,0.06); }
.an-alert-warn { background: rgba(245,158,11,0.08); }
.an-alert-error{ background: rgba(239,68,68,0.08); }

.an-alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}
.an-alert-ok .an-alert-icon svg   { stroke: #22c55e; }
.an-alert-warn .an-alert-icon svg { stroke: #f59e0b; }
.an-alert-error .an-alert-icon svg{ stroke: #ef4444; }

.an-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.an-alert-msg {
    font-weight: 600;
    color: var(--text);
}
.an-alert-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── P&L Card ──────────────────────────────────── */
.an-pnl-rows { margin-bottom: 14px; }
.an-pnl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}
.an-pnl-label { font-size: 0.82rem; color: var(--text-muted); }
.an-pnl-value { font-size: 0.92rem; font-weight: 600; }
.an-pnl-total .an-pnl-label { color: var(--text); font-weight: 600; }
.an-pnl-total .an-pnl-value { font-size: 1.05rem; font-weight: 700; }
.an-pnl-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.an-pnl-bar-wrap { margin-top: 4px; }
.an-pnl-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--red-bg);
    overflow: hidden;
    margin-bottom: 6px;
}
.an-pnl-bar-rev {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.an-pnl-bar-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    font-weight: 500;
}

/* ── Compact recurring for analytics ───────────── */
.an-recurring-compact .recurring-item { padding: 8px 0; }
.an-recurring-compact .recurring-merchant { font-size: 0.82rem; }
.an-recurring-compact .recurring-freq { font-size: 0.7rem; }
.an-recurring-compact .recurring-amount .amount { font-size: 0.85rem; }

.an-see-more {
    text-align: center;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ── Legacy compat (kept for drawers) ─────────── */
.tab-kpi-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.tab-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tab-kpi-label { font-size: 0.72rem; color: var(--text-muted); }
.tab-kpi-value { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.tab-kpi-btn {
    text-align: left;
    font-family: var(--font);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.tab-kpi-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.tab-kpi-btn:active { transform: translateY(1px); }

.leak-item-btn {
    width: 100%;
    text-align: left;
    font-family: var(--font);
    color: inherit;
    cursor: pointer;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    padding: 12px 8px;
    margin: 0 -8px;
    border-radius: var(--radius-sm);
}
.leak-item-btn:hover { background: var(--bg-card-hover); }
.leak-item-btn:last-child { border-bottom: none; }

/* ── Business flow intelligence ───────────────────── */
.flow-intel-card {
    border-color: #2a2f3d;
    background:
        radial-gradient(120% 150% at 0% 0%, rgba(45,212,160,0.07) 0%, rgba(45,212,160,0.01) 40%, transparent 70%),
        linear-gradient(160deg, #151922 0%, #12151c 100%);
}

.flow-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.flow-kpi-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: rgba(12, 14, 20, 0.45);
}
.flow-kpi-btn {
    text-align: left;
    color: inherit;
    font-family: var(--font);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.flow-kpi-btn:hover {
    border-color: var(--accent);
    background: rgba(20, 24, 33, 0.72);
}
.flow-kpi-btn:active { transform: translateY(1px); }

.flow-kpi-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-bottom: 4px;
}

.flow-kpi-value {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.flow-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.flow-section h3 {
    font-size: 0.78rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.flow-row { margin-bottom: 8px; }

.flow-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.flow-row-top strong {
    color: var(--text);
    font-size: 0.74rem;
}

.flow-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}

.flow-fill {
    display: block;
    height: 100%;
    min-width: 2%;
    border-radius: inherit;
}

.flow-client { background: linear-gradient(90deg, #2dd4a0, #65e8c0); }
.flow-supplier { background: linear-gradient(90deg, #f06060, #ff8c8c); }
.flow-payroll { background: linear-gradient(90deg, #f97316, #fb923c); }
.flow-taxes { background: linear-gradient(90deg, #f5a623, #f7bf57); }
.flow-credit { background: linear-gradient(90deg, #a78bfa, #c4b5fd); }
.flow-fees { background: linear-gradient(90deg, #ef4444, #f87171); }
.flow-subscriptions { background: linear-gradient(90deg, #5b9fe6, #8abcf0); }
.flow-transfer { background: linear-gradient(90deg, #22c55e, #4ade80); }
.flow-refund { background: linear-gradient(90deg, #10b981, #34d399); }
.flow-other { background: linear-gradient(90deg, #6b7280, #9ca3af); }

/* ── Dashboard Hero ─────────────────────────────── */

.dash-hero {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    background:
        radial-gradient(ellipse 130% 160% at 0% 0%, rgba(201,165,92,0.13) 0%, rgba(201,165,92,0.03) 40%, transparent 70%),
        linear-gradient(160deg, #171a23 0%, #12141b 100%);
}

.dash-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.dash-hero-eyebrow {
    display: inline-block;
    font-size: 0.65rem;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dash-hero-balance {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1.2px;
    line-height: 1.1;
}

.dash-hero-sub {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dash-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
}

.dash-trend-up {
    background: var(--green-bg);
    color: var(--green);
}

.dash-trend-down {
    background: var(--red-bg);
    color: var(--red);
}

.dash-hero-sparkline {
    height: 72px;
    margin: 12px -4px 16px;
    position: relative;
}

.dash-hero-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.dash-hero-metric {
    padding: 10px 12px;
    background: rgba(13,14,19,0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-hero-metric-label {
    color: var(--text-muted);
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

.dash-hero-metric strong {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.dash-hero-metric-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.15s ease;
}
.dash-hero-metric-link:hover {
    border-color: var(--accent);
    background: rgba(201,165,92,0.06);
}

.dash-hero-metric small {
    color: var(--text-secondary);
    font-size: 0.68rem;
}

/* ── Spending Breakdown ────────────────────────── */

.dash-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.spending-card { margin-bottom: 0; }
.actions-card { margin-bottom: 0; }

.spending-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.dash-cat-list {
    gap: 8px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}
.dash-cat-list .spending-name { font-size: 0.75rem; }
.dash-cat-list .spending-amount { font-size: 0.72rem; }
.dash-cat-list .spending-bar { height: 3px; }

.spending-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.spending-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spending-name {
    font-size: 0.82rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spending-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.spending-amount {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.spending-row-btn {
    border-radius: var(--radius-sm);
    padding: 8px;
    margin: -8px;
    margin-bottom: 0;
    transition: background 0.15s ease;
}
.spending-row-btn:hover {
    background: var(--bg-card-hover);
}

.spending-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
}

.spending-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.5s ease;
}

/* ── Burn KPI icon ─────────────────────────────── */

.kpi-icon-burn {
    background: rgba(245,166,35,0.10);
    color: var(--orange);
}

/* Legacy analytics-hero compat */
.analytics-hero {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    background:
        radial-gradient(120% 150% at 0% 0%, rgba(91,159,230,0.15) 0%, rgba(91,159,230,0.03) 35%, transparent 60%),
        linear-gradient(160deg, #171a23 0%, #12141b 100%);
}

.analytics-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.analytics-hero-top h2 {
    font-size: 0.98rem;
    line-height: 1.2;
    margin-bottom: 3px;
}

.analytics-hero-top p {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.analytics-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 12px;
    background: rgba(13,14,19,0.46);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.metric-sub {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.analytics-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.analytics-grid-revamp { margin-bottom: 12px; }

.recurring-list { display: flex; flex-direction: column; }
.recurring-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.recurring-item:last-child { border-bottom: none; }
.recurring-item-btn {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    color: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.recurring-item-btn:hover { background: var(--bg-card-hover); }
.recurring-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.recurring-merchant { font-weight: 500; font-size: 0.85rem; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.recurring-freq { font-size: 0.68rem; color: var(--text-muted); }
.recurring-amount { text-align: right; display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.recurring-amount .amount { font-weight: 600; font-size: 0.85rem; }
.amount-unit { font-weight: 400; font-size: 0.68rem; color: var(--text-muted); }
.recurring-total { font-size: 0.68rem; }

/* Leaks */
.leaks-card .card-header h2 { color: var(--orange); }
.leaks-list { display: flex; flex-direction: column; }
.leak-item {
    display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    border-radius: var(--radius-sm);
}
a.leak-item { padding: 12px 8px; margin: 0 -8px; }
a.leak-item:hover { background: var(--bg-card-hover); }
.leak-item:last-child { border-bottom: none; }
.leak-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.leak-severity { font-size: 0.7rem; font-weight: 500; display: flex; align-items: center; gap: 5px; }
.severity-dot { width: 7px; height: 7px; border-radius: 50%; }
.severity-high { background: var(--red); }
.severity-medium { background: var(--orange); }
.severity-low { background: var(--blue); }
.leak-message { font-weight: 500; font-size: 0.82rem; overflow-wrap: anywhere; word-break: break-word; }
.leak-type { font-size: 0.68rem; color: var(--text-muted); }
.leak-cost { font-weight: 600; font-size: 0.82rem; }
.empty-inline { color: var(--text-secondary); font-size: 0.78rem; padding: 8px 0; }

/* Forecasts */
.forecast-card { margin-bottom: 16px; }
.forecast-disclaimer { font-size: 0.74rem; margin-bottom: 10px; }
.forecast-projections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.forecast-pill {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.forecast-pill-btn {
    text-align: left;
    font-family: var(--font);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.forecast-pill-btn:hover {
    border-color: var(--accent);
    background: rgba(201,165,92,0.06);
}
.forecast-pill-btn:active { transform: translateY(1px); }
.forecast-pill.is-critical {
    border-color: rgba(240, 96, 96, 0.45);
    background: rgba(240, 96, 96, 0.08);
}
.forecast-pill-label {
    color: var(--text-muted);
    font-size: 0.68rem;
}
.forecast-pill-value {
    font-size: 1rem;
    font-weight: 700;
}
.forecast-pill-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
}
.forecast-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.forecast-toolbar .text-muted {
    font-size: 0.7rem;
}
.forecast-snapshot {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.forecast-snapshot-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.forecast-snapshot-item strong { font-size: 0.76rem; }
.forecast-snapshot-item span { font-size: 0.72rem; color: var(--text-secondary); }
.forecast-alerts,
.forecast-timeline,
.forecast-notifications {
    margin-top: 12px;
}
.forecast-timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.forecast-count { font-size: 0.72rem; }
.forecast-type-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.forecast-type-filters::-webkit-scrollbar { display: none; }
.forecast-type-filters .filter-btn { font-size: 0.72rem; padding: 5px 12px; }
.forecast-alerts h3,
.forecast-timeline h3,
.forecast-notifications h3 {
    font-size: 0.8rem;
    margin-bottom: 6px;
}
.forecast-event-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: inherit;
}
.forecast-event-btn:hover { background: rgba(255, 255, 255, 0.02); }
.forecast-type-tag {
    display: inline-flex;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.62rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
    vertical-align: 1px;
}
.forecast-type-vat { border-color: rgba(91,159,230,0.45); color: #8cb8ea; }
.forecast-type-charges { border-color: rgba(245,166,35,0.45); color: #f3be6a; }
.forecast-type-subscription { border-color: rgba(45,212,160,0.45); color: #7be8c1; }
.forecast-alert,
.forecast-notification {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px;
    background: var(--bg-elevated);
    margin-bottom: 8px;
}
.forecast-alert-title { font-size: 0.77rem; font-weight: 600; }
.forecast-alert-message { font-size: 0.73rem; color: var(--text-secondary); }
.forecast-notification p {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 2px 0;
}
.forecast-alert.severity-high,
.forecast-notification.severity-high { border-color: rgba(240,96,96,0.45); }
.forecast-alert.severity-medium,
.forecast-notification.severity-medium { border-color: rgba(245,166,35,0.45); }
.forecast-alert.severity-low,
.forecast-notification.severity-low { border-color: rgba(91,159,230,0.45); }

.forecast-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}
.forecast-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}
.forecast-event-explanation {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--bg-input);
}
.forecast-event-explanation h4 {
    font-size: 0.78rem;
    margin-bottom: 4px;
}
.forecast-event-explanation p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

/* ===== Audit ===== */

.audit-page { max-width: 1000px; margin: 0 auto; padding-bottom: 18px; }
.audit-hero { margin-bottom: 12px; }
.audit-hero h2 { font-size: 0.95rem; margin-bottom: 4px; }
.audit-hero p { font-size: 0.76rem; color: var(--text-secondary); }
.audit-filters-card { margin-bottom: 12px; }
.audit-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.audit-filters .form-group { gap: 6px; }
.audit-filters .form-group label {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.audit-filters .form-group input,
.audit-filters .form-group select {
    width: 100%;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    padding: 9px 10px;
}
.audit-filters .form-group input:focus,
.audit-filters .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.audit-filters-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.audit-filters-actions .btn { width: 100%; }
.audit-list { display: flex; flex-direction: column; gap: 6px; }
.audit-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    overflow: hidden;
    transition: border-color .15s;
}
.audit-row[open] { border-color: var(--accent); }
.audit-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    padding: 12px 14px;
    transition: background .1s;
}
.audit-summary:hover { background: var(--bg-hover, rgba(255,255,255,0.03)); }
.audit-summary::-webkit-details-marker { display: none; }
.audit-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.audit-action-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.audit-meta { color: var(--text-muted); font-size: 0.72rem; line-height: 1.4; }
.audit-meta strong { color: var(--text-secondary); font-weight: 500; }
.audit-details {
    border-top: 1px solid var(--border);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    background: var(--bg);
}
.audit-detail-row {
    display: flex; gap: 8px; align-items: baseline;
}
.audit-detail-label {
    font-weight: 600; color: var(--text-muted); min-width: 90px; flex-shrink: 0; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: .3px;
}
.audit-detail-meta { flex-direction: column; }
.audit-meta-pre {
    margin-top: 4px;
    background: rgba(13,14,19,0.62);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    overflow: auto;
    font-size: 0.7rem;
    color: var(--text);
    max-height: 200px;
}

.subscription-drawer {
    position: fixed;
    inset: 0;
    z-index: 180;
    pointer-events: none;
}

.subscription-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 15, 0.55);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.subscription-panel {
    position: absolute;
    inset: 0;
    max-height: 100dvh;
    background: var(--bg-card);
    border-top: none;
    border-radius: 0;
    padding: 10px 14px calc(14px + var(--safe-bottom));
    overflow-y: auto;
    transform: translateY(105%);
    transition: transform 0.24s ease, opacity 0.24s ease;
    box-shadow: none;
}

.subscription-drawer.open {
    pointer-events: auto;
}

.subscription-drawer.open .subscription-backdrop {
    opacity: 1;
}

.subscription-drawer.open .subscription-panel {
    transform: translateY(0);
}

.subscription-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    position: sticky;
    top: -10px;
    background: linear-gradient(180deg, rgba(22,24,31,0.98) 0%, rgba(22,24,31,0.93) 100%);
    padding: 6px 0 8px;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.subscription-panel-header h3 {
    font-size: 1rem;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.subscription-panel-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-light);
    margin: 2px auto 8px;
}

.subscription-panel-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.subscription-panel-meta div {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subscription-panel-meta strong {
    font-size: 0.85rem;
    line-height: 1.25;
}

.subscription-panel-meta-filters { grid-template-columns: 1fr; }

.subscription-filter-input {
    background: transparent;
    padding: 4px 0;
    appearance: none;
}

.subscription-panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.subscription-timeline h4 {
    font-size: 0.82rem;
    margin: 8px 0;
}

.timeline-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.timeline-row:last-child {
    border-bottom: none;
}

.timeline-main {
    min-width: 0;
    flex: 1;
}

.timeline-date {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.timeline-desc {
    font-size: 0.78rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.timeline-amount {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.candidate-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 520px) {
    .candidate-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .candidate-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ===== Banking ===== */

.accounts-list { display: flex; flex-direction: column; gap: 12px; }

.account-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}

.account-top { display: flex; align-items: center; gap: 12px; }

.account-bank-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-bg), var(--accent-glow));
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem; color: var(--accent-light); flex-shrink: 0;
    overflow: hidden;
}
.account-bank-logo { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.scope-pill-logo {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    object-fit: contain;
    background: #fff;
    margin-right: 6px;
    vertical-align: -2px;
}

.account-info { flex: 1; min-width: 0; }
.account-bank-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-iban { font-size: 0.68rem; color: var(--text-muted); font-family: 'SF Mono', monospace; }
.account-balance { font-size: 1.15rem; font-weight: 700; text-align: right; }
.account-actions { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.account-actions .btn { flex: 1; }
.account-sync-status { display: flex; align-items: center; gap: 6px; justify-content: center; padding-top: 6px; }
.account-sync-date { font-size: 0.65rem; color: var(--text-muted); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sync-fresh { background: #22c55e; box-shadow: 0 0 4px rgba(34, 197, 94, 0.5); }
.sync-stale { background: #f59e0b; box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
.sync-old { background: #ef4444; box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
.sync-label { font-size: 0.62rem; font-weight: 500; }
.sync-fresh-label { color: #22c55e; }
.sync-stale-label { color: #f59e0b; }
.sync-old-label { color: #ef4444; }
.accounting-help { font-size: 0.75rem; margin-bottom: 10px; }
.accounting-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.accounting-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.accounting-panel {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
}
.accounting-panel h3 { font-size: 0.82rem; margin-bottom: 8px; }
.accounting-candidates-filters { margin-bottom: 8px; }
.accounting-list { max-height: 380px; overflow: auto; }
.accounting-draft-row .candidate-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Banks grid */
.banks-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.bank-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 14px 16px; display: flex; align-items: center; gap: 14px;
    cursor: pointer; transition: all 0.15s ease; width: 100%; text-align: left;
    font-family: var(--font); color: var(--text);
}
.bank-card:hover { border-color: var(--accent); }

.bank-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: var(--text); flex-shrink: 0;
}

.bank-details { flex: 1; }
.bank-name { font-weight: 600; font-size: 0.85rem; }
.bank-country { font-size: 0.68rem; color: var(--text-muted); }
.bank-arrow { color: var(--text-muted); flex-shrink: 0; }

/* Empty */
.empty-state {
    text-align: center; padding: 60px 20px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 40vh; color: var(--text-secondary);
}
.empty-state-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--accent-light); }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 20px; max-width: 300px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* ===== Présentation de fonctionnalité (état vide pédagogique) ===== */
.feature-intro { padding: 22px; }
.feature-intro-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}
.feature-intro-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    background: rgba(91,159,230,0.14);
    color: var(--blue);
}
.feature-intro-icon--accent { background: var(--accent-bg); color: var(--accent-light); }
.feature-intro-icon--green { background: var(--green-bg); color: var(--green); }
.feature-intro-icon svg { width: 22px; height: 22px; }
.feature-intro-text { min-width: 0; }
.feature-intro-text h2 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 4px;
    color: var(--text);
}
.feature-intro-text p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.feature-intro-illu {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 16px;
}
.feature-intro-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.feature-intro-row-num {
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted); letter-spacing: 0.4px;
    white-space: nowrap;
}
.feature-intro-row-amount {
    font-size: 0.82rem; font-weight: 700; color: var(--text);
    text-align: right;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feature-intro-tag {
    font-size: 0.66rem; font-weight: 700;
    padding: 4px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
    white-space: nowrap;
}
.feature-intro-tag svg { width: 11px; height: 11px; }
.feature-intro-tag--paid { background: var(--green-bg); color: var(--green); }
.feature-intro-tag--wait { background: var(--orange-bg); color: var(--orange); }
.feature-intro-tag--late { background: var(--red-bg); color: var(--red); }

.feature-intro-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.feature-intro-point {
    display: flex; flex-direction: column; gap: 2px;
    padding: 11px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}
.feature-intro-point strong {
    font-size: 0.78rem; font-weight: 700; color: var(--text);
}
.feature-intro-point span {
    font-size: 0.7rem; color: var(--text-muted); line-height: 1.4;
}

.feature-intro-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}
.feature-intro-secondary {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.74rem;
    padding: 4px;
}
.feature-intro-secondary:hover { color: var(--text-secondary); }

@media (max-width: 540px) {
    .feature-intro-points { grid-template-columns: 1fr; }
    .feature-intro-row {
        grid-template-columns: 1fr auto;
        gap: 4px 10px;
    }
    .feature-intro-row-num { grid-column: 1; grid-row: 1; }
    .feature-intro-row-amount { grid-column: 1; grid-row: 2; text-align: left; }
    .feature-intro-tag { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* ====== Tuiles "bénéfice en un regard" sur /banking/ ====== */
.banking-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 4px;
}
@media (min-width: 820px) {
    .banking-features { grid-template-columns: 1fr 1fr; gap: 18px; }
}

.feature-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    display: flex; flex-direction: column; gap: 14px;
}
.feature-tile-head {
    display: flex; align-items: center; gap: 12px;
}
.feature-tile-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px;
    display: grid; place-items: center;
    background: rgba(91,159,230,0.14);
    color: var(--blue);
}
.feature-tile-icon--accent { background: var(--accent-bg); color: var(--accent-light); }
.feature-tile-icon svg { width: 22px; height: 22px; }
.feature-tile-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}
.feature-tile-text {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ===== Illustrations narratives (réutilisées depuis l'onboarding) ===== */
.pay-illu {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    min-width: 0;
}
.pay-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 0;
}
.pay-row-num {
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted); letter-spacing: 0.4px;
    white-space: nowrap;
}
.pay-row-amount {
    font-size: 0.78rem; font-weight: 700; color: var(--text);
    text-align: right;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pay-tag {
    font-size: 0.66rem; font-weight: 700;
    padding: 4px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px;
    white-space: nowrap;
}
.pay-tag svg { width: 11px; height: 11px; }
.pay-tag--paid { background: var(--green-bg); color: var(--green); }
.pay-tag--wait { background: var(--orange-bg); color: var(--orange); }
.pay-tag--late { background: var(--red-bg); color: var(--red); }

/* Variante "écran de paiement Stripe" */
.pay-illu--stripe { gap: 10px; padding: 14px; position: relative; }
.pay-illu-tag {
    position: absolute;
    top: 10px; right: 10px;
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text) 8%, transparent);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    pointer-events: none;
    z-index: 1;
}
.pay-screen {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 14px;
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.pay-screen-amount {
    font-size: 1.4rem; font-weight: 800;
    line-height: 1.1; letter-spacing: -0.5px;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pay-screen-status {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 1.05rem; font-weight: 800;
    line-height: 1.15; letter-spacing: -0.2px;
    color: var(--text);
    min-width: 0;
}
.pay-screen-status svg {
    width: 16px; height: 16px;
    color: var(--accent);
    flex-shrink: 0;
}
.pay-screen-label {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 2px;
}
.pay-screen-meta {
    display: inline-flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 0.66rem; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.pay-screen-pill {
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    font-weight: 700; letter-spacing: 0.4px;
}
.pay-screen-sep { opacity: 0.6; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-method {
    border: 1px solid var(--border);
    background: var(--bg-input);
    border-radius: 10px;
    padding: 9px;
    font-size: 0.74rem; font-weight: 700;
    color: var(--text);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 36px; min-width: 0;
}
.pay-method svg { width: 13px; height: 13px; flex-shrink: 0; }
.pay-cta-mock {
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.2px;
    padding: 10px 12px;
}
.pay-cta-mock svg { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.85; }

/* ===== Bande "Compatible avec" (logos discrets) ===== */
.brand-strip {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 2px;
    flex-wrap: wrap;
}
.brand-strip-label {
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted);
    white-space: nowrap;
}
.brand-strip-logos {
    display: flex; align-items: center; gap: 12px;
    flex: 1; flex-wrap: wrap;
}
.brand-strip-logos img {
    height: 16px; width: auto; max-width: 80px;
    object-fit: contain;
    filter: brightness(0) invert(1) opacity(0.55);
    transition: opacity 0.2s ease, filter 0.2s ease;
}
.brand-strip-logos img:hover {
    filter: brightness(0) invert(1) opacity(0.85);
}
[data-theme="light"] .brand-strip-logos img {
    filter: brightness(0) opacity(0.45);
}
[data-theme="light"] .brand-strip-logos img:hover {
    filter: brightness(0) opacity(0.75);
}
.brand-strip-more {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted); letter-spacing: 0.2px;
}

/* Variante : moyens de paiement (logos colorés sur pastilles blanches) */
.brand-strip--methods .brand-strip-logos { gap: 6px; }
.brand-strip--methods .brand-pay-pill {
    background: #fff;
    border-radius: 6px;
    height: 22px; min-width: 38px;
    display: grid; place-items: center;
    padding: 2px 7px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.brand-strip--methods .brand-pay-pill svg {
    height: 14px; width: auto; max-width: 44px;
    display: block;
}
.brand-strip--methods .brand-pay-pill--amex { background: #006FCF; }

/* Signature Stripe (wordmark stylisé en couleur de marque) */
.stripe-wordmark {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-style: italic;
    font-weight: 800;
    color: #635BFF;
    letter-spacing: -0.4px;
    margin-left: 2px;
}

.feature-tile-cta {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #111 !important;
    font-weight: 700; font-size: 0.88rem;
    border: none; cursor: pointer;
    width: 100%;
    text-decoration: none;
}
.feature-tile-cta:hover { filter: brightness(1.05); }
.feature-tile-cta:disabled { opacity: 0.6; cursor: not-allowed; }
.feature-tile-note {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: -4px;
}

/* ====== Statut compact (Stripe déjà connecté) ====== */
.connect-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.connect-row--promo {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 6%, var(--bg-card)),
        var(--bg-card) 60%);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}
.connect-row-icon {
    flex-shrink: 0;
    border-radius: 10px;
    display: grid; place-items: center;
    background: #fff;
    padding: 6px 12px;
    height: 36px;
}
.connect-row-icon--accent {
    width: 36px; padding: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #111;
}
[data-theme="light"] .connect-row-icon--accent { color: #fff; }
.connect-row-icon--accent svg { width: 18px; height: 18px; }
.connect-row-icon .stripe-wordmark {
    font-size: 1.05rem;
    margin-left: 0;
}
.connect-row-text {
    flex: 1; min-width: 160px;
    display: flex; flex-direction: column; gap: 2px;
}
.connect-row-text strong {
    font-size: 0.88rem; color: var(--text);
}
.connect-row-text span {
    font-size: 0.72rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.connect-row-badge {
    font-size: 0.7rem; font-weight: 700;
    padding: 5px 10px; border-radius: 999px;
    white-space: nowrap;
}
.connect-row-badge--ok { background: var(--green-bg); color: var(--green); }
.connect-row-badge--warn { background: var(--orange-bg); color: var(--orange); }
.connect-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (min-width: 600px) {
    .feature-intro { padding: 28px; }
    .feature-intro-actions {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
    .feature-intro-actions .btn-primary { flex: 0 0 auto; min-width: 220px; }
    .feature-intro-secondary { padding: 0 8px; }
}

/* ===== Auth Pages ===== */

.auth-page {
    min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg); padding: 24px 20px;
    position: relative; overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute; top: -120px; left: -80px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(201,165,92,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-container { width: 100%; max-width: 380px; position: relative; z-index: 1; }

.auth-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 32px 24px;
}

.auth-header { text-align: center; margin-bottom: 28px; }

.logo { display: flex; align-items: center; gap: 10px; }

.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #c9a55c, #e8c97a, #b89350);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.15rem; color: #111;
}

.logo-text { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.5px; }

.auth-header .logo { justify-content: center; margin-bottom: 14px; }
.auth-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--accent-light);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}
.auth-title {
    margin: 0 0 8px;
    font-size: 1.35rem;
    line-height: 1.2;
    font-weight: 800;
}
.auth-subtitle { color: var(--text-secondary); font-size: 0.85rem; }
.auth-subtitle strong { color: var(--text); font-weight: 700; }

.auth-flow-note {
    display: grid;
    gap: 4px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
}
.auth-flow-note strong {
    color: var(--text);
    font-size: 0.8rem;
}
.auth-flow-note span {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.45;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); }

.input-wrapper {
    position: relative; display: flex; align-items: center;
}

.form-group input {
    padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-input); color: var(--text); font-family: var(--font);
    font-size: 0.88rem; outline: none; width: 100%; transition: border-color 0.2s;
}

.form-group select {
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
    appearance: none;
}

.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-group input::placeholder { color: var(--text-muted); }

.input-wrapper input { padding-right: 42px; }

.toggle-password {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 2px; display: flex; align-items: center; justify-content: center;
}
.toggle-password:hover { color: var(--text-secondary); }

.auth-footer { text-align: center; margin-top: 22px; font-size: 0.82rem; color: var(--text-secondary); }
.auth-footer p { margin: 8px 0; }
.auth-inline-form { margin-top: 12px; text-align: center; }
.auth-link-button {
    border: none;
    background: transparent;
    color: var(--accent-light);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 4px 6px;
}
.auth-link-button:hover { color: var(--accent); }
.otp-code-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}
.otp-code-grid .otp-digit {
    aspect-ratio: 1;
    padding: 0;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.auth-divider {
    display: flex; align-items: center; gap: 12px; margin-top: 20px;
    font-size: 0.72rem; color: var(--text-muted);
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-test {
    margin-top: 12px; width: 100%; padding: 11px;
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-secondary); font-family: var(--font); font-size: 0.82rem;
    font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.btn-test:hover { border-color: var(--accent); color: var(--accent-light); background: var(--accent-bg); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h2 { font-size: 0.92rem; font-weight: 600; }

/* ===== Users Management ===== */

.users-page { max-width: 1100px; margin: 0 auto; padding-bottom: 20px; }

.users-hero {
    margin-bottom: 14px;
    background:
        radial-gradient(120% 130% at 100% 0%, rgba(201,165,92,0.18) 0%, rgba(201,165,92,0.04) 40%, transparent 72%),
        linear-gradient(160deg, #181b25 0%, #12151d 100%);
}

.users-hero h2 { font-size: 1rem; margin-bottom: 4px; letter-spacing: -0.2px; }
.users-hero p { color: var(--text-secondary); font-size: 0.78rem; margin-bottom: 12px; }

.users-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.users-kpi {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(13,14,19,0.45);
    padding: 9px 10px;
}

.users-kpi span {
    display: block;
    color: var(--text-muted);
    font-size: 0.66rem;
    margin-bottom: 2px;
}

.users-kpi strong {
    font-size: 1rem;
    letter-spacing: -0.3px;
}

.users-layout { display: grid; gap: 12px; }
.users-create-card { margin-bottom: 0; order: 2; }
.users-list-card { margin-bottom: 0; order: 1; }
.users-helper { color: var(--text-secondary); font-size: 0.75rem; margin: -4px 0 12px; }

.account-settings-card {
    max-width: 760px;
    margin: 0 auto 14px;
}

.account-compact-card {
    max-width: 620px;
    margin: 0 auto 14px;
}

.account-compact-card-last {
    margin-bottom: 0;
}

.account-settings-card .card-header,
.account-compact-card .card-header {
    gap: 10px;
    min-width: 0;
}

.account-settings-card .card-header h2,
.account-compact-card .card-header h2 {
    min-width: 0;
}

.account-settings-card .card-badge,
.account-compact-card .card-badge {
    max-width: min(260px, 52%);
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-profile-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.account-profile-section {
    position: relative;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.account-profile-section:first-child {
    padding-top: 0;
    border-top: 0;
}

.account-section-title {
    display: inline-flex;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-search-wrap {
    position: relative;
}

.account-search-results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(230px, 45vh);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: 0 14px 30px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.account-search-results.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.account-search-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
}

.account-search-item:last-child { border-bottom: 0; }
.account-search-item:hover { background: var(--bg-card-hover); }
.account-search-item strong { font-size: 0.82rem; font-weight: 650; }
.account-search-item span,
.account-search-empty {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.account-search-empty {
    padding: 11px 12px;
    text-align: center;
}

.account-derived-settings {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.account-derived-settings > div {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
}

.account-derived-settings span {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.account-derived-settings strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 599px) {
    .account-derived-settings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 400px) {
    .account-settings-card .card-header,
    .account-compact-card .card-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .account-settings-card .card-badge,
    .account-compact-card .card-badge {
        max-width: 100%;
    }

    .account-profile-section {
        padding: 12px 0;
    }
}

.users-list { display: flex; flex-direction: column; gap: 10px; }

.user-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    padding: 11px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-row.is-inactive {
    border-style: dashed;
    opacity: 0.9;
}

.user-row-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.user-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.dot-active { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.dot-inactive { background: var(--red); box-shadow: 0 0 0 4px var(--red-bg); }

.user-main strong {
    font-size: 0.84rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.user-meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.user-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }

.role-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.role-form select,
.reset-form input {
    min-width: 0;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
}

.role-form select:focus,
.reset-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.reset-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.reset-box summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.reset-box summary::-webkit-details-marker { display: none; }

.reset-box[open] summary {
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.reset-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
}

.reset-form .input-wrapper input {
    padding-right: 52px;
}

.reset-form .toggle-password,
.users-create-card .toggle-password {
    right: 10px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.reset-form .toggle-password:hover,
.users-create-card .toggle-password:hover {
    color: var(--accent-light);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Onboarding ===== */

.onboarding-wrap { max-width: 760px; margin: 0 auto; padding-bottom: 20px; }

.onboarding-hero {
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(91,159,230,0.2) 0%, rgba(91,159,230,0.05) 38%, transparent 72%),
        linear-gradient(160deg, #181c27 0%, #12141c 100%);
}

.onboarding-step {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--accent-light);
    font-size: 0.66rem;
    margin-bottom: 8px;
    background: rgba(201,165,92,0.08);
}

.onboarding-hero h2 { font-size: 1.02rem; margin-bottom: 4px; letter-spacing: -0.3px; }
.onboarding-hero p { color: var(--text-secondary); font-size: 0.78rem; max-width: 56ch; }

.onboarding-form { margin-bottom: 0; }
.onboarding-grid { display: grid; gap: 14px; }
.onboarding-submit { margin-top: 8px; min-height: 46px; font-size: 0.9rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.kpi-card, .card, .account-card, .bank-card { animation: fadeIn 0.2s ease forwards; }
.kpi-card:nth-child(2) { animation-delay: 0.03s; }
.kpi-card:nth-child(3) { animation-delay: 0.06s; }
.kpi-card:nth-child(4) { animation-delay: 0.09s; }

/* ============= TABLET 600px+ ============= */
@media (min-width: 600px) {
    .banks-grid { grid-template-columns: 1fr 1fr; }
    .chart-container { height: 260px; }
    .analytics-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-hero-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-hero-balance { font-size: 2.4rem; }
    .dash-hero-sparkline { height: 90px; }
    .dash-split { grid-template-columns: 1fr 1fr; }
    .subscription-panel-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .subscription-panel-meta-filters { grid-template-columns: 1fr 1fr; }
    .onboarding-grid { grid-template-columns: 1fr 1fr; }
    .user-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .audit-filters {
        grid-template-columns: 1.2fr 1fr 1fr;
    }
    .audit-filters .form-group:nth-child(4),
    .audit-filters .form-group:nth-child(5),
    .audit-filters-actions {
        grid-column: span 1;
    }
    .audit-summary { padding: 12px; }
    .forecast-projections { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .forecast-snapshot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .forecast-form { grid-template-columns: 1fr 1fr; }
    .forecast-form .btn { grid-column: 1 / -1; justify-self: start; }
}

/* ============= DESKTOP 900px+ ============= */
@media (min-width: 900px) {
    :root { --sidebar-width: 240px; }
    .app-layout { flex-direction: row; padding-bottom: 0; }

    .sidebar {
        display: flex; flex-direction: column; width: var(--sidebar-width);
        background: var(--sidebar-bg); position: fixed; top: 0; left: 0; bottom: 0;
        z-index: 100; overflow: hidden; border-right: 1px solid var(--border);
    }
    .sidebar::before {
        content: ''; position: absolute; top: -50px; left: -50px;
        width: 300px; height: 220px;
        background: radial-gradient(ellipse at top left, rgba(201,165,92,0.12) 0%, transparent 70%);
        pointer-events: none; z-index: 0;
    }
    .sidebar > * { position: relative; z-index: 1; }
    .bottom-nav { display: none; }
    .main-content { margin-left: var(--sidebar-width); }
    .content { padding: 24px 28px; }
    .top-bar { padding: 16px 28px; border-bottom: 1px solid var(--border); }
    .flash-messages { padding: 12px 28px 0; }
    .billing-banner { margin: 12px 28px 0; }

    .sidebar-header { padding: 22px 20px; display: flex; align-items: center; }
    .sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
    .nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 14px; border-radius: var(--radius); color: var(--text-muted); font-size: 0.85rem; font-weight: 500; transition: all 0.15s; text-decoration: none; }
    .nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-secondary); }
    .nav-item.active { background: var(--accent-bg); color: var(--accent-light); }
    .nav-item.active svg { stroke: var(--accent-light); }

    .sidebar-footer { padding: 14px 10px; border-top: 1px solid var(--border); }
    .user-menu {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: rgba(13, 14, 19, 0.45);
        margin-bottom: 6px;
        overflow: hidden;
    }
    .user-menu summary { list-style: none; cursor: pointer; }
    .user-menu summary::-webkit-details-marker { display: none; }
    .user-info { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: inherit; text-decoration: none; }
    .user-info:hover { background: rgba(255,255,255,0.04); }
    .user-menu-chevron {
        margin-left: auto;
        color: var(--text-muted);
        transition: transform 0.16s ease;
    }
    .user-menu[open] .user-menu-chevron { transform: rotate(180deg); }
    .user-menu-panel {
        padding: 6px;
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .user-menu-button {
        width: 100%;
        border: none;
        background: transparent;
        font-family: var(--font);
        cursor: pointer;
        text-align: left;
    }
    .user-menu-separator {
        height: 1px; background: var(--border); margin: 4px 0;
    }
    .user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-light)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.78rem; color: #111; flex-shrink: 0; }
    .user-details { display: flex; flex-direction: column; overflow: hidden; }
    .user-company { font-size: 0.8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-email { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .logout-btn { color: var(--text-muted) !important; }
    .logout-btn:hover { color: var(--red) !important; background: var(--red-bg) !important; }
    .top-user-menu { display: none; }
    .mobile-more-panel { display: none !important; }
    .top-notif-btn { width: 34px; height: 34px; }
    .support-modal-overlay { align-items: center; padding: 24px; }
    .support-form-grid { grid-template-columns: 1fr 1fr; }
    .support-modal-actions {
        grid-template-columns: auto auto;
        justify-content: flex-end;
    }

    .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
    .kpi-card { padding: 18px 20px; }
    .kpi-value { font-size: 1.5rem; }
    .kpi-icon { width: 34px; height: 34px; }
    .kpi-icon svg { width: 17px; height: 17px; }

    .charts-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
    .chart-container { height: 280px; }

    .table-wrapper { display: block; }
    .tx-list-mobile { display: none; }
    .data-table { width: 100%; border-collapse: collapse; }
    .data-table th { text-align: left; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 9px 14px; border-bottom: 1px solid var(--border); }
    .data-table td { padding: 12px 14px; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
    .data-table tbody tr:hover { background: var(--bg-card-hover); }
    .data-table tbody tr:last-child td { border-bottom: none; }
    .tx-description { display: flex; align-items: center; gap: 8px; font-weight: 500; }

    .analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .accounting-grid { grid-template-columns: 1fr 1fr; }
    .analytics-grid .full-width { grid-column: 1 / -1; }
    .forecast-card { padding: 20px; }
    .card { padding: 20px; margin-bottom: 20px; }

    .an-kpi-row { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .an-kpi-value { font-size: 1.4rem; }
    .an-grid-2 { grid-template-columns: 1fr 1fr; }
    .banks-grid { grid-template-columns: 1fr 1fr 1fr; }
    .analytics-hero { padding: 20px; margin-bottom: 20px; }
    .dash-hero { padding: 24px; margin-bottom: 20px; }
    .dash-hero-balance { font-size: 2.8rem; }
    .dash-hero-sparkline { height: 100px; margin: 16px -4px 20px; }
    .dash-hero-metric strong { font-size: 1.15rem; }
    .dash-split { gap: 20px; margin-bottom: 20px; }
    .spending-card, .actions-card { margin-bottom: 0; }
    .scope-switcher { margin-bottom: 18px; }
    .users-layout {
        grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.4fr);
        align-items: start;
        gap: 16px;
    }
    .users-create-card { order: 1; }
    .users-list-card { order: 2; }
    .users-hero h2 { font-size: 1.2rem; }
    .users-hero p { font-size: 0.82rem; max-width: 72ch; }
    .users-kpi strong { font-size: 1.2rem; }
    .user-row { padding: 13px; }
    .user-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reset-box { grid-column: 1 / -1; }
    .audit-filters {
        grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto;
        align-items: end;
    }
    .audit-filters-actions {
        grid-template-columns: 1fr 1fr;
        min-width: 220px;
    }
    .audit-action-label { font-size: 0.85rem; }
    .audit-meta { font-size: 0.74rem; }
    .audit-details { font-size: 0.8rem; }
    .audit-detail-label { min-width: 110px; }

    .account-card { flex-direction: row; align-items: center; gap: 20px; padding: 18px 20px; }
    .account-top { flex: 1; }
    .account-actions { border-top: none; border-left: 1px solid var(--border); padding-top: 0; padding-left: 16px; flex-direction: column; }
    .account-actions .btn { flex: none; }
    .search-bar { max-width: 260px; flex: none; }
    .subscription-panel {
        inset: auto;
        left: auto;
        right: 28px;
        bottom: 28px;
        width: min(620px, calc(100vw - 320px));
        border-radius: var(--radius-lg);
        border-top: 1px solid var(--border-light);
        border: 1px solid var(--border-light);
        max-height: 78vh;
        transform: translateY(20px);
        opacity: 0;
        padding: 12px 16px 16px;
        box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.45);
    }
    .subscription-panel-header { top: -12px; }
    .subscription-panel-handle { display: none; }
    .subscription-drawer.open .subscription-panel {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 1200px) {
    :root { --sidebar-width: 260px; }
    .content { padding: 28px 36px; }
    .billing-banner { margin: 14px 36px 0; }
    .kpi-value { font-size: 1.65rem; }
    .kpi-card { padding: 22px 24px; }
    .banks-grid { grid-template-columns: repeat(4, 1fr); }
    .dash-hero { padding: 28px 32px; }
    .dash-hero-balance { font-size: 3rem; letter-spacing: -1.5px; }
    .dash-hero-sparkline { height: 110px; }
    .dash-hero-metric strong { font-size: 1.25rem; }
}

/* ======================== TRANSACTION DETAIL MODAL ======================== */
.tx-clickable { cursor: pointer; }
.tx-clickable:hover { background: var(--bg-card-hover); }
tr.tx-clickable:hover td { background: var(--bg-card-hover); }

.tx-modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.tx-modal-overlay[aria-hidden="false"] { opacity: 1; pointer-events: auto; }

.tx-modal {
    width: 100%;
    max-height: 88vh; max-height: 88dvh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    transform: translateY(40px);
    transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
    -webkit-overflow-scrolling: touch;
}
.tx-modal-overlay[aria-hidden="false"] .tx-modal { transform: translateY(0); }

/* Handle bar (mobile) */
.tx-modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 10px auto 4px;
}

.tx-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--bg-card); z-index: 2;
}
.tx-modal-header h3 { font-size: 0.92rem; font-weight: 600; }
.tx-modal-close {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
    transition: all 0.15s; flex-shrink: 0;
}
.tx-modal-close:hover { color: var(--text); border-color: var(--accent); }

.tx-modal-body { padding: 16px; padding-bottom: calc(16px + var(--safe-bottom, 0px)); }

.tx-modal-loading {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 40px 0; color: var(--text-muted); font-size: 0.85rem;
}
.tx-modal-spinner {
    width: 20px; height: 20px; border: 2px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: txSpin 0.6s linear infinite;
}
@keyframes txSpin { to { transform: rotate(360deg); } }

.tx-modal-summary { display: flex; flex-direction: column; gap: 8px; }
.tx-modal-row {
    display: flex; flex-direction: column; gap: 2px;
}
.tx-modal-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.tx-modal-value { font-size: 0.84rem; color: var(--text); word-break: break-word; line-height: 1.45; }
.tx-modal-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }
.tx-modal-amount { font-weight: 700; font-size: 1.15rem; }

.tx-modal-divider { height: 1px; background: var(--border); margin: 14px 0; }

.tx-modal-section { margin-bottom: 6px; }
.tx-modal-section-title {
    display: block; font-size: 0.72rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em;
}
.tx-modal-sublabel { display: block; font-size: 0.68rem; color: var(--text-muted); margin-bottom: 4px; }

.tx-modal-select {
    width: 100%; padding: 11px 12px;
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-family: var(--font); font-size: 0.82rem;
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b8fa3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color 0.15s;
}
.tx-modal-select:focus { border-color: var(--accent); outline: none; }
.tx-modal-select-sm { padding: 9px 10px; font-size: 0.78rem; }

.tx-modal-input {
    width: 100%; padding: 9px 10px;
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-family: var(--font); font-size: 0.82rem;
}
.tx-modal-input:focus { border-color: var(--accent); outline: none; }

/* ── TVA section in transaction modal ── */
.txm-vat-section {
    padding: 8px 0 4px;
    position: relative;
}
.txm-vat-section.txm-vat-suggested::after {
    content: "TVA estimée selon la catégorie";
    display: block;
    font-size: 10px;
    color: var(--accent);
    margin-top: 6px;
    font-style: italic;
    letter-spacing: .3px;
}
.txm-vat-section.txm-vat-suggested .txm-vat-input,
.txm-vat-section.txm-vat-suggested .txm-vat-select {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.txm-vat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.txm-vat-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.txm-vat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
}
.txm-vat-input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-elevated, var(--bg));
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    -moz-appearance: textfield;
}
.txm-vat-input::-webkit-inner-spin-button,
.txm-vat-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.txm-vat-input:focus { border-color: var(--accent); outline: none; }
.txm-vat-input::placeholder { color: var(--text-muted); }
.txm-vat-row {
    display: flex;
    gap: 6px;
}
.txm-vat-row .txm-vat-input { flex: 1; }
.txm-vat-select {
    width: 70px;
    padding: 7px 6px;
    background: var(--bg-elevated, var(--bg));
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.txm-vat-select:focus { border-color: var(--accent); outline: none; }

@media (max-width: 600px) {
    .txm-vat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ── Attachments ── */
.tx-modal-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tx-modal-att-item {
    position: relative; width: 72px; height: 72px;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--border); background: var(--bg);
}
.tx-modal-att-link { display: block; width: 100%; height: 100%; }
.tx-modal-att-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tx-modal-att-item .att-pdf {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 100%; height: 100%; font-size: 10px; color: var(--text-muted); text-align: center; padding: 6px;
    text-decoration: none;
}
.tx-modal-att-item .att-pdf svg { opacity: .4; }
.tx-modal-att-remove {
    position: absolute; top: 2px; right: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(0,0,0,0.7); color: #fff; border: none;
    font-size: 0.7rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    opacity: 1;
}

/* Attachment Viewer Lightbox */
.att-viewer-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; transition: opacity .2s;
}
.att-viewer-overlay.open { opacity: 1; }
.att-viewer-container {
    background: var(--bg); border-radius: 14px;
    width: 100%; max-width: 560px; max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.att-viewer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    min-height: 48px;
}
.att-viewer-name {
    font-size: 13px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; margin-right: 12px;
}
.att-viewer-close {
    width: 32px; height: 32px; border-radius: 8px;
    border: none; background: var(--bg-elevated, var(--border));
    color: var(--text); font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.att-viewer-close:hover { background: var(--border); }
.att-viewer-body {
    flex: 1; overflow: auto;
    display: flex; align-items: center; justify-content: center;
    padding: 12px; min-height: 200px;
    background: var(--bg-elevated, #111);
}
.att-viewer-img {
    max-width: 100%; max-height: 60vh;
    border-radius: 6px; object-fit: contain;
}
.att-viewer-pdf {
    width: 100%; height: 60vh;
    border: none; border-radius: 6px;
    background: #fff;
}
.att-viewer-actions {
    display: flex; gap: 10px; padding: 14px 16px;
    border-top: 1px solid var(--border);
}
.att-viewer-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all .15s;
    text-decoration: none; border: none;
}
.att-viewer-download {
    background: var(--accent); color: #1a1a1a;
}
.att-viewer-download:hover { filter: brightness(1.1); }
.att-viewer-share {
    background: var(--bg-elevated, var(--border)); color: var(--text);
}
.att-viewer-share:hover { background: var(--border); }

@media (max-width: 600px) {
    .att-viewer-container { max-width: 100%; border-radius: 14px 14px 0 0; margin-top: auto; }
    .att-viewer-overlay { align-items: flex-end; padding: 0; }
    .att-viewer-img { max-height: 50vh; }
    .att-viewer-pdf { height: 50vh; }
    .att-viewer-actions { padding-bottom: calc(14px + var(--safe-bottom, 0px)); }
}

.tx-modal-upload-zone {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    flex-wrap: wrap;
    padding: 18px 12px; border: 2px dashed var(--border-light);
    border-radius: var(--radius-sm); cursor: pointer;
    color: var(--text-muted); font-size: 0.76rem;
    transition: all 0.2s;
    user-select: none;
}
.tx-modal-upload-zone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.tx-modal-upload-zone.dragover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); transform: scale(1.01); }
.tx-modal-upload-zone svg { flex-shrink: 0; width: 18px; height: 18px; }
.tx-modal-upload-hint { width: 100%; text-align: center; font-size: 10px; opacity: .55; margin-top: -2px; }

.tx-modal-upload-progress { font-size: 0.75rem; color: var(--accent); padding: 6px 0; }

.tx-modal-actions {
    display: flex; gap: 10px; margin-top: 12px;
    padding-bottom: calc(4px + var(--safe-bottom, 0px));
}
.tx-modal-actions .btn { flex: 1; padding: 12px; font-size: 0.84rem; }

.tx-modal-toast {
    position: fixed; bottom: calc(24px + var(--safe-bottom, 0px)); left: 50%; transform: translateX(-50%);
    padding: 10px 20px; border-radius: var(--radius);
    background: var(--green); color: #111; font-size: 0.82rem; font-weight: 600;
    z-index: 300; opacity: 0; transition: opacity 0.3s;
    pointer-events: none; white-space: nowrap;
}
.tx-modal-toast.show { opacity: 1; }
.tx-modal-toast.error { background: var(--red); color: #fff; }

/* ---- Desktop: center modal ---- */
@media (min-width: 600px) {
    .tx-modal-overlay { align-items: center; }
    .tx-modal {
        max-width: 520px;
        border-radius: var(--radius-lg);
        border-bottom: 1px solid var(--border);
        max-height: 85vh;
    }
    .tx-modal::before { display: none; }
    .tx-modal-header { padding: 16px 24px; }
    .tx-modal-body { padding: 24px; padding-bottom: 24px; }
    .tx-modal-row { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 16px; }
    .tx-modal-label { min-width: 110px; }
    .tx-modal-value { text-align: right; }
    .tx-modal-desc { max-width: 320px; }
    .tx-modal-vat-grid { gap: 12px; }
    .tx-modal-att-item { width: 72px; height: 72px; }
    .tx-modal-att-remove { opacity: 0; }
    .tx-modal-att-item:hover .tx-modal-att-remove { opacity: 1; }
    .tx-modal-actions { padding-bottom: 0; }
}

/* ===== Exclude from analytics ===== */

.txm-exclude-zone {
    border-radius: var(--radius);
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: border-color .2s, background .2s;
}
.txm-exclude-zone.txm-excluded-active {
    border-color: var(--orange, #f59e0b);
    background: color-mix(in srgb, var(--orange, #f59e0b) 6%, transparent);
}
.txm-exclude-toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.txm-exclude-info {
    display: flex; align-items: center; gap: 8px;
}
.txm-exclude-icon { color: var(--text-muted); flex-shrink: 0; }
.txm-excluded-active .txm-exclude-icon { color: var(--orange, #f59e0b); }
.txm-exclude-label { font-size: 0.85rem; font-weight: 500; color: var(--text); }

.txm-exclude-switch {
    position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.txm-exclude-switch input { opacity: 0; width: 0; height: 0; }
.txm-exclude-slider {
    position: absolute; inset: 0; cursor: pointer; border-radius: 24px;
    background: var(--border); transition: background .2s;
}
.txm-exclude-slider::before {
    content: ''; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.txm-exclude-switch input:checked + .txm-exclude-slider {
    background: var(--orange, #f59e0b);
}
.txm-exclude-switch input:checked + .txm-exclude-slider::before {
    transform: translateX(20px);
}

.txm-exclude-scope {
    margin-top: 10px; display: flex; flex-direction: column; gap: 6px; padding-left: 26px;
}
.txm-exclude-scope-option {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 0.82rem; color: var(--text-muted); padding: 4px 0;
}
.txm-exclude-scope-option input[type="radio"] { display: none; }
.txm-scope-radio {
    width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: border-color .2s;
}
.txm-scope-radio::after {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: transparent; transition: background .2s;
}
.txm-exclude-scope-option input[type="radio"]:checked ~ .txm-scope-radio {
    border-color: var(--orange, #f59e0b);
}
.txm-exclude-scope-option input[type="radio"]:checked ~ .txm-scope-radio::after {
    background: var(--orange, #f59e0b);
}
.txm-exclude-scope-option input[type="radio"]:checked ~ span:last-child {
    color: var(--text); font-weight: 500;
}

/* badge "Exclue" in tx list */
.tx-excluded-badge {
    display: inline-block; font-size: 0.55rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; padding: 1px 5px; border-radius: 3px; margin-left: 4px;
    background: color-mix(in srgb, var(--orange, #f59e0b) 15%, transparent);
    color: var(--orange, #f59e0b); vertical-align: middle; flex-shrink: 0;
}
.tx-excluded { opacity: 0.55; }
.tx-excluded:hover { opacity: 0.8; }
@media (max-width: 400px) {
    .tx-excluded-badge { font-size: 0.5rem; padding: 0 4px; }
}


.btn-danger {
    background: var(--red) !important; color: #fff !important;
    border: none;
}
.btn-danger:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* ===== Theme Toggle Button ===== */
.theme-toggle-btn { position: relative; }
.theme-icon-sun, .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* ══════════════════════════════════════════════════════
   LIGHT MODE
══════════════════════════════════════════════════════ */
[data-theme="light"] {
    --bg: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f1f4;
    --bg-input: #edeef2;
    --bg-elevated: #f9f9fb;

    --sidebar-bg: #ffffff;

    --border: #d8dae0;
    --border-light: #c8cad2;

    --text: #1a1c22;
    --text-secondary: #52566a;
    --text-muted: #8b8fa3;

    --accent: #a07828;
    --accent-light: #8a6820;
    --accent-bg: rgba(160,120,40,0.09);
    --accent-glow: rgba(160,120,40,0.05);

    --green: #0d8a60;
    --green-bg: rgba(13,138,96,0.09);
    --red: #cc3838;
    --red-bg: rgba(204,56,56,0.07);
    --orange: #c07a10;
    --orange-bg: rgba(192,122,16,0.09);
    --blue: #3070b8;
}

/* ── Body & scrollbars ── */
[data-theme="light"] body { -webkit-font-smoothing: auto; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* ── Primary button text stays dark ── */
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .top-bar-avatar { color: #fff; }
[data-theme="light"] .user-avatar { color: #fff; }
[data-theme="light"] .logo-icon { color: #fff; }

/* ── Shadows: softer for light ── */
[data-theme="light"] .top-user-menu-panel { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
[data-theme="light"] .top-notif-panel { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
[data-theme="light"] .mobile-more-panel { box-shadow: 0 -12px 28px rgba(0,0,0,0.1); }

/* ── Dashboard hero ── */
[data-theme="light"] .dash-hero {
    background:
        radial-gradient(ellipse 130% 160% at 0% 0%, rgba(160,120,40,0.09) 0%, rgba(160,120,40,0.02) 40%, transparent 70%),
        linear-gradient(160deg, #fafafa 0%, #f3f3f5 100%);
}
[data-theme="light"] .dash-hero-metric { background: rgba(0,0,0,0.025); }

/* ── Analytics cards (light mode) ── */
[data-theme="light"] .an-vat-item { background: rgba(0,0,0,0.025); }
[data-theme="light"] .an-vat-surplus { background: rgba(220,60,60,0.06); border-color: rgba(220,60,60,0.15); }
[data-theme="light"] .an-vat-credit { background: rgba(20,160,100,0.06); border-color: rgba(20,160,100,0.15); }
[data-theme="light"] .an-pnl-bar { background: rgba(220,60,60,0.1); }
[data-theme="light"] .an-kpi-card { background: #fff; }
[data-theme="light"] .an-coherence-header:hover { background: rgba(0,0,0,0.025); }
[data-theme="light"] .an-alert-ok   { background: rgba(34,197,94,0.06); }
[data-theme="light"] .an-alert-warn { background: rgba(245,158,11,0.06); }
[data-theme="light"] .an-alert-error{ background: rgba(239,68,68,0.06); }

/* ── Flow intelligence card ── */
[data-theme="light"] .flow-intel-card {
    border-color: var(--border);
    background:
        radial-gradient(120% 150% at 0% 0%, rgba(13,138,96,0.05) 0%, rgba(13,138,96,0.01) 40%, transparent 70%),
        linear-gradient(160deg, #fafafa 0%, #f5f5f7 100%);
}
[data-theme="light"] .flow-kpi-item { background: rgba(0,0,0,0.02); }
[data-theme="light"] .flow-kpi-btn:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .flow-track { background: rgba(0,0,0,0.06); }
[data-theme="light"] .spending-bar { background: rgba(0,0,0,0.06); }

/* ── Analytics hero ── */
[data-theme="light"] .analytics-hero {
    background:
        radial-gradient(120% 150% at 0% 0%, rgba(48,112,184,0.08) 0%, rgba(48,112,184,0.02) 35%, transparent 60%),
        linear-gradient(160deg, #fafafa 0%, #f5f5f7 100%);
}
[data-theme="light"] .metric-card { background: rgba(0,0,0,0.025); }

/* ── Sidebar ── */
[data-theme="light"] .sidebar::before {
    background: radial-gradient(ellipse at top left, rgba(160,120,40,0.07) 0%, transparent 70%);
}
[data-theme="light"] .nav-item:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .user-menu { background: rgba(0,0,0,0.02); }
[data-theme="light"] .user-info:hover { background: rgba(0,0,0,0.04); }

/* ── Users hero ── */
[data-theme="light"] .users-hero {
    background:
        radial-gradient(120% 130% at 100% 0%, rgba(160,120,40,0.1) 0%, rgba(160,120,40,0.02) 40%, transparent 72%),
        linear-gradient(160deg, #fafafa 0%, #f5f5f7 100%);
}
[data-theme="light"] .users-kpi { background: rgba(0,0,0,0.02); }

/* ── Onboarding hero ── */
[data-theme="light"] .onboarding-hero {
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(48,112,184,0.1) 0%, rgba(48,112,184,0.02) 38%, transparent 72%),
        linear-gradient(160deg, #fafafa 0%, #f5f5f7 100%);
}
[data-theme="light"] .onboarding-step { background: rgba(160,120,40,0.06); }

/* ── Auth page ── */
[data-theme="light"] .auth-page { background: var(--bg); }
[data-theme="light"] .auth-page::before {
    background: radial-gradient(circle, rgba(160,120,40,0.06) 0%, transparent 70%);
}

/* ── Subscription / drawer panels ── */
[data-theme="light"] .subscription-backdrop { background: rgba(0,0,0,0.25); }
[data-theme="light"] .subscription-panel { background: var(--bg-card); }
[data-theme="light"] .subscription-panel-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(255,255,255,0.92) 100%);
}

/* ── Forecast ── */
[data-theme="light"] .forecast-event-btn:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .forecast-type-tag { background: rgba(0,0,0,0.03); }
[data-theme="light"] .forecast-pill.is-critical {
    border-color: rgba(204,56,56,0.35);
    background: rgba(204,56,56,0.05);
}

/* ── Notification severity borders (light-friendly) ── */
[data-theme="light"] .top-notif-item.severity-high { border-color: rgba(204,56,56,0.35); }
[data-theme="light"] .top-notif-item.severity-medium { border-color: rgba(192,122,16,0.35); }
[data-theme="light"] .top-notif-item.severity-low { border-color: rgba(48,112,184,0.35); }
[data-theme="light"] .forecast-type-vat { border-color: rgba(48,112,184,0.35); color: #2a5a8f; }
[data-theme="light"] .forecast-type-charges { border-color: rgba(192,122,16,0.35); color: #9a6a0a; }
[data-theme="light"] .forecast-type-subscription { border-color: rgba(13,138,96,0.35); color: #0a7a52; }

/* ── Transaction modal ── */
[data-theme="light"] .tx-modal-overlay { background: rgba(0,0,0,0.3); }
[data-theme="light"] .tx-modal { background: var(--bg-card); }
[data-theme="light"] .tx-modal::before { background: var(--border); }
[data-theme="light"] .tx-modal-header { background: var(--bg-card); }
[data-theme="light"] .tx-modal-spinner { border-color: var(--border); border-top-color: var(--accent); }
[data-theme="light"] .tx-modal-att-remove { background: rgba(0,0,0,0.6); }
[data-theme="light"] .att-viewer-overlay { background: rgba(0,0,0,0.5); }
[data-theme="light"] .att-viewer-body { background: #f5f5f5; }
[data-theme="light"] .att-viewer-close { background: #eee; }
[data-theme="light"] .att-viewer-close:hover { background: #ddd; }
[data-theme="light"] .att-viewer-share { background: #eee; }
[data-theme="light"] .att-viewer-share:hover { background: #ddd; }
[data-theme="light"] .tx-modal-toast { color: #fff; }
[data-theme="light"] .tx-modal-toast.error { color: #fff; }

/* ── Audit ── */
[data-theme="light"] .audit-meta-pre { background: rgba(0,0,0,0.03); }
[data-theme="light"] .audit-summary:hover { background: rgba(0,0,0,0.02); }
[data-theme="light"] .audit-details { background: rgba(0,0,0,0.015); }

/* ── Accounting panel ── */
[data-theme="light"] .accounting-panel { background: rgba(0,0,0,0.015); }

/* ── Desktop subscription panel shadow ── */
@media (min-width: 900px) {
    [data-theme="light"] .subscription-panel {
        box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
    }
}

/* ── Leaks card header stays orange ── */
[data-theme="light"] .leaks-card .card-header h2 { color: var(--orange); }

/* ── Bank logo white bg preserved ── */
[data-theme="light"] .account-bank-logo { background: #fff; }
[data-theme="light"] .scope-pill-logo { background: #fff; }

/* ══════════════════════════════════════════════
   CATEGORY SYSTEM — Picker, Settings, Rules
   ══════════════════════════════════════════════ */

.nav-separator { height: 1px; background: var(--border); margin: 8px 12px; }

/* ── Category Picker Dropdown ── */
.cat-picker-dropdown {
    position: absolute;
    z-index: 1000;
    width: 280px;
    max-height: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cat-picker-search { padding: 8px; border-bottom: 1px solid var(--border); }
.cat-picker-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text);
    outline: none;
}
.cat-picker-input:focus { border-color: var(--accent); }
.cat-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.cat-picker-group-label {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.cat-picker-item {
    padding: 7px 12px 7px 20px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    transition: background .15s;
}
.cat-picker-item:hover { background: var(--accent-alpha); }
.cat-picker-create-btn {
    border: none;
    background: none;
    color: var(--accent);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    border-top: 1px solid var(--border);
}
.cat-picker-create-btn:hover { background: var(--accent-alpha); }

/* ── Category picker inside modal ── */
.txm-cat-current { margin-bottom: 10px; }
.txm-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--bg);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-family: inherit;
    color: var(--text);
}
.txm-cat-badge:hover {
    border-color: var(--accent);
}
.txm-cat-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.txm-cat-badge-chevron {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform .2s ease;
    margin-left: auto;
}
.txm-cat-none { opacity: .6; }
.txm-cat-picker { margin-top: 8px; }
.txm-cat-search-wrap { margin-bottom: 8px; }
.txm-cat-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}
.txm-cat-accordion {
    border-bottom: 1px solid var(--border);
}
.txm-cat-accordion:last-child { border-bottom: none; }
.txm-cat-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    cursor: pointer;
    transition: background .12s;
    user-select: none;
}
.txm-cat-group:hover { background: rgba(255,255,255,.04); }
.txm-cat-group:active { background: rgba(255,255,255,.07); }
.txm-cat-group-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.txm-cat-group-label {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.txm-cat-group-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(255,255,255,.06);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}
.txm-cat-chevron {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform .2s ease;
}
.txm-cat-accordion.open .txm-cat-chevron {
    transform: rotate(180deg);
}
.txm-cat-subs {
    padding-bottom: 4px;
}
.txm-cat-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 30px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
    transition: background .12s;
    min-height: 40px;
}
.txm-cat-option:hover { background: rgba(255,255,255,.04); }
.txm-cat-option:active { background: rgba(255,255,255,.07); }
.txm-cat-option.txm-cat-active {
    color: #22c55e;
    font-weight: 600;
}
.txm-cat-check {
    flex-shrink: 0;
    color: #22c55e;
}
.txm-cat-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}
@media (max-width: 600px) {
    .txm-cat-list { max-height: 50vh; }
    .txm-cat-option { padding: 12px 12px 12px 30px; min-height: 44px; font-size: 15px; }
    .txm-cat-group { padding: 12px; }
    .txm-cat-group-label { font-size: 15px; }
}

/* Light mode overrides */
[data-theme="light"] .txm-cat-group:hover { background: rgba(0,0,0,.03); }
[data-theme="light"] .txm-cat-group:active { background: rgba(0,0,0,.06); }
[data-theme="light"] .txm-cat-group-count { background: rgba(0,0,0,.05); }
[data-theme="light"] .txm-cat-option:hover { background: rgba(0,0,0,.03); }
[data-theme="light"] .txm-cat-option:active { background: rgba(0,0,0,.06); }

/* ── Settings Header ── */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}
.settings-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 600px;
    line-height: 1.5;
}

/* ── Categories Tree ── */
.categories-tree { display: flex; flex-direction: column; gap: 2px; }
.cat-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}
.cat-parent-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-weight: 500;
}
.cat-drag-handle {
    cursor: grab;
    font-size: 16px;
    opacity: .3;
    user-select: none;
}
.cat-drag-handle:hover { opacity: .7; }
.cat-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cat-name { flex: 1; font-size: 14px; }
.cat-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.cat-type-depense { background: rgba(239,68,68,0.12); color: var(--red); }
.cat-type-revenu { background: rgba(34,197,94,0.12); color: var(--green); }
.cat-type-les_deux { background: rgba(99,102,241,0.12); color: var(--accent); }
.cat-count { font-size: 12px; color: var(--text-secondary); min-width: 40px; text-align: right; }
.cat-actions { display: flex; gap: 4px; }
.cat-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all .15s;
}
.cat-action-btn:hover { background: var(--accent-alpha); color: var(--accent); }
.cat-action-delete:hover { background: rgba(239,68,68,0.1); color: var(--red); }
.cat-children { padding-left: 0; }
.cat-child-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 54px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.cat-indent { width: 0; }
.cat-child-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Color Picker ── */
.cat-color-picker { display: flex; align-items: center; gap: 10px; }
.cat-color-input {
    width: 40px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: var(--bg);
}
.cat-color-hex { font-size: 13px; color: var(--text-secondary); font-family: monospace; }

/* ── Rules Table ── */
.rules-table-card { overflow-x: auto; }
.rule-name { font-weight: 500; max-width: 200px; }
.rule-keywords { display: flex; flex-wrap: wrap; gap: 4px; }
.keyword-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-alpha);
    color: var(--accent);
    border-radius: 4px;
    gap: 4px;
}
.keyword-chip button {
    background: none;
    border: none;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.keyword-chip-editable { background: rgba(99,102,241,0.15); }
.keyword-chip-excluded { background: rgba(239,68,68,0.12); color: var(--red); }
.keyword-chip-toggle {
    cursor: pointer;
    padding: 4px 10px;
    font-size: 13px;
    opacity: .4;
    transition: all .15s;
}
.keyword-chip-toggle.active { opacity: 1; background: var(--accent-alpha); }
.rule-keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rule-source-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.rule-source-utilisateur { background: var(--accent-alpha); color: var(--accent); }
.rule-source-suggestion { background: rgba(245,158,11,0.12); color: var(--orange); }
.rule-source-systeme { background: rgba(107,114,128,0.12); color: var(--text-secondary); }

/* Toggle switch */
.rule-toggle-btn {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    border: none;
    background: var(--border);
    cursor: pointer;
    position: relative;
    transition: background .2s;
}
.rule-toggle-btn.active { background: var(--green); }
.rule-toggle-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}
.rule-toggle-btn.active .rule-toggle-dot { transform: translateX(16px); }

/* ── Rule Preview ── */
.rule-preview-list { max-height: 200px; overflow-y: auto; }
.rule-preview-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}
.rule-preview-item span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.rule-advanced-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 8px 0;
}
.rule-advanced-section summary {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ── Smart Rule Toast ── */
.smart-rule-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    font-size: 14px;
    max-width: 90vw;
}
.smart-rule-toast-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ── Empty state overrides removed (consolidated above) ── */

/* ── Light mode overrides for new components ── */
[data-theme="light"] .cat-picker-dropdown { box-shadow: 0 8px 30px rgba(0,0,0,0.1); }
[data-theme="light"] .smart-rule-toast { box-shadow: 0 8px 30px rgba(0,0,0,0.08); }
[data-theme="light"] .cat-group { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
[data-theme="light"] .keyword-chip { background: rgba(99,102,241,0.08); }
[data-theme="light"] .keyword-chip-excluded { background: rgba(239,68,68,0.08); }

/* ── Uncategorized Widget ── */
.uncategorized-widget {
    margin-bottom: 20px;
    border-left: 4px solid var(--orange);
}
.uncategorized-widget-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}
.uncategorized-widget-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(245,158,11,0.12);
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.uncategorized-widget-title { font-weight: 600; font-size: 14px; }
.uncategorized-widget-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
@media (max-width: 600px) {
    .uncategorized-widget-content { flex-direction: column; text-align: center; }
}

/* ====== CATÉGORIES AUTO ====== */

/* Bento grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
@media (max-width: 600px) { .bento-grid { grid-template-columns: 1fr; } }

/* Bento card */
.bento-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
}
.bento-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bento-card-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 15px; flex-shrink: 0;
}
.bento-card-title { flex: 1; min-width: 0; }
.bento-card-title strong { display: block; font-size: 14px; line-height: 1.3; }
.bento-card-actions { display: flex; gap: 2px; flex-shrink: 0; }

.bento-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.bento-kpi {
    text-align: center;
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 4px;
}
.bento-kpi-value { display: block; font-weight: 600; font-size: 14px; }
.bento-kpi-label { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.bento-footer-info {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-secondary);
}
.bento-card-btns { display: flex; gap: 8px; margin-top: auto; }

/* Color palette */
/* Color picker component */
.ca-cpick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ca-cpick-presets { display: contents; }
.ca-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    outline-offset: 2px;
}
.ca-color-btn:hover { transform: scale(1.12); }
.ca-color-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--text-primary);
}
.ca-cpick-custom {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    position: relative;
}
.ca-cpick-custom:hover { border-color: var(--text-primary); color: var(--text-primary); }
.ca-cpick-custom.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.ca-cpick-custom svg { flex-shrink: 0; }
.ca-cpick-custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}
.ca-cpick-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.ca-cpick-dot {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.ca-cpick-hex {
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* ── Counterparty Confirmation Step ── */
.cpc-header {
    padding: 16px 20px 8px;
}
.cpc-intro {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}
.cpc-intro strong {
    color: var(--text);
}
.cpc-list {
    max-height: 380px;
    overflow-y: auto;
    padding: 0 20px 12px;
}
.cpc-group {
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: border-color .2s;
}
.cpc-group:hover {
    border-color: var(--accent);
}
.cpc-group-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.cpc-group-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cpc-group-meta {
    font-size: 12px;
    color: var(--text-secondary);
}
.cpc-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.cpc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.cpc-row:hover {
    background: rgba(255,255,255,.04);
}
.cpc-row-svg {
    flex-shrink: 0;
    color: var(--text-secondary);
    opacity: .5;
}
.cpc-row-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 0;
}

/* Toggle switch */
.cpc-toggle-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cpc-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 48px;
    height: 26px;
    cursor: pointer;
}
.cpc-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.cpc-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 26px;
    transition: background .3s;
}
.cpc-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform .3s cubic-bezier(.4,.0,.2,1);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.cpc-toggle input:checked + .cpc-toggle-slider {
    background: #22c55e;
}
.cpc-toggle input:checked + .cpc-toggle-slider::before {
    transform: translateX(22px);
}
.cpc-toggle-state {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    min-width: 28px;
}
.cpc-toggle-state--on {
    color: #22c55e;
}
.cpc-toggle-state--off {
    color: var(--text-secondary);
    opacity: .6;
}

/* Transaction Picker */
.txp-search-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.txp-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0;
}
.txp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.txp-item:hover { background: rgba(99,102,241,0.04); }
.txp-checkbox {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: background .2s, border-color .2s, box-shadow .2s;
}
.txp-checkbox:hover {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.txp-checkbox:checked {
    background: #22c55e;
    border-color: #22c55e;
}
.txp-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}
.txp-item-info { flex: 1; min-width: 0; }
.txp-item-desc { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txp-item-meta { font-size: 11px; color: var(--text-secondary); }
.txp-item-amount { font-size: 13px; font-weight: 600; white-space: nowrap; }
.txp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
}
.txp-loading, .txp-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Detail drawer */
.ca-detail-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.ca-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.ca-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.ca-detail-panel { padding: 0 4px; }

.ca-detail-tx {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.ca-detail-tx-info { flex: 1; min-width: 0; }
.ca-detail-tx-desc { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-detail-tx-meta { display: block; font-size: 11px; color: var(--text-secondary); }
.ca-detail-tx-amount { font-size: 13px; font-weight: 600; white-space: nowrap; }

.ca-cp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.ca-cp-info { display: flex; flex-direction: column; gap: 2px; }
.ca-cp-info strong { font-size: 13px; }
.ca-cp-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}
.ca-cp-toggle input { accent-color: var(--green); cursor: pointer; }

/* Auto-cat badges in transaction modal */
.txm-auto-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.txm-auto-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.txm-acb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.txm-auto-cat-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    padding: 0 0 0 2px;
    color: inherit;
}
.txm-auto-cat-remove:hover { opacity: 1; }

/* ── Perso category picker (custom dropdown with colors) ── */
.txm-perso-picker {
    position: relative;
}
.txm-perso-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color .15s, color .15s;
    width: 100%;
    justify-content: center;
    font-family: inherit;
}
.txm-perso-trigger:hover {
    border-color: var(--accent);
    color: var(--text);
}
.txm-perso-dropdown {
    margin-top: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}
.txm-perso-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: background .12s;
}
.txm-perso-item:hover {
    background: rgba(255,255,255,.06);
}
.txm-perso-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,.1);
}
.txm-perso-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
[data-theme="light"] .txm-perso-dropdown { box-shadow: 0 8px 24px rgba(0,0,0,.1); }
[data-theme="light"] .txm-perso-item:hover { background: rgba(0,0,0,.04); }
[data-theme="light"] .txm-perso-dot { box-shadow: 0 0 0 2px rgba(0,0,0,.08); }

/* Dashboard auto-cat empty state */
.ac-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    gap: 10px;
}
.ac-empty-state-side {
    align-items: flex-start;
    text-align: left;
    padding: 20px 24px;
}
.ac-empty-icon { color: var(--text-secondary); opacity: 0.5; }
.ac-empty-title { font-size: 15px; }
.ac-empty-desc { font-size: 13px; color: var(--text-secondary); max-width: 420px; line-height: 1.6; margin: 0; }
.ac-empty-example {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 6px 0;
}
.ac-empty-example-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.ac-empty-how { font-size: 12px; color: var(--text-secondary); max-width: 400px; line-height: 1.5; margin: 0; }
.ac-empty-steps {
    margin: 4px 0 8px;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.8;
}
.ac-empty-steps li { margin-bottom: 2px; }
.ac-empty-steps strong { color: var(--text-primary); }
.ac-empty-note { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin: 0; opacity: 0.8; }

/* Dashboard auto-cat detail KPIs */
.ac-detail-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.ac-detail-kpi { text-align: center; }
.ac-detail-kpi-val { display: block; font-weight: 600; font-size: 15px; }
.ac-detail-kpi-label { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Light mode overrides for auto cats */
[data-theme="light"] .bento-card { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
[data-theme="light"] .bento-kpi { background: #f8f8fa; }
[data-theme="light"] .txp-item:hover { background: rgba(99,102,241,0.06); }
[data-theme="light"] .txp-checkbox { border-color: #d1d5db; }
[data-theme="light"] .txp-checkbox:hover { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
[data-theme="light"] .cpc-toggle-slider { background: #d1d5db; }
[data-theme="light"] .cpc-group { border-color: #e5e7eb; background: #fafafa; }
[data-theme="light"] .cpc-group-header { border-bottom-color: #e5e7eb; }
[data-theme="light"] .cpc-row:hover { background: rgba(0,0,0,.03); }

/* ===== INVOICING MODULE — uses existing design tokens ===== */

.inv-hero {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; text-align: center; margin-bottom: 16px;
}
.inv-hero--credit {
    background: linear-gradient(135deg, rgba(240,96,96,0.08), rgba(240,96,96,0.03));
    border-color: rgba(240,96,96,0.2);
}
.inv-hero-val { font-size: 1.8rem; font-weight: 800; letter-spacing: -1px; line-height: 1.2; }
.inv-hero--credit .inv-hero-val { color: var(--red); }
.inv-hero-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.8px; }

.inv-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.inv-actions form { display: contents; }
.inv-actions .btn-full { flex: 1; }

.inv-meta-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem;
}
.inv-meta-row:last-child { border-bottom: none; }
.inv-meta-label { color: var(--text-secondary); font-size: 0.78rem; }

.inv-line-item {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.inv-line-item:last-child { border-bottom: none; }
.inv-line-info { flex: 1; min-width: 0; }
.inv-line-info strong { font-size: 0.82rem; display: block; }
.inv-line-info small { font-size: 0.7rem; color: var(--text-muted); }
.inv-line-total { font-weight: 600; font-size: 0.82rem; flex-shrink: 0; margin-left: 12px; }

.inv-section-label {
    font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
    margin: 16px 0 6px; padding: 0 2px;
}

/* ===== Invoice share card ===== */
.invoice-share-card { padding: 14px; }
.invoice-share-link {
    display: flex; align-items: stretch; gap: 8px;
}
.invoice-share-link .input-field {
    flex: 1; min-width: 0; font-size: 0.78rem; padding-right: 10px;
}
.btn-share-primary {
    flex-shrink: 0;
    width: 44px; height: 44px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #111;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
    box-shadow: 0 6px 14px rgba(201,165,92,0.25);
}
.btn-share-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(201,165,92,0.32); }
.btn-share-primary:active { transform: translateY(0); }
.btn-share-primary svg { width: 20px; height: 20px; }
.btn-share-primary--fallback {
    background: var(--bg-input);
    color: var(--text-secondary);
    box-shadow: none;
    border: 1px solid var(--border);
}
.btn-share-primary--loading {
    cursor: wait;
    animation: sharePulse 1.2s ease-in-out infinite;
}
@keyframes sharePulse {
    0%, 100% { box-shadow: 0 6px 14px rgba(201,165,92,0.25); }
    50%      { box-shadow: 0 6px 22px rgba(201,165,92,0.55); }
}
.invoice-share-hint {
    font-size: 0.72rem; color: var(--text-muted);
    margin: 10px 0 12px;
    line-height: 1.4;
}
.invoice-share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}
.invoice-share-chip {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 12px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.72rem; font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
    text-align: center;
    line-height: 1.2;
}
.invoice-share-chip:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--bg-card-hover);
}
.invoice-share-chip:active { transform: scale(0.97); }
.invoice-share-chip-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--accent-bg);
    color: var(--accent-light);
}
.invoice-share-chip-icon svg { width: 16px; height: 16px; }
.invoice-share-chip--wa .invoice-share-chip-icon {
    background: rgba(45, 212, 160, 0.14);
    color: var(--green);
}
.invoice-share-toast {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--green-bg);
    color: var(--green);
    font-size: 0.78rem;
    text-align: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.invoice-share-toast--visible { opacity: 1; transform: translateY(0); }
.invoice-share-chip[data-share-empty="true"] .invoice-share-chip-icon { position: relative; }
.invoice-share-chip[data-share-empty="true"] .invoice-share-chip-icon::after {
    content: "+";
    position: absolute;
    top: -4px; right: -4px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent); color: #111;
    font-size: 11px; font-weight: 700; line-height: 14px; text-align: center;
    border: 2px solid var(--bg-input);
    box-sizing: content-box;
}

@media (max-width: 380px) {
    .invoice-share-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Status badges — reuses .category-tag pattern */
.status-tag { font-size: 0.65rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.status-draft { background: var(--bg-input); color: var(--text-secondary); }
.status-validated { background: var(--accent-bg); color: var(--accent-light); }
.status-sent, .status-accepted { background: rgba(91,159,230,0.12); color: var(--blue); }
.status-paid { background: var(--green-bg); color: var(--green); }
.status-partially_paid { background: var(--orange-bg); color: var(--orange); }
.status-cancelled, .status-overdue, .status-rejected, .status-credit { background: var(--red-bg); color: var(--red); }
.status-expired { background: var(--orange-bg); color: var(--orange); }
.status-converted { background: var(--accent-bg); color: var(--accent-light); }

/* Form — invoice/quote/client creation */
.inv-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.inv-field label { font-size: 0.72rem; font-weight: 500; color: var(--text-secondary); }
.vat-select-field {
    position: relative;
}
.vat-select-field::after,
.line-vat-field::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
.vat-select-field:focus-within::after,
.line-vat-field:focus-within::after {
    border-color: var(--accent-light);
}
.vat-rate-select,
.line-vat-select {
    appearance: none;
    cursor: pointer;
    min-height: 42px;
    padding-right: 38px;
}
.vat-default-field small { color: var(--text-muted); font-size: 0.68rem; line-height: 1.35; }
.inv-hint { font-size: 0.68rem; color: var(--text-muted); font-style: italic; margin: 4px 0; }
.inv-form-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-bottom: 40px; }

.client-card {
    position: relative;
    z-index: 30;
    overflow: visible;
}
.client-card:focus-within { z-index: 80; }

.client-type-card { padding-bottom: 14px; }
.client-type-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.client-type-switch--compact {
    margin: 0 0 12px;
}
.client-type-option {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.client-type-option:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.client-type-option input {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    margin-top: 1px;
    flex-shrink: 0;
    background: var(--bg-input);
}
.client-type-option input:checked {
    border: 5px solid var(--accent);
    background: #fff;
}
.client-type-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.client-type-option span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.client-type-option strong {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
}
.client-type-option small {
    color: var(--text-secondary);
    font-size: 0.68rem;
    line-height: 1.3;
}
.client-lookup-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.client-lookup-row .btn { white-space: nowrap; }

.client-mode-pill {
    font-size: 0.66rem;
    font-weight: 650;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 9px;
    white-space: nowrap;
}
.client-mode-pill--selected { color: var(--green); background: var(--green-bg); border-color: rgba(45,212,160,0.22); }
.client-mode-pill--new { color: var(--accent-light); background: var(--accent-bg); border-color: rgba(201,165,92,0.24); }

.smart-client-picker { margin-bottom: 4px; }
.smart-client-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.smart-client-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.smart-client-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.smart-client-search .input-field {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 11px 0;
}
.smart-client-clear {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.smart-client-clear:hover { background: var(--bg-card-hover); color: var(--text); }

.selected-client-card,
.inline-client-panel {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
}
.selected-client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
}
.selected-client-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.selected-client-main div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.selected-client-main span:not(.selected-client-icon) {
    font-size: 0.64rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.35px;
}
.selected-client-main strong {
    font-size: 0.86rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.selected-client-icon,
.inline-client-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.selected-client-icon { background: var(--green-bg); color: var(--green); }
.inline-client-icon { background: var(--accent-bg); color: var(--accent-light); }
.selected-client-icon svg,
.inline-client-icon svg { width: 16px; height: 16px; }

.inline-client-panel { padding: 12px; }
.inline-client-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.inline-client-head > div:nth-child(2) {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.inline-client-head span {
    font-size: 0.64rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.35px;
}
.inline-client-head strong {
    font-size: 0.9rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.inline-client-head small {
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.35;
}

.inline-company-lookup {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    margin-bottom: 12px;
}
.inline-company-lookup label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.inline-lookup-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.inline-lookup-results {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.inline-lookup-item {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    padding: 9px 10px;
    text-align: left;
    font-family: var(--font);
    cursor: pointer;
}
.inline-lookup-item:hover { border-color: var(--accent); }
.inline-lookup-item strong { display: block; font-size: 0.8rem; margin-bottom: 2px; }
.inline-lookup-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 6px 2px;
}

.inline-client-details {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 8px;
}
.inline-client-details summary {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 600;
    list-style-position: inside;
    padding: 4px 0 8px;
}
.inline-client-details[open] summary { color: var(--text); }

.inv-line-edit {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px; margin-bottom: 8px;
}
.inv-line-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.inv-line-num { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.inv-line-rm { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.inv-line-rm:hover { color: var(--red); }
.inv-line-price-grid {
    display: grid;
    grid-template-columns: minmax(88px, 0.34fr) minmax(240px, 1fr) minmax(112px, 0.34fr);
    gap: 10px;
    margin-top: 8px;
    align-items: start;
}
.line-price-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}
.line-price-mode {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    min-height: 42px;
    align-self: stretch;
    overflow: hidden;
    isolation: isolate;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.line-price-mode::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    bottom: 3px;
    width: calc((100% - 9px) / 2);
    border-radius: var(--radius-sm);
    background: var(--accent-bg);
    border: 1px solid rgba(201,165,92,0.28);
    box-shadow: 0 3px 10px rgba(0,0,0,0.10);
    transform: translateX(0);
    transition: transform 0.18s ease, background 0.16s ease, border-color 0.16s ease;
    z-index: 0;
}
.line-price-mode:has(label:nth-child(2) input:checked)::before {
    transform: translateX(calc(100% + 3px));
}
.line-price-mode:hover {
    border-color: rgba(201,165,92,0.52);
    background: var(--bg-card-hover);
}
.line-price-mode label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
}
.line-price-mode input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.line-price-mode span {
    min-width: 44px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    transform: translateY(0);
    transition: color 0.16s ease, transform 0.12s ease;
}
.line-price-mode label:active span {
    transform: scale(0.97);
}
.line-price-mode input:checked + span {
    color: var(--accent-light);
}
.line-price-mode input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.line-price-preview {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.68rem;
    min-height: 16px;
    padding-left: 2px;
}
.line-vat-field {
    position: relative;
    min-width: 0;
}
.line-vat-field .line-vat-input {
    text-align: left;
}

.inv-checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; cursor: pointer; margin-top: 8px; }
.inv-checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Client autocomplete dropdown */
.ac-picker { position: relative; }
.ac-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 3000;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    max-height: min(360px, 46vh); overflow-y: auto; display: none;
    box-shadow: 0 18px 44px rgba(0,0,0,0.28);
}
.ac-dropdown-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-family: var(--font);
    padding: 10px 14px; cursor: pointer; font-size: 0.82rem;
    color: var(--text-secondary); transition: background 0.1s;
}
.ac-dropdown-item:hover { background: var(--bg-card-hover); color: var(--text); }
.ac-dropdown-empty { padding: 12px 14px; color: var(--text-muted); font-size: 0.78rem; }
.ac-dropdown-section {
    padding: 8px 14px 4px;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}
.smart-client-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.smart-client-option strong {
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 650;
}
.smart-client-option small {
    color: var(--text-muted);
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.smart-client-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.smart-client-option em {
    color: var(--accent-light);
    background: var(--accent-bg);
    border-radius: 999px;
    font-size: 0.58rem;
    font-style: normal;
    font-weight: 700;
    padding: 2px 6px;
    white-space: nowrap;
}
.smart-client-option--new {
    border-top: 1px solid var(--border);
}
.smart-client-option--new strong { color: var(--accent-light); }

/* Input field — consistent with existing inputs */
.input-field {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: var(--font); font-size: 0.85rem;
    padding: 10px 12px; width: 100%; outline: none;
    transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-muted); }
textarea.input-field { resize: vertical; min-height: 40px; }

@media (max-width: 820px) {
    .inv-form-grid { grid-template-columns: 1fr; gap: 0; }
    .inv-line-price-grid { grid-template-columns: 1fr; }
    .line-price-field { grid-template-columns: 1fr; }
    .line-price-mode {
        width: 100%;
        min-height: 44px;
    }
    .line-price-mode span {
        width: 100%;
        min-width: 0;
        height: 36px;
    }
    .client-type-switch { grid-template-columns: 1fr; }
    .client-lookup-row { grid-template-columns: 1fr; }
    .client-lookup-row .btn { width: 100%; }
    .input-field { min-height: 44px; font-size: 16px; }
    .inv-form-footer { flex-direction: column-reverse; }
    .inline-lookup-row { grid-template-columns: 1fr; }
    .inline-client-panel { padding: 14px; }
    .inline-client-head {
        display: grid;
        grid-template-columns: 30px minmax(0, 1fr) auto;
        align-items: start;
        gap: 10px;
    }
    .inline-client-head > div:nth-child(2) { min-width: 0; }
    .inline-client-head small { max-width: 100%; }
    .inline-client-head .btn {
        grid-column: 3;
        grid-row: 1 / span 2;
        align-self: start;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .line-price-mode,
    .line-price-mode::before,
    .line-price-mode span {
        transition: none;
    }
}

@media (max-width: 640px) {
    .selected-client-card,
    .inline-client-head { align-items: flex-start; }
    .selected-client-card {
        flex-direction: column;
    }
    .inline-client-head {
        grid-template-columns: 30px minmax(0, 1fr);
    }
    .inline-client-head .btn {
        grid-column: 1 / -1;
        grid-row: auto;
    }
    .selected-client-card .btn,
    .inline-client-head .btn,
    .inline-lookup-row .btn {
        width: 100%;
    }
}

/* Extra button variants for invoicing */
.btn-success { background: var(--green); color: #111; font-weight: 600; border: none; }
.btn-success:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-card-hover); }
.btn-danger-outline { background: transparent; border: 1px solid rgba(240,96,96,0.3); color: var(--red); }
.btn-danger-outline:hover { background: var(--red-bg); }

.referral-page {
    display: grid;
    gap: 16px;
}
.referral-hero {
    display: grid;
    gap: 16px;
    align-items: stretch;
    background: linear-gradient(135deg, rgba(201,165,92,0.16), rgba(45,212,160,0.10));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 2px;
}
.referral-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-light);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}
.referral-hero h2 {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 8px;
}
.referral-hero p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    max-width: 620px;
}
.referral-counter {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 96px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px;
}
.referral-counter strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--green);
}
.referral-counter span {
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.referral-link-card {
    display: grid;
    gap: 12px;
}
.referral-link-input {
    font-family: 'SF Mono', ui-monospace, Menlo, monospace;
}
.referral-share-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.referral-share-actions .btn {
    justify-content: center;
}
.referral-list {
    display: grid;
    gap: 8px;
}
.referral-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}
.referral-row:first-child {
    border-top: 0;
    padding-top: 0;
}
.referral-row-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.referral-row-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.referral-row-main span {
    color: var(--text-secondary);
    font-size: 0.76rem;
}
.referral-row-status {
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
}
.referral-row-status.is-paid {
    background: var(--green-bg);
    color: var(--green);
}
@media (min-width: 720px) {
    .referral-hero {
        grid-template-columns: minmax(0, 1fr) 220px;
        padding: 24px;
    }
    .referral-share-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); font-size: 0.82rem; }

.filters-bar {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 18px;
}
.filters-bar .filter-btn {
    font-size: 0.78rem; font-weight: 500;
    padding: 7px 14px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.filters-bar .filter-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.filters-bar .filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ═══ Onboarding Checklist Bar (Dashboard) ═══ */
.onboarding-checklist-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.ocb-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.ocb-left strong { font-size: 0.85rem; color: var(--text); }
.ocb-left .ocb-progress-text { font-size: 0.75rem; color: var(--text-muted); margin-left: 8px; }
.ocb-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}
.ocb-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}
.ocb-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.ocb-dismiss:hover { color: var(--text); }
.ocb-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ocb-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.ocb-item:hover { border-color: var(--accent); color: var(--text); }
.ocb-item.done {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.ocb-item.done .ocb-check { color: #10b981; font-weight: 700; }
.ocb-check { font-size: 0.85rem; }

/* ===== Categorization source badges ===== */
.cat-source-badge {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
    padding: 0px 4px; border-radius: 3px; margin-left: 3px; vertical-align: middle;
    line-height: 1.5; flex-shrink: 0;
}
.cat-source-auto {
    background: rgba(16, 185, 129, 0.12); color: #10b981;
}
.cat-source-suggestion {
    background: rgba(99, 102, 241, 0.12); color: #6366f1;
    font-size: 0.5rem; min-width: 12px; border-radius: 50%; padding: 0px 3px;
}
.cat-source-manual {
    background: rgba(99, 102, 241, 0.08); color: var(--text-muted);
}
@media (max-width: 400px) {
    .cat-source-badge { font-size: 0.45rem; padding: 0 3px; }
}

/* ===== Propagation banner in modal ===== */
.txm-propagation-banner {
    margin-top: 12px; padding: 10px 14px; border-radius: 8px;
    background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.2);
    animation: txm-prop-in 0.3s ease;
}
@keyframes txm-prop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.txm-prop-text {
    font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4;
}
.txm-prop-text strong { color: var(--text); }
.txm-prop-preview {
    display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px;
    max-height: 120px; overflow-y: auto;
}
.txm-prop-preview-item {
    font-size: 0.72rem; color: var(--text-muted); padding: 3px 0;
    display: flex; justify-content: space-between; align-items: center;
}
.txm-prop-preview-item .txm-prop-desc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txm-prop-preview-item .txm-prop-amt { font-weight: 600; margin-left: 8px; white-space: nowrap; }
.txm-prop-actions {
    display: flex; gap: 8px; align-items: center;
}
.txm-prop-btn {
    font-size: 0.75rem; font-weight: 600; padding: 5px 14px; border-radius: 6px;
    border: none; cursor: pointer; transition: all 0.15s;
}
.txm-prop-btn-apply {
    background: var(--accent); color: #fff;
}
.txm-prop-btn-apply:hover { filter: brightness(1.1); }
.txm-prop-btn-skip {
    background: transparent; color: var(--text-muted); padding: 5px 10px;
}
.txm-prop-btn-skip:hover { color: var(--text); }

/* ===== Suggestions in modal ===== */
.txm-suggestions {
    margin-top: 10px;
}
.txm-suggestions-title {
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.txm-suggestion-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    border-radius: 6px; cursor: pointer; transition: all 0.15s;
    font-size: 0.78rem; color: var(--text-secondary);
}
.txm-suggestion-item:hover {
    background: var(--bg-input); color: var(--text);
}
.txm-suggestion-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.txm-suggestion-name { flex: 1; }

/* ===== Internal transfers ===== */
.tx-transfer { opacity: 0.65; }
.tx-transfer:hover { opacity: 0.85; }
.tx-icon-transfer { background: rgba(139, 92, 246, 0.10); color: #8B5CF6; }
.tx-transfer-badge {
    display: inline-block; font-size: 0.55rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .03em; padding: 1px 5px; border-radius: 3px; margin-left: 4px;
    background: rgba(139, 92, 246, 0.12); color: #8B5CF6; vertical-align: middle; flex-shrink: 0;
}
@media (max-width: 400px) {
    .tx-transfer-badge { font-size: 0.5rem; padding: 0 4px; }
}
.tx-transfer-icon {
    color: #8B5CF6; font-weight: 700; margin-right: 2px;
}

/* Transfer banner in modal */
.txm-transfer-banner {
    margin: 12px 0; padding: 14px 16px; border-radius: 10px;
    background: rgba(139, 92, 246, 0.06); border: 1px solid rgba(139, 92, 246, 0.18);
}
.txm-transfer-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.txm-transfer-icon { font-size: 1.1rem; color: #8B5CF6; }
.txm-transfer-title {
    font-size: 0.82rem; font-weight: 700; color: #8B5CF6;
}
.txm-transfer-text {
    font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 10px;
}
.txm-transfer-linked {
    padding: 8px 10px; border-radius: 6px; background: var(--bg-input); margin-bottom: 10px;
}
.txm-transfer-linked-label {
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .03em; display: block; margin-bottom: 4px;
}
.txm-transfer-linked-detail {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.78rem; color: var(--text);
}
.txm-transfer-linked-amt { font-weight: 700; }
.txm-transfer-unflag {
    display: block; width: 100%; padding: 6px; border: none; border-radius: 6px;
    background: transparent; color: var(--text-muted); font-size: 0.72rem;
    cursor: pointer; text-align: center; transition: all 0.15s;
}
.txm-transfer-unflag:hover { color: var(--red); background: rgba(239, 68, 68, 0.06); }

.txm-transfer-zone {
    padding: 10px 12px; border-radius: 10px;
    background: var(--bg-input); border: 1px solid var(--border-light);
    transition: all 0.2s;
}
.txm-transfer-toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.txm-transfer-hint {
    margin-top: 8px; padding: 8px 10px; border-radius: 6px;
    background: rgba(139, 92, 246, 0.06); border: 1px solid rgba(139, 92, 246, 0.15);
    font-size: 0.73rem; color: #8B5CF6; line-height: 1.4;
}

@media (max-width: 640px) {
    .billing-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .billing-banner a {
        width: 100%;
    }
}

/* ===== Pages d'erreur (404, 403, 405, 429, 500, ...) ===== */

.error-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 48px;
    min-height: calc(100dvh - 160px);
}

.error-standalone {
    flex-direction: column;
    gap: 24px;
}
.error-container-wide { max-width: 520px; }
.error-standalone-logo {
    display: flex;
    justify-content: center;
}
.error-standalone-logo .logo {
    text-decoration: none;
    color: var(--text);
}

.error-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 28px 32px;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .error-card {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.error-card::before {
    content: '';
    position: absolute;
    inset: -40% -20% auto -20%;
    height: 280px;
    background: radial-gradient(ellipse at top, var(--accent-glow), transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.error-card-critical::before {
    background: radial-gradient(ellipse at top, rgba(240, 96, 96, 0.10), transparent 70%);
}
.error-card-warn::before {
    background: radial-gradient(ellipse at top, rgba(245, 166, 35, 0.10), transparent 70%);
}

.error-card > * { position: relative; z-index: 1; }

.error-code-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.error-code {
    font-size: clamp(4.2rem, 12vw, 6rem);
    font-weight: 800;
    letter-spacing: -3px;
    line-height: 0.95;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.error-card-critical .error-code {
    background: linear-gradient(135deg, var(--red), #f8a2a2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-card-warn .error-code {
    background: linear-gradient(135deg, var(--orange), #f5c878);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-bg);
    color: var(--accent-light);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.error-card-critical .error-pill {
    background: var(--red-bg);
    color: var(--red);
}
.error-card-warn .error-pill {
    background: var(--orange-bg);
    color: var(--orange);
}

.error-illustration {
    width: 96px;
    height: 96px;
    margin: 12px auto 18px;
    color: var(--accent-light);
    opacity: 0.85;
}
.error-illustration svg {
    width: 100%;
    height: 100%;
}
.error-card-critical .error-illustration { color: var(--red); }
.error-card-warn .error-illustration { color: var(--orange); }

.error-body {
    margin-bottom: 24px;
}
.error-eyebrow {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.error-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 10px;
    color: var(--text);
}
.error-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 420px;
    margin: 0 auto;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}
.error-actions .btn {
    min-width: 180px;
}

.error-support-hint {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.error-support-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-light);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.error-support-link:hover { color: var(--accent); }

@media (max-width: 600px) {
    .error-card {
        padding: 28px 20px 24px;
        border-radius: var(--radius-lg);
    }
    .error-actions { flex-direction: column; }
    .error-actions .btn { width: 100%; min-width: 0; }
    .error-illustration { width: 80px; height: 80px; }
}
