/* ========================================
   TRX Nova BackOffice — stiluri proprii
   Shell modern (topbar + rail + flyout) + nomenclatoare
   ======================================== */

:root {
    --fc-top: 56px;
    --fc-rail: 178px;

    --fc-indigo: #39316e;   /* topbar */
    --fc-side: #342c64;     /* sidebar rail */
    --fc-flyout: #2c2557;   /* submeniu lateral */
    --fc-accent: #7c6df2;   /* mov accent */

    --fc-bg: #f4f5f9;
    --fc-card: #ffffff;
    --fc-ink: #2b2b40;
    --fc-muted: #8a90a8;
    --fc-line: #ececf3;
}

/* touch-action, text-size-adjust și box-sizing sunt aplicate global din Shared/app.css.
   Aici doar override-urile vizuale specifice BackOffice. */
html, body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--fc-bg);
    color: var(--fc-ink);
    font-size: 14px;
    /* Blocare „mută fereastra" pe mobil/fullscreen (overscroll/rubber-band) — ca la POS.
       Documentul nu scrollează; scroll-ul real e în .fc-main / .bo-page-body. */
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

/* ════════════════════════════════════════════════
   SHELL — grid app (topbar fix, rail fix, main scroll)
   ════════════════════════════════════════════════ */
.fc-shell {
    height: 100vh;
    height: 100dvh;   /* pe mobil 100vh include zona de sub bara browserului → ultimul rând tăiat; dvh = vizibil real */
    overflow: hidden;
    display: grid;
    grid-template-columns: var(--fc-rail) 1fr;
    grid-template-rows: var(--fc-top) 1fr;
    grid-template-areas:
        "top  top"
        "side main";
}

/* ── TOPBAR ──────────────────────────────────── */
.fc-topbar {
    grid-area: top;
    background: var(--fc-indigo);
    display: flex; align-items: center; gap: 14px;
    padding: 0 16px;
    color: #fff;
    z-index: 70;
}
.fc-icon-btn {
    background: transparent; border: 0; color: #cfcbe8;
    width: 38px; height: 38px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .12s, color .12s;
}
.fc-icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.fc-brand { display: flex; align-items: center; height: 100%; text-decoration: none; }
.fc-brand img { height: 34px; width: auto; object-fit: contain; }
.fc-search {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.12);
    border-radius: 9px; padding: 7px 12px;
    max-width: 380px; flex: 1; color: #d7d3ef; margin-left: 8px;
    position: relative;
}
.fc-search input {
    background: transparent; border: 0; outline: 0; color: #fff;
    font-size: .88rem; flex: 1; min-width: 0;
}
.fc-search input::placeholder { color: #b9b4dd; }

/* Dropdown rezultate căutare globală */
.fc-search-scrim { position: fixed; inset: 0; z-index: 1190; }
.fc-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1200;
    background: #fff; color: var(--fc-ink); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(20,12,50,.28); border: 1px solid var(--fc-line);
    max-height: min(70vh, 520px); overflow-y: auto; padding: 6px;
    min-width: 320px;
}
.fc-search-empty { padding: 14px 12px; color: var(--fc-muted); font-size: .85rem; text-align: center; }
.fc-search-group { padding: 4px 0; }
.fc-search-group + .fc-search-group { border-top: 1px solid var(--fc-line); }
.fc-search-group-title {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--fc-accent); padding: 6px 10px 3px;
}
.fc-search-item {
    display: flex; align-items: baseline; gap: 8px; width: 100%;
    background: none; border: 0; cursor: pointer; text-align: left;
    padding: 7px 10px; border-radius: 6px; font-size: .88rem; color: var(--fc-ink);
}
.fc-search-item:hover { background: #f2f0fb; }
.fc-search-item-t { font-weight: 600; }
.fc-search-item-s { color: var(--fc-muted); font-size: .78rem; margin-left: auto; white-space: nowrap; }
.fc-top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.fc-avatar-wrap { position: relative; }
.fc-avatar {
    background: linear-gradient(135deg, #7c6df2, #9b8bff);
    border: 0; color: #fff;
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; margin-left: 6px;
}
.fc-usermenu-scrim { position: fixed; inset: 0; z-index: 80; }
.fc-usermenu {
    position: absolute; right: 0; top: 46px;
    background: #fff; border: 1px solid var(--fc-line);
    border-radius: 10px; box-shadow: 0 8px 28px rgba(30,20,70,.18);
    min-width: 200px; z-index: 90; overflow: hidden;
}
.fc-usermenu-head { padding: 12px 14px; border-bottom: 1px solid var(--fc-line); }
.fc-usermenu-name { font-weight: 700; color: var(--fc-ink); }
.fc-usermenu-role { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--fc-muted); }
.fc-usermenu-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; background: transparent; border: 0;
    padding: 11px 14px; font-size: .88rem; color: #c0392b; cursor: pointer;
}
.fc-usermenu-item:hover { background: #fdecea; }

/* ── SIDEBAR RAIL ─────────────────────────────── */
.fc-sidebar {
    grid-area: side;
    background: var(--fc-side);
    overflow-y: auto; overflow-x: hidden;
}
.fc-rail { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.fc-rail-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; background: transparent; border: 0;
    border-radius: 9px; padding: 10px 12px;
    color: #c4bfe4; cursor: pointer; font-size: .82rem;
    text-align: left; position: relative;
    transition: background .12s, color .12s;
}
.fc-rail-ic { flex: 0 0 24px; display: inline-flex; align-items: center; justify-content: center; }
.fc-rail-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-rail-chev { opacity: .45; display: inline-flex; }
.fc-rail-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.fc-rail-item.open { background: rgba(255,255,255,.12); color: #fff; }
.fc-rail-item.active { background: rgba(255,255,255,.14); color: #fff; }
.fc-rail-item.active::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--fc-accent);
}

/* Collapsed (icon-only) */
.fc-shell.collapsed { --fc-rail: 66px; }
.fc-shell.collapsed .fc-rail-label,
.fc-shell.collapsed .fc-rail-chev { display: none; }
.fc-shell.collapsed .fc-rail-item { justify-content: center; padding: 12px 0; }

/* ── FLYOUT SUBMENU ───────────────────────────── */
.fc-flyout-scrim {
    position: fixed; top: var(--fc-top); left: var(--fc-rail);
    right: 0; bottom: 0; z-index: 55;
}
.fc-flyout {
    position: fixed; top: var(--fc-top); left: var(--fc-rail);
    width: 252px; height: calc(100vh - var(--fc-top));
    background: var(--fc-flyout); z-index: 60;
    overflow-y: auto; box-shadow: 6px 0 24px rgba(20,12,50,.25);
    animation: fcFly .16s ease;
}
@keyframes fcFly {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: none; }
}
.fc-flyout-head {
    position: sticky; top: 0; background: var(--fc-flyout);
    color: #fff; font-weight: 700; font-size: .9rem;
    padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: 10px;
}
/* Buton „înapoi" — afișat doar pe mobil (unde flyout-ul acoperă rail-ul) */
.fc-flyout-back {
    display: none; background: rgba(255,255,255,.1); border: 0;
    color: #fff; width: 32px; height: 32px; border-radius: 8px;
    align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto;
}
.fc-flyout-back:hover { background: rgba(255,255,255,.2); }
.fc-flyout-items { padding: 6px 0 16px; display: flex; flex-direction: column; }
.fc-flyout-sep {
    padding: 13px 18px 5px; font-size: .62rem; text-transform: uppercase;
    letter-spacing: .8px; color: #8c85b3; font-weight: 700;
    border-top: 1px solid rgba(255,255,255,.06); margin-top: 4px;
}
.fc-flyout-sep:first-child { border-top: none; margin-top: 0; }
.fc-flyout-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 18px; color: #cbc6e6; text-decoration: none;
    font-size: .84rem; border-left: 3px solid transparent;
    cursor: pointer; transition: background .1s, color .1s;
}
.fc-flyout-item:hover:not(.disabled) { background: rgba(255,255,255,.08); color: #fff; }
.fc-flyout-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--fc-accent); }
.fc-flyout-item.disabled { color: #837da6; cursor: default; }
.fc-soon {
    font-size: .58rem; text-transform: uppercase; letter-spacing: .5px;
    background: rgba(255,255,255,.08); color: #a79fce;
    padding: 2px 7px; border-radius: 9px; font-weight: 700; white-space: nowrap;
}

/* ── MAIN (scroll independent) ────────────────── */
.fc-main { grid-area: main; overflow-y: auto; padding: 10px 28px 28px; }
/* Pe paginile-listă (.bo-page): fc-main devine flex column care NU scrollează → .bo-page o umple
   (flex:1) și DOAR .bo-page-body scrollează. Altfel ar scrolla fc-main, târând capul de tabel sticky. */
.fc-main:has(.bo-page) { overflow: hidden; padding-bottom: 0; display: flex; flex-direction: column; min-height: 0; }

/* Pagina de listă = coloană flex pe toată înălțimea: header FIX sus + tabel care scrollează.
   Astfel atât header-ul (titlu/căutare/adăugare) CÂT ȘI capul de tabel (thead) rămân ancorate. */
/* flex:1 în fc-main (flex column) — umple înălțimea fiabil, fără percentage-height (height:100% nu
   constrângea mereu .bo-page-body → scrolla fc-main și fugea thead-ul). Fallback height:100% pt. orice context non-flex. */
.bo-page { flex: 1 1 auto; height: 100%; display: flex; flex-direction: column; min-height: 0; }
.bo-page-head {
    flex: 0 0 auto; padding-bottom: 12px;
    display: flex; flex-wrap: wrap; align-items: baseline;
}
/* Titlu stânga + explicație (mică, ștearsă, la dreapta) pe același rând; toolbar pe rândul de jos. */
.bo-page-head > h1 { margin-bottom: 0; }
.bo-page-head > .bo-page-hint {
    margin: 0 0 0 auto; text-align: right; max-width: 62%;
    font-size: 0.76rem; font-weight: 400; color: #a6abbd; line-height: 1.3;
}
.bo-page-head > .bo-msg-eroare,
.bo-page-head > .bo-msg-ok { flex: 0 0 100%; margin-top: 10px; margin-bottom: 0; }
.bo-page-head > .bo-toolbar { flex: 0 0 100%; margin: 12px 0 0; }
/* Zona scrollabilă care conține tabelul */
.bo-page-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 16px; overscroll-behavior: contain; }

