/* erp-nav.css — meniul ERP grupat pe domenii (public/js/erp/shared/erpNav.js).
 * Namespace .erp-nd-* / .erp-nav-domain. Clasele NU conțin „card”, „panel”, „section” (light-theme.css le scoate bordura cu !important).
 * Se aplică DOAR după ce erpNav.js a reorganizat meniul (.erp-nd-on pe rădăcină) — fără script, meniul e cel vechi.
 * Ascunderea o fac în continuare `.hidden` / style.display (permisiuni, app.js) + clasa proprie `.erp-nd-off`. */

:root {
    --erp-nd-ink: #0f172a;
    --erp-nd-ink-2: #334155;
    --erp-nd-muted: #64748b;
    --erp-nd-faint: #94a3b8;
    --erp-nd-line: #e2e8f0;
    --erp-nd-soft: #f1f5f9;
    --erp-nd-bg: #ffffff;
    --erp-nd-accent: #2563eb;
    --erp-nd-accent-soft: #eff6ff;
    --erp-nd-accent-line: #bfdbfe;
    --erp-nd-speed: .22s;
}
@media (prefers-reduced-motion: reduce) {
    :root { --erp-nd-speed: 0s; }
}

/* Ascunderea proprie (domeniu gol, subtitlu inutil, căutare fără rezultat) — nu atinge .hidden / style.display. */
.erp-nd-on .erp-nd-off,
.erp-nd-on .erp-nd-miss,
#navErpHome.erp-nd-off,
#sheetErpHome.erp-nd-off { display: none !important; }

/* Secțiunile vechi devin subgrupuri mereu deschise în interiorul unui domeniu. */
.erp-nd-on .erp-nav-domain .erp-nav-section { margin: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; }
.erp-nd-on .erp-nav-domain .erp-nav-section-items { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.erp-nd-on .erp-nav-domain .erp-nav-section-header { display: none !important; }
.erp-nd-on .erp-nav-domain .erp-nav-section-items { max-height: none !important; overflow: visible !important; }

/* Pictograma + eticheta itemului (decorate de JS; textContent neschimbat). */
.erp-nd-on .erp-nd-ico {
    flex: 0 0 22px;
    width: 22px;
    text-align: center;
    font-size: 15px;
    line-height: 1;
}
.erp-nd-on .erp-nd-lbl { min-width: 0; overflow-wrap: break-word; word-break: normal; }

/* ═════════════ DESKTOP — bara laterală ═════════════ */
.erp-nd-side .erp-nd-find {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 10px 8px;
    background: var(--erp-nd-bg);
    border-bottom: 1px solid var(--erp-nd-soft);
}
.erp-nd-side .erp-nd-find-ico {
    position: absolute;
    left: 20px;
    top: 19px;
    font-size: 12px;
    opacity: .55;
    pointer-events: none;
}
.sidebar .erp-nd-find input.erp-nd-find-input {
    flex: 1 1 100%;
    width: 100% !important;
    min-height: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 6px 10px 6px 30px !important;
    border: 1px solid var(--erp-nd-line) !important;
    border-radius: 9px !important;
    background: var(--erp-nd-soft) !important;
    color: var(--erp-nd-ink) !important;
    font-size: 13px !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color var(--erp-nd-speed), background var(--erp-nd-speed), box-shadow var(--erp-nd-speed);
}
.sidebar .erp-nd-find input.erp-nd-find-input:focus {
    background: #fff !important;
    border-color: #93c5fd !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14) !important;
}
.erp-nd-side .erp-nd-empty {
    margin: 2px 4px 0;
    font-size: 12px;
    color: var(--erp-nd-muted);
}

.erp-nd-side .erp-nd-list { padding: 4px 6px 8px; }
.erp-nd-side .erp-nav-domain { margin: 2px 0; }

.erp-nd-side .erp-nd-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 7px 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--erp-nd-ink-2);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: background var(--erp-nd-speed), color var(--erp-nd-speed);
}
.erp-nd-side .erp-nd-head:hover { background: var(--erp-nd-soft); color: var(--erp-nd-ink); }
.erp-nd-side .erp-nd-head:focus-visible { outline: 2px solid var(--erp-nd-accent); outline-offset: 1px; }
.erp-nd-side .erp-nd-dico {
    flex: 0 0 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--erp-nd-soft);
    font-size: 14px;
    line-height: 1;
    transition: background var(--erp-nd-speed);
}
.erp-nd-side .erp-nd-dlbl { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
.erp-nd-side .erp-nd-chev {
    flex: 0 0 10px;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-right: 2px solid var(--erp-nd-faint);
    border-bottom: 2px solid var(--erp-nd-faint);
    transform: rotate(-45deg);
    transition: transform var(--erp-nd-speed);
}
.erp-nd-side .erp-nav-domain.is-open > .erp-nd-head .erp-nd-chev { transform: rotate(45deg); }
.erp-nd-side .erp-nav-domain.is-open > .erp-nd-head { color: var(--erp-nd-ink); }
.erp-nd-side .erp-nav-domain.is-open > .erp-nd-head .erp-nd-dico { background: var(--erp-nd-accent-soft); }
/* Domeniu închis care conține pagina deschisă: punct albastru + pictogramă colorată. */
.erp-nd-side .erp-nav-domain.has-active:not(.is-open) > .erp-nd-head { color: var(--erp-nd-accent); }
.erp-nd-side .erp-nav-domain.has-active:not(.is-open) > .erp-nd-head .erp-nd-dico { background: var(--erp-nd-accent-soft); box-shadow: inset 0 0 0 1px var(--erp-nd-accent-line); }

/* Plierea animată (grid 0fr → 1fr); conținutul închis nu primește focus (visibility). */
.erp-nd-side .erp-nd-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--erp-nd-speed) ease;
}
.erp-nd-side .erp-nav-domain.is-open > .erp-nd-body,
.erp-nd-side.erp-nd-searching .erp-nd-body { grid-template-rows: 1fr; }
.erp-nd-side .erp-nd-inner {
    min-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: visibility 0s linear var(--erp-nd-speed);
}
.erp-nd-side .erp-nav-domain.is-open > .erp-nd-body > .erp-nd-inner,
.erp-nd-side.erp-nd-searching .erp-nd-inner { visibility: visible; transition-delay: 0s; }
.erp-nd-side.erp-nd-searching .erp-nd-chev { visibility: hidden; }

