/* ===== Tichete — completari peste Bootstrap 5 ===== */

/* Font unic in toata aplicatia: Inter (variable font, gazduit local — CSP nu permite fonturi externe). */
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/InterVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/InterVariable-Italic.woff2') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/*
 * Variabilele temei. Valorile din :root sunt tema implicita (Indigo, day mode);
 * celelalte teme le suprascriu in themes.css prin clase pe <html> (theme-*).
 */
:root {
    --brand: #4f46e5;
    --brand-strong: #4338ca;
    --brand-rgb: 79, 70, 229;
    --brand-soft: #eef2ff;
    --brand-text: #4f46e5;
    --navbar-bg: #4338ca;

    --surface-1: #fff;
    --surface-2: #fafafe;
    --surface-3: #f3f4fb;
    --surface-hover: #f7f8fd;
    --header-bg: #f8f8fd;

    --border-soft: #eceefa;
    --border-softer: #eef0f8;
    --border-strong: #e6e8f5;
    --card-border: rgba(15, 23, 42, .06);
    --card-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
    --card-shadow-hover: 0 4px 8px rgba(15, 23, 42, .06), 0 12px 28px rgba(15, 23, 42, .1);

    --text-heading: #363a5c;
    --text-soft: #6366a3;
    --text-soft-2: #4b4f7a;

    --accent-teal: #0891b2;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;

    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-body-bg: #fff;
    --bs-border-radius: .75rem;
    --bs-border-radius-sm: .55rem;
    --bs-border-radius-lg: 1rem;
}

body {
    background: var(--bs-body-bg);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Paginile aplicatiei: continut limitat la 1900px (nativ pe Full HD), centrat pe ecrane mai late,
   iar footerul sta lipit de partea de jos a ecranului si pe paginile cu putin continut. */
.app-body { display: flex; flex-direction: column; min-height: 100vh; }
.app-body main { flex: 1 0 auto; }
.app-navbar > .container-fluid,
.app-body main > .container-fluid,
.app-footer > .container-fluid {
    max-width: 1900px;
    margin-inline: auto;
}

.app-footer {
    background: var(--header-bg);
    border-top: 1px solid var(--border-soft);
    padding: .8rem 0;
    font-size: .8rem;
    color: var(--text-soft-2);
}

h1, h2, h3, .fw-semibold-heading { letter-spacing: -.01em; }

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-strong);
    --bs-btn-hover-border-color: var(--brand-strong);
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-border-color: var(--brand-strong);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
    box-shadow: 0 2px 6px rgba(var(--brand-rgb), .25);
}
.btn-primary:hover { box-shadow: 0 4px 10px rgba(var(--brand-rgb), .3); }
.btn-outline-primary {
    --bs-btn-color: var(--brand-text);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}

.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.link-brand { color: var(--brand-text); text-decoration: none; font-weight: 500; }
.link-brand:hover { text-decoration: underline; }

/* Componentele Bootstrap cu fundal propriu folosesc suprafata temei (alb pe day, gri inchis pe night). */
.dropdown-menu { --bs-dropdown-bg: var(--surface-1); --bs-dropdown-link-hover-bg: var(--surface-hover); }
.modal { --bs-modal-bg: var(--surface-1); }
.popover { --bs-popover-bg: var(--surface-1); }

/* Paginare: culorile temei (nu albastrul implicit Bootstrap) + stil pastila, modern. */
.pagination {
    --bs-pagination-color: var(--text-soft-2);
    --bs-pagination-bg: var(--surface-1);
    --bs-pagination-border-color: var(--border-soft);
    --bs-pagination-hover-color: var(--brand-text);
    --bs-pagination-hover-bg: var(--surface-hover);
    --bs-pagination-hover-border-color: var(--border-soft);
    --bs-pagination-focus-color: var(--brand-text);
    --bs-pagination-focus-bg: var(--surface-hover);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2);
    --bs-pagination-active-color: #fff;
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-disabled-color: var(--text-soft);
    --bs-pagination-disabled-bg: var(--surface-2);
    --bs-pagination-disabled-border-color: var(--border-soft);
    gap: .2rem;
}
.pagination .page-link {
    border-radius: .5rem !important;
    min-width: 2.15rem;
    text-align: center;
    font-weight: 500;
}
.pagination .page-item.active .page-link { box-shadow: 0 1px 3px rgba(var(--brand-rgb), .35); }
.app-pagination .pagination-jump-input { width: 4.5rem; }

/* Modal mai lat decat modal-xl (1140px), pt. formulare incarcate (ex. intrari magazie din document). */
.modal-2xl { --bs-modal-width: 1400px; }

/* Overlay-ul modalelor: efect de geam mat (blur + tenta intunecata).
   Transparenta e configurabila per user (Contul meu -> Aspect), 0-100%,
   prin variabila --overlay-transparency pusa pe <html> din layout.php.
   La 100% tenta si blur-ul ajung la 0, deci overlay-ul nu se mai vede deloc. */
.modal-backdrop {
    --bs-backdrop-opacity: 1;
    --overlay-t: var(--overlay-transparency, 55);
    background: rgba(15, 23, 42, calc((100 - var(--overlay-t)) / 100));
    backdrop-filter: blur(calc((100 - var(--overlay-t)) * .15px));
    -webkit-backdrop-filter: blur(calc((100 - var(--overlay-t)) * .15px));
    transition: opacity .18s ease;
}
/* Cat timp modalul este tras cu mouse-ul, overlay-ul dispare ca sa se vada pagina. */
.modal-backdrop.drag-hidden { opacity: 0; }