/* ════════════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════════════ */
.fc-dash { max-width: 1400px; }

.fc-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.fc-kpi {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid var(--fc-line);
    border-radius: 12px; padding: 16px 18px;
    text-decoration: none; transition: transform .12s, box-shadow .12s;
}
.fc-kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(40,30,90,.08); }
.fc-kpi-ic {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; flex: 0 0 auto;
}
.fc-kpi-body { display: flex; flex-direction: column; }
.fc-kpi-val { font-size: 1.6rem; font-weight: 800; color: var(--fc-ink); line-height: 1.1; }
.fc-kpi-label { font-size: .8rem; color: var(--fc-muted); }

/* Accent gradients (KPI + quick + alte iconițe) */
.fc-kpi.accent-purple .fc-kpi-ic, .fc-quick-ic.accent-purple { background: linear-gradient(135deg, #7c6df2, #9b8bff); }
.fc-kpi.accent-green  .fc-kpi-ic, .fc-quick-ic.accent-green  { background: linear-gradient(135deg, #14c79a, #3ee0b3); }
.fc-kpi.accent-blue   .fc-kpi-ic, .fc-quick-ic.accent-blue   { background: linear-gradient(135deg, #4b9bff, #6fb0ff); }
.fc-kpi.accent-orange .fc-kpi-ic, .fc-quick-ic.accent-orange { background: linear-gradient(135deg, #ff9f43, #ffb86b); }

.fc-dash-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 18px; }
.fc-panel { background: #fff; border: 1px solid var(--fc-line); border-radius: 12px; padding: 18px 20px; }
.fc-panel-head {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; color: var(--fc-ink); font-size: 1rem; margin-bottom: 14px;
}
.fc-panel-head span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.fc-panel-head svg { color: var(--fc-accent); }
.fc-panel-sub { font-size: .78rem; color: var(--fc-muted); font-weight: 500; }

.fc-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 40px 20px; color: var(--fc-muted);
}
.fc-empty svg { color: #c5c2dd; }
.fc-empty p { margin: 12px 0 4px; color: var(--fc-ink); font-weight: 600; }
.fc-empty-sub { font-size: .82rem; }

.fc-quick { display: flex; flex-direction: column; gap: 8px; }
.fc-quick-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 10px; text-decoration: none;
    color: var(--fc-ink); transition: background .12s;
}
.fc-quick-item:hover { background: #f4f5f9; }
.fc-quick-ic {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 auto;
}
.fc-quick-txt { display: flex; flex-direction: column; flex: 1; }
.fc-quick-txt b { font-size: .9rem; }
.fc-quick-txt small { font-size: .75rem; color: var(--fc-muted); }
.fc-quick-item > svg { color: var(--fc-muted); }

/* ── PAGE HEADING (folosit de paginile de nomenclator) ── */
.bo-page h1 { font-size: 1.5rem; margin: 0 0 8px; color: var(--fc-ink); font-weight: 700; }
.bo-page-hint { color: var(--fc-muted); margin: 0 0 24px; font-size: 0.95rem; }

/* ════════════════════════════════════════════════
   TABLE + TOOLBAR (nomenclatoare) — reutilizat ca atare
   ════════════════════════════════════════════════ */
.bo-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.bo-toolbar-check {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; font-weight: normal; color: var(--fc-ink); user-select: none;
}
.bo-toolbar input {
    flex: 1; max-width: 320px; padding: 8px 12px;
    border: 1px solid #c9d6e9; border-radius: 6px; background: #fff; font-size: 0.9rem;
}
.bo-btn {
    padding: 8px 16px; border: 0; border-radius: 6px;
    background: var(--fc-indigo); color: #fff; font-weight: 600;
    cursor: pointer; font-size: 0.9rem; transition: background 0.12s;
}
.bo-btn:hover  { background: #2f2860; }
.bo-btn.orange { background: var(--fc-accent); }
.bo-btn.orange:hover { background: #6657e0; }
.bo-btn.ghost  { background: transparent; color: var(--fc-ink); border: 1px solid #c9d6e9; }
.bo-btn.ghost:hover { background: #eef3fa; }
.bo-btn.danger { background: #c62828; }
.bo-btn.danger:hover { background: #a52020; }
.bo-btn.sm { padding: 4px 10px; font-size: 0.8rem; }

.bo-table {
    /* separate (NU collapse) — `position:sticky` pe <th>/<thead> e instabil cu border-collapse:collapse. */
    width: 100%; border-collapse: separate; border-spacing: 0; background: #fff;
    border: 1px solid #e1e7ef; border-top: none;
    /* ⚠ FĂRĂ `overflow:hidden` aici! Pe tabel ar deveni scroll-container și ar rupe `position:sticky`
       de pe thead (header-ul fuge la scroll).
       border-top: none → chenarul de sus îl dă thead-ul (sticky), ca să nu scrolleze/dispară.
       FĂRĂ border-radius: colțul rotunjit al thead-ului lăsa un triunghi transparent prin care
       transpărea accentul portocaliu al rândului „brut SPV" la scroll (bleed). Colțuri drepte = thead acoperă complet. */
}
.bo-table th, .bo-table td {
    text-align: left; padding: 4px 14px; border-bottom: 1px solid #f0f2f5;
    font-size: 0.9rem; vertical-align: middle; color: #4b5168;
}
.bo-table th {
    background: #f7f8fb; color: var(--fc-muted); font-weight: 700;
    font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.5px;
}
/* Capul de tabel ancorat sus în zona de scroll (.bo-page-body).
   box-shadow ține linia de jos (border-collapse o pierde la sticky). */
.bo-table thead { position: sticky; top: 0; z-index: 3; }
.bo-table thead th {
    position: relative;   /* containing block pt. resize-handle; sticky stă pe <thead> */
    border-top: 1px solid #e1e7ef;        /* chenarul de sus al tabelului — stă pe thead (sticky) → mereu vizibil */
    box-shadow: inset 0 -1px 0 #e1e7ef;   /* linia de jos a antetului */
}
/* Coloana „nume" (denumire produs/grupă) — vedetă: bold, mai închisă, puțin mai mare */
.bo-table td.bo-cell-name { font-weight: 700; color: var(--fc-ink); font-size: 0.94rem; }

/* Input „vedetă" în formular (ex. Denumire produs) — mai mare + îngroșat */
.bo-form-row input.bo-input-strong { font-size: 1.05rem; font-weight: 700; }
.bo-table tr:hover td { background: #f9fafd; }
/* Rând inactiv — clar vizibil: accent roșu + badge „INACTIV" lângă nume (fără italic). */
.bo-table tr.inactiv td { color: #a6adc0; background: #fdf3f2; }
.bo-table tr.inactiv:hover td { background: #fbe9e7; }
.bo-table tr.inactiv td:first-child { box-shadow: inset 3px 0 0 #e74c3c; }
.bo-table tr.inactiv td.bo-cell-name { color: #1a2744; font-style: normal; font-weight: 600; }
.bo-table tr.inactiv td.bo-cell-name::after {
    content: "Inactiv";
    display: inline-block; margin-left: 8px; vertical-align: middle;
    background: #fdecea; color: #c0392b; border: 1px solid #e6b0aa;
    font-size: 0.64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: 1px 7px; border-radius: 10px;
}

/* ── DOCUMENTE (facturi intrare/ieșire etc.) — stare + color-coding ─────── */
/* Badge de stare în listă. */
.fac-badge {
    display: inline-block; padding: 2px 9px; border-radius: 10px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    white-space: nowrap; border: 1px solid transparent;
}
.fac-brut     { background: #fff3e0; color: #e65100; border-color: #ffcc80; } /* descărcat din SPV, neprocesat */
.fac-procesat { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; } /* document real înregistrat */
.fac-eroare   { background: #fdecea; color: #c0392b; border-color: #e6b0aa; }
.fac-ignorat  { background: #eceff1; color: #607d8b; border-color: #cfd8dc; }
/* Accent stânga pe rând după stare (rândul brut = portocaliu, eroare = roșu). */
.bo-table tr.fac-rand-brut   td:first-child { box-shadow: inset 3px 0 0 #fb8c00; }
.bo-table tr.fac-rand-eroare td:first-child { box-shadow: inset 3px 0 0 #e74c3c; }
.bo-table tr.fac-rand-eroare td { background: #fefafa; }
/* Rândul selectat în vederea split-screen (documentul ale cărui linii sunt afișate jos). */
.bo-table tr.doc-rand.selected td        { background: #e8eefc; }
.bo-table tr.doc-rand.selected:hover td  { background: #dfe8fb; }
.bo-table tr.doc-rand.selected td:first-child { box-shadow: inset 3px 0 0 var(--fc-indigo); }

/* ── DOCUMENTE — lățimi coloane: „conținut + o singură coloană flexibilă (Client)" ──
   Implicit (table-layout:auto): fiecare coloană = lățimea conținutului (Data nu scade sub „14.05.2026",
   Sumă/Index/Număr la fel — nowrap din `.bo-table td`). Coloana Client (Partener) primește width:100% →
   absoarbe restul spațiului și se redimensionează cu lățimea ecranului.
   După primul resize manual, JS adaugă clasa `.doc-fixed` (table-layout:fixed + lățimi px pe coloane);
   Client rămâne fără lățime → tot el absoarbe restul (responsive). */
/* Doar pe desktop (pe telefon tabelul devine carduri — vezi @media max-width:768px mai jos). */
@media (min-width: 769px) {
    .doc-table { table-layout: auto; min-width: 0; }
    .doc-table.doc-fixed { table-layout: fixed; }              /* JS comută aici după măsurarea lățimilor */
    .doc-table td[data-label] { max-width: none; }             /* auto-layout: conținutul dictează lățimea */
    .doc-table.doc-fixed td[data-label] { max-width: 0; }      /* fixed: lățimea din <th> (ellipsis pe depășire) */
    /* Rânduri goale la final (truc SAGA) — semnalează sfârșitul listei; ne-interactive. */
    .doc-table tr.doc-rand-gol td        { background: #fff; cursor: default; }
    .doc-table tr.doc-rand-gol:hover td  { background: #fff; }
}

/* ════════════════════════════════════════════════
   VEDERE SPLIT-SCREEN documente (sus lista / jos liniile) — ca SAGA
   ════════════════════════════════════════════════ */
/* În mod split, pagina nu mai pune body+paginare direct; .doc-split umple înălțimea rămasă. */
.doc-split { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.doc-pane  { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
/* Panoul de sus = lista (bo-page-body scrollează) + paginare fixă jos. */
.doc-pane-top .bo-page-body { flex: 1 1 auto; }
.doc-pane-top .bo-paginare  { padding-top: 8px; padding-bottom: 8px; }

/* Bara de tras dintre panouri. */
.doc-split-bar {
    flex: 0 0 9px; cursor: row-resize; position: relative;
    background: #eef1f7; border-top: 1px solid #dfe4ee; border-bottom: 1px solid #dfe4ee;
    display: flex; align-items: center; justify-content: center;
}
.doc-split-bar:hover { background: #e3e8f3; }
.doc-split-grip { width: 46px; height: 3px; border-radius: 3px; background: #b7c0d4; }
.doc-split-bar:hover .doc-split-grip { background: var(--fc-accent); }

/* Panoul de jos = antet compact + zona cu liniile (scroll propriu). */
.doc-pane-bottom { background: #fff; border: 1px solid #e1e7ef; border-radius: 8px; }
.doc-lines-head {
    flex: 0 0 auto; display: flex; align-items: baseline; gap: 10px;
    padding: 8px 14px; border-bottom: 1px solid #eef0f5; background: #f7f8fb;
    border-radius: 8px 8px 0 0;
}
.doc-lines-title { font-size: .9rem; color: var(--fc-ink); font-weight: 600; }
.doc-lines-title b { color: var(--fc-indigo); }
.doc-lines-part  { color: var(--fc-muted); font-weight: 500; }
.doc-lines-count { margin-left: auto; font-size: .76rem; color: #8a93a6; }
.doc-lines-hint  { font-size: .85rem; color: #9aaac0; font-style: italic; }
.doc-lines-body  { flex: 1 1 auto; min-height: 0; overflow: auto; }
.doc-lines-msg   { padding: 18px 16px; color: #9aaac0; font-size: .88rem; }
.doc-lines-msg.eroare { color: #c0392b; }

/* Tabelul de linii (simplu, fără resize — set fix „ca SAGA").
   table-layout:fixed + colgroup cu lățimi → coloanele NU se mai recalculează din conținut,
   deci rămân identice la schimbarea facturii (cerință user). */
.doc-lines-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.doc-lines-table th, .doc-lines-table td {
    padding: 5px 12px; border-bottom: 1px solid #f0f2f5; font-size: .86rem; color: #4b5168;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-lines-table thead th {
    position: sticky; top: 0; z-index: 2; background: #eef1f7; color: var(--fc-muted);
    font-size: .7rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; text-align: left;
}
.doc-lines-table td.num, .doc-lines-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-lines-table td.den { white-space: normal; font-weight: 600; color: var(--fc-ink); }
.doc-lines-table tbody tr:hover td { background: #f9fafd; }
.doc-lines-table tfoot td {
    position: sticky; bottom: 0; background: #f4f6fb; font-weight: 700; color: var(--fc-ink);
    border-top: 1px solid #dfe4ee; border-bottom: none;
}

/* Mobil: split-screen devine O SINGURA coloana care scrolleaza (NU 2 zone de scroll separate —
   imposibil de folosit pe touch; asta rupea scroll-ul). `.doc-split` = unicul scroller; panourile curg
   natural in interior; splitter-ul ascuns (nu se trage cu degetul). Tabelul de linii scrolleaza orizontal. */
@media (max-width: 768px) {
    .doc-split {
        flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
        scrollbar-width: none; -ms-overflow-style: none;
    }
    .doc-split::-webkit-scrollbar { width: 0; height: 0; display: none; }
    .doc-split-bar { display: none; }
    .doc-pane { flex: none !important; overflow: visible; }
    .doc-pane-top { max-height: none; }
    .doc-pane-top .bo-page-body { overflow: visible; }          /* nu mai e scroller propriu → un singur scroll */
    /* (min-width:0 pe .bo-table e setat global la carduri, mai jos — fixeaza scroll-ul orizontal peste tot.) */
    .doc-pane-bottom { margin-top: 12px; }
    /* Tabelul de linii (9 coloane financiare) ramane scrollabil ORIZONTAL DOAR in panoul lui, nu tot blocul. */
    .doc-lines-body { overflow-x: auto; overflow-y: visible; }
    .doc-lines-table { min-width: 620px; }
}

/* ── PAGINARE (unificat, sub orice tabel BoTablePageBase) ───────────── */
.bo-paginare {
    flex: 0 0 auto;                            /* footer fix al paginii, jos de tot (nu intră în scroll) */
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: nowrap; gap: 10px;              /* stânga + dreapta MEREU pe un rând (nu se rup) */
    padding: 12px 2px 4px; margin-top: 6px;
    border-top: 1px solid #e6ebf3;             /* separator de zona scrollabilă de deasupra */
}
/* Grupurile (paginație stânga / nr-pagină dreapta) nu se micșorează și nu se rup pe rânduri. */
.bo-pag-nav, .bo-pag-size { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; flex: 0 0 auto; }
/* Mijlocul preia spațiul rămas și se trunchiază (max 2 rânduri) când nu încape. */
.bo-pag-mid { flex: 1 1 auto; min-width: 0; text-align: center; padding: 0 8px; }
.bo-pag-info {
    font-size: 0.78rem; color: #8a93a6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bo-pag-info .fac-badge { vertical-align: middle; }
/* Pe ecrane înguste micșorăm butoanele ca să încapă inline. */
@media (max-width: 600px) {
    .bo-pag-btn { min-width: 30px; height: 30px; padding: 0 6px; font-size: 0.82rem; }
    .bo-paginare { gap: 6px; }
    .bo-pag-mid { padding: 0 4px; }
}
.bo-pag-btn {
    min-width: 34px; height: 34px; padding: 0 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--fc-ink, #1a2744);
    border: 1px solid #dfe5ee; border-radius: 8px;
    font-size: 0.9rem; font-weight: 600; cursor: pointer; user-select: none;
    transition: background .12s, border-color .12s, color .12s;
}
.bo-pag-btn:hover:not(:disabled):not(.activ) { background: #f1f4fa; border-color: #c5cee0; }
.bo-pag-btn.activ {
    background: var(--fc-indigo, #39316e); border-color: var(--fc-indigo, #39316e); color: #fff; cursor: default;
}
.bo-pag-btn:disabled { opacity: .4; cursor: default; }

/* ── TOGGLE SWITCH (Activ) ─────────────────────── */
.bo-switch { position: relative; display: inline-block; width: 42px; height: 23px; cursor: pointer; vertical-align: middle; }
.bo-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.bo-switch .slider {
    position: absolute; inset: 0; background: #cfd3e0; border-radius: 23px; transition: background .15s;
}
.bo-switch .slider::before {
    content: ''; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.bo-switch input:checked + .slider { background: var(--fc-indigo); }
.bo-switch input:checked + .slider::before { transform: translateX(19px); }
/* Switch bazat pe clasă (model) — folosit de BoRowActions (fără checkbox necontrolat). */
.bo-switch.on .slider { background: var(--fc-indigo); }
.bo-switch.on .slider::before { transform: translateX(19px); }

/* Buton-icon discret pentru acțiuni de rând (editare etc.) */
.bo-icon-act {
    background: transparent; border: 0; color: var(--fc-muted); cursor: pointer;
    font-size: 1.05rem; padding: 5px 8px; border-radius: 7px; line-height: 1; transition: background .12s, color .12s;
}
.bo-icon-act:hover { background: #eef0f6; color: var(--fc-ink); }
.bo-icon-act.danger { color: #c62828; }
.bo-icon-act.danger:hover { background: #fdecea; color: #a52020; }
.bo-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.bo-table .col-act { text-align: right; white-space: nowrap; }

/* Header sortabil + draggable (rearanjare coloane) */
.bo-table th.sortable {
    cursor: pointer; user-select: none;
    /* position:sticky vine din `.bo-table thead th` — oferă și containing block pt. resize-handle */
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bo-table th .resize-handle {
    position: absolute; top: 0; right: 0; bottom: 0; width: 6px;
    cursor: col-resize; user-select: none; z-index: 2;
}
.bo-table th .resize-handle:hover { background: #e65100; opacity: 0.35; }
.bo-table td {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0;
}
.bo-table td.col-act, .bo-table th.col-act {
    overflow: visible; max-width: none; white-space: nowrap;
}
.bo-table th.sortable:hover { background: #eef2f8; }
.bo-table th.sortable.dragging   { opacity: 0.4; }
.bo-table th.sortable.drop-target { box-shadow: inset 4px 0 0 #e65100; }
.bo-table th .sort-arrow { margin-left: 4px; color: #e65100; font-size: 0.7rem; font-weight: 700; }
.bo-table tbody tr { cursor: pointer; }

/* ── MODAL EDITARE ────────────────────────────── */
.bo-modal-bg {
    position: fixed; inset: 0; height: 100dvh; background: rgba(26,39,68,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    overflow: hidden; overscroll-behavior: contain; touch-action: none;
}
.bo-modal {
    background: #fff; border-radius: 10px; padding: 0;
    min-width: 480px; max-width: 640px; max-height: 90dvh;
    display: flex; flex-direction: column; overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    overscroll-behavior: contain;
}
html:has(.bo-modal-bg),
body:has(.bo-modal-bg) { overflow: hidden !important; height: 100% !important; }

/* Modal suprapus (ex. alocări custom peste editorul de gestiune) */
.bo-modal-bg-top { z-index: 1400; background: rgba(26,39,68,0.35); }

/* Bară de progres (ex. descărcare SPV) */
.bo-progress {
    height: 12px; background: #e1e7ef; border-radius: 7px; overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
.bo-progress-fill {
    height: 100%; background: linear-gradient(90deg, #e65100, #ff9800);
    border-radius: 7px; transition: width .2s ease;
}
.bo-progress-fill.indet {
    width: 35%; animation: boIndet 1.1s ease-in-out infinite;
}
@keyframes boIndet {
    0%   { margin-left: -35%; }
    100% { margin-left: 100%; }
}

/* Indicator servicii de fundal (topbar) */
.fc-bg-wrap { position: relative; display: inline-flex; align-items: center; }
.fc-bg-on { color: #ff9800 !important; }
.fc-bg-spin { display: inline-block; font-size: 18px; line-height: 1; animation: fcSpin 1s linear infinite; }
@keyframes fcSpin { to { transform: rotate(360deg); } }
.fc-bg-mini {
    font-size: 0.72rem; font-weight: 700; color: #ff9800; margin-left: -2px;
    background: rgba(255,152,0,.15); padding: 1px 6px; border-radius: 9px;
}
.fc-bg-menu {
    position: absolute; right: 0; top: 46px; width: 320px; z-index: 90;
    background: #fff; border: 1px solid var(--fc-line); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(20,12,50,.28); overflow: hidden;
}
.fc-bg-row { padding: 10px 14px; border-bottom: 1px solid var(--fc-line); }
.fc-bg-row-top { display: flex; justify-content: space-between; align-items: center; }
.fc-bg-name { font-weight: 700; color: var(--fc-ink); font-size: 0.9rem; }
.fc-bg-sub { font-size: 0.78rem; color: #6a7a8e; margin-top: 2px; }
.fc-bg-badge { font-size: 0.68rem; font-weight: 700; padding: 1px 8px; border-radius: 9px; background: #eef3fa; color: #6a7a8e; }
.fc-bg-run {
    margin-top: 7px; width: 100%; padding: 6px 10px; border-radius: 7px; cursor: pointer;
    background: var(--fc-indigo, #39316e); color: #fff; border: 0; font-size: 0.8rem; font-weight: 600;
}
.fc-bg-run:hover:not(:disabled) { filter: brightness(1.1); }
.fc-bg-run:disabled { opacity: .45; cursor: default; }
.fc-bg-badge.run { background: rgba(255,152,0,.18); color: #e65100; }
.fc-bg-badge.ok  { background: #e8f5e9; color: #2e7d32; }
.fc-bg-badge.err { background: #ffebee; color: #c62828; }

/* Header ancorat sus (titlu + tab-uri), footer ancorat jos (acțiuni), scroll doar la mijloc. */
.bo-modal > h2 {
    flex: 0 0 auto; margin: 0; font-size: 1.2rem; color: var(--fc-ink);
    padding: 20px 24px 14px;
}
.bo-modal > .bo-tabs { flex: 0 0 auto; margin: 0; padding: 0 24px; }
.bo-modal-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: 14px 24px;
    touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
/* Mesaje care rămân în zona header (ex. eroare deasupra tab-urilor) — primesc padding propriu */
.bo-modal > .bo-msg-eroare,
.bo-modal > .bo-msg-ok { flex: 0 0 auto; margin: 0 24px 10px; }

/* ── TAB-URI ÎN MODAL ────────────────────────── */
.bo-tabs { display: flex; gap: 4px; border-bottom: 2px solid #eef3fa; margin: 0 0 16px; }
.bo-tab {
    background: none; border: none; border-bottom: 3px solid transparent;
    padding: 8px 16px; margin-bottom: -2px; font-size: 0.9rem; font-weight: 600;
    color: #6a7a8e; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.bo-tab:hover { color: var(--fc-ink); }
.bo-tab.active { color: var(--fc-accent); border-bottom-color: var(--fc-accent); }

/* ── INPUT NUMERIC CU − / + ─────────────────── */
.bo-num-input {
    display: flex; align-items: center; flex: 1;
    border: 1px solid #d4dce8; border-radius: 6px; overflow: hidden; background: #fff;
}
.bo-num-input input {
    flex: 1; border: none; text-align: center; padding: 8px 6px;
    font-size: 0.95rem; font-variant-numeric: tabular-nums; outline: none; min-width: 0;
}
.bo-num-btn {
    background: #f4f7fb; border: none; color: var(--fc-ink);
    font-size: 1.2rem; font-weight: 700; width: 38px; height: 38px;
    cursor: pointer; line-height: 1; transition: background 0.1s;
}
.bo-num-btn:hover { background: #e1e7ef; }
.bo-num-btn:active { background: #d4dce8; }

/* ── DROPDOWN MULTI-LINE LOOKUP (cod vamal, CPV) ──── */
.bo-multi-lookup { position: relative; display: flex; flex-direction: column; }
.bo-multi-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff;
    border: 1px solid #d4dce8; border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18); max-height: 320px; overflow-y: auto;
    z-index: 20; margin-top: 2px;
}
.bo-multi-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 6px 12px;
    border-bottom: 1px solid #f0f3f7; cursor: pointer; font-size: 0.85rem;
    min-height: 48px; box-sizing: border-box;
}
.bo-multi-item:hover { background: #fff3e0; }
.bo-multi-code {
    flex: 0 0 auto; color: #e65100; font-weight: 600; font-family: monospace;
    white-space: nowrap; padding-top: 2px;
}
.bo-multi-desc {
    flex: 1; color: var(--fc-ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.35; word-break: break-word;
}
.bo-form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bo-form-row label { flex: 0 0 140px; font-weight: 600; font-size: 0.85rem; color: #444; }
.bo-form-row input, .bo-form-row select, .bo-form-row textarea {
    flex: 1; padding: 7px 10px; border: 1px solid #c9d6e9; border-radius: 6px;
    font-size: 0.9rem; font-family: inherit;
}
.bo-form-row textarea { min-height: 60px; resize: vertical; }
.bo-form-row input[type=checkbox] { flex: 0 0 18px; width: 18px; height: 18px; }

/* Ascuns implicit; afișat doar în media query-ul de telefon (≤768px) */
.mobile-only { display: none; }

.bo-modal-actions {
    flex: 0 0 auto;
    display: flex; gap: 10px; justify-content: flex-end;
    margin: 0; padding: 14px 24px; border-top: 1px solid #f0f2f5;
    background: #fff; border-radius: 0 0 10px 10px;
}

/* ── Mapare cote TVA → cod casă (în editorul de gestiune) ── */
.bo-tva-map {
    margin-top: 14px; padding-top: 14px; border-top: 1px solid #f0f2f5;
}
.bo-tva-map-head { font-weight: 700; color: var(--fc-ink); font-size: 0.95rem; margin-bottom: 4px; }
.bo-tva-map-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bo-tva-map-cota {
    flex: 0 0 64px; font-weight: 700; color: var(--fc-ink);
    font-variant-numeric: tabular-nums; text-align: right;
}
.bo-tva-map-arrow { flex: 0 0 auto; color: var(--fc-muted); }
.bo-tva-map-input {
    flex: 0 0 80px; padding: 7px 10px; border: 1px solid #c9d6e9; border-radius: 6px;
    font-size: 0.95rem; font-family: monospace; text-align: center;
}

/* ── Mapări gestiune → casă (rânduri per cotă + excepții) ── */
.bo-map-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.bo-map-cota {
    flex: 0 0 56px; font-weight: 700; color: var(--fc-ink);
    font-variant-numeric: tabular-nums; text-align: right;
}
.bo-map-dep      { flex: 1 1 150px; min-width: 130px; }
.bo-map-tva      { flex: 0 0 78px; }
.bo-map-scope    { flex: 0 0 92px; }
.bo-map-scopeval { flex: 1 1 140px; min-width: 120px; }
.bo-map-row select, .bo-map-num {
    padding: 6px 9px; border: 1px solid #c9d6e9; border-radius: 6px;
    font-size: 0.9rem; background: #fff; color: var(--fc-ink);
}
.bo-map-num { flex: 0 0 62px; font-family: monospace; text-align: center; }
.bo-map-lbl { flex: 0 0 auto; font-size: 0.74rem; color: var(--fc-muted); }
.bo-map-exc-head {
    margin: 14px 0 8px; font-weight: 700; color: var(--fc-ink); font-size: 0.88rem;
}
.bo-map-exc-head .bo-page-hint { display: inline; margin-left: 6px; font-weight: 400; }
/* Card alocare custom (excepție) — 2 linii: scope sus, cotă+departament jos */
.bo-map-exc-card { background: #f7f9fc; border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.bo-map-exc-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bo-map-exc-line.sub { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #dde4ee; }
.bo-map-exc-for { font-size: 0.84rem; font-weight: 600; color: var(--fc-ink); }
.bo-map-exc-line .bo-map-del { margin-left: auto; }
.bo-map-del {
    flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
    font-size: 1rem; padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.bo-map-del:hover { background: #fdecec; }
.bo-map-add { margin-top: 4px; }

.bo-msg-eroare {
    background: #ffebee; color: #c62828; padding: 10px 14px;
    border-radius: 6px; margin-bottom: 12px; font-size: 0.88rem;
}
.bo-msg-ok {
    background: #e8f5e9; color: #2e7d32; padding: 10px 14px;
    border-radius: 6px; margin-bottom: 12px; font-size: 0.88rem;
}

/* ════════════════════════════════════════════════
   RESPONSIVE — tabletă (≤ 1024px) + telefon (≤ 768px)
   ════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .fc-dash-grid { grid-template-columns: 1fr; }
    .fc-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* Buton vizibil DOAR pe mobil (≤600px) — ex. lupa care deschide căutarea */
.show-sm { display: none; }

@media (max-width: 600px) {
    .fc-search, .hide-sm { display: none; }
    .show-sm { display: inline-flex; }
    /* Lupa deschide câmpul de căutare ca bară full-width sub topbar */
    .fc-search.fc-search-mobile-on {
        display: flex; position: fixed; top: var(--fc-top); left: 8px; right: 8px;
        margin: 0; max-width: none; z-index: 1205;
        background: var(--fc-side); box-shadow: 0 10px 28px rgba(0,0,0,.4);
    }
}

@media (max-width: 768px) {
    /* Shell devine o coloană; rail-ul off-canvas */
    .fc-shell {
        grid-template-columns: 1fr;
        grid-template-areas: "top" "main";
    }
    .fc-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 264px; height: 100vh; transform: translateX(-100%);
        transition: transform 0.25s ease; z-index: 1200;
        box-shadow: 4px 0 16px rgba(0,0,0,0.3);
    }
    .fc-shell.mobile-open .fc-sidebar { transform: translateX(0); }
    .fc-rail-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1150; }

    /* Pe mobil rail-ul e off-canvas la lățime plină — afișăm MEREU textele,
       chiar dacă starea `collapsed` e activă (hamburgerul o comută și pe mobil). */
    .fc-shell.collapsed .fc-rail-label { display: block; }
    .fc-shell.collapsed .fc-rail-chev  { display: inline-flex; }
    .fc-shell.collapsed .fc-rail-item  { justify-content: flex-start; padding: 10px 12px; }

    /* Flyout full-screen peste rail */
    .fc-flyout {
        top: 0; left: 0; width: 264px; height: 100vh; z-index: 1300;
    }
    .fc-flyout-scrim { top: 0; left: 0; z-index: 1290; }
    .fc-flyout-back { display: inline-flex; }

    .fc-toolbar { padding: 10px 16px 4px; }
    .fc-toolbar-firm { font-size: 0.95rem; }
    .fc-main { padding: 10px 16px 24px; }

    .fc-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .fc-kpi { padding: 14px; }
    .fc-kpi-val { font-size: 1.35rem; }

    .bo-page h1 { font-size: 1.25rem; }
    .bo-page-hint { font-size: 0.85rem; margin-bottom: 16px; }

    .bo-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .bo-toolbar input { max-width: none; }

    /* ── Tabel → carduri pe telefon ───────────────────── */
    /* Ascunde bara de scroll (apare ca o dungă pe dreapta pe telefon/WebView); scroll-ul touch rămâne. */
    .fc-main, .bo-page-body, .bo-modal-body {
        scrollbar-width: none; -ms-overflow-style: none;
    }
    .fc-main::-webkit-scrollbar,
    .bo-page-body::-webkit-scrollbar,
    .bo-modal-body::-webkit-scrollbar { width: 0; height: 0; display: none; }

    /* La CARDURI tabelul nu mai e grid → anulam min-width-ul inline pus de bo-table.js (~nrCol*95px,
       fallback de scroll pe desktop) care altfel latea cardurile peste ecran si dadea scroll orizontal. */
    .bo-table { background: transparent; border: none; border-radius: 0; font-size: 0.85rem; min-width: 0 !important; }
    .bo-table thead { display: none; }
    .bo-table tbody, .bo-table tr, .bo-table td { display: block; width: 100%; }
    .bo-table tr {
        background: #fff; border: 1px solid #e1e7ef; border-radius: 8px;
        margin-bottom: 8px; padding: 2px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    }
    .bo-table tr:hover td { background: #fff; }
    .bo-table td {
        position: relative; padding: 4px 14px 4px 45%; text-align: right;
        border-bottom: 1px solid #f4f7fb;
        max-width: none; overflow: visible; white-space: normal; word-break: break-word;
        /* min-height ca eticheta (poziționată absolut) să încapă chiar și când valoarea e goală */
        min-height: 1.7rem;
    }
    .bo-table td:last-child { border-bottom: none; }
    .bo-table td::before {
        content: attr(data-label); position: absolute; left: 14px; top: 4px;
        width: 40%; font-size: 0.72rem; font-weight: 700; color: var(--fc-muted);
        text-transform: uppercase; letter-spacing: 0.4px; text-align: left;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    /* Pe telefon ascundem coloanele mai puțin relevante din cardul de produs */
    .bo-table td[data-label="Preț fără TVA"],
    .bo-table td[data-label="Ultim preț achiziție"] { display: none; }

    /* Produse pe telefon: ordine FIXĂ Denumire / Cod / UM+Grupa / Preț cu TVA
       (indiferent de ordinea coloanelor — pe telefon nu se pot trage). */
    .bo-table td[data-label="Denumire"]    { order: 1; }
    .bo-table td[data-label="Cod"]         { order: 2; }
    .bo-table td[data-label="UM"]          { order: 3; }
    .bo-table td[data-label="Grupa"]       { order: 4; }
    .bo-table td[data-label="Preț cu TVA"] { order: 5; }

    /* Denumirea (coloana-nume) = TITLUL cardului pe telefon: sus, lățime plină, bold, fără etichetă.
       Se aplică la toată clasa (gestiuni, departamente, grupuri, produse, parteneri...). */
    .bo-table td.bo-cell-name {
        order: -1; flex: 0 0 100%;
        padding: 8px 14px 6px; text-align: left;
        font-size: 1.02rem; font-weight: 700; color: var(--fc-ink);
        border-bottom: 1px solid #eef2f7; min-height: 0;
    }
    .bo-table td.bo-cell-name::before { display: none; }
    /* UM + Grupa pe ACELAȘI rând, compacte (etichetă lângă valoare) */
    /* Fiecare umple jumătate (fără spațiu gol între ele, ca să nu se vadă culoarea la swipe).
       UM = text stânga, Grupa = text dreapta. */
    .bo-table td[data-label="UM"],
    .bo-table td[data-label="Grupa"] {
        flex: 1 1 0; min-height: 0; padding: 3px 14px; border-bottom: none;
    }
    .bo-table td[data-label="UM"]    { text-align: left; }
    .bo-table td[data-label="Grupa"] { text-align: right; }
    .bo-table td[data-label="UM"]::before,
    .bo-table td[data-label="Grupa"]::before {
        position: static; display: inline; width: auto; top: auto; left: auto;
        margin-right: 5px;
    }

    /* Pe telefon NU arătăm butoanele — rămân în DOM (ascunse) ca să fie click-uite de swipe.
       Swipe stânga = ștergere, swipe dreapta = inactivare, dublu-tap = editare. */
    .bo-table td.col-act { display: none; }

    /* Documente (facturi): swipe-ul e dezactivat → arătăm acțiunile (PDF) în card; ascundem rândurile goale. */
    .doc-table tr.doc-rand-gol { display: none; }
    .doc-table td.col-act {
        display: flex; gap: 8px; justify-content: flex-start;
        padding: 8px 14px; border-bottom: none;
    }

    /* Swipe: cardul urmează degetul; în spate apar etichetele
       „Ștergere 🗑" (la swipe stânga, dreapta) / „⏸ Inactivare" (la swipe dreapta, stânga). */
    .bo-table tbody tr { will-change: transform; position: relative; overflow: hidden;
        display: flex; flex-wrap: wrap; align-items: baseline; }   /* card = flex-wrap (pt. order + inline) */
    .bo-table tr.swiping { transition: none !important; }
    .bo-table tbody td { background: #fff; position: relative; z-index: 1; flex: 0 0 100%; }   /* implicit: rând întreg; acoperă etichetele */
    .bo-table tbody tr::before,
    .bo-table tbody tr::after {
        position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 0;
        display: none; align-items: center; color: #fff; font-weight: 700;
        font-size: 0.95rem; padding: 0 20px; letter-spacing: .3px;
        /* Fixe în <tr> (care nu se mișcă); td-urile alunecă deasupra și le „descoperă". */
    }
    .bo-table tbody tr::after  { content: "Ștergere 🗑"; justify-content: flex-end;   background: #c62828; }
    .bo-table tbody tr::before { content: "⏸ Inactivare"; justify-content: flex-start; background: #2f2860; }
    .bo-table tbody tr.swipe-left::after   { display: flex; }
    .bo-table tbody tr.swipe-right::before { display: flex; }
    .bo-table td[colspan] { padding: 24px 12px; text-align: center; background: #fff; border-radius: 8px; }
    .bo-table td[colspan]::before { display: none; }
    .bo-table th .resize-handle { display: none; }

    /* Modal full-screen pe telefon */
    .bo-modal {
        min-width: 0; width: calc(100vw - 24px); max-height: calc(100dvh - 24px);
        padding: 0; border-radius: 8px;
    }
    .bo-modal > h2 { font-size: 1.05rem; padding: 16px 16px 10px; }
    .bo-modal > .bo-tabs { padding: 0 16px; }
    .bo-modal-body { padding: 10px 16px; }
    .bo-modal-actions { padding: 12px 16px; }
    .bo-form-row { flex-direction: column; align-items: stretch; gap: 4px; }
    .bo-form-row label { flex: 0 0 auto; font-size: 0.78rem; }
    .bo-modal-actions { flex-direction: column-reverse; }
    .bo-modal-actions .bo-btn { width: 100%; }
    .bo-table .bo-btn.sm { padding: 4px 6px; font-size: 0.72rem; }
}

/* Touch-friendly: pe ecrane fără hover, mărim suprafețele clickabile */
@media (hover: none) and (pointer: coarse) {
    .fc-rail-item { padding: 12px; }
    .fc-flyout-item { padding: 12px 18px; }
}

/* iOS PWA „Adaugă pe ecranul de start" (standalone): conținutul ar intra sub bara de stare
   (ceas/semnal) și ar lăsa spațiu alb jos. Tratăm safe-area: topbar-ul navy se extinde sub
   status bar (text alb pe navy), conținutul stă dedesubt; jos lăsăm loc de home indicator.
   --fc-top crește cu inset → topbar + barele fixe (top: var(--fc-top)) + grid-ul se aliniază. */
@media (display-mode: standalone) {
    /* status bar = `black` → iOS rezervă bara de stare. Doar insetul de jos (home indicator) pe ROOT.
       FĂRĂ background colorat aici: .fc-main e transparentă, deci un bg pe shell ar colora tot conținutul. */
    .fc-shell { padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
}


/* ════════════════════ RBAC — editor drepturi roluri ════════════════════ */
.rbac-toggle { display:flex; align-items:center; gap:8px; font-weight:600; cursor:pointer; }
.rbac-toggle .rbac-hint { color:var(--fc-muted); font-weight:400; font-size:0.85rem; }
.rbac-grid { display:flex; flex-direction:column; gap:2px; margin-top:6px;
    max-height:46vh; overflow-y:auto; border:1px solid #e3e6ef; border-radius:8px; padding:10px 12px; background:#fafbff; }
.rbac-modul { font-weight:700; color:var(--fc-indigo); text-transform:uppercase; font-size:0.78rem;
    letter-spacing:.5px; margin:10px 0 2px; border-bottom:1px solid #e3e6ef; padding-bottom:4px; }
.rbac-modul:first-child { margin-top:0; }
.rbac-grup { font-weight:600; color:var(--fc-ink); font-size:0.82rem; margin:6px 0 2px; }
.rbac-drept { display:flex; align-items:center; gap:8px; padding:3px 0 3px 10px; cursor:pointer; font-size:0.9rem; }
.rbac-drept input { width:17px; height:17px; cursor:pointer; }
.rbac-exc-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:3px 0 3px 10px; font-size:0.9rem; }
.rbac-exc-row select { flex:0 0 auto; padding:3px 6px; border:1px solid #ccd3e0; border-radius:6px; }

/* ════════════════════ Jurnal de activitate ════════════════════ */
.jrn-filtre { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:8px; }
.jrn-filtre .bo-input { width:auto; }
.jrn-filtre label { display:flex; align-items:center; gap:4px; font-size:0.85rem; color:var(--fc-muted); }
.jrn-actiune { font-size:0.74rem; font-weight:700; padding:2px 8px; border-radius:10px; background:#eef0f7; color:var(--fc-ink); white-space:nowrap; }
.jrn-actiune.jrn-del   { background:#fde8e8; color:#b3261e; }
.jrn-actiune.jrn-add   { background:#e6f4ea; color:#1e7d34; }
.jrn-actiune.jrn-inact { background:#fff3e0; color:#9a5a00; }
.jrn-det { display:flex; flex-direction:column; gap:4px; margin-bottom:12px; font-size:0.92rem; }
.jrn-diff { width:100%; border-collapse:collapse; font-size:0.9rem; }
.jrn-diff th, .jrn-diff td { border:1px solid #e3e6ef; padding:6px 10px; text-align:left; }
.jrn-diff th { background:#f4f5f9; }
.jrn-diff .jrn-vechi { color:#b3261e; }
.jrn-diff .jrn-nou   { color:#1e7d34; }
.jrn-raw { background:#f4f5f9; padding:10px; border-radius:8px; font-size:0.82rem; overflow:auto; }

/* ── Badge bancă (BancaLogo) ─────────────────────────────────────────
   Monogramă pe fundal de brand. Culorile vin din BanciRomania; aici doar forma.
   NU e logo oficial — vezi comentariul din BanciRomania.cs.                     */
.banca-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 7px;
    font-weight: 800;
    letter-spacing: .3px;
    line-height: 1;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08);
    user-select: none;
}

/* Badge + text pe același rând (celule de tabel, linii de formular) */
.banca-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.banca-cell > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Logo real (fisier in /img/banci) — fundal alb ca logo-urile transparente sa nu se piarda */
.banca-logo-img {
    object-fit: contain;
    background: #fff;
    padding: 2px;
    box-sizing: border-box;
}
