/* facturi.cloud — design premium (variabile + suprapuneri Bootstrap) */

:root {
    --fc-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --fc-body-bg: #f0f2f7;
    --fc-body-gradient: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.09), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(14, 165, 233, 0.07), transparent 50%),
        linear-gradient(180deg, #f8fafc 0%, var(--fc-body-bg) 45%, #eef1f8 100%);
    --fc-sidebar-from: #0b1020;
    --fc-sidebar-via: #121a2e;
    --fc-sidebar-to: #0f172a;
    --fc-sidebar-border: rgba(148, 163, 184, 0.12);
    --fc-sidebar-text: #e2e8f0;
    --fc-sidebar-muted: #94a3b8;
    --fc-accent: #6366f1;
    --fc-accent-hover: #4f46e5;
    --fc-accent-soft: rgba(99, 102, 241, 0.14);
    --fc-glow: rgba(99, 102, 241, 0.35);
    --fc-card-border: rgba(15, 23, 42, 0.06);
    --fc-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 40px -12px rgba(15, 23, 42, 0.12);
    --fc-radius: 0.875rem;
    --fc-radius-sm: 0.625rem;
    --fc-primary: var(--fc-accent);
    --bs-font-sans-serif: var(--fc-font);
    --bs-body-font-family: var(--fc-font);
    --bs-primary: var(--fc-accent);
    --bs-primary-rgb: 99, 102, 241;
    --bs-link-color: var(--fc-accent);
    --bs-link-hover-color: var(--fc-accent-hover);
    --bs-border-radius: 0.625rem;
    --bs-border-radius-lg: var(--fc-radius);
    --bs-focus-ring-color: rgba(99, 102, 241, 0.35);
}

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

body.theme-light,
body.guest-premium {
    font-family: var(--fc-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.theme-light.app-premium {
    background: var(--fc-body-bg);
    background-image: var(--fc-body-gradient);
    background-attachment: fixed;
    color: #1e293b;
}

.app-shell {
    min-height: 100vh;
}

/* —— Sidebar —— */
.sidebar.app-sidebar {
    min-height: 100vh;
    width: 272px;
    flex-shrink: 0;
    padding: 1.35rem 1rem 1.25rem;
    background: linear-gradient(165deg, var(--fc-sidebar-from) 0%, var(--fc-sidebar-via) 42%, var(--fc-sidebar-to) 100%);
    color: var(--fc-sidebar-text);
    border-right: 1px solid var(--fc-sidebar-border);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.18);
    transition: width 0.18s ease, margin-left 0.18s ease, opacity 0.18s ease;
}

/* Sidebar ascuns la cerere (toggle din topbar, persistat în localStorage) */
@media (min-width: 768px) {
    html.sidebar-hidden .sidebar.app-sidebar {
        width: 0 !important;
        min-width: 0 !important;
        padding-left: 0;
        padding-right: 0;
        margin-left: -1px;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
        border-right-width: 0;
    }
}

#sidebarToggleBtn {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 1px solid var(--fc-border, rgba(15, 23, 42, 0.12));
    background: var(--fc-card-bg, #fff);
    color: var(--fc-text-muted, #475569);
}
#sidebarToggleBtn:hover {
    background: var(--fc-card-bg-hover, #f1f5f9);
    color: var(--fc-text, #0f172a);
}
html.sidebar-hidden #sidebarToggleBtn {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
    color: #4338ca;
}

.sidebar-logo {
    padding: 0.35rem 0.5rem 1.1rem;
    margin: -0.15rem -0.25rem 0.5rem;
    border-radius: var(--fc-radius-sm);
}

.sidebar-logo a {
    display: block;
    background: #fff;
    border-radius: var(--fc-radius-sm);
    padding: 0.5rem 0.75rem;
    box-shadow: 0 0 24px var(--fc-glow);
}

.sidebar-logo-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 44px;
    object-fit: contain;
}

.sidebar-logo-tag {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fc-sidebar-muted);
    margin-top: 0.35rem;
    opacity: 0.95;
}

