/* =====================================================================
   ContaRO — sistem de design (light, profesional, dens)
   Reproiectat pentru contabili: shell cu meniuri grupate, tabele dense,
   formulare eficiente. Temă deschisă, accent albastru corporativ.
   ===================================================================== */

@layer reset, base, components, utilities;

/* ---------------------------------------------------------------------
   Tokenuri de design
   --------------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Spațiere (bază 4px) */
    --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
    --space-4: 1rem;     --space-5: 1.25rem;  --space-6: 1.5rem;
    --space-8: 2rem;     --space-10: 2.5rem;  --space-12: 3rem;
    --space-16: 4rem;

    /* Rază de colț (mai mici = aspect tehnic) */
    --radius-sm: 4px;  --radius-md: 6px;  --radius-lg: 9px;
    --radius-xl: 14px; --radius-full: 9999px; --radius-pill: 9999px;

    /* Tipografie (densă) */
    --text-xs: 0.75rem;   --text-sm: 0.8125rem;  --text-base: 0.875rem;
    --text-md: 1rem;      --text-lg: 1.125rem;   --text-xl: 1.375rem;
    --text-2xl: 1.75rem;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', ui-monospace, monospace;

    /* Tranziții */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 110ms; --dur-normal: 180ms; --dur-slow: 300ms;

    /* Umbre */
    --shadow-xs: 0 1px 2px oklch(45% 0.03 256 / 0.08);
    --shadow-sm: 0 1px 3px oklch(45% 0.03 256 / 0.10);
    --shadow-md: 0 6px 18px oklch(45% 0.03 256 / 0.12);
    --shadow-lg: 0 14px 40px oklch(40% 0.03 256 / 0.18);

    /* Culoare de brand (albastru corporativ) */
    --color-primary: oklch(52% 0.2 256);
    --color-primary-strong: oklch(45% 0.2 256);
    --color-primary-soft: oklch(95.5% 0.03 256);
    --shadow-primary: 0 2px 8px oklch(52% 0.2 256 / 0.28);

    /* Suprafețe */
    --surface-app: oklch(97.2% 0.005 256);
    --surface-card: oklch(100% 0 0);
    --surface-muted: oklch(96% 0.006 256);
    --surface-subtle: oklch(97.6% 0.005 256);

    /* Borduri */
    --border-default: oklch(91% 0.007 256);
    --border-strong: oklch(85% 0.01 256);

    /* Text */
    --text-primary: oklch(27% 0.02 256);
    --text-secondary: oklch(45% 0.018 256);
    --text-muted: oklch(58% 0.013 256);

    /* Stări semantice (text / fundal) */
    --success: oklch(52% 0.14 155);   --success-bg: oklch(95.5% 0.035 155);
    --danger: oklch(54% 0.21 25);     --danger-bg: oklch(95.5% 0.035 25);
    --warning: oklch(58% 0.13 70);    --warning-bg: oklch(95.5% 0.05 75);
    --info: oklch(54% 0.13 240);      --info-bg: oklch(95.5% 0.035 240);

    /* Înălțimi shell */
    --header-h: 56px;
}

/* ---------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------- */
@layer reset {
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { -webkit-text-size-adjust: 100%; }

    body {
        min-height: 100dvh;
        font-family: var(--font-sans);
        font-size: var(--text-base);
        line-height: 1.55;
        color: var(--text-primary);
        background: oklch(0.52 0.12 246.3 / 0.16);
        -webkit-font-smoothing: antialiased;
        display: flex;
        flex-direction: column;
    }

    h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; }
    p { text-wrap: pretty; }

    a { color: var(--color-primary); text-decoration: none; }
    a:hover { text-decoration: underline; }

    button, input, select, textarea { font: inherit; color: inherit; }
    button { cursor: pointer; }

    img, svg { display: block; max-width: 100%; }

    :focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
        border-radius: var(--radius-sm);
    }

    [x-cloak] { display: none !important; }
}

/* ---------------------------------------------------------------------
   Bază
   --------------------------------------------------------------------- */
@layer base {
    .skip-link {
        position: absolute;
        left: -999px;
        top: var(--space-2);
        z-index: 100;
        padding: var(--space-2) var(--space-4);
        background: var(--color-primary);
        color: #fff;
        border-radius: var(--radius-md);
    }
    .skip-link:focus { left: var(--space-2); }
}

/* ---------------------------------------------------------------------
   Componente
   --------------------------------------------------------------------- */