.erp-nd-side .erp-nd-cap {
    padding: 8px 8px 3px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--erp-nd-faint);
}
.erp-nd-side .erp-nd-inner { padding-left: 0; }
.erp-nd-side .erp-nd-inner .nav-item {
    min-height: 36px;
    margin: 1px 0 1px 6px !important;
    padding: 7px 8px !important;
    gap: 8px !important;
    font-size: 13.5px;
    border-left: 0 !important;
    border-radius: 8px !important;
    transition: background var(--erp-nd-speed), color var(--erp-nd-speed);
}
.erp-nd-side .erp-nd-inner .nav-item:focus-visible { outline: 2px solid var(--erp-nd-accent); outline-offset: -2px; }

/* „🏠 Acasă” ERP — primul element al grupului. */
.erp-nd-side #navErpHome {
    margin: 8px 8px 2px !important;
    padding: 8px 10px !important;
    border-left: 0 !important;
    border-radius: 9px !important;
    font-weight: 600;
}

/* Bara laterală e îngustă pe tabletă: lista ERP ocupă mai mult din înălțime decât vechiul plafon de 520 px. */
@media (min-width: 769px) {
    .nav-group.erp-module.erp-nd-side.expanded .nav-group-items { max-height: min(640px, calc(100vh - 200px)); }
}

/* ═════════════ TELEFON — panoul 🧩 ERP: grilă de scurtături ═════════════ */
#mobileERPSheet.erp-nd-sheet .mobile-sheet-body { padding-top: 0; }
#mobileERPSheet .erp-nd-top {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 -10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: saturate(1.4) blur(6px);
    backdrop-filter: saturate(1.4) blur(6px);
    border-bottom: 1px solid var(--erp-nd-soft);
}
#mobileERPSheet .erp-nd-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
}
#mobileERPSheet .erp-nd-chips::-webkit-scrollbar { display: none; }
#mobileERPSheet .erp-nd-chip {
    flex: 0 0 auto;
    min-height: 36px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--erp-nd-line);
    border-radius: 999px;
    background: #fff;
    color: var(--erp-nd-ink-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
#mobileERPSheet .erp-nd-chip:active { background: var(--erp-nd-accent-soft); border-color: var(--erp-nd-accent-line); }
#mobileERPSheet.sheet-search-active .erp-nd-top,
#mobileERPSheet.sheet-search-active .erp-nd-recents { display: none !important; }

#mobileERPSheet .erp-nd-recents { margin: 12px 2px 4px; }
#mobileERPSheet .erp-nd-rtitle,
#mobileERPSheet .erp-nd-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--erp-nd-ink);
}
#mobileERPSheet .erp-nd-rtitle { font-size: 12px; color: var(--erp-nd-muted); font-weight: 700; letter-spacing: .02em; }
#mobileERPSheet .erp-nd-rlist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
#mobileERPSheet .erp-nd-rtile {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--erp-nd-accent-line);
    border-radius: 12px;
    background: var(--erp-nd-accent-soft);
    color: var(--erp-nd-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}