.sidebar .app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.2rem;
    border-radius: var(--fc-radius-sm);
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.sidebar .app-nav-link i {
    font-size: 1.1rem;
    opacity: 0.88;
}

.sidebar .app-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.06);
}

.sidebar .app-nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(99, 102, 241, 0.12) 100%);
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2), 0 8px 24px -8px rgba(0, 0, 0, 0.35);
}

.sidebar .app-nav-link.ps-4,
.sidebar .app-nav-link.small {
    font-size: 0.8125rem;
    padding-left: 2.25rem !important;
    font-weight: 400;
    color: #94a3b8;
}

.sidebar .app-nav-link.ps-4:hover,
.sidebar .app-nav-link.small:hover {
    color: #e2e8f0;
}

.sidebar .app-nav-link.ps-4.active,
.sidebar .app-nav-link.small.active {
    color: #c7d2fe;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--fc-sidebar-border);
}

.sidebar-footer .user-pill {
    font-size: 0.8125rem;
    color: var(--fc-sidebar-muted);
    padding: 0.35rem 0;
    font-weight: 500;
}

.sidebar-footer .app-nav-link {
    padding-left: 0.5rem;
    margin-bottom: 0;
    color: #94a3b8;
}

.sidebar-footer .app-nav-link:hover {
    color: #f1f5f9;
}

/* —— Header —— */
.app-topbar {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.app-topbar .page-title {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.app-topbar .form-select {
    border-radius: var(--fc-radius-sm);
    border-color: rgba(15, 23, 42, 0.1);
    max-width: 280px;
    font-size: 0.875rem;
}

.app-topbar .btn-outline-secondary {
    border-color: rgba(15, 23, 42, 0.12);
    color: #475569;
}

.app-topbar .btn-outline-secondary:hover {
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--fc-accent);
    background: var(--fc-accent-soft);
}

/* —— Main —— */
.app-main {
    max-width: 1680px;
}

/* —— Cards & tables —— */
.card {
    border: 1px solid var(--fc-card-border);
    box-shadow: var(--fc-card-shadow);
    border-radius: var(--fc-radius);
    overflow: hidden;
}

.card.card-body {
    border-radius: var(--fc-radius);
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.95);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(248, 250, 252, 0.65);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-hover-bg: rgba(99, 102, 241, 0.04);
}

.btn-primary {
    border: none;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 14px -4px rgba(99, 102, 241, 0.55);
    background: linear-gradient(180deg, #818cf8 0%, var(--fc-accent) 55%, #4f46e5 100%);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, #a5b4fc 0%, var(--fc-accent-hover) 55%, #4338ca 100%);
}

.btn-success {
    font-weight: 600;
    box-shadow: 0 2px 8px -2px rgba(25, 135, 84, 0.35);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.12);
}

.alert {
    border-radius: var(--fc-radius-sm);
    border-width: 1px;
}

.badge.bg-light.text-dark {
    font-weight: 500;
    padding: 0.4em 0.65em;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

/* —— Offcanvas mobil —— */
.offcanvas.sidebar-offcanvas {
    background: linear-gradient(165deg, var(--fc-sidebar-from) 0%, var(--fc-sidebar-to) 100%);
    color: var(--fc-sidebar-text);
}

.offcanvas.sidebar-offcanvas .app-nav-link {
    color: #cbd5e1;
}

.offcanvas.sidebar-offcanvas .app-nav-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.25);
}

/* —— Legacy / dashboard —— */
.card-metric {
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius);
    box-shadow: var(--fc-card-shadow);
}

.dash-page {
    max-width: 1480px;
    margin: 0 auto;
}

.dash-toolbar {
    border-radius: var(--fc-radius);
}

.dash-kpi {
    border-radius: var(--fc-radius);
    border-left: 4px solid var(--fc-accent);
}

.dash-kpi-highlight {
    border-left-color: #4f46e5;
    background: linear-gradient(135deg, #ffffff 0%, rgba(238, 242, 255, 0.95) 100%);
}

.dash-accent-orange {
    color: #ea580c;
}

.dash-chart-wrap {
    position: relative;
    min-height: 220px;
    max-height: 280px;
}

.dash-activity {
    max-height: 320px;
    overflow-y: auto;
}

.dash-activity-item:last-child {
    border-bottom: 0 !important;
}

.dash-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #64748b;
}