@layer components {

    /* ===== Antet / shell ===== */
    .app-header {
        position: sticky;
        top: 0;
        z-index: 30;
        background: var(--surface-card);
        border-bottom: 1px solid var(--border-default);
        box-shadow: var(--shadow-xs);
    }
    .app-header__inner {
        display: flex;
        align-items: center;
        gap: var(--space-4);
        min-height: var(--header-h);
        width: min(1700px, 100% - 2 * var(--space-5));
        margin-inline: auto;
    }
    .app-footer__inner,
    .app-main {
        width: min(1700px, 100% - 2 * var(--space-5));
        margin-inline: auto;
    }

    .brand {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        font-weight: 700;
        color: var(--text-primary);
        flex-shrink: 0;
    }
    .brand:hover { text-decoration: none; }
    .brand__mark {
        display: grid;
        place-items: center;
        width: 30px; height: 30px;
        border-radius: var(--radius-md);
        background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
        color: #fff;
        font-size: var(--text-md);
        font-weight: 800;
        box-shadow: var(--shadow-primary);
    }
    .brand__name { font-size: var(--text-md); letter-spacing: -0.01em; }

    .app-nav { flex: 1; min-width: 0; }
    .app-nav__hint { color: var(--text-muted); font-size: var(--text-sm); }
    @media (width < 640px) { .app-nav__hint { display: none; } }

    /* ===== Bara de meniuri (top nav cu dropdown-uri) ===== */
    .menubar {
        display: flex;
        align-items: center;
        gap: 0;
        list-style: none;
    }
    .menubar__spacer { margin-left: auto; }
    .menubar > .menubar__spacer ~ .menu-item { margin-left: 5px; }
    .menu-item { position: relative; }
    /* Punte invizibilă peste golul de 6px dintre buton și panoul dropdown. Stă pe <li>
       (nu pe .dropdown), fiindcă mega-dropdown-urile au overflow:auto care ar tăia o punte
       plasată pe panou. Activă doar cât meniul e deschis, ca să nu deschidă meniul din greșeală. */
    .menu-item::after {
        content: ''; position: absolute; left: 0; right: 0;
        top: 100%; height: 8px; display: none;
    }
    .menu-item:hover::after { display: block; }

    .menu-link,
    .menu-trigger {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: var(--space-2) 6px;
        border: 0;
        background: none;
        border-radius: var(--radius-md);
        color: var(--text-secondary);
        font-size: var(--text-sm);
        font-weight: 550;
        white-space: nowrap;
        transition: background var(--dur-fast) var(--ease-out),
                    color var(--dur-fast) var(--ease-out);
    }
    .menu-link:hover,
    .menu-trigger:hover {
        background: var(--surface-muted);
        color: var(--text-primary);
        text-decoration: none;
    }
    .menu-link.is-active {
        color: var(--color-primary-strong);
        background: var(--color-primary-soft);
    }
    .menu-trigger[aria-expanded="true"] {
        background: var(--surface-muted);
        color: var(--color-primary-strong);
    }
    .menu-caret { font-size: 0.6em; opacity: 0.7; }
    .menu-ico { font-size: 1.3em; line-height: 1; }
    /* Badge contor pe un element de meniu (ex. viramente de confirmat) */
    .menu-badge {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 18px; height: 18px; padding: 0 5px;
        border-radius: 999px;
        background: var(--warning); color: #fff;
        font-size: 11px; font-weight: 700; line-height: 1;
    }

    .dropdown {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        min-width: 224px;
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        padding: var(--space-1);
        z-index: 40;
        display: flex;
        flex-direction: column;
    }
    .dropdown--right { left: auto; right: 0; }
    /* Mega-dropdown (Situații & listări): pe mai multe coloane, ca tot meniul să fie vizibil
       fără tăiere pe verticală. Fiecare secțiune (.dd-sect) rămâne întreagă (nu se rupe între
       coloane). Plasă de siguranță: scroll dacă tot nu încape pe ecrane scunde. */
    .dropdown--mega, .dropdown--mega-3 {
        display: block;
        column-gap: var(--space-3);
        max-width: 94vw;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    .dropdown--mega { columns: 2; min-width: 480px; }
    .dropdown--mega-3 { columns: 3; min-width: 700px; }
    .dropdown--mega .dd-sect, .dropdown--mega-3 .dd-sect { break-inside: avoid; display: block; }
    .dropdown--mega .dd-sect + .dd-sect, .dropdown--mega-3 .dd-sect + .dd-sect { margin-top: var(--space-1); }
    @media (max-width: 760px) {
        .dropdown--mega, .dropdown--mega-3 { columns: 1; min-width: 224px; }
    }
    /* Meniuri: densitate moderată (compact, dar nu înghesuit) + linie subtilă între categorii. */
    .menubar .dropdown { padding: 4px 4px 16px; }
    .menubar .dropdown__item,
    .menubar .dropdown__item button { padding-top: 3px; padding-bottom: 3px; line-height: 1.3; }
    .menubar .dropdown__label { padding-top: 3px; padding-bottom: 2px; line-height: 1.2; }
    .menubar .dd-sect + .dd-sect {
        margin-top: 5px;
        padding-top: 5px;
        border-top: 1px solid var(--border-default);
    }
    .menubar .dropdown__sep { margin: 3px 0; }
    .dropdown__label {
        font-size: var(--text-xs);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        padding: var(--space-2) var(--space-3) var(--space-1);
    }
    .dropdown__item,
    .dropdown__item button {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        width: 100%;
        text-align: left;
        white-space: nowrap;
        padding: var(--space-1) var(--space-3);
        border: 0;
        background: none;
        border-radius: var(--radius-md);
        color: var(--text-secondary);
        font-size: var(--text-sm);
        transition: background var(--dur-fast) var(--ease-out),
                    color var(--dur-fast) var(--ease-out);
    }
    .dropdown__item:hover {
        background: var(--surface-muted);
        color: var(--color-primary-strong);
        text-decoration: none;
    }
    .dropdown__sep { height: 1px; background: var(--border-default); margin: 3px 0; }

    /* Submeniu (flyout) — o secțiune cu mai multe operații, deschisă la hover/click */
    .dropdown__group { position: relative; }
    .dropdown__item--sub { justify-content: space-between; cursor: pointer; }
    .dropdown__caret { color: currentColor; opacity: .7; font-size: var(--text-xs); margin-left: var(--space-2); }
    .dropdown__sub {
        position: absolute; top: -1px; left: 100%;
        min-width: 240px;
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        padding: var(--space-1) var(--space-1) var(--space-3);
        display: none; flex-direction: column;
        z-index: 50;
    }
    .dropdown__group:hover > .dropdown__sub,
    .dropdown__group.is-open > .dropdown__sub { display: flex; }
    .dropdown__group:hover > .dropdown__item--sub,
    .dropdown__group.is-open > .dropdown__item--sub {
        background: var(--surface-muted); color: var(--color-primary-strong);
    }
    @media (max-width: 720px) {
        /* Pe ecrane mici: submeniul devine listă indentată, mereu vizibilă */
        .dropdown__sub {
            position: static; display: flex; box-shadow: none; border: 0;
            border-left: 2px solid var(--border-default); border-radius: 0;
            margin-left: var(--space-3); min-width: 0; padding: 0;
        }
        .dropdown__caret { transform: rotate(90deg); }
    }

    /* Chip companie activă + meniu utilizator */
    .menu-chip {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 34px;
        padding: 4px 10px 4px 5px;
        background: #f7fbff;
        color: #174b83;
        border: 1px solid #cbd9e8;
        border-radius: 6px;
        font-size: var(--text-xs);
        font-weight: 650;
        white-space: nowrap;
        max-width: 250px;
        overflow: hidden;
        box-shadow: 0 1px 1px rgba(16,24,40,.03), inset 0 1px 0 rgba(255,255,255,.65);
    }
    .menu-chip:hover { background: #edf5ff; border-color: #9fc0e4; color: #174b83; text-decoration: none; }
    .menu-chip--warn { background: var(--warning-bg); color: var(--warning); }
    .menu-chip--warn:hover { background: var(--warning); color: #fff; }
    .menu-chip__mark {
        display: grid;
        place-items: center;
        width: 24px;
        height: 24px;
        flex: 0 0 auto;
        border-radius: 5px;
        background: #dcecff;
        color: #1f63ab;
        font-size: 12px;
        font-weight: 800;
        font-family: var(--font-mono);
    }
    .menu-chip__text {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
        line-height: 1.05;
    }
    .menu-chip__label {
        font-size: 9px;
        font-weight: 750;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #64748b;
    }
    /* Ellipsis pe numele firmei: pe un chip `inline-flex`, `text-overflow` nu prinde
       pe textul direct — îl aplicăm pe span-ul interior (flex item cu min-width:0). */
    .menu-chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0f3f73; }
    .menu-chip__go {
        flex: 0 0 auto;
        margin-left: 1px;
        padding-left: 7px;
        border-left: 1px solid #c7d8ea;
        color: #1f63ab;
        font-size: 10px;
        font-weight: 800;
    }

    .shell-fullscreen {
        display: inline-grid;
        place-items: center;
        width: 38px;
        height: 34px;
        padding: 0;
        border: 1px solid #8fb8e6;
        border-radius: 8px;
        background: linear-gradient(to bottom, #fbfdff, #e7f1fd);
        color: #1f63ab;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(16,40,80,.08), inset 0 1px 0 rgba(255,255,255,.88);
        transition: background var(--dur-fast) var(--ease-out),
                    border-color var(--dur-fast) var(--ease-out),
                    color var(--dur-fast) var(--ease-out),
                    box-shadow var(--dur-fast) var(--ease-out);
    }
    .shell-fullscreen[hidden] { display: none !important; }
    .shell-fullscreen:hover {
        background: linear-gradient(to bottom, #ffffff, #d8eafd);
        border-color: #4f8fd3;
        color: #174b83;
        box-shadow: 0 2px 7px rgba(16,40,80,.15), inset 0 1px 0 rgba(255,255,255,.9);
    }
    .shell-fullscreen:focus-visible { outline: 2px solid #2865A8; outline-offset: 2px; }
    .shell-fullscreen.is-on {
        background: #1f63ab;
        border-color: #18508d;
        color: #fff;
        box-shadow: 0 2px 8px rgba(31,99,171,.22), inset 0 1px 0 rgba(255,255,255,.18);
    }
    .shell-fullscreen svg {
        display: block;
        width: 19px;
        height: 19px;
    }
    .shell-fullscreen__icon--exit { display: none; }
    .shell-fullscreen.is-on .shell-fullscreen__icon--enter { display: none; }
    .shell-fullscreen.is-on .shell-fullscreen__icon--exit { display: block; }

    .user-trigger {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 34px;
        max-width: 250px;
        padding: 4px 8px 4px 4px;
        border: 1px solid #cbd3dd;
        background: #ffffff;
        border-radius: var(--radius-full);
        color: var(--text-secondary);
        font-size: var(--text-xs);
        font-weight: 650;
        white-space: nowrap;
        box-shadow: 0 1px 1px rgba(16,24,40,.03), inset 0 1px 0 rgba(255,255,255,.72);
    }
    .user-trigger:hover { background: #f8fafc; border-color: #aeb8c4; color: var(--text-primary); }
    .user-avatar {
        display: grid;
        place-items: center;
        width: 26px; height: 26px;
        border-radius: var(--radius-full);
        background: var(--color-primary);
        color: #fff;
        font-size: var(--text-xs);
        font-weight: 700;
        flex-shrink: 0;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
    }
    .user-meta {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
        line-height: 1.05;
    }
    .user-label {
        font-size: 9px;
        font-weight: 750;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
    }
    .user-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Navigare condensată pe ecrane mici */
    @media (width < 900px) {
        .menu-link, .menu-trigger { padding: var(--space-2); font-size: var(--text-xs); }
        .user-trigger .user-meta { display: none; }
        .menu-chip__label { display: none; }
        .menu-chip__go { display: none; }
    }

    /* ===== Conținut principal ===== */
    .app-main {
        flex: 1;
        padding-block: var(--space-4) var(--space-10);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* ===== Subsol ===== */
    .app-footer {
        border-top: 1px solid var(--border-default);
        background: var(--surface-card);
    }
    .app-footer__inner {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-3);
        min-height: 28px;
        padding-block: 4px;
        color: var(--text-muted);
        font-size: var(--text-xs);
    }
    .app-footer__sep { color: var(--border-strong); }

    /* ===== Antet de pagină (fost .hero) ===== */
    .hero {
        display: flex;
        flex-flow: row wrap;
        align-items: baseline;
        gap: var(--space-1) var(--space-3);
    }
    .hero__badge {
        flex-basis: 100%;
        order: -1;
        font-size: var(--text-xs);
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--color-primary-strong);
    }
    .hero__title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
    .hero__lead {
        color: var(--text-secondary);
        max-width: 86ch;
        font-size: var(--text-sm);
    }

    /* ===== Antet de pagină cu acțiuni (titlu stânga, butoane dreapta) ===== */
    .page-head {
        display: flex; align-items: flex-start; justify-content: space-between;
        gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5);
    }
    .page-head__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

    /* Rând de acțiuni inline (footer pagini de detaliu) */
    .inline-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-top: var(--space-5); }

    /* ===== Toolbar / bara de filtre (formulare GET în conținut) ===== */
    .app-main form[method="get"],
    .toolbar {
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        padding: var(--space-3) var(--space-4);
        box-shadow: var(--shadow-xs);
        align-items: end;
    }
    .toolbar {
        display: flex;
        gap: var(--space-3);
        flex-wrap: wrap;
        justify-content: space-between;
    }

    /* ===== Grilă de carduri / KPI ===== */
    /* Panou „plat" (stil fpx-kpi): un singur contur exterior + linii subțiri
       între celule (grid gap 1px pe fond border-strong), NU chenare individuale
       pe fiecare card — la fel ca la .fpx-kpis, pentru un aspect unitar. */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1px;
        background: var(--border-default);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
    .card {
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        padding: var(--space-4);
        box-shadow: var(--shadow-xs);
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        transition: box-shadow var(--dur-normal) var(--ease-out),
                    border-color var(--dur-normal) var(--ease-out);
    }
    .card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
    .card-grid .card { border: 0; border-radius: 0; box-shadow: none; }
    .card-grid .card:hover { box-shadow: none; border-color: transparent; }
    .card__head { display: flex; align-items: center; gap: var(--space-2); }
    .card__title {
        font-size: var(--text-xs);
        font-weight: 650;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    .card__metric {
        font-size: var(--text-xl);
        font-weight: 700;
        color: var(--text-primary);
        line-height: 1.1;
    }
    .card__metric--muted { color: var(--text-muted); }
    .card__note { font-size: var(--text-sm); color: var(--text-muted); }

    /* ===== Acțiuni rapide (dashboard) ===== */
    .quick-grid {
        display: grid;
        gap: var(--space-3);
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .quick {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-4);
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        color: var(--text-primary);
        box-shadow: var(--shadow-xs);
        transition: border-color var(--dur-fast) var(--ease-out),
                    box-shadow var(--dur-fast) var(--ease-out),
                    transform var(--dur-fast) var(--ease-out);
    }
    .quick:hover {
        text-decoration: none;
        border-color: var(--color-primary);
        box-shadow: var(--shadow-sm);
        transform: translateY(-1px);
    }
    .quick__icon {
        display: grid;
        place-items: center;
        width: 36px; height: 36px;
        border-radius: var(--radius-md);
        background: var(--color-primary-soft);
        color: var(--color-primary-strong);
        font-size: var(--text-md);
        flex-shrink: 0;
    }
    .quick__title { font-weight: 600; font-size: var(--text-sm); }
    .quick__note { font-size: var(--text-xs); color: var(--text-muted); }

    /* Titlu de secțiune intern */
    .section-title {
        font-size: var(--text-md);
        font-weight: 650;
        margin-bottom: var(--space-3);
        color: var(--text-primary);
    }

    /* ===== Indicator de stare ===== */
    .status-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex-shrink: 0; }
    .status-dot--ok   { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
    .status-dot--warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
    .status-dot--err  { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-bg); }

    /* ===== Butoane ===== */
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-4);
        border: 1px solid transparent;
        border-radius: var(--radius-md);
        font-size: var(--text-sm);
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        transition: background var(--dur-fast) var(--ease-out),
                    border-color var(--dur-fast) var(--ease-out),
                    box-shadow var(--dur-fast) var(--ease-out),
                    transform var(--dur-fast) var(--ease-out);
    }
    .btn:hover { text-decoration: none; }
    .btn:active { transform: translateY(1px); }
    .btn:disabled { opacity: 0.5; pointer-events: none; }
    .btn--sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }

    .btn--primary {
        background: var(--color-primary);
        color: #fff;
        box-shadow: var(--shadow-primary);
    }
    .btn--primary:hover { background: var(--color-primary-strong); }

    .btn--ghost {
        background: var(--surface-card);
        color: var(--text-primary);
        border-color: var(--border-strong);
    }
    .btn--ghost:hover { background: var(--surface-muted); border-color: var(--text-muted); }

    .btn--danger { background: var(--danger); color: #fff; }
    .btn--danger:hover { background: oklch(from var(--danger) calc(l - 0.06) c h); }

    /* ===== Alerte / flash ===== */
    .flash-stack { display: flex; flex-direction: column; gap: var(--space-2); }
    .alert {
        padding: var(--space-3) var(--space-4);
        border-radius: var(--radius-md);
        border: 1px solid transparent;
        border-left-width: 3px;
        font-size: var(--text-sm);
    }
    .alert--success { background: var(--success-bg); border-color: var(--success); color: oklch(from var(--success) calc(l - 0.08) c h); }
    .alert--danger  { background: var(--danger-bg);  border-color: var(--danger);  color: oklch(from var(--danger) calc(l - 0.05) c h); }
    .alert--warning { background: var(--warning-bg); border-color: var(--warning); color: oklch(from var(--warning) calc(l - 0.1) c h); }
    .alert--info    { background: var(--info-bg);    border-color: var(--info);    color: oklch(from var(--info) calc(l - 0.05) c h); }

    /* ===== Badge ===== */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 2px var(--space-2);
        border-radius: var(--radius-sm);
        font-size: var(--text-xs);
        font-weight: 600;
        line-height: 1.4;
    }
    .badge--neutral { background: var(--surface-muted); color: var(--text-secondary); border: 1px solid var(--border-default); }
    .badge--primary { background: var(--color-primary-soft); color: var(--color-primary-strong); }

    /* ===== Stare document (factură / notă) — pill cu status dot ===== */
    .stare-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 3px 10px 3px 8px;
        border-radius: 999px;
        font-size: var(--text-xs);
        font-weight: 600;
        line-height: 1.4;
        white-space: nowrap;
        border: 1px solid transparent;
        cursor: help;
    }
    .stare-badge__dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        flex: 0 0 auto;
        background: currentColor;
        box-shadow: 0 0 0 3px color-mix(in oklch, currentColor 18%, transparent);
    }
    .stare-badge--draft {
        background: var(--warning-bg);
        color: oklch(from var(--warning) calc(l - 0.08) c h);
        border-color: color-mix(in oklch, var(--warning) 28%, transparent);
    }
    .stare-badge--ok {
        background: var(--success-bg);
        color: oklch(from var(--success) calc(l - 0.06) c h);
        border-color: color-mix(in oklch, var(--success) 28%, transparent);
    }
    .stare-badge--cancel {
        background: var(--surface-muted);
        color: var(--text-secondary);
        border-color: var(--border-default);
    }
    .stare-badge--cancel .stare-badge__dot { box-shadow: none; opacity: 0.7; }

    .stare-legend {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2) var(--space-4);
        margin-top: var(--space-3);
        padding: var(--space-3) var(--space-1);
        font-size: var(--text-xs);
        color: var(--text-muted);
    }
    .stare-legend__item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .stare-legend .stare-badge { cursor: default; }

    /* ===== Master-detail (listă facturi + panou liniile selectate) ===== */
    .fp-grid .table tbody tr { cursor: pointer; }
    .fp-grid .table tbody tr:hover { background: var(--surface-muted); }
    .fp-grid .table tbody tr.is-selected {
        background: var(--color-primary-soft);
        box-shadow: inset 3px 0 0 var(--color-primary);
    }
    .fp-grid .table tbody tr.is-selected:hover { background: var(--color-primary-soft); }
    /* Listă compactă: ~10 facturi vizibile, header fix, scroll peste */
    .fp-grid .table-wrap { max-height: 380px; overflow-y: auto; }
    .fp-grid .table th, .fp-grid .table td { padding: 5px var(--space-3); }
    .fp-grid .table thead th { z-index: 2; }
    .fp-detail {
        margin-top: var(--space-4);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        background: var(--surface-subtle);
        box-shadow: var(--shadow-sm);
        padding: var(--space-4);
        min-height: 140px;
    }
    .fp-detail__empty { color: var(--text-muted); text-align: center; padding: var(--space-6); }
    .fp-detail__head {
        display: flex; justify-content: space-between; align-items: flex-start;
        gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3);
    }
    .fp-detail__doc { font-size: var(--text-md); font-weight: 600; }
    .fp-detail__toolbar {
        display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center;
        margin-top: var(--space-3); padding-top: var(--space-3);
        border-top: 1px solid var(--border-default);
    }
    .fp-summary {
        display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
        margin-top: var(--space-3);
    }
    .fp-summary__item {
        background: var(--surface-muted);
        border: 1px solid var(--border-default);
        border-radius: 999px;
        padding: 4px 12px;
        font-size: var(--text-sm);
        color: var(--text-secondary);
    }

    /* ===== Ecran facturi (intrare/ieșire): KPI + tab-uri + master-detail inline ===== */
    .tva-card.is-warning { border-color: color-mix(in oklch, var(--warning) 35%, transparent); background: var(--warning-bg); }

    .inv-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); font-size: 11px; font-weight: 700; margin-left: 4px; }
    .tva-tab.is-active .inv-count { background: rgba(255,255,255,.25); color: #fff; }
    .inv-count--danger { background: var(--danger); color: #fff; }
    .tva-tab.is-active .inv-count--danger { background: #fff; color: var(--danger); }

    .inv-toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin: var(--space-3) 0; }
    .inv-search { max-width: 340px; flex: 1 1 240px; }
    .inv-daterange { display: flex; gap: var(--space-2); align-items: center; flex-wrap: nowrap; }
    .inv-daterange .input, .inv-daterange .select { width: auto; }

    .inv-grid { margin-top: var(--space-2); }
    .inv-grid .table tbody tr.inv-row { cursor: pointer; }
    .inv-grid .table tbody tr.inv-row:hover { background: var(--surface-muted); }
    .inv-grid .table tbody tr.inv-row.is-open { background: var(--color-primary-soft); box-shadow: inset 3px 0 0 var(--color-primary); }
    .inv-grid .table th, .inv-grid .table td { padding: 6px var(--space-3); }
    .inv-caret { display: inline-block; color: var(--text-muted); font-size: var(--text-xs); transition: transform var(--dur-fast) var(--ease-out); margin-right: 4px; }
    .inv-caret.is-open { transform: rotate(90deg); color: var(--color-primary); }
    .inv-expand > td { padding: 0 !important; background: var(--surface-app); }
    .inv-expand .fp-detail { margin: 0; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
    .inv-foot td { background: var(--surface-muted); font-weight: 600; border-top: 1px solid var(--border-strong); }
    .inv-foot__rest { color: var(--danger); }

    .inv-note-sumar {
        display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
        margin-top: var(--space-3); padding: var(--space-2) var(--space-3);
        background: var(--surface-card); border: 1px solid var(--border-default);
        border-radius: var(--radius-md); font-size: var(--text-sm);
    }
    .inv-note-sumar__lbl { font-weight: 600; color: var(--text-secondary); }
    .inv-note-sumar__pd { font-weight: 600; }
    .inv-note-sumar__link { font-size: var(--text-xs); color: var(--color-primary-strong); white-space: nowrap; }
    .inv-note-sumar__plata { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); }

    /* ===== Ecran Registru de casă ===== */
    .casa-datenav {
        display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-3);
        margin-top: var(--space-3); padding: var(--space-2) var(--space-3);
        background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    }
    .casa-datenav__nav { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
    .casa-datenav__label { font-weight: 600; min-width: 180px; text-align: center; }
    .casa-datenav__pick { margin: 0; }
    .casa-datenav__pick .input { width: auto; }
    .casa-datenav__modes { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-muted); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
    .casa-mode { padding: 5px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); text-decoration: none; }
    .casa-mode:hover { background: var(--surface-card); color: var(--text-primary); }
    .casa-mode.is-active { background: var(--color-primary); color: #fff; }

    .casa-actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
    .casa-action {
        display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
        padding: var(--space-3); background: var(--surface-card); border: 1px solid var(--border-default);
        border-radius: var(--radius-lg); color: var(--text-secondary); text-decoration: none; font-size: var(--text-xs); font-weight: 600;
        transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
    }
    .casa-action:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); color: var(--color-primary-strong); }
    .casa-action__ic { font-size: 22px; line-height: 1; }

    .casa-kpi { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
    .casa-plafon__bar { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin: 4px 0 2px; }
    .casa-plafon__bar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
    .casa-plafon--warning .casa-plafon__bar > span { background: var(--warning); }
    .casa-plafon--danger { border-color: color-mix(in oklch, var(--danger) 35%, transparent); background: var(--danger-bg); }
    .casa-plafon--danger .casa-plafon__bar > span { background: var(--danger); }

    .cont-badge { display: inline-block; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; padding: 1px 7px; border-radius: 999px; }
    .cont-b-blue { background: var(--color-primary-soft); color: var(--color-primary-strong); }
    .cont-b-amber { background: var(--warning-bg); color: oklch(from var(--warning) calc(l - 0.1) c h); }
    .cont-b-gray { background: var(--surface-muted); color: var(--text-secondary); }

    .casa-table .casa-special td { background: var(--surface-muted); font-weight: 600; }
    .casa-table .casa-sold-row td { background: var(--surface-subtle); }
    .casa-table .casa-total-row td { border-top: 1px solid var(--border-strong); }
    .casa-table tr.casa-row--alert td { background: var(--row-alert-bg, rgba(250,238,218,0.45)); }
    .casa-warn { color: var(--warning); cursor: help; font-weight: 700; }

    .casa-detaliu__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); font-size: var(--text-sm); }
    .casa-detaliu__lbl { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }

    @media (max-width: 1023px) {
        .casa-actions { grid-template-columns: repeat(3, 1fr); }
        .casa-kpi { grid-template-columns: repeat(2, 1fr); }
    }
    @media (max-width: 600px) { .casa-actions { grid-template-columns: repeat(2, 1fr); } }

    /* ===== Ecran Registru de bancă ===== */
    .banca-cards__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
    .banca-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-top: var(--space-2); }
    .banca-card {
        background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
        padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-xs); cursor: pointer;
        transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
    }
    .banca-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
    .banca-card.is-active { border-color: var(--color-primary); border-width: 2px; box-shadow: 0 0 0 3px var(--color-primary-soft); }
    .banca-card__top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
    .banca-card__bank { font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .02em; }
    .banca-card__sold { font-size: var(--text-lg); font-weight: 700; margin: 6px 0 2px; }
    .banca-card__cur { font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); }
    .banca-card__iban { font-size: var(--text-xs); color: var(--text-muted); margin: 0; }
    .banca-card__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
    .banca-card__recon { font-size: var(--text-xs); }
    .recon-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
    .banca-card--add {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
        border-style: dashed; color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm); font-weight: 600; text-align: center;
    }
    .banca-card--add:hover { color: var(--color-primary-strong); }

    /* ===== Ecran Exerciții financiare ===== */
    .ex-active {
        margin-top: var(--space-3); padding: var(--space-4) var(--space-5);
        background: oklch(from var(--color-primary) 97% 0.02 h); border: 1px solid color-mix(in oklch, var(--color-primary) 25%, transparent);
        border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    }
    .ex-active__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; }
    .ex-active__title { display: flex; align-items: center; gap: var(--space-3); }
    .ex-active__an { font-size: 2rem; font-weight: 600; line-height: 1; }
    .ex-active__progress { text-align: right; min-width: 200px; font-size: var(--text-sm); display: flex; flex-direction: column; gap: 2px; }
    .ex-active__progress-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
    .ex-progressbar { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin: 2px 0; }
    .ex-progressbar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
    .ex-active__termen { font-size: var(--text-xs); color: var(--text-muted); }
    .ex-active__meta { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-2); }

    .ex-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-4); }
    .ex-kpi__cell { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: 2px; }
    .ex-kpi__lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
    .ex-kpi__val { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
    .ex-kpi__note { font-size: var(--text-xs); color: var(--text-muted); }

    .ex-calendar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
    .ex-month { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--space-3); background: var(--surface-card); display: flex; flex-direction: column; gap: 4px; }
    .ex-month__top { display: flex; justify-content: space-between; align-items: center; }
    .ex-month__name { font-weight: 600; font-size: var(--text-sm); }
    .ex-month__ic { font-size: var(--text-sm); }
    .ex-month__stat { font-size: var(--text-xs); color: var(--text-secondary); margin: 0; }
    .ex-month__stat--muted { color: var(--text-muted); }
    .ex-month__foot { margin-top: 2px; }
    .ex-month__action { font-size: var(--text-xs); font-weight: 600; text-decoration: none; }
    .ex-month__action--ok { color: var(--success); }
    .ex-month__action--info { color: var(--color-primary-strong); }
    .ex-month__action--warn { color: var(--warning); }
    .ex-month__action--muted { color: var(--text-muted); font-weight: 400; }
    .ex-month__close { border: 1px solid var(--color-primary); background: var(--color-primary); color: #fff; border-radius: var(--radius-sm); padding: 3px 10px; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
    .ex-month__close:hover { background: var(--color-primary-strong); }
    .ex-month--inchisa { background: var(--success-bg); border-color: color-mix(in oklch, var(--success) 30%, transparent); }
    .ex-month--curenta { background: var(--color-primary-soft); border-color: var(--color-primary); border-width: 2px; }
    .ex-month--problema { background: var(--warning-bg); border-color: color-mix(in oklch, var(--warning) 35%, transparent); }
    .ex-month--gata { border-color: var(--color-primary); }
    .ex-month--viitoare { background: var(--surface-subtle); color: var(--text-muted); }

    .ex-alerts { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
    .ex-alert { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid; border-left-width: 4px; border-radius: var(--radius-md); flex-wrap: wrap; }
    .ex-alert__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
    .ex-alert__msg { flex: 1; font-size: var(--text-sm); }
    .ex-alert__cta { font-size: var(--text-xs); font-weight: 700; color: var(--color-primary-strong); white-space: nowrap; text-decoration: none; }

    @media (max-width: 1023px) {
        .ex-kpi { grid-template-columns: repeat(2, 1fr); }
        .ex-calendar { grid-template-columns: repeat(3, 1fr); }
    }
    @media (max-width: 600px) { .ex-calendar { grid-template-columns: repeat(2, 1fr); } }

    /* ===== Ecran Mijloace fixe ===== */
    .mf-amort {
        display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap;
        margin-top: var(--space-3); padding: var(--space-3) var(--space-4);
        background: var(--color-primary-soft); border: 1px solid var(--color-primary); border-radius: var(--radius-lg);
    }
    .mf-amort__title { font-size: var(--text-md); margin: 0 0 4px; }
    .mf-amort__line { font-size: var(--text-sm); margin: 0; }
    .mf-amort__last { font-size: var(--text-xs); color: var(--text-muted); margin: 2px 0 0; }
    .mf-amort__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
    .mf-progress { height: 5px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin-top: 3px; max-width: 140px; }
    .mf-progress > span { display: block; height: 100%; border-radius: 999px; }

    /* ===== Ecran Deconturi de cheltuieli ===== */
    .dc-avatar {
        display: inline-flex; align-items: center; justify-content: center;
        width: 24px; height: 24px; border-radius: 50%; margin-right: 6px; vertical-align: middle;
        background: var(--color-primary-soft); color: var(--color-primary-strong);
        font-size: 10px; font-weight: 700;
    }
    .dc-validari { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-3); font-size: var(--text-sm); }
    .dc-ok { color: var(--success); font-weight: 600; }
    .dc-warn { color: var(--danger); font-weight: 600; }
    .dc-sumar { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border-default); }
    .dc-sumar > div { display: flex; flex-direction: column; gap: 2px; }
    .dc-sumar__lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
    .dc-sumar strong { font-size: var(--text-md); }
    .dc-detaliu__head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }

    /* Avertizare „produs asemănător" pe linia facturii */
    .line-sim {
        display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
        margin-top: 6px; padding: 6px 8px;
        background: var(--warning-bg);
        border: 1px solid color-mix(in oklch, var(--warning) 35%, transparent);
        border-radius: var(--radius-md);
        font-size: var(--text-xs);
    }
    .line-sim__lbl { color: oklch(from var(--warning) calc(l - 0.1) c h); font-weight: 600; }
    .line-sim__pick {
        border: 1px solid var(--border-strong); background: var(--surface-card);
        color: var(--color-primary-strong); border-radius: 999px;
        padding: 2px 10px; font-size: var(--text-xs); cursor: pointer;
    }
    .line-sim__pick:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
    .line-sim__close {
        margin-left: auto; border: 0; background: none; cursor: pointer;
        color: var(--text-muted); font-size: var(--text-md); line-height: 1; padding: 0 4px;
    }

    /* Atenționare viramente interne (581) de confirmat din extras */
    .virament-alert {
        display: flex; align-items: center; gap: var(--space-3);
        padding: var(--space-3) var(--space-4);
        background: var(--warning-bg);
        border: 1px solid color-mix(in oklch, var(--warning) 40%, transparent);
        border-left: 4px solid var(--warning);
        border-radius: var(--radius-lg);
        text-decoration: none; color: var(--text-primary);
        transition: background var(--dur-fast) var(--ease-out);
    }
    .virament-alert:hover { background: color-mix(in oklch, var(--warning) 18%, var(--surface-card)); }
    .virament-alert__icon { font-size: var(--text-xl); flex: 0 0 auto; }
    .virament-alert__txt { flex: 1; font-size: var(--text-sm); line-height: 1.5; }
    .virament-alert__cta { flex: 0 0 auto; font-weight: 700; color: var(--color-primary-strong); white-space: nowrap; }

    /* ===== Ecran Jurnal & Decont TVA ===== */
    .tva-filtre { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); margin-top: var(--space-3); box-shadow: var(--shadow-xs); }
    .tva-chips, .tva-cote-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
    .chip {
        border: 1px solid var(--border-default); background: var(--surface-muted);
        color: var(--text-secondary); border-radius: 999px; padding: 4px 12px;
        font-size: var(--text-sm); cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
    }
    .chip:hover { border-color: var(--color-primary); color: var(--color-primary-strong); }
    .chip.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
    .tva-filtre__row { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
    .tva-filtre__actions { display: flex; gap: var(--space-2); align-items: end; margin-left: auto; flex-wrap: wrap; }
    .tva-termen {
        display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
        border: 1px solid; border-left-width: 4px; border-radius: var(--radius-md);
        padding: var(--space-2) var(--space-4); margin-top: var(--space-3); font-size: var(--text-sm);
    }
    .tva-termen__lbl { font-weight: 600; }

    /* Panou plat (stil fpx-kpi) — linii subțiri între celule, fără chenar pe fiecare card. */
    .tva-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; margin-top: var(--space-3); }
    .tva-card { background: var(--surface-card); border: 0; border-radius: 0; padding: 8px 14px; box-shadow: none; }
    .tva-card.is-danger { background: var(--danger-bg); }
    .tva-card.is-success { background: var(--success-bg); }
    .tva-card__title { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin: 0; line-height: 1.2; }
    .tva-card__metric { font-size: 1.25rem; font-weight: 600; margin: 1px 0; line-height: 1.15; }
    .tva-card__note { font-size: var(--text-xs); color: var(--text-muted); margin: 0; line-height: 1.2; }
    .tva-delta { margin-left: 6px; font-weight: 600; }
    .tva-delta.up { color: var(--success); }
    .tva-delta.down { color: var(--danger); }

    .tva-tabs {
        display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0;
        background: var(--surface-muted); border: 1px solid var(--border-default);
        border-radius: var(--radius-md); max-width: 100%; overflow-x: auto;
    }
    .tva-tab {
        border: 0; background: transparent; cursor: pointer; padding: 7px 16px;
        border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 500;
        color: var(--text-secondary); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
        transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
    }
    .tva-tab:hover { background: var(--surface-card); color: var(--text-primary); }
    .tva-tab.is-active { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-xs); }
    .tva-tab__badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; }
    .tva-tab.is-active .tva-tab__badge { background: #fff; color: var(--danger); }

    .tva-toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin: var(--space-3) 0; }
    .tva-search { max-width: 320px; }
    .tva-table th[data-sort] { cursor: pointer; user-select: none; }
    .tva-table th[data-sort]::after { content: ' ⇅'; opacity: .35; font-size: .85em; }
    .tva-table th[data-dir="asc"]::after { content: ' ↑'; opacity: .9; }
    .tva-table th[data-dir="desc"]::after { content: ' ↓'; opacity: .9; }
    .tva-table thead th { position: sticky; top: 0; z-index: 1; }
    .tva-trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tva-warn { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--warning); color: #fff; font-weight: 700; font-size: 11px; cursor: help; }
    .tva-subtotal td { background: var(--surface-subtle); font-weight: 600; }
    .tva-total td { background: var(--surface-muted); font-weight: 500; border-top: 1px solid var(--border-strong); }

    .cota-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }
    .cota-b-blue { background: var(--color-primary-soft); color: var(--color-primary-strong); }
    .cota-b-amber { background: var(--warning-bg); color: oklch(from var(--warning) calc(l - 0.1) c h); }
    .cota-b-purple { background: oklch(94% 0.04 300); color: oklch(45% 0.16 300); }
    .cota-b-gray { background: var(--surface-muted); color: var(--text-secondary); }

    .tva-anomalii { display: flex; flex-direction: column; gap: var(--space-2); }
    .tva-anomalie { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-card); }
    .tva-anomalie__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
    .tva-anomalie--warning .tva-anomalie__dot { background: var(--warning); }
    .tva-anomalie--danger .tva-anomalie__dot { background: var(--danger); }
    .tva-anomalie__msg { flex: 1; font-size: var(--text-sm); }

    @media (max-width: 1023px) { .tva-kpi { grid-template-columns: repeat(2, 1fr); } }
    @media print {
        .no-print { display: none !important; }
        .tva-panel { display: block !important; }
        .tva-panel + .tva-panel { margin-top: 1rem; }
        .tva-table thead th { position: static; }
    }

    /* ===== Print global: tot ce se tipărește din ecranele aplicației = A4 =====
       Implicit A4 portrait; ecranele cu liste/registre late suprascriu local cu
       `@page { size: A4 landscape; }` (vezi tva/index, cartea_mare/index, nomenclatoare).
       Listările dedicate (layout:false) au propriul @page în partials/print_head. */
    @media print {
        @page { size: A4 portrait; margin: 12mm; }
        body { background: #fff !important; }
    }

    /* ===== Ecran Note contabile ===== */
    .note-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
    .note-stat { background: var(--surface-card); border: 1px solid var(--border-default); border-left-width: 3px; border-radius: var(--radius-lg); padding: 8px 14px; box-shadow: var(--shadow-xs); }
    .note-stat__title { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin: 0; line-height: 1.2; }
    .note-stat__metric { font-size: 1.25rem; font-weight: 600; margin: 1px 0 0; line-height: 1.15; }
    .note-stat--ciorna { border-left-color: var(--warning); }
    .note-stat--validata { border-left-color: var(--success); }
    .note-stat--stornata { border-left-color: var(--text-muted); }

    .note-toolbar { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; justify-content: space-between; margin-top: var(--space-3); }
    .note-filtre { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
    .note-filtre .field { min-width: 150px; }
    .note-search-field { min-width: 220px; }
    .note-toolbar__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
    .note-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warning); color: #fff; font-size: 11px; font-weight: 700; }

    .note-frecvente { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-top: var(--space-3); }
    .note-frecvente__lbl { font-size: var(--text-xs); color: var(--text-muted); }

    .note-anomalii { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
    .note-anomalie { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-default); border-left: 3px solid var(--warning); border-radius: var(--radius-md); background: var(--surface-card); flex-wrap: wrap; }
    .note-anomalie__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: 0 0 auto; }
    .note-anomalie__ref { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; }
    .note-anomalie__msg { flex: 1; font-size: var(--text-sm); color: var(--text-secondary); }

    .note-bulk { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-top: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--color-primary-soft); border: 1px solid var(--color-primary); border-radius: var(--radius-md); }
    .note-bulk__count { font-size: var(--text-sm); }

    .note-table td, .note-table th { vertical-align: middle; }
    .note-col-check { width: 32px; text-align: center; }
    .note-descriere { max-width: 320px; }
    .note-src { margin-right: 4px; cursor: help; }
    .note-conturi { white-space: normal; }
    .acct { display: inline-block; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm); margin: 1px 2px 1px 0; }
    .acct-d { background: var(--success-bg); color: var(--success); }
    .acct-c { background: var(--danger-bg); color: var(--danger); }
    .acct-sep { color: var(--text-muted); margin: 0 2px; }
    .note-actiuni { text-align: right; white-space: nowrap; }
    .note-exp-btn { border: 0; background: transparent; cursor: pointer; color: var(--text-secondary); font-size: var(--text-md); line-height: 1; padding: 2px 6px; transition: transform var(--dur-fast) var(--ease-out); }
    .note-exp-btn:hover { color: var(--color-primary); }
    .note-exp-btn.is-open { transform: rotate(90deg); color: var(--color-primary); }

    .note-expand > td { background: var(--surface-subtle); padding: 0; }
    .note-expand__inner { padding: var(--space-3) var(--space-4); }
    .note-pd { width: 100%; border-collapse: collapse; }
    .note-pd th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 2px 8px; border-bottom: 1px solid var(--border-default); }
    .note-pd td { padding: 3px 8px; border-bottom: 1px solid color-mix(in oklch, var(--border-default) 55%, transparent); }
    .note-pd tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; }

    @media (max-width: 1023px) { .note-stats { grid-template-columns: repeat(2, 1fr); } }

    /* ===== Câmpuri de formular ===== */
    .field { display: flex; flex-direction: column; gap: var(--space-1); }
    .field__label {
        font-size: var(--text-xs);
        font-weight: 600;
        color: var(--text-secondary);
    }
    .input, .select, .textarea {
        width: 100%;
        padding: var(--space-2) var(--space-3);
        background: #eaf4ff;
        border: 1px solid #86add8;
        border-radius: var(--radius-md);
        font-size: var(--text-sm);
        color: var(--text-primary);
        transition: background-color var(--dur-fast) var(--ease-out),
                    border-color var(--dur-fast) var(--ease-out),
                    box-shadow var(--dur-fast) var(--ease-out);
    }
    .input:hover, .select:hover, .textarea:hover {
        background: #e1efff;
        border-color: #4f85bd;
    }
    .input::placeholder, .textarea::placeholder { color: var(--text-muted); }
    .input:focus, .select:focus, .textarea:focus {
        background: #fff;
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 2px rgba(0, 59, 122, .18);
    }
    .field:has(:invalid:not(:placeholder-shown)) .input { border-color: var(--danger); }
    .textarea { min-height: 90px; resize: vertical; font-family: inherit; }
    .field__error { font-size: var(--text-xs); color: var(--danger); font-weight: 500; }
    .field__hint  { font-size: var(--text-xs); color: var(--text-muted); }
    .field__label .req { color: var(--danger); margin-left: 2px; }

    /* ===== Sistem de formulare (creare / editare) ===== */
    .form-card {
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        padding: 0;
        box-shadow: var(--shadow-xs);
        overflow: hidden;
        max-width: 880px;
        margin-inline: auto;
    }
    .form-card--wide { max-width: 100%; }
    /* Antetul unui card de formular */
    .form-card__head {
        padding: var(--space-4) var(--space-6);
        border-bottom: 1px solid var(--border-default);
        background: var(--surface-subtle);
    }
    .form-card__title { font-size: var(--text-md); font-weight: 650; color: var(--text-primary); }
    .form-card__sub   { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
    .form-card__body  { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }

    /* Câmpuri vizibil „de completat" în formularele de date (creare/editare):
       fundal pal + bordură clară ca să sară în ochi pe cardul alb; la focus devin
       albe cu inel albastru. Specificitate .form-card .input bate regula globală .input.
       NU afectează barele de căutare/filtrare (care nu sunt în .form-card). */
    .form-card .input, .form-card .select, .form-card .textarea {
        background: #eaf4ff;
        border: 1px solid #86add8;
    }
    .form-card .input:hover, .form-card .select:hover, .form-card .textarea:hover { background:#e1efff; border-color:#4f85bd; }
    .form-card .input:focus, .form-card .select:focus, .form-card .textarea:focus {
        background: #fff;
        border-color: var(--saga-blue, #003B7A);
        box-shadow: 0 0 0 2px rgba(0, 59, 122, .18);
        outline: none;
    }
    .form-card .input::placeholder, .form-card .textarea::placeholder { color: #98a6bd; }
    .form-card .field__label { color: var(--saga-blue, #003B7A); }

    /* Rând orizontal de câmpuri (toolbar de formular) — se înfășoară la nevoie.
       De folosit în loc de display:flex inline pe .form-card__body (care e
       coloană), ca să nu reapară alinierea greșită pe dreapta. */
    .form-row { display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; }

    /* Secțiune de formular (înlocuiește fieldset inline) */
    .form-section { display: flex; flex-direction: column; gap: var(--space-3); }
    .form-section__title {
        font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
        letter-spacing: 0.05em; color: var(--text-muted);
        padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-default);
        display: flex; align-items: center; gap: var(--space-2);
    }
    .form-section + .form-section { margin-top: var(--space-2); }

    /* Grile de câmpuri responsive */
    .form-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
    .form-grid--2 { grid-template-columns: repeat(2, 1fr); }
    .form-grid--3 { grid-template-columns: repeat(3, 1fr); }
    .form-grid--2-1 { grid-template-columns: 2fr 1fr; }
    .form-grid--2-1-1 { grid-template-columns: 2fr 1fr 1fr; }
    .field--full { grid-column: 1 / -1; }
    @media (max-width: 720px) {
        .form-grid--2, .form-grid--3, .form-grid--2-1, .form-grid--2-1-1 { grid-template-columns: 1fr; }
    }

    /* Câmp de tip checkbox / switch */
    .check-field {
        display: flex; align-items: center; gap: var(--space-2);
        padding: var(--space-2) var(--space-3);
        border: 1px solid var(--border-default); border-radius: var(--radius-md);
        background: var(--surface-subtle); font-size: var(--text-sm); cursor: pointer;
        transition: border-color var(--dur-fast) var(--ease-out);
    }
    .check-field:hover { border-color: var(--border-strong); }
    .check-field input[type="checkbox"], .check-field input[type="radio"] { width: 16px; height: 16px; accent-color: var(--color-primary); }
    .check-field:has(:checked) { border-color: var(--color-primary); background: var(--color-primary-soft); }

    /* Bara de acțiuni a formularului (footer sticky vizual) */
    .form-actions {
        display: flex; gap: var(--space-3); align-items: center;
        padding: var(--space-4) var(--space-6);
        border-top: 1px solid var(--border-default); background: var(--surface-subtle);
    }
    .form-actions--end { justify-content: flex-end; }
    .form-actions__spacer { flex: 1; }

    /* Prefix/sufix pe input (ex: lei, %, RO) */
    .input-group { display: flex; align-items: stretch; }
    .input-group .input { border-radius: var(--radius-md) 0 0 var(--radius-md); border-right: 0; }
    .input-group__suffix {
        display: inline-flex; align-items: center; padding: 0 var(--space-3);
        background: var(--surface-muted); border: 1px solid var(--border-strong);
        border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0;
        font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap;
    }

    /* ===== Modal (dialog suprapus) ===== */
    .modal-backdrop {
        position: fixed; inset: 0; z-index: 100;
        background: oklch(20% 0.02 256 / 0.45);
        display: grid; place-items: center; padding: var(--space-4);
        backdrop-filter: blur(2px);
    }
    .modal {
        background: var(--surface-card); border: 1px solid var(--border-default);
        border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
        width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
        display: flex; flex-direction: column;
    }
    .modal__head {
        display: flex; align-items: center; justify-content: space-between;
        padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-default);
        background: var(--surface-subtle); position: sticky; top: 0;
    }
    .modal__title { font-size: var(--text-md); font-weight: 650; color: var(--text-primary); }
    .modal__close {
        border: 0; background: transparent; cursor: pointer; color: var(--text-muted);
        font-size: var(--text-xl); line-height: 1; padding: 0 var(--space-1);
    }
    .modal__close:hover { color: var(--text-primary); }
    .modal__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
    .modal__foot {
        display: flex; gap: var(--space-3); justify-content: flex-end;
        padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-default);
        background: var(--surface-subtle); position: sticky; bottom: 0;
    }

    /* Buton mic „adaugă" lângă un select */
    .field-with-add { display: flex; gap: var(--space-2); align-items: stretch; }
    .field-with-add .select { flex: 1; }
    .btn-add {
        flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
        width: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
        background: var(--surface-card); color: var(--color-primary); font-size: var(--text-lg);
        font-weight: 700; cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
    }
    .btn-add:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }

    /* ===== Tabel ===== */
    .table-wrap {
        overflow-x: auto;
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        background: var(--surface-card);
        box-shadow: var(--shadow-xs);
    }
    .table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
    .table th, .table td {
        padding: var(--space-2) var(--space-3);
        text-align: left;
        border-bottom: 1px solid var(--border-default);
        vertical-align: middle;
    }
    .table thead th {
        position: sticky;
        top: 0;
        background: var(--surface-muted);
        color: var(--text-secondary);
        font-weight: 650;
        font-size: var(--text-xs);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        border-bottom: 1px solid var(--border-strong);
        white-space: nowrap;
        z-index: 1;
    }
    .table tbody tr:nth-child(even) td { background: var(--surface-subtle); }
    .table tbody tr:hover td { background: var(--color-primary-soft); }
    .table tbody tr:last-child td { border-bottom: none; }
    .table tfoot td { border-top: 2px solid var(--border-strong); border-bottom: none; }
    .table a { font-weight: 500; }

    /* ===== Cutia de test HTMX ===== */
    .ping-box { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
    .ping-box__result { font-size: var(--text-sm); color: var(--text-muted); }
    .ping-ok { color: var(--success); font-weight: 600; font-size: var(--text-sm); }
    .htmx-request .btn { opacity: 0.65; pointer-events: none; }

    /* ===== Stare goală / pasul următor ===== */
    .next-steps {
        background: var(--surface-card);
        border: 1px dashed var(--border-strong);
        border-radius: var(--radius-lg);
        padding: var(--space-5) var(--space-6);
    }
    .next-steps__title { font-size: var(--text-md); margin-bottom: var(--space-2); }
    .next-steps p { color: var(--text-secondary); font-size: var(--text-sm); }

    /* ===== Pagini de eroare ===== */
    .error-page { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6); }
    .error-page__box {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-3);
        max-width: 560px;
    }
    .error-page__code { font-size: 4rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
    .error-page__code--danger { color: var(--danger); }
    .error-page__title { font-size: var(--text-xl); }
    .error-page__text { color: var(--text-secondary); }
    .error-page__trace {
        width: 100%;
        text-align: left;
        font-family: var(--font-mono);
        font-size: var(--text-xs);
        background: var(--surface-muted);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-md);
        padding: var(--space-4);
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-word;
    }

    /* ===== Autentificare ===== */
    .auth {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-5);
        padding: var(--space-6);
        background:
            radial-gradient(70% 55% at 50% -5%, var(--color-primary-soft), transparent),
            var(--surface-app);
    }
    .auth__card {
        width: min(400px, 100%);
        background: var(--surface-card);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
        padding: var(--space-8) var(--space-6);
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }
    .auth__brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
    .auth__brand-name { font-size: var(--text-md); font-weight: 700; }
    .auth__title { font-size: var(--text-xl); }
    .auth__subtitle { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-2); }
    .auth__form { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-2); }
    .auth__submit { width: 100%; margin-top: var(--space-1); }
    .auth__footer { color: var(--text-muted); font-size: var(--text-xs); }
    .auth__separator {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        color: var(--text-muted);
        font-size: var(--text-xs);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin: var(--space-2) 0;
    }
    .auth__separator::before, .auth__separator::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-default);
    }
    .auth__row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        font-size: var(--text-sm);
        flex-wrap: wrap;
    }
    .auth__link { color: var(--color-primary); text-decoration: none; }
    .auth__link:hover { text-decoration: underline; }

    /* Câmp cu buton alipit (ex. afișează/ascunde parola) */
    .input-group { display: flex; align-items: stretch; }
    .input-group .input {
        flex: 1;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .input-group__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 var(--space-3);
        border: 1px solid var(--border-default);
        border-left: 0;
        border-top-right-radius: var(--radius-md);
        border-bottom-right-radius: var(--radius-md);
        background: var(--surface-app);
        cursor: pointer;
        font-size: var(--text-md);
        line-height: 1;
    }
    .input-group__btn:hover { background: var(--surface-card); }

    /* Checkbox cu etichetă inline */
    .checkbox {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        cursor: pointer;
        color: var(--text-muted);
    }
    .checkbox input { width: 1rem; height: 1rem; cursor: pointer; }

    /* Bară de consum (abonament: consum vs. limită) */
    .usage { display: flex; align-items: center; gap: var(--space-2); }
    .usage__bar { flex: 1; height: 8px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; }
    .usage__fill { display: block; height: 100%; background: var(--color-primary); border-radius: 999px; }
    .usage__fill.is-warn { background: #d6a200; }
    .usage__fill.is-danger { background: var(--danger); }
    .usage__txt { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
}

/* ---------------------------------------------------------------------
   Utilitare
   --------------------------------------------------------------------- */
@layer utilities {
    .text-muted { color: var(--text-muted); }
    .mono { font-family: var(--font-mono); }
    .num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
    .row-actions { text-align: right; white-space: nowrap; }
    .hidden { display: none !important; }
    .stack { display: flex; flex-direction: column; gap: var(--space-4); }
    .inline-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
}

/* ---------------------------------------------------------------------
   Accesibilitate — reducerea mișcării
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================================
   TEMĂ SAGA / WinMentor (Iter #11) — strat FINAL nelayerat de suprascriere.
   Stil „modern classic": albastru Saga, panouri dense, butoane cu gradient,
   tabele clasice, pill-uri de stare. Fiind în afara @layer, are prioritate
   peste tot design-system-ul de bază, fără !important. Bara de sus cu
   meniuri este PĂSTRATĂ și doar retematizată.
   ===================================================================== */
:root {
    /* Brand Saga */
    --color-primary:        #1E5BA8;
    --color-primary-strong: #003B7A;
    --color-primary-soft:   #E3F2FD;
    --saga-blue:   #003B7A;
    --saga-blue-2: #1E5BA8;
    --shadow-primary: 0 2px 6px rgba(0,59,122,.30);

    /* Tipografie clasică, densă */
    --font-sans: "Segoe UI", Tahoma, "Lucida Sans Unicode", Verdana, sans-serif;
    --font-mono: "Consolas", "Liberation Mono", "Courier New", monospace;
    --text-xs: 0.69rem; --text-sm: 0.73rem; --text-base: 0.78rem;
    --text-md: 0.86rem; --text-lg: 1.0rem; --text-xl: 1.18rem; --text-2xl: 1.5rem;

    /* Colțuri tehnice */
    --radius-sm: 2px; --radius-md: 3px; --radius-lg: 4px; --radius-xl: 6px;

    /* Suprafețe & borduri */
    --surface-app:    #ECECEC;
    --surface-card:   #FFFFFF;
    --surface-muted:  #F2F3F5;
    --surface-subtle: #FAFBFD;
    --surface-2:      #F2F3F5;
    --border-default: #C8C8C8;
    --border-strong:  #A8A8A8;
    --border:         #C8C8C8;

    /* Text */
    --text-primary:   #1F1F1F;
    --text-secondary: #555555;
    --text-muted:     #6B6B6B;
    --text-subtle:    #8A8A8A;

    /* Stări semantice */
    --success: #2E7D32; --success-bg: #E8F5E9;
    --danger:  #C62828; --danger-bg:  #FFEBEE;
    --warning: #E65100; --warning-bg: #FFF3E0;
    --info:    #1565C0; --info-bg:    #E3F2FD;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.10);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
    --shadow-md: 0 4px 14px rgba(0,0,0,.16);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.22);
}