/* Panoul de filtre (toate paginile cu tabele filtrabile): slide-in din dreapta, nu
   card colapsabil in flux. Latime fixa, ingusta pe desktop (nu are rost sa ocupe
   jumatate de ecran pe monitoare late); pe mobil portret, unde 400px ar acoperi
   aproape tot ecranul oricum, trece la latime procentuala. */
.filters-offcanvas { --bs-offcanvas-width: 500px; }
@media (max-width: 576px) {
    .filters-offcanvas { --bs-offcanvas-width: 88vw; }
}

/* Panoul de comutare a proiectului curent, deschis din logo-ul din navbar: randuri
   aerisite (nu carduri), separate prin linie subtire, cu un inel (conic-gradient,
   fara JS/canvas) care arata procentul de tichete deschise — acelasi limbaj vizual
   ca graficul donut de pe pagina de proiect, dar usor de randat pe orice pagina. */
.project-switch-offcanvas { --bs-offcanvas-width: 400px; }
@media (max-width: 576px) {
    .project-switch-offcanvas { --bs-offcanvas-width: 88vw; }
}
.project-switch-list { display: flex; flex-direction: column; }
.project-switch-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    transition: background-color .12s ease;
}
.project-switch-row:last-child { border-bottom: 0; }
.project-switch-row:hover { background: var(--surface-hover); }
.project-switch-row-active { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.project-switch-ring {
    flex-shrink: 0;
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--surface-3) 0);
}
.project-switch-ring-hole {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-1);
    display: flex; align-items: center; justify-content: center;
    font-size: .64rem;
    font-weight: 700;
    color: var(--text-body);
}
.project-switch-form { display: contents; }
.project-switch-action {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-soft);
    background: var(--surface-1);
    color: var(--text-body);
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.project-switch-action:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.project-switch-action-current { color: #16a34a; border-color: color-mix(in srgb, #16a34a 40%, var(--border-soft)); }
.project-switch-action-current:hover { background: #16a34a; border-color: #16a34a; color: #fff; }
.offcanvas { --bs-offcanvas-bg: var(--surface-1); }
.offcanvas-backdrop {
    --bs-backdrop-opacity: 1;
    --overlay-t: var(--overlay-transparency, 55);
    background: rgba(15, 23, 42, calc((100 - var(--overlay-t)) / 100));
    backdrop-filter: blur(calc((100 - var(--overlay-t)) * .15px));
    -webkit-backdrop-filter: blur(calc((100 - var(--overlay-t)) * .15px));
}

/* Modalele se pot repozitiona pe desktop tragand de header. */
@media (hover: hover) and (pointer: fine) {
    .modal-header { cursor: move; user-select: none; }
}
.modal-dialog.modal-dragging { transition: none; }
.modal-dialog.modal-dragging .modal-content { box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }

/* ===== Navbar orizontal ===== */
.app-navbar {
    background: var(--navbar-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: .55rem;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}
.navbar-brand.btn { text-decoration: none; max-width: 220px; }
.navbar-brand.btn:hover .brand-project { color: #fff; }
.brand-title { color: #fff; font-weight: 700; font-size: .92rem; }
.brand-project {
    color: rgba(255, 255, 255, .65);
    font-weight: 300;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    max-width: 100%;
}
.top-link {
    color: rgba(255, 255, 255, .78) !important;
    font-size: .92rem;
    font-weight: 500;
    border-radius: .5rem;
    padding: .5rem .85rem !important;
    margin: 0 .1rem;
    transition: background .15s ease, color .15s ease;
}
.top-link i { font-size: .95rem; margin-right: .15rem; }
.top-link:hover { color: #fff !important; background: rgba(255, 255, 255, .12); }
.top-link.active { color: #fff !important; background: rgba(255, 255, 255, .2); font-weight: 600; }
.top-link.disabled { opacity: .5; cursor: not-allowed; }
.top-link.disabled:hover { background: transparent; }
.navbar-nav .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.navbar-nav .dropdown-toggle { color: rgba(255, 255, 255, .9) !important; }
.navbar-nav .dropdown-toggle::after { color: rgba(255, 255, 255, .6); }
.navbar-toggler { border-color: rgba(255, 255, 255, .3); }
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .25); }

/* ===== Carduri ===== */
.card {
    --bs-card-bg: var(--surface-1);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}
.card-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-soft);
    padding: .7rem 1.25rem;
}
.card-header h2 { color: var(--text-heading); }
.card-footer {
    background: var(--header-bg);
    border-top: 1px solid var(--border-soft);
    padding: .7rem 1.25rem;
}
.card.shadow-sm { box-shadow: var(--card-shadow) !important; }
.stat-card { border-left: 4px solid var(--brand); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: var(--brand-soft);
    color: var(--brand-text);
}
.stat-card-amber { border-left-color: #d97706; }
.stat-card-amber .stat-icon { background: color-mix(in srgb, #d97706 12%, var(--surface-1)); color: #d97706; }
.stat-card-success { border-left-color: #16a34a; }
.stat-card-success .stat-icon { background: color-mix(in srgb, #16a34a 12%, var(--surface-1)); color: #16a34a; }
.stat-card-teal { border-left-color: #0891b2; }
.stat-card-teal .stat-icon { background: color-mix(in srgb, #0891b2 12%, var(--surface-1)); color: #0891b2; }
.stat-card-rose { border-left-color: #e11d48; }
.stat-icon-rose { background: color-mix(in srgb, #e11d48 12%, var(--surface-1)); color: #e11d48; }
.stat-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; }

.project-card { text-decoration: none; color: inherit; transition: box-shadow .15s ease, transform .1s ease; overflow: hidden; }
.project-card:hover { box-shadow: var(--card-shadow-hover) !important; transform: translateY(-2px); color: inherit; }

/* Reseteaza stilul implicit de <button>, pentru cazul in care un card clickable trebuie
   sa fie un buton de submit (ex. schimbare proiect curent) in loc de <a>. */
.card-btn-reset { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; font: inherit; cursor: pointer; }

/* Paleta de accente pentru carduri de proiect, ciclica pe index (fara style="" inline, blocat de CSP) */
.proj-accent-0 { --accent: #4f46e5; }
.proj-accent-1 { --accent: #0891b2; }
.proj-accent-2 { --accent: #d97706; }
.proj-accent-3 { --accent: #16a34a; }
.proj-accent-4 { --accent: #e11d48; }
.proj-accent-5 { --accent: #7c3aed; }

.project-card-accent { height: 4px; background: var(--accent, #4f46e5); }
.project-avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: color-mix(in srgb, var(--accent, #4f46e5) 14%, var(--surface-1));
    color: var(--accent, #4f46e5);
}
.project-progress { height: 6px; background: var(--surface-3); }
.project-progress .progress-bar { background: var(--accent, #4f46e5); }

.status-segbar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.status-segbar-empty { background: var(--surface-3); }
.status-seg { height: 100%; }
.status-seg:not(:last-child) { border-right: 1px solid rgba(255, 255, 255, .5); }

.feature-chip {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: .72rem;
    flex-shrink: 0;
}

.project-switch-modules .feature-chip { width: 16px; height: 16px; font-size: .55rem; }

.avatar-stack { display: flex; }
.avatar-stack-item {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-soft-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid var(--surface-1);
    margin-left: -8px;
}
.avatar-stack-item:first-child { margin-left: 0; }
.avatar-stack-more { background: var(--brand); color: #fff; }
.avatar-stack .user-avatar { border: 2px solid var(--surface-1); margin-left: -8px; }
.avatar-stack .user-avatar:first-child { margin-left: 0; }

/* ===== Tabele ===== */
.table-modern thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    font-weight: 700;
    color: var(--text-soft);
    background: var(--surface-3);
    border-bottom: 2px solid var(--border-strong);
    padding-top: .8rem;
    padding-bottom: .8rem;
}
.table-modern td { padding-top: .8rem; padding-bottom: .8rem; vertical-align: middle; }
.table-modern tbody tr { transition: background .12s ease; }
.table-modern tbody tr:hover { background: var(--surface-hover); }
.table-modern tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border-softer); }

/* Aliniaza dimensiunea textului din tabelul de tichete cu cea din panoul de filtre (ambele .875rem). */
.tickets-table td { font-size: .875rem; }

/* Listele de tabele pe mobil (sub md): un card per rand in loc de tabel cu scroll
   orizontal, cu aceleasi informatii ca in coloanele tabelului desktop. Folosit in
   toate paginile cu tabele (tickets.php, users.php, sessions.php, logs.php etc). */
.mobile-row-list { display: flex; flex-direction: column; }
.mobile-row-card {
    display: block;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--border-softer);
    transition: background-color .12s ease;
}
.mobile-row-card:last-child { border-bottom: 0; }
a.mobile-row-card:hover, a.mobile-row-card:active { background: var(--surface-hover); }
.mobile-row-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .2rem 0;
    font-size: .82rem;
}
.mobile-row-label { color: var(--text-soft); flex-shrink: 0; }

.min-w-0 { min-width: 0; }
.chart-box { position: relative; height: 220px; }
.time-card { border-left: 4px solid var(--accent-teal); }
.time-card .card-header { background: color-mix(in srgb, var(--accent-teal) 10%, var(--surface-1)); }
.ticket-highlight-card { border-left: 4px solid var(--brand); }
.ticket-actions-card { border-left: 4px solid var(--accent-teal); }
.ticket-actions-card .card-header { background: color-mix(in srgb, var(--accent-teal) 10%, var(--surface-1)); }

/* ===== Wiki ===== */
.wiki-tree-card { position: sticky; top: 76px; }
.wiki-icon-folder { color: #e9a23b; }
.wiki-icon-file { color: var(--text-soft); }

/* Arborele din sidebar: randuri intregi clickabile, ghidaj de indentare, activ evidentiat */
.wiki-tree-level { padding-left: 0; }
.wiki-tree-level .wiki-tree-level {
    padding-left: .85rem;
    margin-left: .55rem;
    border-left: 1px solid var(--border-softer);
}
.wiki-tree-row {
    display: flex;
    align-items: center;
    gap: .15rem;
    padding: .28rem .45rem;
    border-radius: .5rem;
    transition: background .12s ease;
}
.wiki-tree-row:hover { background: var(--surface-hover); }
.wiki-tree-row.active { background: var(--brand-soft); }
.wiki-tree-row.active .wiki-tree-link { font-weight: 600; color: var(--brand-text); }
.wiki-tree-link {
    color: inherit;
    text-decoration: none;
    font-size: .875rem;
    flex-grow: 1;
    min-width: 0;
}
.wiki-tree-link:hover { color: var(--brand-text); }
.wiki-tree-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    width: 1.05rem;
    line-height: 1;
    color: var(--text-soft);
    flex-shrink: 0;
}
.wiki-tree-toggle .bi { font-size: .7rem; transition: transform .15s ease; display: inline-block; }
.wiki-tree-toggle.collapsed .bi { transform: rotate(-90deg); }
.wiki-tree-toggle-spacer { display: inline-block; width: 1.05rem; flex-shrink: 0; }
/* In timpul cautarii, toate nivelurile raman desfasurate ca sa se vada potrivirile */
#wiki-tree.filtering .collapse:not(.show) { display: block; }
#wiki-tree.filtering .wiki-tree-level { border-left-color: transparent; }

/* Antetul zonei de continut (breadcrumb + actiuni) */
.wiki-content-header { min-height: 52px; }

/* Breadcrumb global, opt-in per pagina (vezi render_breadcrumb() in src/layout.php). */
.app-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .15rem;
}
.app-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 600;
}
.app-breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-soft);
    text-decoration: none;
    padding: .1rem .3rem;
    border-radius: .35rem;
    transition: color .12s ease, background-color .12s ease;
}
.app-breadcrumb-item a:hover { color: var(--brand); background: var(--surface-hover); }
.app-breadcrumb-sep { font-size: .65rem; color: var(--text-soft); opacity: .6; margin-right: .15rem; }
.app-breadcrumb-item-current span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-body);
}
.app-breadcrumb-item .bi { font-size: .85rem; }

/* Tile-uri pentru continutul unui folder */
.wiki-tile {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem .95rem;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s ease, transform .1s ease, border-color .15s ease;
}
.wiki-tile:hover {
    color: inherit;
    border-color: color-mix(in srgb, var(--brand) 35%, var(--border-soft));
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}
.wiki-tile-icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.wiki-tile-icon-folder { background: color-mix(in srgb, #e9a23b 15%, var(--surface-1)); color: #d18a1f; }
.wiki-tile-icon-file { background: var(--brand-soft); color: var(--brand-text); }

/* Chip pentru tipurile de tichet asociate unui nod */
.wiki-type-chip { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }

/* Continutul unei pagini: tipografie aerisita */
.wiki-view-box { line-height: 1.65; }
.wiki-view-box h1, .wiki-view-box h2, .wiki-view-box h3 { margin-top: 1.2em; margin-bottom: .5em; }
.wiki-view-box table { border-collapse: collapse; margin: .75rem 0; }
.wiki-view-box table td, .wiki-view-box table th { border: 1px solid var(--border-strong); padding: .35rem .6rem; }
.wiki-view-box img, .note-editable img { max-width: 100%; height: auto; }
/* Editorul Summernote ramane mereu "document alb", indiferent de tema. */
.note-editable { background: #fff !important; color: #212529; padding: 10px !important; }
.th-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.th-sort i { font-size: .75rem; opacity: .35; }
.th-sort:hover { color: var(--brand-text); }
.th-sort:hover i { opacity: .7; }
.th-sort.active { color: var(--brand-text); }
.th-sort.active i { opacity: 1; }

.table-row-link { cursor: pointer; }
.table-row-link td a { color: inherit; text-decoration: none; font-weight: 600; }
.table-row-link td a:hover { color: var(--brand-text); text-decoration: underline; }

/* ===== Badge-uri ===== */
.badge { font-weight: 600; letter-spacing: .01em; }
.priority-low { background-color: #16a34a; color: #fff; }
.priority-medium { background-color: #2563eb; color: #fff; }
.priority-high { background-color: var(--accent-amber); color: #fff; }
.priority-urgent { background-color: var(--accent-rose); color: #fff; }

/* ===== Butoane de actiune pe rand (tabele si liste) =====
   Acelasi buton peste tot: dimensiune fixa, iconita standard pe rol
   (bi-pencil = editare, bi-trash = stergere), fara bordura, hover subtil. */
.btn-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1;
    transition: background .12s ease, color .12s ease;
}
.btn-row-action:hover, .btn-row-action:focus-visible { background: var(--surface-3); color: var(--brand-text); }
.btn-row-action:disabled { opacity: .4; }
.btn-row-action.btn-row-danger { color: var(--accent-rose); }
.btn-row-action.btn-row-danger:hover, .btn-row-action.btn-row-danger:focus-visible {
    background: color-mix(in srgb, var(--accent-rose) 12%, var(--surface-1));
    color: var(--accent-rose);
}

/* ===== Componente specifice aplicatiei ===== */
.chip-off { opacity: .5; text-decoration: line-through; }

.ticket-side-card { position: sticky; top: 76px; }
.history-toggle-icon { transition: transform .2s ease; }
[aria-expanded="true"] .history-toggle-icon { transform: rotate(180deg); }
.avatar-sm {
    width: 30px; height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.user-avatar {
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    cursor: default;
    line-height: 1;
    user-select: none;
}
.user-avatar-xs { width: 22px; height: 22px; font-size: 9px; }
.user-avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.user-avatar-md { width: 38px; height: 38px; font-size: 14px; }
.user-avatar-popover { min-width: 160px; }
.user-avatar-popover-box { max-width: 240px; }
.user-avatar-popover-box .popover-body { padding: .6rem .75rem; }

/* Pagina de login este in afara sistemului de teme: pastreaza mereu designul propriu. */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%);
    position: relative;
    overflow: hidden;
}
/* Pete de lumina decorative in fundal */
.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.login-page::before {
    width: 480px; height: 480px;
    top: -140px; right: -100px;
    background: radial-gradient(circle, rgba(129, 140, 248, .4), transparent 70%);
}
.login-page::after {
    width: 420px; height: 420px;
    bottom: -160px; left: -120px;
    background: radial-gradient(circle, rgba(34, 211, 238, .22), transparent 70%);
}
.login-wrap { width: 100%; max-width: 400px; position: relative; z-index: 1; }
.login-card { border-radius: var(--bs-border-radius-lg); }
.login-card-accent { height: 5px; background: linear-gradient(90deg, #4f46e5, #8b5cf6, #0891b2); }
.brand-mark-lg {
    width: 52px; height: 52px;
    border-radius: .9rem;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 6px 18px rgba(79, 70, 229, .35);
}

/* Input cu iconita in stanga + buton arata/ascunde parola in dreapta */
.input-icon-wrap { position: relative; }
.input-icon-wrap > i {
    position: absolute;
    left: .95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    opacity: .75;
    pointer-events: none;
}
.password-toggle {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-soft);
    padding: .3rem .55rem;
    border-radius: .5rem;
    line-height: 1;
}
.password-toggle:hover { color: var(--brand-text); background: var(--surface-3); }

/* ===== Utilitare (CSP blocheaza style="" inline, deci folosim clase) ===== */
.cell-truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-box { max-height: 200px; overflow-y: auto; }
.text-pre-line { white-space: pre-line; }
.btn-close-tiny { font-size: .55rem; }
.text-tiny { font-size: .6rem; }
.flex-input-sm { width: auto; flex: 1 1 140px; }
.workflow-legend-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; }
.status-color-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.workflow-diagram { max-width: 560px; }
.js-drag-item.dragging { opacity: .4; background: var(--bs-tertiary-bg, #f1f3f9); }
.drag-handle { cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }

.modal-section { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: .75rem; padding: 1.1rem 1.35rem; }
.modal-section-title {
    font-size: .95rem; font-weight: 700; letter-spacing: .01em;
    color: var(--brand-text); margin-bottom: .65rem; display: flex; align-items: center; gap: .5rem;
}

/* ===== Picker cu cautare pentru consum materiale (modal activitate) ===== */
.material-search-icon {
    position: absolute;
    left: .95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    opacity: .75;
    pointer-events: none;
}
.material-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1080;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: .6rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
    max-height: 264px;
    overflow-y: auto;
    padding: .3rem;
}
.material-result-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .45rem .6rem;
    border: 0;
    background: transparent;
    border-radius: .5rem;
    text-align: left;
    font-size: .875rem;
    color: inherit;
}
.material-result-item:hover, .material-result-item.active { background: var(--surface-hover); }
.material-result-item:disabled { opacity: .5; }
.material-result-empty { padding: .45rem .6rem; }
.material-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: .6rem;
    padding: .5rem .65rem .5rem .8rem;
}
.material-row .flex-grow-1 { flex-basis: 160px; }
.material-qty-group { width: 140px; flex-shrink: 0; }
/* Lista de materiale adaugate la intrarea din document: propriul scroll, ca modalul (fara
   modal-dialog-scrollable, care ar clipa dropdown-ul de cautare pozitionat absolut) sa nu
   creasca nelimitat cu multe materiale adaugate. */
.material-selected-scroll { max-height: 320px; overflow-y: auto; padding-right: .25rem; }

/* ===== Modul Documente: panoul de atasamente (render_document_panel) ===== */
.document-list { display: flex; flex-direction: column; gap: .4rem; }
.document-item,
.document-edit-row {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: .6rem;
    padding: .45rem .6rem;
}
.document-item-icon { font-size: 1.35rem; opacity: .8; flex-shrink: 0; }
.document-upload-form .form-text { margin-top: .25rem; }
/* Iconitele de actiune (vizualizare/descarcare/editare/stergere) raman ascunse pana la hover
   sau focus pe rand, ca lista de fisiere sa ramana curata vizual. */
.document-item .btn-row-action { opacity: 0; transition: opacity .12s ease, background .12s ease, color .12s ease; }
.document-item:hover .btn-row-action,
.document-item:focus-within .btn-row-action { opacity: 1; }

.ticket-action-row {
    background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: .6rem; padding: .65rem .8rem;
    transition: background-color .15s ease, border-color .15s ease;
}
.ticket-action-row.action-status-done {
    background: color-mix(in srgb, #16a34a 10%, var(--surface-1));
    border-color: color-mix(in srgb, #16a34a 35%, var(--surface-1));
}
.ticket-action-row.action-status-na {
    background: color-mix(in srgb, #d97706 10%, var(--surface-1));
    border-color: color-mix(in srgb, #d97706 35%, var(--surface-1));
}

/* ===== Navigare taburi in zona de setari proiect ===== */
.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    background: var(--surface-3);
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    padding: .35rem;
    margin-bottom: 1.5rem;
}
.settings-nav .nav-item { display: flex; }
.settings-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--text-soft-2);
    font-size: .85rem;
    font-weight: 600;
    padding: .55rem 1rem;
    border-radius: .55rem;
    white-space: nowrap;
    transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.settings-nav .nav-link i { font-size: .95rem; opacity: .7; }
.settings-nav .nav-link:hover { background: var(--surface-1); color: var(--brand-text); }
.settings-nav .nav-link.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 2px 6px rgba(var(--brand-rgb), .35);
}
.settings-nav .nav-link.active i,
.settings-nav .nav-link.active:hover { color: #fff; opacity: 1; }

/* ===== Carduri informative (sfaturi) folosite in barele laterale din setari proiect ===== */
.settings-tip-card { border-left: 4px solid var(--brand); background: var(--surface-2); }
.settings-tip-card .card-body { font-size: .82rem; color: var(--text-soft-2); }
.settings-tip-card .bi { color: var(--brand-text); }

/* ===== Carduri vizuale in modalul de automatizari (design curat, pas cu pas) ===== */
.automation-modal-body {
    max-height: 72vh;
    overflow-y: auto;
    background: var(--surface-2);
}
.automation-card {
    border: 1px solid var(--border-soft);
    box-shadow: none;
}
.automation-card:last-child { margin-bottom: 0 !important; }
.automation-card-header {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-soft-2);
    background: var(--surface-3, var(--surface-2));
}
.automation-card-header i { color: var(--brand-text); font-size: 1rem; }
.automation-collapse-caret { transition: transform .15s ease; display: inline-block; }
[aria-expanded="true"] .automation-collapse-caret { transform: rotate(90deg); }
.automation-cond-multibox { max-height: 140px; overflow-y: auto; }

/* Picker de token-uri [camp]: ascuns discret, apare doar cat inputul/textarea asociat are
   focus (sau cat userul interactioneaza cu tag-urile insesi — :focus-within ramane activ
   cand focusul trece pe un buton din interiorul aceluiasi wrapper). */
.automation-token-picker {
    display: none;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .35rem;
}
.automation-token-field:focus-within .automation-token-picker {
    display: flex;
}
.automation-token-tag {
    font-size: .72rem;
    line-height: 1.4;
    font-weight: 500;
    color: var(--brand-text);
    background: var(--surface-3, var(--surface-2));
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: .1rem .6rem;
    cursor: pointer;
}
.automation-token-tag:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Picker de iconite (Bootstrap Icons) pt. modalul de creare a unui tip de entitate. */
.icon-picker-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem; height: 2.4rem;
    flex-shrink: 0;
    border-radius: .5rem;
    background: var(--surface-3);
    color: var(--text-body);
    font-size: 1.1rem;
}
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
    gap: .4rem;
    max-height: 11rem;
    overflow-y: auto;
    padding: .5rem;
    border: 1px solid var(--border-soft);
    border-radius: .5rem;
    background: var(--surface-1);
}
.icon-picker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem; height: 2.4rem;
    border-radius: .5rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-soft-2);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.icon-picker-btn:hover { background: var(--surface-hover); color: var(--text-body); }
.icon-picker-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Rand de material marcat pentru stergere in modalul de editare document de intrare. */
.js-wh-doc-edit-line-marked {
    opacity: .55;
}
.js-wh-doc-edit-line-marked .js-wh-doc-edit-line-label {
    text-decoration: line-through;
}

/* Comutator vizualizare (Listă/Kanban/Timeline/Calendar) pe pagina de tichete - segmented
   control modern, disponibil doar pe ecrane mari (d-none d-lg-flex aplicat in markup). */
.view-switcher {
    display: inline-flex;
    gap: .15rem;
    padding: .2rem;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: .7rem;
}
.view-switcher-item {
    display: inline-flex;
    align-items: center;
    padding: .35rem .75rem;
    border-radius: .5rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.view-switcher-item:hover { color: var(--text-body); background: var(--surface-hover); }
.view-switcher-item-active,
.view-switcher-item-active:hover {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 .1rem .35rem rgba(var(--brand-rgb), .35);
}
/* Text vizibil doar pentru elementul activ si la hover; restul raman doar iconite.
   Pentru rollback rapid: sterge acest bloc (labelurile revin permanent vizibile). */
.view-switcher-item .view-switcher-label {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width .16s ease, opacity .12s ease, margin-left .16s ease;
}
.view-switcher-item:hover .view-switcher-label,
.view-switcher-item-active .view-switcher-label {
    max-width: 6rem;
    opacity: 1;
    margin-left: .35rem;
}
.view-switcher-item i { margin: 0; }

/* Kanban: coloane pe stare, carduri draggable. */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: .5rem;
}
.kanban-column {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: .75rem;
    max-height: calc(100vh - 320px);
    min-height: 200px;
    transition: background-color .12s ease, border-color .12s ease;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--border-soft);
    font-weight: 600;
}
.kanban-column-dot {
    width: .6rem; height: .6rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.kanban-column-title { flex-grow: 1; }
.kanban-column-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: .6rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.kanban-column-disabled { opacity: .4; }
.kanban-column-valid-target.kanban-column-over {
    background: var(--brand-soft);
    border-color: var(--brand);
}
.kanban-card {
    background: var(--surface-1, #fff);
    border: 1px solid var(--border-softer);
    border-radius: .6rem;
    padding: .6rem .7rem;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.kanban-card-dragging { opacity: .4; }
.kanban-card-title {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-body);
    text-decoration: none;
}
.kanban-card-title:hover { color: var(--brand); }

/* Timeline/Gantt: toolbar de navigare luna + grila CSS de zile pe toata latimea disponibila. */
.timeline-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.timeline-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem; height: 2.1rem;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    color: var(--text-body);
    text-decoration: none;
    transition: background-color .12s ease, border-color .12s ease;
}
.timeline-nav-btn:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.timeline-month-title {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: capitalize;
    min-width: 12rem;
    text-align: center;
    margin: 0;
}
.gantt-wrapper {
    display: flex;
    border: 1px solid var(--border-soft);
    border-radius: .9rem;
    overflow: hidden;
    background: var(--surface-1, #fff);
    box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .05);
}
.gantt-labels {
    flex-shrink: 0;
    width: 270px;
    border-right: 1px solid var(--border-soft);
    background: var(--surface-2);
}
.gantt-label-header { height: 32px; border-bottom: 1px solid var(--border-soft); }
.gantt-label {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 .7rem;
    border-bottom: 1px solid var(--border-softer);
    overflow: hidden;
}
.gantt-label > .js-ticket-group-toggle,
.gantt-label > .bi-arrow-return-right,
.gantt-label > .badge {
    flex-shrink: 0;
}
.gantt-label-trigger {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
    cursor: pointer;
}
.gantt-label-title {
    font-size: .8rem;
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.gantt-label-trigger:hover .gantt-label-title { color: var(--brand); text-decoration: underline; }
.gantt-label-badges { display: flex; align-items: center; gap: .3rem; }
.gantt-label-status {
    font-size: .62rem;
    font-weight: 700;
    color: #fff;
    padding: .05rem .4rem;
    border-radius: .25rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 7rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
}
.gantt-label-priority { font-size: .62rem; padding: .05rem .4rem; border-radius: .25rem; }
.gantt-chart { overflow-x: auto; flex-grow: 1; }
.gantt-grid { display: grid; position: relative; }
/* Evidentiere pe toata latimea randului la hover (eticheta SAU orice bara/activitate a
   aceluiasi tichet) - fara ea e greu de urmarit carui tichet ii apartine un grafic care
   incepe spre finalul lunii. Randul din spatele barelor (z-index implicit, randat primul in
   DOM) + eticheta corespunzatoare, sincronizate prin JS (vezi tickets.js). */
.gantt-row-highlight {
    background: var(--surface-hover);
    pointer-events: none;
}
.gantt-label.gantt-row-hover {
    background: var(--surface-hover);
}
.gantt-day-header {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-soft);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-soft);
    border-left: 1px solid var(--border-softer);
}
.gantt-today-col { background: var(--brand-soft); }
/* Linia verticala a unui milestone: acopera intreaga inaltime a grilei, clickabila -> aplica
   filtrul de milestone (vezi ?milestone=ID in qs_with()). */
.gantt-milestone-line {
    position: relative;
    border-left: 2px dashed var(--accent-amber, #f59e0b);
    z-index: 3;
    display: block;
}
.gantt-milestone-flag {
    position: sticky;
    top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent-amber, #f59e0b);
    color: #fff;
    font-size: 10px;
    margin-left: -10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.gantt-milestone-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}
.gantt-milestone-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: .5rem;
    background: var(--surface-2);
    color: var(--text-body);
    text-decoration: none;
}
.gantt-milestone-legend-item:hover { background: var(--surface-hover); color: var(--brand); }
.gantt-milestone-legend-item .bi { color: var(--accent-amber, #f59e0b); }
.gantt-bar {
    align-self: center;
    height: 22px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.gantt-bar-first { border-top-left-radius: .35rem; border-bottom-left-radius: .35rem; }
.gantt-bar-last { border-top-right-radius: .35rem; border-bottom-right-radius: .35rem; }
.gantt-bar-overdue-border {
    align-self: center;
    height: 30px;
    border: 2px solid #dc2626;
    border-radius: .45rem;
    box-sizing: border-box;
    background: transparent;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, .15);
}
.gantt-activity-slot {
    align-self: center;
    justify-self: center;
    z-index: 2;
}

/* Avatar de activitate (initiale user) cu popover Bootstrap la click - Timeline + Calendar.
   Halo alb (box-shadow) ca sa se distinga clar de culoarea barei/bordurii din spate. */
.activity-avatar {
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
    width: 22px; height: 22px;
    font-size: 9px;
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 2px var(--surface-1, #fff), 0 1px 3px rgba(0, 0, 0, .3);
}
.activity-popover { min-width: 240px; max-width: 340px; }
.activity-popover-box { max-width: 400px; }
.activity-popover-box .popover-body { padding: .85rem 1rem; }
.activity-popover-actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; }
.activity-popover-actions .badge { font-size: .65rem; margin-right: .3rem; }

/* Calendar: grila lunara CSS. */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-soft);
    border: 1px solid var(--border-soft);
    border-radius: .9rem;
    overflow: hidden;
    box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .05);
}
.calendar-weekday {
    background: var(--surface-2);
    text-align: center;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .55rem 0;
    color: var(--text-soft);
}
.calendar-cell {
    background: var(--surface-1, #fff);
    min-height: 100px;
    padding: .4rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    transition: background-color .12s ease;
}
.calendar-cell-outside { background: var(--surface-2); }
.calendar-cell-today { background: var(--brand-soft); }
.calendar-cell-day {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-soft);
    width: 1.4rem; height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.calendar-cell-today .calendar-cell-day { background: var(--brand); color: #fff; }
.calendar-chip {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    padding: .1rem .3rem;
    border-radius: .3rem;
    background: var(--surface-2);
    color: var(--text-body);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.calendar-chip:hover { background: var(--surface-hover); }
.calendar-chip-dot {
    width: .45rem; height: .45rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-soft);
}
/* Design neutru: un singur fundal pt. toate tipurile de chip, doar iconita ramane colorata
   (semantica pastrata prin culoarea icon-ului, nu prin fundal). */
.calendar-chip-opened .bi { color: #16a34a; }
.calendar-chip-activity .bi { color: #2563eb; }
.calendar-chip-closed .bi { color: #7c3aed; }
.calendar-chip-overdue { box-shadow: inset 2px 0 0 #dc2626; }
.calendar-chip-warn { font-size: .68rem; flex-shrink: 0; color: #dc2626; }
.activity-chip-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem; height: 1rem;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 7px;
    flex-shrink: 0;
    line-height: 1;
}
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-bottom: 1rem;
    padding: .5rem .75rem;
    background: var(--surface-2);
    border-radius: .6rem;
    font-size: .78rem;
    color: var(--text-soft);
}
.calendar-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.calendar-legend-opened { color: #16a34a; }
.calendar-legend-activity { color: #2563eb; }
.calendar-legend-closed { color: #7c3aed; }

/* ===== Etichete (tag-uri) tichete ===== */
.ticket-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .3rem .2rem .55rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    color: var(--text-soft);
    font-size: .78rem;
    line-height: 1.4;
}
.ticket-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    padding: 0;
    font-size: .7rem;
}
.ticket-tag-remove:hover { background: var(--surface-hover); color: var(--danger, #dc3545); }
.ticket-tag-input-wrap { max-width: 280px; }
.ticket-tag-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1080;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: .6rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
    max-height: 200px;
    overflow-y: auto;
    padding: .3rem;
}
.ticket-tag-suggestion-item {
    display: block;
    width: 100%;
    padding: .35rem .55rem;
    border: 0;
    background: transparent;
    border-radius: .5rem;
    text-align: left;
    font-size: .82rem;
    color: inherit;
}
.ticket-tag-suggestion-item:hover, .ticket-tag-suggestion-item.active { background: var(--surface-hover); }

/* Etichete afisate neutru/discret sub titlul tichetului in lista (aceeasi forma de "eticheta"
   ca in tichet, .ticket-tag-chip, dar mai mica si fara buton de stergere - vezi .ticket-tag-chip-sm) */
.ticket-tag-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .2rem;
}
.ticket-tag-chip-sm {
    padding: .1rem .5rem;
    font-size: .7rem;
}

/* Filtrul multi-select de etichete (panoul de filtre tichete): aceleasi pastile mici/neutre ca in
   lista de tichete (.ticket-tag-chip-sm), doar ca devin clickabile (label pt. un btn-check ascuns);
   scrollabil pe verticala - suporta si liste lungi (ex. 100 de etichete pe proiect), cu camp de
   cautare deasupra (js-tag-filter-search) care ascunde pastilele nepotrivite. */
.ticket-filter-tags-list {
    max-height: 220px;
    overflow-y: auto;
    padding: .5rem;
    border: 1px solid var(--border-soft);
    border-radius: .5rem;
    background: var(--surface-1);
    align-content: flex-start;
}
/* Pastilele din filtru refolosesc stilul mic/neutru din .ticket-tag-chip-sm (acelasi ca afisarea
   din lista de tichete), doar ca sunt clickabile (label pt. un btn-check ascuns) si capata o
   evidentiere discreta cand sunt selectate. */
.ticket-tag-chip-filter {
    cursor: pointer;
    user-select: none;
}
.ticket-tag-chip-filter:hover {
    background: var(--surface-hover);
}
.btn-check:checked + .ticket-tag-chip-filter {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* Subtichete in Listă/Cronologie: fundal gri subtil pe randul-parinte (are subtichete). Cat timp
   grupul e expandat (.ticket-group-expanded, adaugata de JS pe randul-parinte la click pe
   chevron), atat parintele cat si subtichetele vizibile primesc o dunga colorata pe marginea
   stanga (aceeasi culoare, brand) + fundal usor mai intens, ca sa se vada clar ca fac parte
   din acelasi grup - box-shadow inset in loc de border, functioneaza uniform pe <td> si <div>. */
.ticket-row-has-children {
    background: var(--surface-hover);
}
.ticket-row-has-children:hover,
tr.ticket-row-has-children.table-row-link:hover {
    background: var(--surface-hover);
    filter: brightness(0.97);
}
tr.ticket-row-has-children.ticket-group-expanded > td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}
.gantt-label.ticket-row-has-children.ticket-group-expanded {
    box-shadow: inset 3px 0 0 var(--brand);
}
.mobile-row-card.ticket-row-has-children {
    box-shadow: inset 3px 0 0 var(--brand);
}
.ticket-row-child > td {
    background: var(--surface-hover);
}
.ticket-row-child > td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}
.gantt-label.ticket-row-child {
    background: var(--surface-hover);
    box-shadow: inset 3px 0 0 var(--brand);
}
.mobile-row-card.ticket-row-child {
    background: var(--surface-hover);
    box-shadow: inset 3px 0 0 var(--brand);
}