.dash-hbar {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.dash-hbar-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    min-width: 4px;
}

.dash-hbar-teal {
    background: #14b8a6;
}

.table-responsive-stack {
    overflow-x: auto;
}

/* Tom Select */
.input-group .flex-grow-1.min-width-0 {
    min-width: 0;
}
.input-group .flex-grow-1 .ts-wrapper {
    width: 100%;
}
#linesTable .ts-wrapper .ts-control {
    min-height: calc(1.5em + 0.375rem + 2px);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
}
#linesTable .ts-wrapper {
    min-width: 11rem;
}

/* —— Guest / auth premium —— */
body.guest-premium {
    min-height: 100vh;
    margin: 0;
    background: var(--fc-body-bg);
    background-image: var(--fc-body-gradient);
    background-attachment: fixed;
}

.guest-premium-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.guest-premium-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--fc-card-border);
    border-radius: 1.125rem;
    box-shadow: var(--fc-card-shadow), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.guest-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.guest-brand-logo {
    display: block;
    margin: 0 auto;
    max-width: 240px;
    width: 100%;
    height: auto;
}

.guest-brand-mark {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #312e81 0%, var(--fc-accent) 50%, #0ea5e9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.guest-brand-tag {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin-top: 0.35rem;
}

@media (max-width: 767.98px) {
    .sidebar.app-sidebar {
        display: none !important;
    }
}

/* —— Mobile responsiveness: prevenire overflow orizontal —— */
/* `overflow-x: clip` păstrează `position: sticky` funcțional pe topbar
   spre deosebire de `overflow-x: hidden` care creează context de scroll. */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