body { background: #a9c6c342; font-size: var(--text-base); }

/* ---- Header + bara de meniuri (temă deschisă — logo color vizibil pe fundal deschis) ---- */
.app-header {
    background: linear-gradient(to bottom, #ffffff 0%, #f1f6fc 100%);
    border-bottom: 1px solid #d6e2f2;
    box-shadow: 0 1px 4px rgba(16,40,80,.07);
}
.app-header__inner { max-width: 1700px; margin: 0 auto; }
.brand, .brand__name { color: var(--color-primary-strong); }
.brand__name { letter-spacing: .4px; }
.brand__mark { background: #FFD56B; color: #422C00; border-radius: 3px; font-weight: 800; }
.menu-link, .menu-trigger { color: var(--text-secondary); background: transparent; border-radius: 6px; font-weight: 600; }
.menu-link:hover, .menu-trigger:hover { background: var(--surface-muted); color: var(--text-primary); text-decoration: none; }
.menu-link.is-active, .menu-trigger.is-active { background: var(--color-primary-soft); color: var(--color-primary-strong); box-shadow: inset 0 -3px 0 var(--color-primary); }
.menu-caret { color: var(--text-muted); }
.menu-badge { background: var(--danger); color: #fff; border-radius: 2px; }

.dropdown { background: #fff; border: 1px solid var(--border-strong); border-radius: 0; box-shadow: var(--shadow-md); padding: 3px; }
.dropdown__item { color: var(--text-primary); border-radius: 2px; font-weight: 500; }
.dropdown__item:hover { background: var(--color-primary-soft); color: var(--color-primary-strong); text-decoration: none; }
.dropdown__item.is-active { background: var(--color-primary); color: #fff; }
.dropdown__sep { background: var(--border-default); }
.app-nav__hint { color: var(--text-muted); }
/* CTA „Setează compania activă" — umplut solid ca să iasă în evidență pe bara deschisă (AA). */
.menu-chip--warn { background: var(--warning); color: #fff; border-color: transparent; }
.menu-chip--warn:hover { filter: brightness(.93); color: #fff; }

/* ---- Butoane — stil SAGA modern (gradient subtil, depth, stări clare) ---- */
.btn { border-radius: 5px; background: linear-gradient(to bottom, #fbfcfd, #eceff3); border: 1px solid #c6cdd6;
    color: var(--text-primary); font-weight: 600; letter-spacing: .1px;
    box-shadow: 0 1px 1px rgba(16,24,40,.04), inset 0 1px 0 rgba(255,255,255,.75);
    transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .04s ease; }
.btn:hover { background: linear-gradient(to bottom, #ffffff, #f2f5f8); border-color: #aeb8c4;
    box-shadow: 0 2px 6px rgba(16,24,40,.10), inset 0 1px 0 rgba(255,255,255,.85); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(16,24,40,.14); }
.btn:focus-visible { outline: 2px solid #2865A8; outline-offset: 1px; }

.btn--primary { background: linear-gradient(to bottom, #3d88d6, #1f63ab); border-color: #1a5392; color: #fff;
    box-shadow: 0 1px 2px rgba(30,79,138,.30), inset 0 1px 0 rgba(255,255,255,.28); }
.btn--primary:hover { background: linear-gradient(to bottom, #4d96e2, #2470bc); border-color: #184f8c;
    box-shadow: 0 3px 9px rgba(30,79,138,.32), inset 0 1px 0 rgba(255,255,255,.32); }
.btn--primary:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(0,0,0,.28); }

.btn--ghost { background: #fff; border-color: #cfd6df; color: var(--text-primary);
    box-shadow: 0 1px 1px rgba(16,24,40,.03), inset 0 1px 0 rgba(255,255,255,.6); }
.btn--ghost:hover { background: #f5f7fa; border-color: #b4bec9; box-shadow: 0 2px 5px rgba(16,24,40,.08); }

.btn--sm { font-size: var(--text-xs); padding: 3px 10px; }

.btn--danger { background: linear-gradient(to bottom, #e2574f, #c5362f); border-color: #a72a24; color: #fff;
    box-shadow: 0 1px 2px rgba(197,54,47,.28), inset 0 1px 0 rgba(255,255,255,.2); }
.btn--danger:hover { background: linear-gradient(to bottom, #ea655d, #d04039); border-color: #a72a24;
    box-shadow: 0 3px 9px rgba(197,54,47,.30), inset 0 1px 0 rgba(255,255,255,.24); }

.btn--success { background: linear-gradient(to bottom, #3fae5b, #258e44); border-color: #1f7a3a; color: #fff;
    box-shadow: 0 1px 2px rgba(37,142,68,.28), inset 0 1px 0 rgba(255,255,255,.2); }
.btn--success:hover { background: linear-gradient(to bottom, #4abb66, #2c9c4c); border-color: #1f7a3a;
    box-shadow: 0 3px 9px rgba(37,142,68,.30), inset 0 1px 0 rgba(255,255,255,.24); }

/* ---- Card de identitate abonat (antet detaliu, redesign) ---- */
.pf-idcard { display: flex; align-items: center; gap: 12px; background: var(--surface-card);
    border: 1px solid var(--border-default); border-radius: 11px; box-shadow: var(--shadow-sm);
    padding: 10px 14px; margin-bottom: 12px; position: relative; overflow: hidden; }
.pf-idcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(to bottom, #3d88d6, #1f63ab); }
.pf-idcard__avatar { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
    font-size: 1.1rem; font-weight: 750; color: #fff; background: linear-gradient(135deg, #3d88d6, #1f63ab);
    box-shadow: 0 3px 9px rgba(31,99,171,.28); }
.pf-idcard__main { min-width: 0; flex: 1; }
.pf-idcard__sub { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-primary-strong); }
.pf-idcard__top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 1px; }
.pf-idcard__name { font-size: 1.18rem; font-weight: 750; color: var(--text-primary); letter-spacing: -.01em; margin: 0; line-height: 1.1; }
.pf-idcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin-top: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.pf-idcard__meta b { color: var(--text-secondary); font-weight: 600; }
.pf-idcard__actions { display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }
@media (max-width: 760px){ .pf-idcard { flex-direction: column; align-items: stretch; }
    .pf-idcard__actions { justify-content: flex-start; } }

/* ---- Tabele clasice ---- */
.table-wrap { border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; }
.table { font-size: var(--text-sm); border-collapse: separate; border-spacing: 0; }
.table thead th { background: linear-gradient(to bottom, #DCE4F0, #C5D5EC); color: var(--color-primary-strong); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 5px 8px; border-right: 1px solid #A0B5D5; border-bottom: 1px solid #7090B5; white-space: nowrap; }
.table thead th:last-child { border-right: none; }
.table tbody td { padding: 5px 8px; border-right: 1px solid var(--border-default); border-bottom: 1px solid #E8E8E8; }
.table tbody td:last-child { border-right: none; }
.table tbody tr:nth-child(even) { background: #FAFBFD; }
.table tbody tr:hover { background: #FFF7CD; }
.table tbody tr.selected, .table tbody tr.is-open { background: #B5D2FF; }
.table tfoot td, .table .inv-foot td { background: linear-gradient(to bottom, #F0E8B8, #E0D088); color: #3A2C00; font-weight: 700; border-top: 1px solid #B89C20; }

/* ---- Carduri / KPI ---- */
.card { background: #fff; border: 1px solid var(--border-strong); border-radius: 2px; box-shadow: none; }
.tva-card { background: #fff; border: 0; border-radius: 0; box-shadow: none; }
.tva-card__title, .card__title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 600; }
.tva-card__metric, .card__metric { font-family: var(--font-mono); color: var(--color-primary-strong); font-weight: 700; }

/* ---- Tab-uri (folder WinMentor) ---- */
.tva-tab { background: #D5D5D5; border: 1px solid var(--border-strong); border-bottom: none; color: var(--text-muted); border-radius: 0; font-weight: 600; }
.tva-tab.is-active { background: #FFD56B; color: #422C00; border-color: #B8860B; }
.tva-tab:hover:not(.is-active) { background: #E8E8E8; }
.tva-tabs .part-anaf-form { margin: 0 0 0 10px; display: inline-flex; align-items: center; }
.btn-anaf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #aeb6c1;
    border-radius: 7px;
    background: #ffffff;
    color: #102f55;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, color .14s ease;
}
.btn-anaf:hover {
    color: #0b4f91;
    background: #f5f9fd;
    border-color: #7f91a8;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .12);
}
.btn-anaf:active {
    background: #edf4fa;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .12);
}
.btn-anaf:focus-visible { outline: 2px solid rgba(24, 104, 175, .34); outline-offset: 2px; }
.btn-anaf:disabled { opacity: .58; cursor: progress; }
/* Variantă compactă — pentru butoanele ANAF din formulare/selectoare (lângă input). */
.btn-anaf--inline { height: 32px; padding: 0 11px; border-radius: 7px; font-size: 12px; gap: 6px; }
.btn-anaf--inline .anaf-icon { width: 17px; height: 17px; }
.anaf-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .16));
}
.anaf-text {
    line-height: 1;
    text-shadow: none;
}
@media (max-width: 760px) {
    .tva-tabs .part-anaf-form { margin-left: 0; }
    .btn-anaf { height: 32px; padding: 0 10px; font-size: 12px; gap: 6px; }
    .anaf-icon { width: 17px; height: 17px; }
}
.inv-count { background: rgba(0,0,0,.15); font-family: var(--font-mono); border-radius: 0; }
.inv-count--danger { background: var(--danger); color: #fff; }

/* ---- Badge / pill-uri ---- */
.badge { border-radius: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .2px; font-size: var(--text-xs); }
.stb, .stare-badge { border-radius: 2px; }

/* ---- Inputuri ---- */
.input, .select, .textarea { border-radius: 2px; border: 1px solid #86add8; background: #eaf4ff; }
.input:hover, .select:hover, .textarea:hover { background:#e1efff; border-color:#4f85bd; }
.input:focus, .select:focus, .textarea:focus { background:#fff; outline: 1px solid var(--color-primary); border-color: var(--color-primary); }
.field__label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); font-weight: 600; }

/* ---- page-head / hero / titluri ---- */
/* ===== Antet de pagină unificat — stil „context" peste toată aplicația =====
   Eyebrow discret (slate) + titlu solid + descriere lizibilă. Pe ecranele cu
   descriere (fără butoane) antetul devine 2 coloane: titlu | descriere; pe cele
   cu butoane (.page-head) rămâne titlu-stânga / butoane-dreapta, dar cu aceeași
   tipografie. Tokenizat (fără culori/fonturi hardcodate). */
.hero__badge { color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; font-size: 11px; }
.hero__title { color: var(--text-primary); font-weight: 700; font-size: 19px; line-height: 1.25; }
.hero__lead { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.hero__icon { display: inline-block; width: 18px; height: 18px; color: var(--color-primary); vertical-align: -3px; margin-right: 7px; }

/* Hero cu descriere (standalone) → 2 coloane: titlu | descriere */
.hero:has(.hero__lead) {
    display: grid;
    grid-template-columns: minmax(220px, 290px) 1fr;
    grid-template-areas: "badge desc" "title desc";
    column-gap: 30px; row-gap: 2px;
    align-items: start;
}
.hero:has(.hero__lead) .hero__badge { grid-area: badge; }
.hero:has(.hero__lead) .hero__title { grid-area: title; }
.hero:has(.hero__lead) .hero__lead  { grid-area: desc; max-width: none; }

/* În page-head CU butoane: descrierea rămâne sub titlu (nu coloana 2), ca să lase loc butoanelor. */
.page-head:has(.page-head__actions) .hero:has(.hero__lead) { display: flex; flex-flow: row wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.page-head:has(.page-head__actions) .hero:has(.hero__lead) .hero__badge { grid-area: auto; flex-basis: 100%; }
.page-head:has(.page-head__actions) .hero:has(.hero__lead) .hero__title { grid-area: auto; }
.page-head:has(.page-head__actions) .hero:has(.hero__lead) .hero__lead  { grid-area: auto; flex-basis: 100%; max-width: 86ch; }
/* page-head FĂRĂ butoane: hero cu descriere ocupă toată lățimea → se vede grila 2-col. */
.page-head:not(:has(.page-head__actions)) .hero:has(.hero__lead) { flex: 1 1 100%; }

@media (max-width: 640px) {
    .hero:has(.hero__lead) { grid-template-columns: 1fr; grid-template-areas: "badge" "title" "desc"; row-gap: 6px; }
}

/* ===== Antet unificat „bară context" — eyebrow STÂNGA · titlu CENTRAT · acțiuni DREAPTA =====
   Aplicat global pe .page-head (badge+titlu+descriere în .hero, butoane în .page-head__actions).
   .hero devine display:contents, ca badge/titlu/descriere să intre direct în grila de 3 coloane
   (1fr | auto | 1fr): coloanele laterale egale țin titlul exact pe mijlocul ecranului, indiferent
   de lățimea eyebrow-ului / butoanelor. !important bate regulile :has() de mai sus (același nivel,
   nelayerizat). Pe ecrane înguste se stivuiește la stânga (fallback, fără suprapunere). */
.app-main .page-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: var(--space-4);
    row-gap: 1px;
    margin: 0 0 4px;
    padding: 0 2px 2px;
    border-bottom: 1px solid var(--border-default);
}
.app-main .page-head > .hero { display: contents !important; }
.app-main .page-head .hero__badge {
    grid-column: 1 !important; grid-row: 1 !important;
    justify-self: start; align-self: center;
    flex-basis: auto !important; max-width: 100%; min-width: 0;
    font-size: 10px; line-height: 1; letter-spacing: .12em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-main .page-head .hero__title {
    grid-column: 2 !important; grid-row: 1 !important;
    justify-self: center; text-align: center;
    font-size: 16px; line-height: 1.15; margin: 0;
}
.app-main .page-head .hero__lead {
    grid-column: 2 !important; grid-row: 2 !important;
    justify-self: center; text-align: center;
    font-size: 12px; line-height: 1.25; margin: 0; max-width: 90ch;
}
.app-main .page-head .page-head__actions {
    grid-column: 3 !important; grid-row: 1 / span 2;
    justify-self: end; align-self: center; min-width: 0;
}
@media (max-width: 860px) {
    .app-main .page-head {
        grid-template-columns: 1fr;
        align-items: start; row-gap: 4px; padding-bottom: 5px;
    }
    .app-main .page-head .hero__badge,
    .app-main .page-head .hero__title,
    .app-main .page-head .hero__lead,
    .app-main .page-head .page-head__actions {
        grid-column: 1 !important; grid-row: auto !important;
        justify-self: start; text-align: left;
    }
    .app-main .page-head .page-head__actions { justify-self: stretch; }
}

.section-title { color: var(--color-primary-strong); text-transform: uppercase; letter-spacing: .3px; font-size: var(--text-sm); }

/* ---- chips / alerte / formulare ---- */
.chip { border-radius: 2px; border: 1px solid var(--border); }
.chip.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary-strong); }
.alert { border-radius: 2px; }
.form-card { border: 1px solid var(--border-strong); border-radius: 2px; box-shadow: var(--shadow-sm); }

/* ---- acțiuni rapide ---- */
.casa-action { border: 1px solid var(--border-strong); border-radius: 2px; background: linear-gradient(to bottom, #FCFCFC, #ECECEC); }
.casa-action:hover { background: linear-gradient(to bottom, #FFFFFF, #E8F0FA); border-color: var(--color-primary); }

/* ---- footer ---- */
.app-footer { background: #F4F4F4; border-top: 1px solid var(--border-strong); color: var(--text-muted); }

/* =====================================================================
   COMPONENTĂ MASTER/DETAIL „WinMentor" (.fpx) — reutilizabilă pe ecranele
   de documente (facturi, note, casă, bancă). Folosită cu helperul JS
   global mdScreen('/baza') din layout.
   ===================================================================== */
.fpx { display: flex; flex-direction: column; }
.fpx-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border-default); border: 1px solid var(--border-default); }
/* Densitate verticală aliniată la cardurile compacte din /balanta (.bal-kpi .card). */
.fpx-kpi { background: #fff; padding: 5px 14px; }
.fpx-kpi .lbl { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; line-height: 1.15; }
.fpx-kpi .val { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--saga-blue); line-height: 1.15; margin-top: 1px; }
.fpx-kpi .val.danger { color: var(--danger); } .fpx-kpi .val.warn { color: var(--warning); } .fpx-kpi .val.ok { color: var(--success); }
.fpx-kpi .sub { font-size: var(--text-xs); color: var(--text-subtle); margin-top: 1px; line-height: 1.15; }
.fpx-toolbar { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; background: linear-gradient(to bottom, #ECECEC, #D8D8D8); border: 1px solid var(--border-strong); border-top: none; padding: 4px 6px; }
.fpx kbd { background: rgba(0,0,0,.16); color: inherit; padding: 0 4px; font-family: var(--font-mono); font-size: 9.5px; border-radius: 2px; }
.btn--warnx { background: linear-gradient(to bottom, #F2C46C, #D69E2E); border: 1px solid #8B6914; color: #422C00; }
.btn--warnx:hover { background: linear-gradient(to bottom, #F8CE7C, #E0A838); }
.fpx .btn kbd { background: rgba(0,0,0,.18); }
.fpx .btn--primary kbd, .fpx .btn--danger kbd { background: rgba(255,255,255,.28); color: #fff; }
.tb-div { width: 1px; align-self: stretch; background: var(--border-strong); margin: 2px 4px; }
.fpx-search { min-width: 240px; flex: 1; }

/* ===== Bară de filtre unitară (perioadă + căutare) — UNLAYERED ca să bată .fpx-search + stilul base ===== */
.fpx-filterbar {
    display: inline-flex; align-items: stretch; gap: 0; margin: 0; padding: 0;
    background: var(--surface-card);
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.fpx-filterbar:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.fpx-filterbar .select,
.fpx-filterbar .input {
    height: 36px; box-sizing: border-box; line-height: normal;
    margin: 0; padding: 0 12px; border: 0; border-radius: 0;
    background: transparent; box-shadow: none !important; outline: none;
    border-left: 1px solid var(--border-default); font-size: var(--text-sm);
}
.fpx-filterbar > .select:first-of-type { border-left: 0; }
.fpx-filterbar .select:hover, .fpx-filterbar .input:hover { background: var(--surface-muted); }
.fpx-filterbar #fp-interval { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-left: 1px solid var(--border-default); }
.fpx-filterbar #fp-interval .input { border-left: 0; }
.fpx-filterbar .fpx-search { min-width: 240px; }
/* Bifa „Anii trecuți" din bara de filtre (facturi emise/primite). */
.fp-past { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
    font-size: var(--text-sm); color: var(--text-secondary); padding: 0 6px; cursor: pointer; user-select: none; }
.fp-past input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--color-primary); }
.fpx-grid { overflow: auto; border: 1px solid var(--border-strong); border-top: none; background: #fff; }

/* ===== Consolă platformă — densitate compactă ===== */
.pnl-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.form-card--compact .form-card__head { padding: 7px 12px; }
.form-card--compact .form-card__body { padding: 10px 12px; gap: 10px; }
.fpx-kpis.facts { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.fpx-kpi .val.sm { font-size: 0.98rem; font-family: var(--font-sans); }
.table--compact th, .table--compact td { padding: 4px 10px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: var(--text-sm); align-items: baseline; margin: 0; }
.dl dt { color: var(--text-muted); white-space: nowrap; }
.dl dd { margin: 0; font-weight: 500; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ctl-row { display: flex; gap: 8px; align-items: flex-end; }
.ctl-row .field { flex: 1; margin: 0; }
/* Antetul (logo color, fundal transparent) — direct pe bara deschisă, fără plăcuță albă. */
.brand__antet { display: block; height: 38px; width: auto; max-width: 280px; }

/* ===== Consolă platformă — KPI & panouri moderne, compacte ===== */
.pf-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); margin-bottom: 12px; }
.pf-kpi { display: flex; align-items: center; gap: 11px; background: var(--surface-card); border: 1px solid var(--border-default);
    border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow-sm);
    transition: box-shadow var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out); }
.pf-kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.pf-kpi__ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; line-height: 1; }
.pf-kpi__body { min-width: 0; }
.pf-kpi__lbl { font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); }
.pf-kpi__val { font-size: 1.3rem; font-weight: 750; color: var(--text-primary); line-height: 1.1; margin-top: 1px; letter-spacing: -.02em; white-space: nowrap; }
.pf-kpi__val small { font-size: .5em; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.pf-kpi__val.ok { color: var(--success); } .pf-kpi__val.warn { color: var(--warning); } .pf-kpi__val.danger { color: var(--danger); }
.pf-kpi__sub { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.pf-ico--blue { background: #e8f0fe; } .pf-ico--green { background: #e6f4ea; } .pf-ico--amber { background: #fef7e0; }
.pf-ico--red { background: #fce8e6; } .pf-ico--purple { background: #f3e8fd; } .pf-ico--teal { background: #e0f2f1; }
.pf-panel { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; margin-inline: auto; }
.pf-panel__hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-default); }
.pf-panel__title { font-size: var(--text-md); font-weight: 650; color: var(--text-primary); }
.pf-panel__sub { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; }
.pf-panel__bd { padding: 14px 16px; }
.pf-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.pf-table thead th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted);
    font-weight: 600; text-align: left; padding: 9px 16px; background: var(--surface-subtle); border-bottom: 1px solid var(--border-default); }
.pf-table thead th.num, .pf-table td.num { text-align: right; }
.pf-table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border-default); }
.pf-table tbody tr:last-child td { border-bottom: none; }
.pf-table tbody tr:hover td { background: var(--surface-subtle); }
.pf-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
    font-size: var(--text-xs); font-weight: 600; background: var(--surface-subtle); color: var(--text-secondary); border: 1px solid var(--border-default); }
.pf-pill::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .7; }
.pf-pill--ok { color: var(--success); background: var(--success-bg); border-color: transparent; }
.pf-pill--warn { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.pf-pill--danger { color: var(--danger); background: var(--danger-bg, #fdecec); border-color: transparent; }
.pf-pill--info { color: var(--info); background: var(--info-bg); border-color: transparent; }

/* ===================================================================
   Selector „Compania activă" (/companie-activa) — SAGA modern
   Spotlight pe firma activă + grilă de carduri 1-click pe restul.
   =================================================================== */
.coa-page-head--pick { margin-bottom: -4px; }
.coa-page-head--pick .hero__lead { max-width: 58ch; }
.coa { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: none; scroll-margin-top: calc(var(--header-h) + 16px); }
.coa--pick { gap: 10px; }
.coa:target {
    border-radius: 10px;
    animation: coaTargetPulse 1.2s ease-out;
}
.coa:focus { outline: none; }
@keyframes coaTargetPulse {
    0% { box-shadow: 0 0 0 4px rgba(61,136,214,.24); }
    100% { box-shadow: 0 0 0 0 rgba(61,136,214,0); }
}

.coa-note { background: var(--info-bg); border: 1px solid #b9d3f3; color: var(--text-secondary); border-radius: 10px; padding: 10px 14px; font-size: var(--text-sm); }
.coa-note--muted { background: var(--surface-muted); border-color: var(--border-default); color: var(--text-muted); }
.coa-anaf-rau { color: var(--danger); font-weight: 600; }

/* Alegere rapidă când nu există companie activă */
.coa-pick {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--shadow-xs);
}
.coa-pick__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.coa-pick__title {
    margin: 0 0 3px;
    font-size: 16px;
    line-height: 1.25;
    color: var(--text-primary);
}
.coa-pick__head p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
.coa-pick__anaf { margin: 0; flex: 0 0 auto; }
.coa-pick__actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
/* Aliniere de înălțime/rotunjime cu butonul ANAF (glossy, 32px) — ca să citească
   drept un singur cluster de acțiuni, nu controale disparate. */
.coa-pick__actions .btn { height: 32px; padding: 0 14px; border-radius: 8px;
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.coa-pick__tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
}
.coa-pick__tools .input {
    max-width: 440px;
    border-radius: 6px;
}
.coa-pick__quick {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 10px;
}
@media (max-width: 640px) {
    .coa-pick { padding: 10px; }
    .coa-pick__head { flex-direction: column; align-items: stretch; }
    .coa-pick__actions { flex-direction: column; align-items: stretch; width: 100%; }
    .coa-pick__anaf .btn { width: 100%; justify-content: center; }
    .coa-pick__tools { flex-direction: column; align-items: stretch; }
    .coa-pick__tools .input { max-width: none; }
    .coa-pick__quick { flex-direction: column; align-items: stretch; }
}

/* KPI strip (3 coloane, colțuri rotunjite peste fpx-kpis) */
.coa-kpis.fpx-kpis { grid-template-columns: repeat(3, 1fr); border-radius: 10px; overflow: hidden; }
.coa-kpis .fpx-kpi { display: flex; align-items: baseline; gap: 9px; min-width: 0; padding-block: 8px; }
.coa-kpis .fpx-kpi .lbl { flex: 0 0 auto; white-space: nowrap; }
.coa-kpis .fpx-kpi .val { flex: 0 0 auto; margin-top: 0; font-size: 1rem; }
.coa-kpis .fpx-kpi .sub { min-width: 0; margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coa-overview-line { display: flex; align-items: center; gap: 14px; min-width: 0; overflow: hidden; }
.coa-overview-line .coa-kpis.fpx-kpis { flex: 1 1 47%; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.coa-overview-line .coa-recente { flex: 1 1 53%; min-width: 0; flex-wrap: nowrap; }
.coa-overview-line .coa-recente form { flex: 1 1 0; min-width: 0; }
.coa-overview-line .coa-chip { width: 100%; min-width: 0; }
@media (max-width: 640px) { .coa-kpis.fpx-kpis { grid-template-columns: 1fr; } }

/* Spotlight firma activă */
.coa-spot { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
    background: linear-gradient(135deg, #f5f9fe 0%, #e9f1fc 100%); border: 1px solid #cfdef2;
    border-radius: 14px; box-shadow: var(--shadow-sm); padding: 14px 18px; }
.coa-spot::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(to bottom, #3d88d6, #1f63ab); }
.coa-spot__id { display: flex; align-items: center; gap: 13px; flex: 1 1 260px; min-width: 0; }
.coa-spot__av { width: 54px; height: 54px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center;
    font-size: 1.5rem; font-weight: 750; color: #fff; background: linear-gradient(135deg, #3d88d6, #1f63ab); box-shadow: 0 4px 12px rgba(31,99,171,.28); }
.coa-spot__txt { min-width: 0; }
.coa-spot__sub { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--color-primary-strong); }
.coa-spot__name { font-size: 1.2rem; font-weight: 750; color: var(--text-primary); line-height: 1.15; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coa-spot__cui { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }
.coa-spot__kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.coa-spot__kpis .fpx-kpi { border: 1px solid var(--border-default); border-radius: 9px; min-width: 116px; padding: 6px 12px; }
.coa-spot__kpis .fpx-kpi .val { font-size: 1rem; }
.coa-spot__act { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; margin-left: auto; }
@media (max-width: 820px) { .coa-spot__act { align-items: flex-start; margin-left: 0; } }

/* Toolbar căutare (sticky sub header) */
.coa-toolbar { position: sticky; top: calc(var(--header-h) + 1px); z-index: 5; display: flex; align-items: center; gap: 10px;
    background: var(--surface-app); padding: 4px 0; }
.coa-toolbar .input { max-width: 340px; border-radius: 6px; }
.coa-count { margin-left: auto; font-size: var(--text-xs); color: var(--text-secondary); font-family: var(--font-mono); white-space: nowrap; }
.coa-count b { color: var(--color-primary-strong); }
.coa-count kbd { background: rgba(0,0,0,.10); color: var(--text-secondary); padding: 0 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 11px; }

/* Grila de carduri */
.coa-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.coa-grid--pick { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.coa-grid--busy { pointer-events: none; }
.coa-grid--busy .coa-card { opacity: .55; }
.coa-card-wrap form { margin: 0; }
.coa-card { display: flex; flex-direction: column; gap: 9px; width: 100%; text-align: left; cursor: pointer; font: inherit;
    background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 12px; padding: 13px 14px;
    box-shadow: var(--shadow-xs); transition: border-color .14s ease, box-shadow .14s ease, transform .06s ease; }
.coa-grid--pick .coa-card { min-height: 136px; border-radius: 7px; background: #fbfdff; }
.coa-card:hover { border-color: #9cc0ec; box-shadow: 0 6px 18px rgba(16,40,80,.12); transform: translateY(-2px); }
.coa-card:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.coa-card:active { transform: translateY(0); }
.coa-card__top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.coa-av { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
    font-size: 1.05rem; font-weight: 750; color: #fff; box-shadow: 0 3px 9px rgba(31,99,171,.20); }
.coa-av--0 { background: linear-gradient(135deg, #3d88d6, #1f63ab); }
.coa-av--1 { background: linear-gradient(135deg, #2bb3a3, #127d73); }
.coa-av--2 { background: linear-gradient(135deg, #7c6cf0, #4f3fd0); }
.coa-av--3 { background: linear-gradient(135deg, #e08a3c, #c0631a); }
.coa-av--4 { background: linear-gradient(135deg, #48a662, #2c8047); }
.coa-av--5 { background: linear-gradient(135deg, #d8688c, #b53e66); }
.coa-card__hd { min-width: 0; }
.coa-card__name { font-weight: 700; color: var(--text-primary); font-size: var(--text-sm); line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.coa-card__cui { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }
.coa-card__pills { display: flex; flex-wrap: wrap; gap: 6px; }
.coa-card__meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11px; color: var(--text-muted); }
.coa-card__meta b { color: var(--text-secondary); font-weight: 600; }
.coa-card__go { margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: var(--text-xs);
    font-weight: 700; color: var(--color-primary-strong); transition: color .14s ease, background .14s ease, transform .14s ease; }
.coa-grid--pick .coa-card__go,
.coa-grid--list .coa-card__go {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 4px;
    background: #1f63ab;
    color: #fff;
}
.coa-card:hover .coa-card__go, .coa-card:focus-visible .coa-card__go { transform: translateX(2px); }
.coa-grid--pick .coa-card:hover,
.coa-grid--pick .coa-card:focus-visible { background: #f4f9ff; }
@media (max-width: 560px) { .coa-card__meta { display: none; } }

.coa-empty { padding: 26px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: 12px; }
.coa-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: var(--text-xs); color: var(--text-muted); padding-top: 2px; }
.coa-foot b { color: var(--text-secondary); }

/* Tonuri valoare KPI (spotlight) */
.coa-spot__kpis .val.ok { color: var(--success); }
.coa-spot__kpis .val.warn { color: var(--warning); }
.coa-spot__kpis .val.danger { color: var(--danger); }

/* Avertismente firmă activă (exercițiu lipsă / plafon micro) */
.coa-warns { display: flex; flex-direction: column; gap: 8px; }
.coa-warn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-decoration: none; font-size: var(--text-sm);
    font-weight: 500; line-height: 1.35; border-radius: 10px; padding: 10px 14px; border: 1px solid transparent; }
.coa-warn b { font-weight: 700; }
.coa-warn__go { margin-left: auto; font-weight: 700; white-space: nowrap; }
.coa-warn--danger { color: var(--danger); background: var(--danger-bg, #fdecec); border-color: #f3c9c9; }
.coa-warn--warn { color: #8a5a00; background: var(--warning-bg); border-color: #f0d8a8; }
.coa-warn:hover { filter: brightness(.985); }

/* Rând „Recente" — chip-uri 1-click */
.coa-recente { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.coa-recente__lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--text-muted); margin-right: 2px; }
.coa-recente form { margin: 0; }
.coa-chip { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font: inherit; max-width: 230px;
    background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 999px; padding: 3px 12px 3px 3px;
    box-shadow: var(--shadow-xs); transition: border-color .14s ease, box-shadow .14s ease, transform .06s ease; }
.coa-chip:hover { border-color: #9cc0ec; box-shadow: 0 4px 12px rgba(16,40,80,.12); transform: translateY(-1px); }
.coa-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.coa-chip__av { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 700; }
.coa-chip__name { font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Toggle vedere (carduri / listă) + buton ANAF în toolbar */
.coa-toolbar { flex-wrap: wrap; }
.coa-viewtoggle { display: inline-flex; border: 1px solid var(--border-default); border-radius: 8px; overflow: hidden; }
.coa-viewtoggle button { border: 0; background: var(--surface-card); color: var(--text-secondary); font: inherit; font-size: var(--text-xs);
    font-weight: 600; height: 32px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; line-height: 1; }
.coa-viewtoggle button + button { border-left: 1px solid var(--border-default); }
.coa-viewtoggle button:hover { background: var(--surface-subtle); color: var(--text-primary); }
.coa-viewtoggle button.is-on { background: var(--color-primary); color: #fff; }
.coa-anaf-form { margin: 0 0 0 auto; }

/* Pastilă „termen apropiat" pe card */
.coa-pill-termen { font-variant-numeric: tabular-nums; }
.coa-pill-termen::before { display: none; }
.coa-pill-termen--calm { color: var(--text-secondary); background: var(--surface-subtle); border-color: var(--border-default); }
.coa-pill-termen--warn { color: #8a5a00; background: var(--warning-bg); border-color: transparent; }
.coa-pill-termen--danger { color: var(--danger); background: var(--danger-bg, #fdecec); border-color: transparent; }

/* Vedere listă compactă (un rând per firmă) */
.coa-grid--list { grid-template-columns: 1fr; gap: 4px; }
/* min-height/border-radius/background vin din .coa-grid--pick .coa-card (mod carduri) —
   le anulăm explicit, altfel rândurile de listă rămân înalte cât cardurile. */
.coa-grid--list .coa-card { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 5px 14px;
    padding: 6px 14px; min-height: 0; border-radius: 8px; background: var(--surface-card); }
.coa-grid--list .coa-card__top { flex: 0 0 250px; min-width: 0; }
.coa-grid--list .coa-card__name { -webkit-line-clamp: 1; }
.coa-grid--list .coa-card__pills { flex: 1 1 320px; }
.coa-grid--list .coa-card__meta { flex: 0 0 auto; }
.coa-grid--list .coa-card__go { margin-left: auto; flex: 0 0 auto; margin-top: 0; }
.coa-grid--list .coa-av { width: 32px; height: 32px; font-size: .92rem; border-radius: 8px; }
@media (max-width: 720px) { .coa-grid--list .coa-card__top { flex-basis: 100%; } .coa-grid--list .coa-card__go { display: none; } }

/* ===================================================================
   ANTET CONTARO „CORPORATE CLEAN" — folosit pe consola de platformă (dev)
   Clase prefixate .crh- ca să nu intre în conflict cu headerul aplicației.
   =================================================================== */
:root{
  --crh-brand:#2563eb; --crh-brand-700:#1e40af; --crh-brand-50:#eff6ff;
  --crh-red:#e11d2a; --crh-ink:#0f172a; --crh-ink-soft:#334155; --crh-muted:#64748b;
  --crh-line:#e2e8f0; --crh-surface:#ffffff; --crh-radius:8px; --crh-radius-pill:999px;
  --crh-shadow-pop:0 12px 32px rgba(15,23,42,.14);
  --crh-ease:cubic-bezier(.2,.8,.2,1);
  --crh-font:'Inter','Segoe UI',system-ui,-apple-system,sans-serif; --crh-height:66px;
}
.crh{ background:var(--crh-surface); border-bottom:3px solid var(--crh-brand); font-family:var(--crh-font); position:sticky; top:0; z-index:1000; }
.crh *{box-sizing:border-box}
.crh-inner{ display:flex; align-items:center; gap:24px; height:var(--crh-height); padding-inline:22px; }
.crh-logo{display:block; height:40px; width:auto; flex:0 0 auto}
.crh-nav{margin-inline-start:6px}
.crh-nav ul{list-style:none; margin:0; padding:0; display:flex; align-items:center; gap:4px}
.crh-link{ display:inline-flex; align-items:center; gap:7px; padding:9px 14px; border-radius:var(--crh-radius);
  text-decoration:none; white-space:nowrap; font-size:.9rem; font-weight:600; color:var(--crh-ink-soft);
  transition:background .18s var(--crh-ease), color .18s var(--crh-ease); }
.crh-link svg{width:17px; height:17px; flex:0 0 auto}
.crh-link:hover{background:var(--crh-brand-50); color:var(--crh-brand-700)}
.crh-link.is-active{background:var(--crh-brand-50); color:var(--crh-brand)}
.crh-actions{margin-inline-start:auto; display:flex; align-items:center; gap:6px; position:relative}
.crh-user{display:flex; align-items:center; gap:10px; cursor:pointer; padding:5px 8px; border-radius:var(--crh-radius); transition:background .18s var(--crh-ease)}
.crh-user:hover{background:var(--crh-brand-50)}
.crh-company{display:flex; flex-direction:column; line-height:1.15; text-align:right}
.crh-company strong{font-size:.85rem; font-weight:700; color:var(--crh-ink)}
.crh-company span{font-size:.72rem; color:var(--crh-muted)}
.crh-avatar{ width:36px; height:36px; flex:0 0 auto; border-radius:var(--crh-radius-pill);
  background:linear-gradient(135deg,var(--crh-brand),var(--crh-brand-700)); color:#fff; font-weight:700; font-size:.85rem;
  display:flex; align-items:center; justify-content:center; }
.crh-menu{ position:absolute; right:0; top:calc(100% + 8px); background:#fff; border:1px solid var(--crh-line);
  border-radius:var(--crh-radius); box-shadow:var(--crh-shadow-pop); min-width:210px; padding:6px; z-index:1100; }
.crh-menu a, .crh-menu button{ display:block; width:100%; text-align:left; background:none; border:none; cursor:pointer;
  font:600 .85rem var(--crh-font); color:var(--crh-ink-soft); padding:9px 12px; border-radius:6px; text-decoration:none; }
.crh-menu a:hover, .crh-menu button:hover{background:var(--crh-brand-50); color:var(--crh-brand-700)}
.crh-menu__lbl{font-size:.72rem; color:var(--crh-muted); padding:6px 12px 2px}
.crh-menu__sep{height:1px; background:var(--crh-line); margin:4px 0}
@media (max-width:760px){ .crh-company{display:none} .crh-inner{gap:12px; padding-inline:14px} .crh-link{padding:8px 10px} }

/* ===== Consolă tenant — redesign compact ===== */
.pf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; margin-top: 7px; font-size: var(--text-sm); color: var(--text-secondary); }
.pf-meta__k { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 600; margin-right: 3px; }
.pf-meta .sep { color: var(--border-strong); }
.pf-kpi__val--text { font-size: 1.06rem; font-weight: 650; white-space: normal; line-height: 1.22; }
.pf-panel__bd--tight { padding: 10px 16px; }
.pf-form-row { display: flex; align-items: flex-end; gap: 8px; }
.pf-form-row + .pf-form-row { margin-top: 9px; }
.pf-form-row .field { flex: 1; margin: 0; }
.pf-form-row .select { height: 32px; }
.pf-form-row .btn { height: 32px; display: inline-flex; align-items: center; }
/* grilă compactă de module (înlocuiește tabelul înalt) */
.pf-modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); border-top: 1px solid var(--border-default); }
.pf-modrow { display: flex; align-items: center; gap: 9px; padding: 9px 16px; background: var(--surface-card); box-shadow: inset -1px -1px 0 var(--border-default); }
.pf-modrow:hover { background: var(--surface-subtle); }
.pf-modrow__dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; background: var(--border-strong); }
.pf-modrow__dot.on { background: var(--success); }
.pf-modrow__name { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-modrow__ctl { display: inline-flex; align-items: center; gap: 6px; margin: 0; flex-shrink: 0; }
.pf-seg { display: inline-flex; border: 1px solid var(--border-default); border-radius: 7px; overflow: hidden; }
.pf-seg button { border: 0; background: var(--surface-card); color: var(--text-secondary); width: 26px; height: 24px; font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; transition: background var(--dur-fast) var(--ease-out); }
.pf-seg button + button { border-left: 1px solid var(--border-default); }
.pf-seg button:hover { background: var(--surface-muted); color: var(--text-primary); }
.pf-seg button.is-on { background: var(--success); color: #fff; }
.pf-seg button.is-off { background: var(--danger); color: #fff; }
.pf-iconbtn { border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-muted); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; font-size: 12px; line-height: 1; padding: 0; }
.pf-iconbtn:hover { background: var(--surface-muted); color: var(--text-primary); }
.pf-lim-form { display: flex; gap: 6px; }
.pf-lim-form .input { max-width: 140px; height: 28px; }
.pf-lim-form .btn { height: 28px; display: inline-flex; align-items: center; }
.page-head__actions form { margin: 0; }
.hero__title { overflow-wrap: anywhere; }

/* === Toolbar din antetul paginilor (page-head) — controale compacte ===
   Scoped la .page-head__actions ca formularele mari din pagină să rămână intacte. */
.page-head__actions { gap: 8px; align-items: center; }
.page-head__actions form { margin: 0; }
.page-head__actions .btn {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    font-size: var(--text-xs);
    font-weight: 700;
}
.page-head__actions .btn--ghost {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #24364a;
    box-shadow: 0 1px 2px rgba(16,24,40,.06), inset 0 1px 0 rgba(255,255,255,.78);
}
.page-head__actions .btn--ghost:hover {
    background: #f7fbff;
    border-color: #8bb3dd;
    color: #12385f;
    box-shadow: 0 3px 8px rgba(16,40,80,.10), inset 0 1px 0 rgba(255,255,255,.82);
}
.page-head__actions .btn--ghost:focus-visible {
    outline: none;
    border-color: #1f63ab;
    box-shadow: 0 0 0 3px rgba(31,99,171,.16), 0 1px 2px rgba(16,24,40,.06);
}
.page-head__actions .btn__icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: #1f63ab;
}
.page-head__actions .btn__icon svg { width: 16px; height: 16px; display: block; }
.app-main .page-head__actions form:has(.select),
.page-head__actions form:has(.select) {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    min-height: 36px;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 7px !important;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16,24,40,.06), inset 0 1px 0 rgba(255,255,255,.78) !important;
}
.page-head__actions form:has(.select):focus-within {
    border-color: #1f63ab !important;
    box-shadow: 0 0 0 3px rgba(31,99,171,.16), 0 1px 2px rgba(16,24,40,.06) !important;
}
.page-head__actions form > label {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    background: #f6f8fb;
    border-right: 1px solid #e2e8f0;
    color: #526174 !important;
    font-size: 10px !important;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}
.page-head__actions .select {
    width: auto !important;
    min-width: 110px !important;
    height: 34px !important;
    line-height: 1.1;
    padding: 0 34px 0 12px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    border: 0 !important;
    border-radius: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none !important;
    color: #0f2742;
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: 800;
}
.page-head__actions .select:hover { background-color: #f7fbff; }
.page-head__actions .select:focus { outline: none; box-shadow: none !important; background-color: #fff; }
/* Pilula segmentată „EXERCIȚIU | 2026" — temă întunecată (baza folosește !important) */
:root[data-theme="dark"] .page-head__actions form:has(.select) {
    background: var(--surface-muted) !important;
    border-color: var(--border-strong) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.05) !important;
}
:root[data-theme="dark"] .page-head__actions form > label {
    background: oklch(34% 0.02 256);
    border-right-color: var(--border-strong);
    color: var(--text-secondary) !important;
}
:root[data-theme="dark"] .page-head__actions .select { color: var(--text-primary); background-color: oklch(30% 0.02 256); }
:root[data-theme="dark"] .page-head__actions .select:hover,
:root[data-theme="dark"] .page-head__actions .select:focus { background-color: oklch(33% 0.022 256); }
@media (max-width: 640px) {
    .page-head__actions { width: 100%; align-items: stretch; }
    .page-head__actions .btn,
    .page-head__actions form:has(.select) { width: 100%; justify-content: center; }
    .page-head__actions .select { flex: 1 1 auto; }
}

.fpx .table tbody tr { cursor: pointer; }
.fpx-row.sel > td { background: #B5D2FF !important; }
.fpx .st { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; font-size: var(--text-xs); font-weight: 600; border: 1px solid; text-transform: uppercase; letter-spacing: .2px; border-radius: 2px; }
.fpx .st::before { content: ''; width: 6px; height: 6px; background: currentColor; }
.fpx .st.paid { background: var(--success-bg); color: var(--success); border-color: #A5D6A7; }
.fpx .st.unpaid { background: var(--danger-bg); color: var(--danger); border-color: #EF9A9A; }
.fpx .st.draft { background: var(--warning-bg); color: var(--warning); border-color: #FFCC80; }
.fpx .st.info { background: var(--info-bg); color: var(--info); border-color: #90CAF9; }
.fpx .st.warn { background: #FFFDE7; color: #F57F17; border-color: #FFE082; }
.fpx-resizer { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 22px; padding: 0 12px; background: linear-gradient(to bottom, #4A6FA5, #2C5282); color: #fff; font-size: var(--text-xs); font-weight: 600; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong); cursor: ns-resize; user-select: none; }
.fpx-resizer .doc { font-family: var(--font-mono); color: #FFD56B; font-weight: 600; }
.fpx-resizer .grip { display: inline-flex; flex-direction: column; gap: 2px; }
.fpx-resizer .grip span { width: 16px; height: 2px; background: rgba(255,255,255,.5); }
.fpx-resizer .tgl { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 1px 8px; border-radius: 2px; font-size: var(--text-xs); }
.fpx-detail { border: 1px solid var(--border-strong); border-top: none; background: #fff; overflow: auto; }
.fpx-detail.hidden { display: none; }
.fpx-status { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: linear-gradient(to bottom, #5878A5, #2C5282); color: #fff; font-size: var(--text-xs); padding: 4px 10px; border: 1px solid var(--saga-blue); border-top: none; }
.fpx-status .lbl { color: rgba(255,255,255,.75); text-transform: uppercase; letter-spacing: .4px; }
.fpx-status .val { font-family: var(--font-mono); font-weight: 600; }
.fpx-status .sb-r { margin-left: auto; }
.fpx-fkeys { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; background: linear-gradient(to bottom, #E8E8E8, #D0D0D0); border: 1px solid var(--border-strong); border-top: none; padding: 3px 4px; }
.fpx-fkey { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; background: linear-gradient(to bottom, #FAFAFA, #E0E0E0); border: 1px solid #999; font-size: var(--text-xs); font-weight: 500; border-radius: 2px; color: var(--text-primary); }
.fpx-fkey:hover { background: linear-gradient(to bottom, #fff, #E8E8E8); text-decoration: none; }
.fpx-fkey .k { background: var(--saga-blue); color: #fff; padding: 0 4px; font-size: 9.5px; font-weight: 700; border-radius: 2px; }
.fpx-fkey.danger .k { background: var(--danger); } .fpx-fkey.warn .k { background: var(--warning); } .fpx-fkey.ok .k { background: var(--success); }
.fpx-dtabs { display: flex; gap: 4px; background: #eef1f5; border-bottom: 2px solid var(--saga-blue, #003B7A); flex-wrap: wrap; padding: 4px 6px 0; }
.fpx-dtab { padding: 7px 16px; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); cursor: pointer; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; background: transparent; display: inline-flex; gap: 6px; align-items: center; margin-bottom: -2px; transition: background .12s, color .12s; }
.fpx-dtab:hover { background: #e2e9f3; color: var(--saga-blue, #003B7A); }
.fpx-dtab.act { background: #fff; color: var(--saga-blue, #003B7A); font-weight: 700; border-color: var(--saga-blue, #003B7A); border-bottom: 2px solid #fff; }
.fpx-dtab .c { background: rgba(0,0,0,.15); padding: 0 5px; font-family: var(--font-mono); font-size: 10px; border-radius: 2px; }
.fpx-dbody { padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr 360px; gap: 16px; font-size: var(--text-sm); }
.fpx-dcol h5 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .4px; color: var(--saga-blue); font-weight: 700; padding-bottom: 4px; border-bottom: 1px dashed var(--border-default); margin-bottom: 8px; }
.fpx-kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 8px; }
.fpx-kv .k { color: var(--text-muted); } .fpx-kv .v { font-weight: 500; } .fpx-kv .v.mono { font-family: var(--font-mono); }
.fpx-sumtot { margin-top: 8px; padding: 6px 8px; background: linear-gradient(to bottom, #F0F6FE, #DCE4F0); border: 1px solid var(--saga-blue-2); display: flex; justify-content: space-between; align-items: center; }
.fpx-sumtot .l { text-transform: uppercase; font-weight: 700; color: var(--saga-blue); } .fpx-sumtot .v { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; color: var(--saga-blue); }
.fpx-alert { padding: 6px 10px; font-size: var(--text-xs); border: 1px solid; border-radius: 2px; margin-top: 8px; }
.fpx-alert.warn { background: #FFFDE7; border-color: #FFCC80; color: #6B4D00; } .fpx-alert.success { background: var(--success-bg); border-color: #A5D6A7; color: #1B5E20; }
.fpx-alert.danger { background: #FDECEA; border-color: #F3B5AE; color: #9F1B12; } .fpx-alert.info { background: #E8F1FC; border-color: #B6D4F5; color: #1B4B82; }
.fpx-nota { background: #FFFCE8; border: 1px solid #E0CB87; padding: 8px 10px; font-family: var(--font-mono); font-size: var(--text-xs); }
.fpx-nota .h { color: var(--saga-blue); font-weight: 700; margin-bottom: 5px; padding-bottom: 4px; border-bottom: 1px solid #E0CB87; display: flex; justify-content: space-between; gap: 8px; }
.fpx-nota table { width: 100%; } .fpx-nota td { padding: 2px 0; vertical-align: top; }
.fpx-nota td.cn { color: var(--saga-blue); font-weight: 700; width: 64px; } .fpx-nota td.lb { color: var(--text-muted); }
.fpx-nota td.d { text-align: right; color: var(--success); font-weight: 600; width: 74px; } .fpx-nota td.c { text-align: right; color: var(--info); font-weight: 600; width: 74px; }
.fpx-nota tr.sep td { border-top: 1px dashed #C9A227; color: #888; font-size: 10px; }
.fpx-nota .verif { margin-top: 6px; font-size: 10px; color: var(--success); font-weight: 600; font-family: var(--font-sans); }
@media (max-width: 1100px) { .fpx-kpis { grid-template-columns: repeat(2,1fr); } .fpx-dbody { grid-template-columns: 1fr; } }

/* =====================================================================
   Filtre GET compacte — bară slim WinMentor (global). Înlocuiește cardul
   alb voluminos pe care îl primeau automat formularele de filtrare GET.
   ===================================================================== */
.app-main form[method="get"] {
    background: linear-gradient(to bottom, #ECECEC, #D8D8D8);
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    padding: 5px 8px;
    box-shadow: none;
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
    flex-wrap: wrap;
}
.app-main form[method="get"] .field { gap: 1px; }
.app-main form[method="get"] .field__label { margin-bottom: 1px; }

/* ---- Dialog de confirmare (înlocuiește confirm() nativ; stil SAGA, centrat) ---- */
.cc-overlay {
    position: fixed; inset: 0; z-index: 1200;
    display: none; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15, 23, 42, .48);
}
.cc-overlay.is-open { display: flex; animation: cc-fade .12s ease-out; }
.cc-dialog {
    width: min(440px, 100%); background: var(--surface-card);
    border: 1px solid var(--border-strong); border-radius: var(--radius-xl, 6px);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .38); overflow: hidden;
    animation: cc-pop .13s cubic-bezier(.2, .9, .3, 1.3);
}
.cc-dialog__bar {
    display: flex; align-items: center; gap: 9px; padding: 9px 14px;
    background: linear-gradient(to bottom, #3d88d6, #1f63ab);
    color: #fff; font-weight: 700; font-size: var(--text-md);
    border-bottom: 1px solid #18548f;
}
.cc-dialog__ico {
    flex: 0 0 auto; width: 22px; height: 22px; display: inline-grid; place-items: center;
    border-radius: 50%; background: rgba(255, 255, 255, .22);
    font: 800 14px/1 system-ui, 'Segoe UI', sans-serif;
}
.cc-dialog__title { flex: 1 1 auto; min-width: 0; }
.cc-dialog__body {
    padding: 16px 16px 8px; color: var(--text-primary);
    font-size: var(--text-base); line-height: 1.55;
}
.cc-dialog__body p { margin: 0; }
.cc-dialog__foot {
    display: flex; justify-content: flex-end; gap: 8px; padding: 14px 16px 16px;
}
.cc-dialog--danger .cc-dialog__bar {
    background: linear-gradient(to bottom, #e2574f, #c5362f); border-bottom-color: #a72a24;
}
@keyframes cc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cc-pop  { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .cc-overlay.is-open, .cc-dialog { animation: none; }
}

/* =====================================================================
   Comutator temă (buton din antet) — stil de bază (temă deschisă)
   ===================================================================== */
.theme-toggle {
    display: inline-grid; place-items: center;
    width: 38px; height: 34px; padding: 0;
    border: 1px solid #8fb8e6; border-radius: 8px;
    background: linear-gradient(to bottom, #fbfdff, #e7f1fd);
    color: #1f63ab; cursor: pointer; font-size: 17px; line-height: 1;
    box-shadow: 0 1px 2px rgba(16,40,80,.08), inset 0 1px 0 rgba(255,255,255,.88);
    transition: background var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover { background: linear-gradient(to bottom, #ffffff, #d8eafd); border-color: #4f8fd3; }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle:focus-visible { outline: 2px solid #2865A8; outline-offset: 2px; }
.theme-toggle__ico { display: none; }
.theme-toggle__ico--moon { display: block; }               /* implicit (temă deschisă): arată luna → click = întunecat */
:root[data-theme="dark"] .theme-toggle__ico--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__ico--sun { display: block; }

/* =====================================================================
   TEMĂ ÎNTUNECATĂ — flip pe tokenuri + suprafețele hardcodate din shell.
   Prietenoasă cu ochii pentru lucrul de noapte. Comutator în antet.
   Sistemul de design e pe OKLCH, deci majoritatea ecranelor se adaptează
   automat prin tokenuri; aici acoperim și componentele cu culori fixe.
   ===================================================================== */
:root[data-theme="dark"] {
    color-scheme: dark;

    --color-primary: oklch(70% 0.15 256);
    --color-primary-strong: oklch(80% 0.13 256);
    --color-primary-soft: oklch(34% 0.07 256);
    --shadow-primary: 0 2px 8px oklch(70% 0.15 256 / 0.35);

    --surface-app: oklch(21% 0.014 256);
    --surface-card: oklch(25% 0.017 256);
    --surface-muted: oklch(30% 0.02 256);
    --surface-subtle: oklch(27% 0.018 256);
    --surface-2: oklch(30% 0.02 256); /* definit doar în light (~1623) — fără asta, zecile de var(--surface-2, #fallback-deschis) rămân albe în dark */

    --border-default: oklch(35% 0.02 256);
    --border-strong: oklch(44% 0.025 256);

    --text-primary: oklch(94% 0.008 256);
    --text-secondary: oklch(80% 0.015 256);
    --text-muted: oklch(66% 0.016 256);

    --success: oklch(76% 0.15 155);  --success-bg: oklch(32% 0.06 155);
    --danger:  oklch(72% 0.18 25);   --danger-bg:  oklch(34% 0.09 25);
    --warning: oklch(80% 0.13 75);   --warning-bg: oklch(35% 0.07 75);
    --info:    oklch(74% 0.13 240);  --info-bg:    oklch(32% 0.07 240);

    --shadow-xs: 0 1px 2px rgba(0,0,0,.45);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow-md: 0 6px 18px rgba(0,0,0,.55);
    --shadow-lg: 0 14px 40px rgba(0,0,0,.65);
}

:root[data-theme="dark"] body { background: oklch(16% 0.012 256); }

/* Antet + logo */
:root[data-theme="dark"] .app-header {
    background: linear-gradient(to bottom, oklch(27% 0.02 256), oklch(23% 0.018 256));
    border-bottom-color: var(--border-strong);
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
:root[data-theme="dark"] .brand__antet { filter: brightness(1.7) contrast(1.04); }

/* Meniuri / dropdown */
:root[data-theme="dark"] .dropdown { background: var(--surface-card); border-color: var(--border-strong); }
:root[data-theme="dark"] .dropdown__item.is-active { background: var(--color-primary); color: #0b1220; }

/* Controale dreapta antet: chip firmă activă + meniu utilizator */
:root[data-theme="dark"] .menu-chip {
    background: oklch(30% 0.02 256); border-color: var(--border-strong); color: var(--text-primary);
    box-shadow: 0 1px 1px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.05);
}
:root[data-theme="dark"] .menu-chip:hover { background: oklch(34% 0.03 256); border-color: var(--color-primary); color: var(--text-primary); }
:root[data-theme="dark"] .menu-chip__mark { background: #1e3a5f; color: #bcd6f5; }
:root[data-theme="dark"] .menu-chip__label { color: var(--text-muted); }
:root[data-theme="dark"] .menu-chip__name { color: var(--text-primary); }
:root[data-theme="dark"] .menu-chip__go { border-left-color: var(--border-strong); color: var(--color-primary-strong); }

:root[data-theme="dark"] .user-trigger {
    background: oklch(30% 0.02 256); border-color: var(--border-strong); color: var(--text-secondary);
    box-shadow: 0 1px 1px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.05);
}
:root[data-theme="dark"] .user-trigger:hover { background: oklch(34% 0.03 256); border-color: var(--color-primary); color: var(--text-primary); }
:root[data-theme="dark"] .user-avatar { background: #2563eb; color: #fff; }
:root[data-theme="dark"] .user-label { color: var(--text-muted); }

/* Butoane neutre (cele colorate — primary/danger/success — rămân, au contrast bun) */
:root[data-theme="dark"] .btn {
    background: linear-gradient(to bottom, oklch(34% 0.02 256), oklch(29% 0.018 256));
    border-color: var(--border-strong); color: var(--text-primary);
    box-shadow: 0 1px 1px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.06);
}
:root[data-theme="dark"] .btn:hover {
    background: linear-gradient(to bottom, oklch(38% 0.02 256), oklch(33% 0.018 256));
    border-color: var(--border-strong);
}
:root[data-theme="dark"] .btn--ghost { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text-primary); }
:root[data-theme="dark"] .btn--ghost:hover { background: var(--surface-subtle); border-color: var(--color-primary); }

/* Inputuri */
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea {
    background: oklch(30% 0.02 256); border-color: var(--border-strong); color: var(--text-primary);
}
:root[data-theme="dark"] .input:hover,
:root[data-theme="dark"] .select:hover,
:root[data-theme="dark"] .textarea:hover { background: oklch(33% 0.022 256); border-color: var(--color-primary); }
:root[data-theme="dark"] .input:focus,
:root[data-theme="dark"] .select:focus,
:root[data-theme="dark"] .textarea:focus { background: oklch(28% 0.02 256); }
:root[data-theme="dark"] .select option { background: oklch(25% 0.017 256); color: var(--text-primary); }
:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] .textarea::placeholder { color: var(--text-muted); }
/* Multe selectoare de perioadă au inline `color:#16202c` (text închis) care, fiind inline,
   bate tema — îl anulăm cu !important și fixăm fundal închis + opțiuni lizibile. */
:root[data-theme="dark"] select.input,
:root[data-theme="dark"] select.select {
    color: var(--text-primary) !important;
    background-color: oklch(30% 0.02 256) !important;
}
:root[data-theme="dark"] select.input option,
:root[data-theme="dark"] select.select option { background-color: oklch(25% 0.017 256); color: var(--text-primary); }
/* Câmpuri native de dată/lună — fundal închis + iconița de calendar vizibilă */
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="datetime-local"],
:root[data-theme="dark"] input[type="month"],
:root[data-theme="dark"] input[type="time"],
:root[data-theme="dark"] input[type="week"] {
    background-color: oklch(30% 0.02 256) !important;
    color: var(--text-primary) !important;
    color-scheme: dark;
    border-color: var(--border-strong) !important;
}
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="week"]::-webkit-calendar-picker-indicator { filter: invert(0.85); opacity: .85; }

/* Tabele */
:root[data-theme="dark"] .table-wrap { background: var(--surface-card); border-color: var(--border-strong); }
:root[data-theme="dark"] .table thead th {
    background: linear-gradient(to bottom, oklch(34% 0.03 256), oklch(29% 0.028 256));
    color: var(--text-primary); border-right-color: var(--border-strong); border-bottom-color: var(--border-strong);
}
:root[data-theme="dark"] .table tbody td { border-right-color: var(--border-default); border-bottom-color: var(--border-default); }
:root[data-theme="dark"] .table tbody tr:nth-child(even) { background: oklch(27% 0.016 256); }
:root[data-theme="dark"] .table tbody tr:hover { background: oklch(38% 0.05 256); }
:root[data-theme="dark"] .table tbody tr.selected,
:root[data-theme="dark"] .table tbody tr.is-open { background: oklch(42% 0.08 256); }
:root[data-theme="dark"] .table tfoot td,
:root[data-theme="dark"] .table .inv-foot td {
    background: linear-gradient(to bottom, oklch(36% 0.05 90), oklch(31% 0.05 90));
    color: var(--text-primary); border-top-color: var(--border-strong);
}

/* Carduri / KPI */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .tva-card { background: var(--surface-card); border-color: var(--border-strong); }

/* Tab-uri WinMentor (is-active rămâne amber — contrast bun) */
:root[data-theme="dark"] .tva-tab { background: oklch(30% 0.015 256); border-color: var(--border-strong); color: var(--text-muted); }
:root[data-theme="dark"] .tva-tab:hover:not(.is-active) { background: oklch(34% 0.018 256); }

/* Master-detail „.fpx" (stil SAGA/WinMentor) — parteneri, produse, plan de conturi etc. */
:root[data-theme="dark"] { --saga-blue: #5aa2f0; }
:root[data-theme="dark"] .fpx-kpi,
:root[data-theme="dark"] .fpx-grid,
:root[data-theme="dark"] .fpx-detail { background: var(--surface-card); border-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-dtabs { background: oklch(22% 0.015 256); border-bottom-color: var(--saga-blue); }
:root[data-theme="dark"] .fpx-dtab:hover { background: oklch(30% 0.02 256); color: var(--saga-blue); }
:root[data-theme="dark"] .fpx-dtab.act { background: var(--surface-card); color: var(--saga-blue); border-color: var(--saga-blue); border-bottom-color: var(--surface-card); }
:root[data-theme="dark"] .fpx-dcol h5 { border-bottom-color: var(--border-default); }
:root[data-theme="dark"] .fpx-fkeys { background: linear-gradient(to bottom, oklch(30% 0.018 256), oklch(25% 0.016 256)); border-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-fkey { background: linear-gradient(to bottom, oklch(34% 0.02 256), oklch(29% 0.018 256)); border-color: var(--border-strong); color: var(--text-primary); }
:root[data-theme="dark"] .fpx-fkey:hover { background: oklch(38% 0.03 256); }
:root[data-theme="dark"] .fpx-toolbar { background: linear-gradient(to bottom, oklch(30% 0.018 256), oklch(26% 0.016 256)); border-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-sumtot { background: var(--surface-muted); border-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-nota { background: oklch(27% 0.025 90); border-color: var(--border-strong); color: var(--text-primary); }
:root[data-theme="dark"] .fpx-nota .h { border-bottom-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-nota tr.sep td { border-top-color: var(--border-strong); }
:root[data-theme="dark"] .fpx-alert.warn   { background:#332813; border-color:#5a4620; color:#fcd34d; }
:root[data-theme="dark"] .fpx-alert.danger { background:#331a1a; border-color:#5c2626; color:#fca5a5; }
:root[data-theme="dark"] .fpx-alert.info   { background:#18293f; border-color:#2c4d73; color:#bcd6f5; }
:root[data-theme="dark"] .fpx-alert.success{ background:#13301f; border-color:#1f7a3a; color:#86efac; }
/* Rândul SELECTAT din grila .fpx (baza folosește #B5D2FF !important) → albastru închis + text deschis */
:root[data-theme="dark"] .fpx-row.sel > td { background: oklch(40% 0.085 256) !important; color: var(--text-primary); }
:root[data-theme="dark"] .table tbody tr.selected > td,
:root[data-theme="dark"] .table tbody tr.is-open > td { color: var(--text-primary); }
/* Câmpul de căutare — să iasă clar în evidență pe fundal închis */
:root[data-theme="dark"] .fpx-search { background-color: oklch(31% 0.02 256) !important; border: 1px solid oklch(31% 0.02 256) !important; color: var(--text-primary); box-shadow: none !important; }
:root[data-theme="dark"] .fpx-search:hover { background-color: oklch(33% 0.022 256) !important; border-color: oklch(33% 0.022 256) !important; }
:root[data-theme="dark"] .fpx-search:focus { border-color: var(--color-primary) !important; background-color: oklch(29% 0.02 256) !important; outline: none !important; }
:root[data-theme="dark"] .fpx-search::placeholder { color: var(--text-muted); opacity: 1; }
/* Bara slim a filtrelor GET (regulă UNLAYERED, ~2478) hardcodează gradient deschis
   #ECECEC→#D8D8D8 — fără override-ul de mai jos, în dark apare ca o ramă albă în
   jurul controalelor (ex. Registru de casă / Parteneri). */
:root[data-theme="dark"] .app-main form[method="get"] {
    background: linear-gradient(to bottom, oklch(32% 0.02 256), oklch(28% 0.018 256));
    border-color: var(--border-strong);
}
/* Pastilele de stare din listele fpx (~2428): .warn are fundal/bordură/culoare hardcodate
   deschis (#FFFDE7/#FFE082/#F57F17 — ex. „FURNIZOR" la parteneri), iar celelalte variante
   au borduri pastel hex care rămân deschise în dark deși fundalul din tokenuri se răstoarnă. */
:root[data-theme="dark"] .fpx .st.warn { background: oklch(33% 0.06 80); color: oklch(82% 0.14 70); border-color: oklch(48% 0.09 75); }
:root[data-theme="dark"] .fpx .st.paid { border-color: oklch(45% 0.08 155); }
:root[data-theme="dark"] .fpx .st.unpaid { border-color: oklch(46% 0.10 25); }
:root[data-theme="dark"] .fpx .st.draft { border-color: oklch(48% 0.09 75); }
:root[data-theme="dark"] .fpx .st.info { border-color: oklch(45% 0.08 240); }
/* Formularele de stoc (.stoc-form — stiluri locale duplicate în 5 view-uri: gestiune/
   mișcare/bon consum/producție/transfer) au card alb + antet gradient deschis hardcodate. */
:root[data-theme="dark"] .stoc-form { background: var(--surface-card); }
:root[data-theme="dark"] .stoc-form__head { background: linear-gradient(to bottom, oklch(32% 0.02 256), oklch(28% 0.018 256)); }
:root[data-theme="dark"] .stoc-form__section { background: oklch(22% 0.015 256); }
/* Cardurile-secțiune din Case de marcat (.section-card — duplicat în index/registre/import_form) */
:root[data-theme="dark"] .section-card { background: var(--surface-card); }
/* Salarii — totalurile din „Sumar contabil" au gradiente pastel hardcodate */
:root[data-theme="dark"] .sc-r.tot.buget { background: linear-gradient(to bottom, oklch(33% 0.06 80), oklch(29% 0.05 80)); }
:root[data-theme="dark"] .sc-r.tot.plata { background: linear-gradient(to bottom, oklch(32% 0.05 155), oklch(28% 0.045 155)); }
/* Fișa angajatului (salarii/_angajat_panou) — carduri albe hardcodate (#fcfdff / #fff) */
:root[data-theme="dark"] .angp .acard { background: var(--surface-card); }
:root[data-theme="dark"] .angp .acard--est { background: var(--surface-card); border-color: var(--border-strong); }
/* Taburile aurii WinMentor (.ang-tabs — duplicate în salarii/angajat_form + parteneri/form):
   banda și taburile inactive se întunecă; tabul activ rămâne auriu aprins (semnal). */
:root[data-theme="dark"] .ang-tabs { background: linear-gradient(oklch(26% 0.018 256), oklch(22% 0.015 256)); border-bottom-color: oklch(60% 0.11 85); }
:root[data-theme="dark"] .ang-tab { background: linear-gradient(oklch(32% 0.045 85), oklch(27% 0.04 85)); border-color: oklch(45% 0.07 85); color: oklch(85% 0.09 90); }
:root[data-theme="dark"] .ang-tab:hover { background: linear-gradient(oklch(36% 0.05 85), oklch(30% 0.045 85)); }
:root[data-theme="dark"] .ang-tab.act { background: linear-gradient(oklch(78% 0.13 85), oklch(68% 0.13 80)); border-color: oklch(60% 0.11 85); color: oklch(24% 0.05 85); }
/* Modalul de corecție din formularul de angajat are fundal alb INLINE (bătut doar cu !important) */
:root[data-theme="dark"] #corModal > div { background: var(--surface-card) !important; }
/* Formularele de factură (.fdoc/.finv__box — stiluri duplicate în facturi_emise/form +
   facturi_primite/form, cu !important și fundaluri deschise hardcodate). Cutia clientului
   păstrează nuanța gălbuie distinctivă, în variantă închisă. */
:root[data-theme="dark"] .fdoc .input, :root[data-theme="dark"] .fdoc .select { background: oklch(30% 0.02 256) !important; border-color: var(--border-strong) !important; color: var(--text-primary) !important; }
:root[data-theme="dark"] .fdoc .input:focus, :root[data-theme="dark"] .fdoc .select:focus { background: oklch(28% 0.02 256) !important; border-color: var(--color-primary) !important; }
:root[data-theme="dark"] .fdoc .input::placeholder { color: var(--text-muted) !important; }
:root[data-theme="dark"] .finv__box { background: var(--surface-card); border-color: var(--border-strong); }
:root[data-theme="dark"] .finv__box--doc { background: oklch(27% 0.02 256); }
:root[data-theme="dark"] .finv__box--client { background: oklch(29% 0.035 85); border-color: oklch(45% 0.06 85); }
/* Exerciții financiare — cardul activ folosește în light `oklch(... 97%)`, care rămâne
   aproape alb în dark; îl coborâm pe suprafață albastru-închisă, cu text lizibil. */
:root[data-theme="dark"] .ex-active {
    background: linear-gradient(to bottom, oklch(28% 0.035 256), oklch(24% 0.03 256));
    border-color: var(--border-strong);
    box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .ex-active__an,
:root[data-theme="dark"] .ex-active__progress strong { color: var(--text-primary); }
:root[data-theme="dark"] .ex-progressbar { background: oklch(18% 0.018 256); }
/* Detaliu exercițiu — operațiunile de sfârșit de an (.yec-step) au stil local
   cu card alb + header gradient deschis; specificitatea de aici bate stilul local. */
:root[data-theme="dark"] .yec-step {
    background: var(--surface-card);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
:root[data-theme="dark"] .yec-step > h2 {
    background: linear-gradient(to bottom, oklch(31% 0.02 256), oklch(27% 0.018 256));
    border-bottom-color: var(--border-strong);
    color: var(--color-primary-strong);
}
:root[data-theme="dark"] .yec-step p,
:root[data-theme="dark"] .yec-step li { color: var(--text-secondary); }

/* Subsol (are #F4F4F4 hardcodat) */
:root[data-theme="dark"] .app-footer { background: var(--surface-card); color: var(--text-muted); border-top-color: var(--border-strong); }

/* Selector companie activă (.coa-*) — cardurile firmelor aveau fundal alb fix */
:root[data-theme="dark"] .coa-grid--pick .coa-card { background: var(--surface-card); }
:root[data-theme="dark"] .coa-grid--pick .coa-card:hover,
:root[data-theme="dark"] .coa-grid--pick .coa-card:focus-visible { background: oklch(30% 0.02 256); }
:root[data-theme="dark"] .coa-card:hover { border-color: var(--color-primary); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
:root[data-theme="dark"] .coa-chip:hover { border-color: var(--color-primary); box-shadow: 0 4px 12px rgba(0,0,0,.35); }
:root[data-theme="dark"] .coa-spot {
    background: linear-gradient(135deg, oklch(27% 0.02 256), oklch(24% 0.018 256));
    border-color: var(--border-strong);
}
:root[data-theme="dark"] .coa-warn--danger { background:#331a1a; border-color:#5c2626; color:#fca5a5; }
:root[data-theme="dark"] .coa-warn--warn { background:#332813; border-color:#5a4620; color:#fcd34d; }

/* Taskbar ferestre (stil SAGA) */
:root[data-theme="dark"] #cr-taskbar { background: oklch(24% 0.017 256); border-top-color: var(--border-strong); box-shadow: 0 -1px 6px rgba(0,0,0,.4); }
:root[data-theme="dark"] .crtb__w { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text-secondary); }
:root[data-theme="dark"] .crtb__all { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text-muted); }

/* Comutator temă în modul întunecat */
:root[data-theme="dark"] .theme-toggle {
    background: linear-gradient(to bottom, oklch(34% 0.02 256), oklch(29% 0.018 256));
    border-color: var(--border-strong); color: oklch(85% 0.12 90);
    box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
:root[data-theme="dark"] .theme-toggle:hover { border-color: var(--color-primary); }

/* Buton ecran complet — în modul întunecat */
:root[data-theme="dark"] .shell-fullscreen {
    background: linear-gradient(to bottom, oklch(34% 0.02 256), oklch(29% 0.018 256));
    border-color: var(--border-strong); color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
:root[data-theme="dark"] .shell-fullscreen:hover { background: oklch(38% 0.03 256); border-color: var(--color-primary); color: var(--text-primary); }
:root[data-theme="dark"] .shell-fullscreen.is-on { background: var(--color-primary); border-color: var(--color-primary-strong); color: #0b1220; }

/* Butonul de cont din antet: doar iconița (avatarul), fără text „CONT / nume" și fără caret */
.user-trigger .user-meta,
.user-trigger .menu-caret { display: none; }
.user-trigger { padding: 3px; gap: 0; max-width: none; }

/* Meniuri „doar iconiță" (Panou, Asistent): ascunde eticheta, păstrează emoji-ul (nume la hover) */
.menu-link--icon .menu-link__txt { display: none; }

/* ===== Combo (selectoare căutabile — combo.js) =====
   Input-ul e SIBLING direct al <select>-ului și îi copiază clasele → moștenește orice
   stil care viza selectul (bare de filtre etc.). Popup = <datalist> nativ (nu e tăiat de tabele). */
/* <select>-ul real rămâne în DOM pentru submit/Alpine/HTMX, dar scos din pagină.
   Off-screen (nu display:none) ca să rămână focusabil (validarea nativă). */
.cbx__native {
    position: absolute !important; left: -9999px !important; top: auto !important;
    width: 1px !important; height: 1px !important; opacity: 0 !important;
    padding: 0 !important; margin: 0 !important; border: 0 !important;
    pointer-events: none !important; clip: rect(0 0 0 0);
}
/* Caret consistent de „picker" pe orice combo (indiferent de clasele moștenite),
   ca să se vadă că e o listă, nu un câmp liber. */
.cbx__in {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23888' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.55rem center !important;
    background-size: 10px 6px !important;
    padding-right: 1.7rem !important;
    -webkit-appearance: none;
    appearance: none;
}
/* Chromium/WebKit adaugă propriul indicator pentru input[list]. Îl ascundem:
   caret-ul SVG de mai sus rămâne singurul indicator vizual al selectorului. */
.cbx__in::-webkit-calendar-picker-indicator,
.cbx__in::-webkit-list-button { display: none !important; opacity: 0 !important; }
/* Multe selectoare au inline `color:#16202c` (text închis) pe care input-ul îl moștenește
   din style-ul copiat → în dark ar fi text închis pe fundal închis. Îl anulăm ca la select.input. */
:root[data-theme="dark"] .cbx__in {
    color: var(--text-primary) !important;
    background-color: oklch(30% 0.02 256) !important;
    border-color: var(--border-strong) !important;
}

/* Acțiunile din dreapta antetului: relief discret, uniform în ambele teme. */
.menubar__spacer .menu-chip,
.menubar__spacer ~ .menu-item > .theme-toggle,
.menubar__spacer ~ .menu-item > .shell-fullscreen,
.menubar__spacer ~ .menu-item > .user-trigger {
    box-shadow: 0 2px 5px rgba(15, 23, 42, .15), inset 0 1px 0 rgba(255, 255, 255, .12);
    transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.menubar__spacer .menu-chip:hover,
.menubar__spacer ~ .menu-item > .theme-toggle:hover,
.menubar__spacer ~ .menu-item > .shell-fullscreen:hover,
.menubar__spacer ~ .menu-item > .user-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 9px rgba(15, 23, 42, .19), inset 0 1px 0 rgba(255, 255, 255, .16);
}

/* ===================================================================
   Selector firmă — registru contabil modern (2026-07)
   Listă implicită, densitate controlată și reflow real la zoom.
   =================================================================== */
.coa-page-head--pick {
    display: block;
    margin: 0 0 10px;
    padding: 2px 0 0;
}
.coa-page-head--pick .hero__badge { margin-bottom: 3px; }
.coa-page-head--pick .hero__title { margin: 0; font-size: clamp(1.08rem, 1.5vw, 1.35rem); letter-spacing: -.015em; }
.coa-page-head--pick .hero__lead { margin: 3px 0 0; max-width: none; color: var(--text-secondary); }

.coa--pick { gap: 10px; }
.coa-pick {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    background: var(--surface-card);
    box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
}
.coa-pick__head {
    align-items: center;
    margin: 0;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-card);
}
.coa-pick__eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--color-primary-strong);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .09em;
    line-height: 1.2;
    text-transform: uppercase;
}
.coa-pick__title { margin: 0; font-size: 1rem; letter-spacing: -.01em; }
.coa-pick__head p { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.coa-pick__actions { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.coa-pick__actions .btn,
.coa-pick__actions .btn-anaf,
.coa-viewtoggle button {
    min-height: 34px;
    height: 34px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 650;
}
.coa-pick__actions .btn-anaf {
    padding: 0 12px;
    color: #102f55;
    background: #fff;
    border: 1px solid #aeb6c1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    text-transform: none;
    letter-spacing: 0;
}
.coa-pick__actions .btn-anaf:hover {
    color: #0b4f91;
    background: #f5f9fd;
    border-color: #7f91a8;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .12);
}
.coa-viewtoggle { padding: 2px; gap: 2px; border: 1px solid var(--border-default); border-radius: 9px; background: var(--surface-muted); }
.coa-viewtoggle button { min-height: 28px; height: 28px; padding: 0 11px; border-radius: 6px; background: transparent; }
.coa-viewtoggle button + button { border-left: 0; }
.coa-viewtoggle button.is-on { background: var(--surface-card); color: var(--color-primary-strong); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }

.coa-pick__quick {
    margin: 0;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-subtle);
}
.coa-pick__quick .coa-recente { gap: 6px; width: 100%; }
.coa-recente__lbl { color: var(--text-muted); font-size: 10px; letter-spacing: .08em; }
.coa-chip {
    min-height: 30px;
    padding: 2px 10px 2px 3px;
    border-radius: 7px;
    box-shadow: none;
    background: var(--surface-card);
}
.coa-chip:hover { transform: none; border-color: var(--color-primary); box-shadow: 0 2px 7px rgba(15, 23, 42, .09); }
.coa-chip__av { border-radius: 5px; }
.coa-chip__name { font-weight: 650; }

.coa-pick__tools { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--border-default); }
.coa-pick__tools .input { min-height: 36px; max-width: 520px; }

.coa-pick .coa-grid { margin: 12px 14px; }
.coa-pick .coa-grid--list {
    display: block;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--surface-card);
}
.coa-grid--list .coa-card-wrap { margin: 0; }
.coa-grid--list .coa-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(340px, 1.8fr) minmax(220px, 1.25fr) auto;
    align-items: center;
    gap: 8px 18px;
    min-height: 58px;
    padding: 9px 14px;
    border: 0;
    border-bottom: 1px solid var(--border-default);
    border-radius: 0;
    background: var(--surface-card);
    box-shadow: none;
    transform: none;
}
.coa-grid--list .coa-card-wrap:last-child .coa-card { border-bottom: 0; }
.coa-grid--list .coa-card:hover,
.coa-grid--list .coa-card:focus-visible {
    transform: none;
    border-color: var(--border-default);
    background: var(--surface-subtle);
    box-shadow: inset 3px 0 0 var(--color-primary);
}
.coa-grid--list .coa-card__top { min-width: 0; flex: none; }
.coa-grid--list .coa-card__hd { overflow: hidden; }
.coa-grid--list .coa-card__name { font-size: 12px; font-weight: 720; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; display: block; }
.coa-grid--list .coa-card__cui { margin-top: 2px; font-size: 10px; letter-spacing: .015em; }
.coa-grid--list .coa-av { width: 34px; height: 34px; border-radius: 8px; font-size: .86rem; box-shadow: none; }
.coa-grid--list .coa-card__pills { flex: none; gap: 5px; min-width: 0; }
.coa-grid--list .pf-pill { min-height: 22px; padding: 2px 8px; font-size: 10px; font-weight: 620; }
.coa-grid--list .coa-card__meta {
    display: flex;
    justify-content: flex-end;
    gap: 4px 12px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 10px;
    text-align: right;
}
.coa-grid--list .coa-card__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coa-grid--list .coa-card__go {
    justify-self: end;
    align-self: center;
    min-width: 92px;
    min-height: 30px;
    margin: 0;
    padding: 0 11px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    color: #fff;
    background: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
}
.coa-grid--list .coa-card__go span { transition: transform .14s ease; }
.coa-grid--list .coa-card:hover .coa-card__go span { transform: translateX(2px); }

/* Cardurile rămân disponibile, dar folosesc aceeași gramatică vizuală. */
.coa-grid--pick:not(.coa-grid--list) { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.coa-grid--pick:not(.coa-grid--list) .coa-card { min-height: 150px; border-radius: 10px; background: var(--surface-card); box-shadow: 0 1px 5px rgba(15, 23, 42, .06); }
.coa-grid--pick:not(.coa-grid--list) .coa-card__go { align-self: stretch; min-height: 32px; border-radius: 6px; }

.coa-foot { padding: 10px 14px; border-top: 1px solid var(--border-default); background: var(--surface-subtle); }
.coa-pick + .coa-foot { margin-top: 0; }

/* Paletă sobră: firmele rămân ușor de recunoscut, fără culori stridente. */
.coa-av--0 { background: #2b608f; }
.coa-av--1 { background: #237c72; }
.coa-av--2 { background: #4f5fa8; }
.coa-av--3 { background: #ad6427; }
.coa-av--4 { background: #39794d; }
.coa-av--5 { background: #a64b6d; }

@media (max-width: 1180px) {
    .coa-grid--list .coa-card { grid-template-columns: minmax(210px, 1.1fr) minmax(300px, 1.7fr) auto; }
    .coa-grid--list .coa-card__meta { grid-column: 1 / 3; grid-row: 2; justify-content: flex-start; text-align: left; }
    .coa-grid--list .coa-card__go { grid-column: 3; grid-row: 1 / 3; }
}
@media (max-width: 820px) {
    .coa-pick__head { align-items: flex-start; }
    .coa-pick__actions { width: 100%; justify-content: flex-start; }
    .coa-grid--list .coa-card { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 11px 12px; }
    .coa-grid--list .coa-card__top { grid-column: 1; grid-row: 1; }
    .coa-grid--list .coa-card__pills { grid-column: 1 / -1; grid-row: 2; }
    .coa-grid--list .coa-card__meta { grid-column: 1 / -1; grid-row: 3; }
    .coa-grid--list .coa-card__go { grid-column: 2; grid-row: 1; }
}
@media (max-width: 560px) {
    .coa-page-head--pick .hero__lead { font-size: 12px; }
    .coa-pick { border-radius: 9px; }
    .coa-pick__head, .coa-pick__quick, .coa-pick__tools { padding-inline: 11px; }
    .coa-pick__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .coa-pick__actions .coa-viewtoggle { grid-column: 1 / -1; }
    .coa-pick__actions .coa-viewtoggle button { flex: 1; }
    .coa-pick__actions .btn, .coa-pick__actions form, .coa-pick__actions .btn-anaf { width: 100%; justify-content: center; }
    .coa-recente form { max-width: calc(50% - 4px); }
    .coa-chip { width: 100%; min-width: 0; }
    .coa-grid--list .coa-card { grid-template-columns: 1fr; }
    .coa-grid--list .coa-card__top,
    .coa-grid--list .coa-card__pills,
    .coa-grid--list .coa-card__meta,
    .coa-grid--list .coa-card__go { grid-column: 1; grid-row: auto; }
    .coa-grid--list .coa-card__go { width: 100%; justify-self: stretch; }
    .coa-grid--list .coa-card__meta { justify-content: flex-start; text-align: left; }
}

:root[data-theme="dark"] .coa-pick,
:root[data-theme="dark"] .coa-pick__head,
:root[data-theme="dark"] .coa-grid--list .coa-card { background: var(--surface-card); }
:root[data-theme="dark"] .coa-pick__quick,
:root[data-theme="dark"] .coa-foot { background: var(--surface-subtle); }
:root[data-theme="dark"] .coa-grid--list .coa-card:hover,
:root[data-theme="dark"] .coa-grid--list .coa-card:focus-visible { background: oklch(30% 0.02 256); box-shadow: inset 3px 0 0 var(--color-primary); }
:root[data-theme="dark"] .coa-pick__actions .btn-anaf { color: #102f55; background: #fff; border-color: #aeb6c1; }
:root[data-theme="dark"] .coa-viewtoggle button.is-on { background: oklch(34% 0.025 256); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,.28); }
/* Nomenclatoare — registru compact, orientat pe verificare contabilă. */
.nom-registry { --nom-line: color-mix(in srgb, var(--border) 84%, transparent); }
.nom-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid var(--nom-line); }
.nom-head .hero { min-width:0; }
.nom-head .hero__badge { letter-spacing:.1em; }
.nom-head .hero__title { margin-top:2px; }
.nom-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.nom-kpis { grid-template-columns:repeat(4,minmax(0,1fr)); margin-bottom:6px; }
.nom-kpis .fpx-kpi { min-height:54px; padding:7px 11px; }
.nom-kpis .val { line-height:1.05; }
.nom-kpis .val small { margin-left:3px; color:var(--text-muted); font-size:.55em; font-weight:600; }
.nom-accounting-note { margin:0 0 7px; padding:5px 9px; border:1px solid color-mix(in srgb, var(--saga-blue) 22%, var(--border)); border-left:3px solid var(--saga-blue); border-radius:5px; background:color-mix(in srgb, var(--saga-blue) 5%, var(--surface)); color:var(--text-muted); font-size:11px; line-height:1.35; }
.nom-accounting-note strong { color:var(--text); }
.nom-filterbar { display:flex; align-items:center; gap:10px; min-height:44px; padding:5px 7px; border:1px solid var(--nom-line); border-bottom:0; border-radius:5px 5px 0 0; background:#f1f2f3; }
.nom-tabs { display:inline-flex; align-items:stretch; gap:6px; max-width:100%; padding:0; border:0; border-radius:0; background:transparent; overflow-x:auto; scrollbar-width:thin; }
.nom-tab { display:inline-flex; align-items:center; justify-content:space-between; gap:10px; min-width:94px; min-height:33px; padding:5px 9px 5px 12px; border:1px solid #aeb4bc; border-radius:2px 2px 0 0; background:#e0e2e4; color:#4b535c; box-shadow:inset 0 1px 0 rgba(255,255,255,.72); font:600 11px/1 var(--font-sans); cursor:pointer; transition:background-color .12s,border-color .12s,color .12s; }
.nom-tab:hover { color:#20262d; background:#e9eaeb; border-color:#89929c; }
.nom-tab:focus-visible { outline:2px solid var(--saga-blue); outline-offset:1px; }
.nom-tab.is-active { color:#28220f; background:#fff0ad; border-color:#c9a33a; box-shadow:inset 0 3px 0 #e0b42c,inset 0 1px 0 rgba(255,255,255,.65); }
.nom-tab span { min-width:25px; padding:3px 5px; border-radius:1px; background:rgba(45,52,60,.13); color:inherit; font:700 10px/1 var(--font-mono); text-align:center; }
.nom-tab.is-active span { background:rgba(160,119,5,.2); }
.nom-search { position:relative; display:flex; align-items:center; width:min(360px,32vw); margin-left:auto; }
.nom-search > span { position:absolute; left:9px; z-index:1; color:var(--text-muted); font-size:16px; pointer-events:none; }
.nom-search .input { width:100%; height:30px; padding-left:29px; background:var(--surface); }
.nom-result-count { flex:none; color:var(--text-muted); font:11px/1 var(--font-sans); white-space:nowrap; }
.nom-result-count b { color:var(--saga-blue); font-family:var(--font-mono); }
:root[data-theme="dark"] .nom-filterbar { background:#22272e; }
:root[data-theme="dark"] .nom-tab { background:#30363d; border-color:#58616c; color:#c4ccd5; box-shadow:inset 0 1px 0 rgba(255,255,255,.04); }
:root[data-theme="dark"] .nom-tab:hover { background:#39414a; border-color:#788492; color:#f0f4f8; }
:root[data-theme="dark"] .nom-tab.is-active { background:#5b4a1d; border-color:#c69d2e; color:#fff2bf; box-shadow:inset 0 3px 0 #e2b638; }
:root[data-theme="dark"] .nom-tab span { background:rgba(255,255,255,.11); }
.nom-table-wrap { max-width:100%; border-radius:0 0 7px 7px; overflow:auto; }
.nom-table { min-width:980px; table-layout:auto; }
.nom-table thead th { position:sticky; top:0; z-index:2; height:29px; padding:5px 8px; background:color-mix(in srgb, var(--saga-blue) 9%, var(--surface-2)); color:var(--text-muted); font-size:10px; letter-spacing:.025em; white-space:nowrap; }
.nom-table tbody td { height:34px; padding:4px 8px; font-size:11px; vertical-align:middle; }
.nom-table tbody tr[data-row]:hover { background:color-mix(in srgb, var(--saga-blue) 4%, var(--surface)); }
.nom-table .btn--sm { min-height:25px; padding:3px 7px; }
.nom-table .nom-delete { min-width:25px; color:var(--danger); font-size:17px; line-height:1; }
.nom-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; min-height:122px; padding:18px; text-align:center; }
.nom-empty strong { color:var(--text); font-size:14px; }
.nom-empty span { max-width:600px; color:var(--text-muted); font-size:11px; }
.nom-add-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 12px; align-items:start; }
.nom-add-grid .field { gap:1px; min-width:0; }
.nom-add-grid .field__label { margin-bottom:1px; font-size:11px; white-space:nowrap; }
.nom-edit-row { background:var(--surface-2,#f2f3f5); }
.nom-edit-row td { padding:8px 10px; }
.nom-edit-form { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px 10px; align-items:end; }
.nom-edit-form .field { gap:1px; min-width:0; }
.nom-edit-form .field__label { margin-bottom:1px; font-size:11px; }
.nom-edit-form .actions { grid-column:1 / -1; display:flex; gap:6px; justify-content:flex-end; }

@media (max-width:1100px) {
  .nom-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .nom-search { width:min(320px,38vw); }
  .nom-edit-form { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .nom-head { align-items:flex-start; flex-direction:column; }
  .nom-toolbar { justify-content:flex-start; width:100%; }
  .nom-filterbar { align-items:stretch; flex-wrap:wrap; }
  .nom-tabs { width:max-content; }
  .nom-search { order:3; width:100%; margin-left:0; }
  .nom-result-count { margin-left:auto; align-self:center; }
  .nom-add-grid, .nom-edit-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:480px) {
  .nom-kpis { grid-template-columns:1fr; }
  .nom-add-grid, .nom-edit-form { grid-template-columns:1fr; }
}

/* Fișa Agent nou — compactă, grupată după fluxul contabil. */
.nom-modal { width:min(880px,calc(100vw - 24px)); max-width:880px; }
.nom-modal--agenti { width:min(920px,calc(100vw - 24px)); max-width:920px; }
.nom-modal--agenti .modal__head { min-height:50px; padding:8px 14px; }
.nom-modal-title { display:flex; flex-direction:column; min-width:0; gap:2px; }
.nom-modal-title > span:last-child:not(:first-child) { color:var(--text-muted); font-size:10px; font-weight:400; }
.nom-modal-body { position:relative; padding:10px 14px 12px; }
.nom-form-required { position:absolute; top:10px; right:14px; color:var(--text-muted); font-size:9px; }
.nom-form-required span { color:var(--danger); font-weight:700; }
.nom-agent-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px 10px; }
.nom-form-section { grid-column:1 / -1; display:flex; align-items:center; gap:7px; height:20px; margin-top:2px; border-bottom:1px solid var(--nom-line); color:var(--text); font-size:10px; font-weight:700; letter-spacing:.035em; text-transform:uppercase; }
.nom-form-section:not(:first-child) { margin-top:5px; }
.nom-form-section > span { color:var(--saga-blue); font:700 9px/1 var(--font-mono); }
.nom-agent-grid .field { align-content:start; gap:2px; }
.nom-agent-grid .field__label { color:var(--text-muted); font-size:9px; font-weight:650; letter-spacing:.025em; text-transform:uppercase; }
.nom-agent-grid .input, .nom-agent-grid .select { height:31px; min-height:31px; padding-top:4px; padding-bottom:4px; background:var(--surface); }
.nom-modal--agenti .nom-agent-grid .input,
.nom-modal--agenti .nom-agent-grid .select {
  background:#edf6ff;
  border-color:#83afe5;
  color:#172033;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.72);
}
.nom-modal--agenti .nom-agent-grid .input:hover,
.nom-modal--agenti .nom-agent-grid .select:hover { background:#e6f2ff; border-color:#5795dc; }
.nom-modal--agenti .nom-agent-grid .input:focus,
.nom-modal--agenti .nom-agent-grid .select:focus {
  background:#deeeff;
  border-color:#226fc2;
  box-shadow:0 0 0 2px rgba(34,111,194,.16), inset 0 1px 0 rgba(255,255,255,.7);
}
.nom-modal--agenti .nom-agent-grid .input::placeholder { color:#6f7f91; }
.nom-modal--agenti .nom-agent-grid .select option { background:#fff; color:#172033; }
.nom-agent-grid .nom-field--nume,
.nom-agent-grid .nom-field--partener-id,
.nom-agent-grid .nom-field--cont-id,
.nom-agent-grid .nom-field--adresa,
.nom-agent-grid .nom-field--data-contract,
.nom-agent-grid .nom-field--data-expirare { grid-column:span 2; }
.nom-field-help { display:block; min-height:12px; color:var(--text-subtle); font-size:9px; line-height:1.2; }
.nom-active-check { display:inline-flex; align-items:center; gap:6px; margin-right:auto; color:var(--text); font-size:11px; font-weight:600; }
.nom-modal--agenti .modal__foot { min-height:46px; padding:7px 14px; }
.nom-modal--agenti .modal__foot .btn { min-height:29px; }

:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .input,
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .select {
  background:#152c45;
  border-color:#477eae;
  color:#e8f3ff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .input:hover,
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .select:hover { background:#193653; border-color:#65a4d8; }
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .input:focus,
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .select:focus {
  background:#1b3d5e;
  border-color:#78b8ed;
  box-shadow:0 0 0 2px rgba(120,184,237,.2);
}
:root[data-theme="dark"] .nom-modal--agenti .nom-agent-grid .select option { background:#172b40; color:#e8f3ff; }

@media (max-width:760px) {
  .nom-agent-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .nom-agent-grid .nom-field--nume,
  .nom-agent-grid .nom-field--partener-id,
  .nom-agent-grid .nom-field--cont-id,
  .nom-agent-grid .nom-field--adresa,
  .nom-agent-grid .nom-field--data-contract,
  .nom-agent-grid .nom-field--data-expirare { grid-column:span 1; }
  .nom-form-required { position:static; margin-bottom:4px; text-align:right; }
}
@media (max-width:480px) {
  .nom-modal, .nom-modal--agenti { width:calc(100vw - 12px); }
  .nom-agent-grid { grid-template-columns:1fr; }
}

/* =====================================================================
   SISTEM UI CONTABIL UNITAR — registre dense, aceleași repere în toate
   modulele. Strat final intenționat: unifică familiile istorice fără să
   schimbe markup-ul sau logica ecranelor.
   ===================================================================== */
.app-main {
  --acct-panel:#f1f2f3;
  --acct-tab:#e0e2e4;
  --acct-tab-border:#aeb4bc;
  --acct-active:#fff0ad;
  --acct-active-border:#c9a33a;
  --acct-head-top:#dce7f4;
  --acct-head-bottom:#c9d8eb;
  --acct-line:#b8c0ca;
}

/* Antet de lucru: titlu, context și acțiuni pe o bandă scurtă. */
.app-main .page-head {
  align-items:center;
  gap:6px 12px;
  margin-bottom:8px;
  padding:0 1px 5px;
  border-bottom:1px solid var(--acct-line);
}
.app-main .page-head .hero { min-width:0; gap:1px 9px; }
.app-main .page-head .hero__badge { font-size:9px; letter-spacing:.1em; }
.app-main .page-head .hero__title { font-size:16px; line-height:1.15; letter-spacing:-.01em; }
.app-main .page-head .hero__lead { max-width:92ch; font-size:11px; line-height:1.3; }
.app-main .page-head__actions { gap:5px; }
.app-main .page-head__actions .btn { min-height:29px; }

/* KPI: celule plate, scanabile stânga-dreapta, rearanjate la zoom. */
.app-main :is(.fpx-kpis,.usr-metrics,.rl-metrics,.ag-kpis,.am-kpis,.bd-kpis,.cmd-kpis,.ei-kpis,.inv-kpis,.sc-kpis,.cfg-kpis) {
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(145px,1fr)) !important;
  gap:1px !important;
  margin-bottom:7px;
  border:1px solid var(--acct-line);
  border-radius:2px;
  background:var(--acct-line);
  overflow:hidden;
}
.app-main :is(.fpx-kpis,.usr-metrics,.rl-metrics,.ag-kpis,.am-kpis,.bd-kpis,.cmd-kpis,.ei-kpis,.inv-kpis,.sc-kpis,.cfg-kpis) > * {
  min-width:0;
  margin:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
}
.app-main .fpx-kpi { min-height:55px; padding:6px 10px; }
.app-main .fpx-kpi .lbl { font-size:9px; letter-spacing:.055em; }
.app-main .fpx-kpi .val { margin-top:2px; font-size:17px; }
.app-main .fpx-kpi .sub { font-size:9px; line-height:1.2; }

/* Taburi de registru: aceeași geometrie pentru toate familiile istorice. */
.app-main :is(.tva-tabs,.nom-tabs,.fpx-dtabs,.ang-tabs,.usr-tabs,.rl-tabs) {
  display:flex;
  align-items:center;
  gap:6px;
  max-width:100%;
  margin:0;
  padding:5px 7px;
  border:1px solid var(--acct-line);
  border-radius:3px 3px 0 0;
  background:var(--acct-panel);
  flex-wrap:wrap;
  overflow-x:auto;
  scrollbar-width:thin;
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab) {
  position:static;
  top:auto;
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  gap:9px;
  min-width:88px;
  min-height:32px;
  margin:0;
  padding:5px 9px 5px 11px;
  border:1px solid var(--acct-tab-border);
  border-radius:2px 2px 0 0;
  background:var(--acct-tab);
  color:#4b535c;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.72);
  font:600 11px/1.1 var(--font-sans);
  text-decoration:none;
  white-space:nowrap;
  cursor:pointer;
  transition:background-color .12s,border-color .12s,color .12s;
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):hover {
  background:#e9eaeb;
  border-color:#89929c;
  color:#20262d;
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):is(.is-active,.act) {
  background:var(--acct-active);
  border-color:var(--acct-active-border);
  color:#28220f;
  box-shadow:inset 0 3px 0 #e0b42c,inset 0 1px 0 rgba(255,255,255,.65);
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):focus-visible {
  outline:2px solid var(--saga-blue);
  outline-offset:1px;
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab) :is(.inv-count,.tva-tab__badge,.c,.usr-count,.rl-count),
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab) > span:last-child:not(:first-child) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:24px;
  height:19px;
  margin:0;
  padding:2px 5px;
  border:0;
  border-radius:1px;
  background:rgba(45,52,60,.13);
  color:inherit;
  font:700 10px/1 var(--font-mono);
}
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):is(.is-active,.act) :is(.inv-count,.tva-tab__badge,.c,.usr-count,.rl-count),
.app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):is(.is-active,.act) > span:last-child:not(:first-child) {
  background:rgba(160,119,5,.2);
  color:inherit;
}

/* Bare de lucru și filtre: suprafață neutră, fără volum decorativ. */
.app-main :is(.fpx-toolbar,.usr-toolbar,.rl-toolbar,.ei-toolbar,.coa-toolbar,.diu-cat-toolbar,.cmd-toolbar,.tva-toolbar,.mas-toolbar,.app-toolbar,.toolbar) {
  gap:5px;
  min-height:38px;
  padding:4px 6px;
  border:1px solid var(--acct-line);
  border-radius:2px;
  background:var(--acct-panel);
  box-shadow:none;
}
.app-main form[method="get"] {
  gap:6px 8px;
  padding:6px 8px;
  border-color:var(--acct-line);
  border-radius:2px;
  background:var(--acct-panel);
  box-shadow:none;
}
.app-main .fpx-filterbar { border-color:var(--acct-line); border-radius:2px; }
.app-main .fpx-filterbar :is(.input,.select) { height:32px; padding-inline:9px; }

/* Tabele și liste: antet albastru-pal, rânduri joase, totaluri distincte. */
.app-main .table-wrap { max-width:100%; border-color:var(--acct-line); border-radius:2px; overflow:auto; }
.app-main .table thead th {
  height:29px;
  padding:5px 7px;
  background:linear-gradient(to bottom,var(--acct-head-top),var(--acct-head-bottom));
  border-right-color:#a5b7cd;
  border-bottom-color:#7894b4;
  font-size:9px;
  letter-spacing:.045em;
}
.app-main .table tbody td { height:32px; padding:4px 7px; }
.app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:11px;
}
.app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) th {
  height:29px;
  padding:5px 7px;
  background:linear-gradient(to bottom,var(--acct-head-top),var(--acct-head-bottom));
  color:var(--color-primary-strong);
  border:1px solid #9eb3cf;
  font-size:9px;
  letter-spacing:.045em;
  text-transform:uppercase;
  white-space:nowrap;
}
.app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) td {
  height:32px;
  padding:4px 7px;
  border-right:1px solid var(--border-default);
  border-bottom:1px solid var(--border-default);
}
.app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) tbody tr:nth-child(even) { background:#fafbfd; }
.app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) tbody tr:hover { background:#fff7cd; }

/* Stări fără date: concise și instructive, fără panouri supradimensionate. */
.app-main :is(.empty-state,.nom-empty,.stoc-empty) { min-height:112px; padding:16px; gap:5px; }
.app-main :is(.empty-state,.nom-empty,.stoc-empty) :is(h2,h3,strong) { font-size:13px; }
.app-main :is(.empty-state,.nom-empty,.stoc-empty) :is(p,span) { font-size:10px; }

/* Tema întunecată păstrează aceeași ierarhie, fără suprafețe albe reziduale. */
:root[data-theme="dark"] .app-main {
  --acct-panel:#22272e;
  --acct-tab:#30363d;
  --acct-tab-border:#58616c;
  --acct-active:#5b4a1d;
  --acct-active-border:#c69d2e;
  --acct-head-top:#303b49;
  --acct-head-bottom:#283442;
  --acct-line:#4b5561;
}
:root[data-theme="dark"] .app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab) {
  background:var(--acct-tab);
  border-color:var(--acct-tab-border);
  color:#c4ccd5;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
:root[data-theme="dark"] .app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):hover { background:#39414a; border-color:#788492; color:#f0f4f8; }
:root[data-theme="dark"] .app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab):is(.is-active,.act) {
  background:var(--acct-active);
  border-color:var(--acct-active-border);
  color:#fff2bf;
  box-shadow:inset 0 3px 0 #e2b638;
}
:root[data-theme="dark"] .app-main :is(.fpx-toolbar,.usr-toolbar,.rl-toolbar,.ei-toolbar,.coa-toolbar,.diu-cat-toolbar,.cmd-toolbar,.tva-toolbar,.mas-toolbar,.app-toolbar,.toolbar),
:root[data-theme="dark"] .app-main form[method="get"] { background:var(--acct-panel); border-color:var(--acct-line); }
:root[data-theme="dark"] .app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) th { color:var(--text-primary); border-color:var(--acct-line); }
:root[data-theme="dark"] .app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) td { border-color:var(--border-default); }
:root[data-theme="dark"] .app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) tbody tr:nth-child(even) { background:oklch(27% 0.016 256); }
:root[data-theme="dark"] .app-main :is(.usr-table,.rl-table,.bd-table,.sr-table,.pf-table,.decl-table) tbody tr:hover { background:oklch(38% 0.05 256); }

@media (max-width:900px) {
  .app-main .page-head { align-items:flex-start; }
  .app-main .page-head__actions { width:100%; justify-content:flex-start; }
  .app-main :is(.fpx-kpis,.usr-metrics,.rl-metrics,.ag-kpis,.am-kpis,.bd-kpis,.cmd-kpis,.ei-kpis,.inv-kpis,.sc-kpis,.cfg-kpis) { grid-template-columns:repeat(auto-fit,minmax(135px,1fr)) !important; }
}
@media (max-width:560px) {
  .app-main :is(.tva-tabs,.nom-tabs,.fpx-dtabs,.ang-tabs,.usr-tabs,.rl-tabs) { flex-wrap:nowrap; }
  .app-main :is(.tva-tab,.nom-tab,.fpx-dtab,.ang-tab,.usr-tab,.rl-tab) { flex:0 0 auto; min-width:82px; }
  .app-main :is(.fpx-kpis,.usr-metrics,.rl-metrics,.ag-kpis,.am-kpis,.bd-kpis,.cmd-kpis,.ei-kpis,.inv-kpis,.sc-kpis,.cfg-kpis) { grid-template-columns:1fr 1fr !important; }
}