#mobileERPSheet .erp-nd-rtile .erp-nd-lbl { white-space: nowrap; }

#mobileERPSheet .erp-nav-domain { margin: 18px 2px 4px; scroll-margin-top: 60px; }
#mobileERPSheet .erp-nd-title .erp-nd-dico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--erp-nd-soft);
    font-size: 16px;
}
#mobileERPSheet .erp-nd-cap {
    margin: 10px 2px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--erp-nd-faint);
}
#mobileERPSheet .erp-nav-domain .erp-nav-section-items {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
#mobileERPSheet .erp-nav-domain .erp-nav-section + .erp-nd-cap { margin-top: 14px; }
#mobileERPSheet .erp-nav-domain .erp-nav-section + .erp-nd-cap.erp-nd-off + .erp-nav-section { margin-top: 8px; }

/* Dala: id + 2 clase ⇒ bate `.mobile-nav-group-sheet .sheet-nav-item{display:flex!important;padding…!important}` și culorile light-theme. */
#mobileERPSheet .erp-nav-domain .sheet-nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px !important;
    min-height: 78px !important;
    margin: 0 !important;
    padding: 10px 6px !important;
    border: 1px solid var(--erp-nd-line) !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: var(--erp-nd-ink-2) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1.25;
    text-align: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
#mobileERPSheet .erp-nav-domain .sheet-nav-item .erp-nd-ico { flex: 0 0 auto; width: auto; font-size: 24px; }
#mobileERPSheet .erp-nav-domain .sheet-nav-item .erp-nd-lbl {
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    hyphens: auto;
}
#mobileERPSheet .erp-nav-domain .sheet-nav-item:active {
    transform: scale(.97);
    background: var(--erp-nd-accent-soft) !important;
    border-color: var(--erp-nd-accent-line) !important;
}
#mobileERPSheet .erp-nav-domain .sheet-nav-item.erp-nd-current,
#mobileERPSheet #sheetErpHome.erp-nd-current {
    background: var(--erp-nd-accent-soft) !important;
    border-color: var(--erp-nd-accent) !important;
    color: var(--erp-nd-accent) !important;
    box-shadow: inset 0 0 0 1px var(--erp-nd-accent);
}
/* Permisiunile / căutarea ascund în continuare dala (specificitate peste regula de afișare de mai sus). */
#mobileERPSheet .erp-nav-domain .sheet-nav-item.hidden,
#mobileERPSheet .erp-nav-domain .sheet-nav-item[style*="display: none"],
#mobileERPSheet .erp-nav-domain .sheet-nav-item[style*="display:none"],
#mobileERPSheet .erp-nav-domain .sheet-nav-item.sheet-filtered-out { display: none !important; }

#mobileERPSheet #sheetErpHome {
    margin: 12px 2px 0 !important;
    min-height: 52px !important;
    border: 1px solid var(--erp-nd-line) !important;
    border-radius: 14px !important;
    background: #fff !important;
    font-weight: 700;
}

/* ═════════════ Bara de jos (telefon): „🧩 ERP” + „🔎 Caută” primele, ca să nu stea în afara ecranului ═════════════ */
#mobileBottomNav > .erp-nd-barsearch.erp-nd-off { display: none !important; }
@media (max-width: 768px) {
    .erp-nd-ready #mobileBottomNav > .mobile-nav-item.erp-module,
    .erp-nd-ready #mobileBottomNav > .erp-nd-barsearch { order: -1; }
    /* Butonul rotund al căutării globale (erpSearch.js) acoperea prima scurtătură / conținutul până la derulare:
       pe telefon căutarea stă în bara de jos și în panoul ERP. Pe desktop butonul „🔎 Caută ⌘K” și Ctrl+K rămân. */
    html.erp-nd-ready .erp-search-trigger { display: none !important; }
    html.erp-nd-ready.erp-search-fab-on .main-content::after { display: none !important; }
}
#mobileERPSheet .erp-nd-gsearch {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    margin: 0 0 8px;
    padding: 8px 14px;
    border: 1px solid var(--erp-nd-accent-line);
    border-radius: 12px;
    background: var(--erp-nd-accent-soft);
    color: var(--erp-nd-accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
#mobileERPSheet .erp-nd-gsearch.erp-nd-off { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .erp-nd-on *,
    #mobileERPSheet .erp-nav-domain .sheet-nav-item { transition: none !important; }
}