.app-shell {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

.app-shell > .flex-grow-1 {
    min-width: 0;
    max-width: 100%;
}

/* Imaginile / video-urile / iframe-urile nu trebuie să forțeze pagina */
img,
video,
iframe,
canvas {
    max-width: 100%;
    height: auto;
}

/* Tabelele Bootstrap se păstrează inline, dar dacă „scapă" de table-responsive
   le forțăm să nu rupă layout-ul */
.table {
    max-width: 100%;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Permite cuvintelor lungi (URL-uri, CUI-uri, IBAN-uri) să se rupă pe mobil */
.card,
.alert,
.list-group-item,
.app-main {
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

@media (max-width: 575.98px) {
    .app-main {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .app-topbar .container-fluid {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
        gap: 0.5rem !important;
    }
    .app-topbar .form-select {
        max-width: 180px;
        font-size: 0.8125rem;
    }
    .app-topbar .page-title {
        font-size: 0.95rem;
        flex-basis: 100%;
        order: 99;
    }
    .dash-toolbar .card-body {
        padding: 0.5rem 0.65rem;
    }
    .dash-toolbar .btn {
        font-size: 0.78rem;
        padding: 0.3rem 0.55rem;
    }
    .container,
    .container-fluid,
    .container-sm,
    .container-md,
    .container-lg,
    .container-xl,
    .container-xxl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    /* Spațiere implicită mai mică între coloane pe Bootstrap pe mobil */
    .row.g-3 {
        --bs-gutter-x: 0.65rem;
        --bs-gutter-y: 0.65rem;
    }
    /* Card-headere & body cu padding mai mic */
    .card-body {
        padding: 0.85rem;
    }
    .card-header {
        padding: 0.6rem 0.85rem;
    }
    /* Butoane „pill" / cu icon din toolbar nu mai depășesc lățimea ecranului */
    .btn-group,
    .btn-toolbar {
        flex-wrap: wrap;
    }
    /* Ascunde scrollbar-ul orizontal nedorit pe forms wrap */
    .form-select,
    .form-control {
        max-width: 100%;
    }
}

@media (max-width: 360px) {
    .app-topbar .form-select {
        max-width: 140px;
    }
    .dash-page,
    .app-main {
        font-size: 0.95rem;
    }
}

/* —— Pagina Integrare ANAF e-Factura —— */
.anaf-integrare .anaf-hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(14, 165, 233, 0.06) 50%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.anaf-integrare .anaf-eyebrow {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0;
}

.anaf-integrare .anaf-icon-wrap {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.anaf-integrare .anaf-uri-box {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: #334155;
    word-break: break-all;
}

.anaf-integrare .table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.9);
}

/* —— Listă facturi + tab-uri e-Factura —— */
.invoice-ef-breadcrumb {
    letter-spacing: 0.02em;
}

.invoice-ef-tabs .nav-link {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: var(--fc-radius-sm);
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.45rem 0.65rem;
    line-height: 1.25;
}

.invoice-ef-tabs .nav-link:hover {
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--fc-accent);
    background: rgba(99, 102, 241, 0.06);
}

.invoice-ef-tabs .nav-link.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.invoice-ef-tabs .nav-link.active .badge {
    font-weight: 600;
}

/* —— Formularul de facturi / proforme / avize: responsive mobil-first —— */
.invoice-form .invoice-totals strong {
    font-variant-numeric: tabular-nums;
}

.invoice-fab-add {
    position: fixed;
    right: 1rem;
    bottom: 5.25rem;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    box-shadow: 0 10px 25px -8px rgba(99, 102, 241, 0.55), 0 6px 12px -6px rgba(15, 23, 42, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    padding: 0;
    z-index: 1030;
}

@media (max-width: 767.98px) {
    .invoice-form-mobile {
        padding: 0.85rem !important;
    }
    .invoice-form-mobile .row.g-3.mb-3 {
        --bs-gutter-x: 0.6rem;
        --bs-gutter-y: 0.6rem;
    }
    /* Header form: nu lăsăm `style="max-width:140px"` să strângă coloana */
    .invoice-form-mobile > fieldset > .row > [class*="col-"][style] {
        max-width: none !important;
    }
    .invoice-form-mobile .form-label {
        margin-bottom: 0.2rem;
        font-size: 0.78rem;
        font-weight: 600;
        color: #475569;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    .invoice-form-mobile .form-control,
    .invoice-form-mobile .form-select {
        font-size: 1rem;
        min-height: 2.5rem;
    }
    .invoice-form-mobile .form-control-sm,
    .invoice-form-mobile .form-select-sm {
        font-size: 0.95rem;
        min-height: 2.4rem;
    }

    /* Tabel linii → cards */
    .invoice-form-mobile #linesTable {
        display: block;
        margin-bottom: 0;
    }
    .invoice-form-mobile #linesTable > thead {
        display: none;
    }
    .invoice-form-mobile #linesTable > tbody.line-row {
        display: block;
        background: #fff;
        border: 1px solid var(--fc-card-border);
        border-radius: var(--fc-radius-sm);
        padding: 0.65rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }
    .invoice-form-mobile #linesTable > tbody.line-row + tbody.line-row > tr.line-row-data > td {
        border-top: 0;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr {
        display: block;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        column-gap: 0.5rem;
        row-gap: 0.55rem;
        align-items: stretch;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > td {
        display: flex;
        flex-direction: column;
        padding: 0;
        border: 0;
        position: relative;
        min-width: 0;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > td > .form-control,
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > td > .form-select {
        width: 100%;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > td[data-mlabel]::before {
        content: attr(data-mlabel);
        display: block;
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #64748b;
        margin-bottom: 0.2rem;
    }
    /* Layout explicit pe grid 12-coloane (rând + coloană fixate):
         rând 1: Produs
         rând 2: Cantitate (1-6)  | Preț (7-12)
         rând 3: Disc % (1-4)     | Disc val (5-8)      | TVA % (9-12)
         rând 4: Stoc (1-6)       | Total linie (7-12)
         rând 5: × Șterge (right) */
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-prod {
        grid-row: 1;
        grid-column: 1 / -1;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-qty {
        grid-row: 2;
        grid-column: 1 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-price {
        grid-row: 2;
        grid-column: 7 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-dpct {
        grid-row: 3;
        grid-column: 1 / span 4;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-dval {
        grid-row: 3;
        grid-column: 5 / span 4;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-tva {
        grid-row: 3;
        grid-column: 9 / span 4;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc {
        grid-row: 4;
        grid-column: 1 / span 6;
        justify-content: center;
        text-align: left !important;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc .stoc-cell {
        font-size: 1rem;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.55rem;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.05);
        line-height: 1.1;
        align-self: flex-start;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc .stoc-cell.text-success {
        background: rgba(34, 197, 94, 0.12);
        color: #15803d !important;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc .stoc-cell.text-warning {
        background: rgba(234, 179, 8, 0.18);
        color: #92400e !important;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc .stoc-cell.text-danger {
        background: rgba(239, 68, 68, 0.15);
        color: #b91c1c !important;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-total {
        grid-row: 4;
        grid-column: 7 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-total .line-total {
        font-weight: 700;
        font-size: 1.1rem;
        background: rgba(99, 102, 241, 0.08);
        border-color: rgba(99, 102, 241, 0.3);
        color: #312e81;
        min-height: 2.6rem;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-del {
        grid-row: 5;
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 0;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-del::before {
        display: none;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-del .btn {
        min-width: 2.6rem;
        min-height: 2.4rem;
        font-size: 1.15rem;
        padding: 0 0.8rem;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-desc > td,
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-extra > td {
        display: block;
        padding: 0.35rem 0 0 0;
        border: 0;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-desc .input-group-text,
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-extra .input-group-text {
        min-width: 80px;
        font-size: 0.78rem;
    }

    /* Totaluri → card colorat, mai vizibil */
    .invoice-form-mobile .invoice-totals .col-md-4 {
        background: #f8fafc;
        border: 1px solid var(--fc-card-border);
        border-radius: var(--fc-radius-sm);
        padding: 0.85rem 1rem;
    }
    .invoice-form-mobile .invoice-totals .fs-5 {
        margin-top: 0.35rem;
        padding-top: 0.35rem;
        border-top: 1px dashed rgba(15, 23, 42, 0.15);
        font-size: 1.25rem !important;
    }

    /* Bara de acțiuni: sticky jos pe mobil, butoane mari */
    .invoice-form-mobile .invoice-actions {
        position: sticky;
        bottom: 0;
        z-index: 10;
        margin-left: -0.85rem;
        margin-right: -0.85rem;
        margin-bottom: -0.85rem;
        padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(6px);
        border-top: 1px solid var(--fc-card-border);
        box-shadow: 0 -6px 18px -10px rgba(15, 23, 42, 0.18);
    }
    .invoice-form-mobile .invoice-actions .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-height: 2.6rem;
        padding: 0.55rem 0.65rem;
        font-size: 0.92rem;
    }
    .invoice-form-mobile .invoice-actions .btn-primary,
    .invoice-form-mobile .invoice-actions .btn-success {
        flex: 1 1 100%;
    }
    .invoice-form-mobile .invoice-actions form.d-inline {
        display: flex !important;
        flex: 1 1 100%;
    }
    .invoice-form-mobile .invoice-actions form.d-inline .btn {
        width: 100%;
    }

    /* Încasări card / produs nou modal: spațiere mai aerisită */
    .invoice-form-mobile .table-responsive {
        margin-bottom: 0;
    }
}

@media (max-width: 420px) {
    /* Pe ecrane foarte înguste păstrăm layoutul cu 12-coloane,
       dar mutăm Disc/TVA pe 2 rânduri ca să nu se îngrămădească: */
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-dpct {
        grid-row: 3;
        grid-column: 1 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-dval {
        grid-row: 3;
        grid-column: 7 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-tva {
        grid-row: 4;
        grid-column: 1 / span 12;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-stoc {
        grid-row: 5;
        grid-column: 1 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-total {
        grid-row: 5;
        grid-column: 7 / span 6;
    }
    .invoice-form-mobile #linesTable > tbody.line-row > tr.line-row-data > .lc-del {
        grid-row: 6;
    }
}
