/**
 * Nexus UI Components – Szeparált Komponens Stílusok
 * 
 * Központi CSS az összes Web Components elemhez:
 * - <nexus-header>
 * - <nexus-select> (Custom Dropdown)
 * - <nexus-input>
 * - <nexus-switch>
 * - <nexus-card> & <nexus-section-card>
 * - <nexus-stat-box>
 * - <nexus-ticket-card>
 * - <nexus-item-row>
 * - <nexus-presence-board> & <nexus-presence-item>
 * - <nexus-modal>, NexusUI (confirm / alert / toast), <nexus-calendar>, <nexus-state>, <nexus-table>,
 *   <nexus-badge>, <nexus-field>
 */

/* ── 1. Oldalfejléc (<nexus-header>) ────────────────────────────────────────── */
nexus-header {
    display: block;
    width: 100%;
}

nexus-header:not(:defined),
nexus-dashboard-header:not(:defined) {
    visibility: hidden;
    min-height: 92px;
    display: block;
}

.nexus-header-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.nexus-header-card {
    border-radius: var(--nexus-card-radius, 1rem);
    background: var(--nexus-card-bg, #ffffff);
    border: 1px solid var(--nexus-card-border, #e2e8f0);
    box-shadow: var(--nexus-card-shadow, 0 1px 3px rgba(0, 0, 0, 0.05));
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nexus-header-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Üres jelvénysor / lábsor (a d-flex !important miatt külön kell rejteni) */
.nexus-header__badges[hidden],
.nexus-header__footer[hidden] {
    display: none !important;
}

/* ── 1/b. Beviteli mező (<nexus-input>) ────────────────────────────────────────
   Egyedi elemként alapból inline lenne (a tartalmához zsugorodna, pl. a kereső placeholderje levágódik):
   mindig kitölti a rendelkezésre álló szélességet, flex sorban is (flex-grow-1 mellett is működik) */
nexus-input {
    display: block;
    width: 100%;
    min-width: 0;
}

nexus-input .input-group,
nexus-input .form-control,
nexus-input textarea {
    width: 100%;
}

nexus-input .input-group > .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── 2. Egyedi Lekerekített Select (<nexus-select>) ─────────────────────────── */
nexus-select,
nexus-select.filter-active,
.nexus-select-wrapper {
    display: block;
    width: 100%;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.nexus-custom-select {
    position: relative;
    width: 100%;
}

.nexus-custom-select .nexus-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    background-color: var(--nexus-input-bg, #ffffff);
    border: 1px solid var(--nexus-input-border, #cbd5e1);
    color: var(--nexus-text-main, #1e293b);
    border-radius: 0.5rem;
    min-height: 38px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
    cursor: pointer;
    background-image: none !important;
}

.nexus-custom-select .nexus-select-btn.form-select-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.84rem;
    min-height: 34px;
}

.nexus-custom-select .nexus-select-btn.form-select-lg {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    min-height: 46px;
}

.nexus-custom-select .nexus-select-btn.rounded-pill {
    border-radius: 50rem !important;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
}

.nexus-custom-select .nexus-select-btn.rounded-3 {
    border-radius: 0.5rem !important;
}

.nexus-custom-select .nexus-select-btn:hover {
    border-color: var(--nexus-accent-blue, #0284c7);
    background-color: var(--nexus-input-bg-hover, #f8fafc);
}

.nexus-custom-select .nexus-select-btn:focus,
.nexus-custom-select .nexus-select-btn.open-active {
    border-color: var(--nexus-accent-blue, #0284c7);
    box-shadow: 0 0 0 0.2rem rgba(2, 132, 199, 0.18);
    outline: 0;
}

/* Kijelölt állapot (szűrés aktív): letisztult prémium Nexus kék border és diszkrét fókuszgyűrű */
nexus-select.filter-active .nexus-select-btn,
nexus-select.filter-active select.form-select,
.nexus-custom-select .nexus-select-btn.has-selection,
.nexus-custom-select .nexus-select-btn.filter-active,
select.form-select.has-selection {
    background-color: var(--nexus-input-bg, #ffffff) !important;
    border-color: var(--nexus-accent-blue, #0284c7) !important;
    box-shadow: 0 0 0 0.15rem rgba(2, 132, 199, 0.16) !important;
    color: var(--nexus-text-main, #0f172a) !important;
    font-weight: 600 !important;
}

[data-bs-theme="dark"] nexus-select.filter-active .nexus-select-btn,
[data-bs-theme="dark"] nexus-select.filter-active select.form-select,
[data-bs-theme="dark"] .nexus-custom-select .nexus-select-btn.has-selection,
[data-bs-theme="dark"] .nexus-custom-select .nexus-select-btn.filter-active,
[data-bs-theme="dark"] select.form-select.has-selection {
    background-color: var(--nexus-input-bg, #1e293b) !important;
    border-color: var(--nexus-accent-blue, #38bdf8) !important;
    box-shadow: 0 0 0 0.15rem rgba(56, 189, 248, 0.2) !important;
    color: var(--nexus-text-main, #f8fafc) !important;
}

.nexus-custom-select .transition-transform {
    transition: transform 0.2s ease;
}

.nexus-custom-select .rotate-180 {
    transform: rotate(180deg);
}

/* Lenyíló menüablak */
.nexus-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1060;
    min-width: 100%;
    max-height: 320px;
    overflow-y: auto;
    border-radius: 1.15rem !important;
    background: var(--nexus-card-bg, #ffffff) !important;
    border: 1px solid var(--nexus-card-border, #e2e8f0) !important;
    box-shadow: var(--nexus-shadow-md) !important;
    padding: 0 !important;
    scrollbar-width: thin;
}

.nexus-select-menu::-webkit-scrollbar {
    width: 6px;
}

.nexus-select-menu::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 4px;
}

/* Dropdown beépített kereső */
.nexus-select-search-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--nexus-card-bg, #ffffff);
    border-top-left-radius: 1.15rem;
    border-top-right-radius: 1.15rem;
    border-bottom: 1px solid var(--nexus-card-border, #e2e8f0);
}

[data-bs-theme="dark"] .nexus-select-search-wrap {
    background: var(--nexus-card-bg, #1e293b);
}

.nexus-select-search {
    background-color: var(--nexus-input-bg, #f8fafc) !important;
    border-color: var(--nexus-card-border, #cbd5e1) !important;
    color: var(--nexus-text-main, #1e293b) !important;
    font-size: 0.82rem;
}

.nexus-select-search:focus {
    border-color: var(--nexus-accent-blue, #0284c7) !important;
    box-shadow: 0 0 0 0.15rem rgba(2, 132, 199, 0.15) !important;
}

.nexus-select-items-wrap {
    padding: 0.35rem;
}

.nexus-select-menu .dropdown-item {
    border-radius: 0.65rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--nexus-text-main, #334155);
    transition: background-color 0.12s ease, color 0.12s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.nexus-select-menu .dropdown-item:hover,
.nexus-select-menu .dropdown-item:focus {
    background-color: var(--nexus-accent-blue-subtle, rgba(2, 132, 199, 0.08));
    color: var(--nexus-accent-blue, #0284c7);
}

.nexus-select-menu .dropdown-item.active-item {
    background-color: var(--nexus-accent-blue-subtle, rgba(2, 132, 199, 0.12));
    color: var(--nexus-accent-blue, #0284c7);
    font-weight: 600;
}

/* ── 3. Kapcsoló (<nexus-switch>) ───────────────────────────────────────────── */
nexus-switch {
    display: inline-block;
}

.nexus-switch-container .form-check-input {
    cursor: pointer;
    width: 2.25rem;
    height: 1.25rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nexus-switch-container .form-check-label {
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
}

/* ── 4. Kártyák (<nexus-card>, <nexus-section-card>, <nexus-widget>) ────────── */
nexus-card,
nexus-widget {
    display: block;
    width: 100%;
    height: 100%;
}

nexus-section-card {
    display: block;
    width: 100%;
    margin-bottom: 1.5rem;
}

nexus-section-card.h-100 > .nexus-section-card {
    height: 100%;
}

.nexus-section-card.card-nexus {
    padding: 1.5rem;
}

.nexus-section-body {
    flex: 1 1 auto;
    min-width: 0;
}

.nexus-section-card.nexus-section-card--padding-sm {
    padding: 1rem;
}

.nexus-section-card.nexus-section-card--padding-lg {
    padding: 2rem;
}

.nexus-section-card.nexus-section-card--padding-none,
.nexus-section-card.nexus-section-card--flush {
    padding: 0;
    overflow: hidden;
}

.nexus-section-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--nexus-card-border);
}

.nexus-section-card__header[hidden] {
    display: none;
}

.nexus-section-card--flush > .nexus-section-card__header {
    padding: 1rem 1.5rem;
    margin-bottom: 0;
}

.nexus-section-card__heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.nexus-section-card__heading > i[hidden],
.nexus-section-card__title[hidden],
.nexus-section-card__description[hidden],
.nexus-section-actions > nexus-badge[hidden] {
    display: none;
}

.nexus-section-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--nexus-text-main);
}

.nexus-section-card__description {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--nexus-text-muted);
}

.nexus-section-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

/* Összecsukható szakaszkártya (collapsible="true") */
.nexus-section-card__heading--toggle {
    cursor: pointer;
    user-select: none;
}

.nexus-section-card__toggle {
    padding: 0.15rem 0.35rem;
    line-height: 1;
    color: var(--nexus-text-muted);
}

.nexus-section-card__toggle:hover,
.nexus-section-card__toggle:focus-visible {
    color: var(--nexus-text-main);
}

.nexus-section-card__toggle .bi {
    display: inline-block;
    transition: transform 0.2s ease;
}

.nexus-section-card--collapsed .nexus-section-card__toggle .bi {
    transform: rotate(180deg);
}

.nexus-section-card--collapsed > .nexus-section-card__header {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.nexus-section-card--flush.nexus-section-card--collapsed > .nexus-section-card__header {
    padding-bottom: 1rem;
}

.nexus-section-body[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .nexus-section-card__toggle .bi {
        transition: none;
    }
}

@media print {
    .nexus-section-card.card-nexus {
        box-shadow: none !important;
        border-color: #ccc !important;
        background: transparent !important;
    }

    .nexus-section-card__header {
        break-after: avoid;
    }

    /* Műveleti gombok és az összecsukó gomb papíron értelmetlen; a jelvény marad */
    .nexus-section-actions > :not(nexus-badge),
    .nexus-section-card__toggle {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .nexus-section-card.card-nexus:not(.nexus-section-card--flush):not(.nexus-section-card--padding-none) {
        padding: 1rem;
    }

    .nexus-section-card--flush > .nexus-section-card__header {
        padding: 0.85rem 1rem;
    }
}

/* Kártya stílus variációk */
.nexus-card-warning-border {
    border-color: #f59e0b !important;
}

[data-bs-theme="dark"] .nexus-card-warning-border {
    border-color: rgba(245, 158, 11, 0.7) !important;
}

.nexus-approval-item {
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.22) !important;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nexus-approval-item:hover {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
}

[data-bs-theme="dark"] .nexus-approval-item {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
}

[data-bs-theme="dark"] .nexus-approval-item:hover {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

.nexus-card-active-work {
    border-color: var(--nexus-accent-blue, #2563eb) !important;
    box-shadow: 0 0 0 1.5px var(--nexus-accent-blue, #2563eb), 0 4px 14px rgba(37, 99, 235, 0.12) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ── 5. Hibajegy Kártya (<nexus-ticket-card>) ───────────────────────────────── */
nexus-ticket-card {
    display: block;
    min-width: 0;
    height: 100%;
    z-index: 100;
}

nexus-stat-box,
nexus-item-row,
nexus-quick-btn,
nexus-server-item,
nexus-dashboard-computer {
    display: block;
    min-width: 0;
    overflow: hidden;
}

/* ── 6. KPI Kártyasor (<nexus-stat-row>) ────────────────────────────────────── */
/* A dobozok mindig kitöltik a teljes sort; ha nem férnek el, kiegyensúlyozva törnek több sorba.
   A --nexus-stat-basis értékét a komponens (stat-row.js) számolja a szélességből és a dobozok számából. */
nexus-stat-row {
    --nexus-stat-min: 190px;
    --nexus-stat-gap: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: var(--nexus-stat-gap);
    width: 100%;
}

nexus-stat-row > * {
    flex: 1 1 var(--nexus-stat-basis, var(--nexus-stat-min));
    min-width: 0;
}

nexus-stat-row > nexus-stat-box > .summary-stat-box {
    height: 100%;
    min-width: 0;
}

@media (max-width: 575.98px) {
    nexus-stat-row {
        --nexus-stat-min: 150px;
        --nexus-stat-gap: 0.75rem;
    }

    /* Telefonon két doboz fér egy sorba: kisebb ikon és belső térköz, hogy az érték ne törjön */
    nexus-stat-row .summary-stat-box {
        padding: 0.7rem 0.8rem;
        gap: 0.6rem;
    }

    nexus-stat-row .summary-stat-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1.1rem;
    }

    nexus-stat-row .summary-stat-box .fs-4 {
        font-size: 1.2rem !important;
    }
}

/* ── 7. Számítógép Kártya Stílusok ─────────────────────────────────────────── */
.computer-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.35rem;
    transition: transform 0.2s ease;
}

.metric-card-inner {
    border: 1px solid var(--nexus-card-border, #e2e8f0);
    border-radius: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: var(--nexus-card-bg-elevated, rgba(125, 125, 125, 0.03));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.power-bar-bg {
    height: 4px;
    width: 100%;
    background: rgba(125, 125, 125, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.4rem;
}

.power-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── 8. Gyorsindító Presetek & Modal Stílusok ──────────────────────────────── */
.nexus-preset-card {
    background: var(--nexus-card-bg, #ffffff);
    border: 1px solid var(--nexus-card-border, #e2e8f0);
    border-radius: 0.85rem;
    padding: 0.75rem 1rem;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.nexus-preset-card:hover {
    border-color: var(--nexus-accent-blue, #2563eb);
    background: var(--nexus-accent-blue-subtle, rgba(37, 99, 235, 0.04));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nexus-preset-card.is-active {
    background: var(--nexus-accent-blue-subtle, rgba(37, 99, 235, 0.07));
    border-color: var(--nexus-accent-blue, #2563eb);
}

[data-bs-theme="dark"] .nexus-preset-card {
    background: var(--nexus-card-bg, #1e293b);
    border-color: var(--nexus-card-border, #334155);
}

[data-bs-theme="dark"] .nexus-preset-card:hover {
    border-color: var(--nexus-accent-blue, #38bdf8);
    background: rgba(56, 189, 248, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .nexus-preset-card.is-active {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--nexus-accent-blue, #38bdf8);
}

.nexus-preset-icon-box {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nexus-preset-card:hover .nexus-preset-icon-box {
    transform: scale(1.08);
}

/* Színes pasztell hátterek a preset ikonokhoz */
.bg-purple-subtle {
    background-color: rgba(147, 51, 234, 0.12) !important;
}

.text-purple {
    color: #9333ea !important;
}

.bg-indigo-subtle {
    background-color: rgba(99, 102, 241, 0.12) !important;
}

.text-indigo {
    color: #6366f1 !important;
}

.bg-teal-subtle {
    background-color: rgba(20, 184, 166, 0.12) !important;
}

.text-teal {
    color: #0d9488 !important;
}

.bg-pink-subtle {
    background-color: rgba(236, 72, 153, 0.12) !important;
}

.text-pink {
    color: #db2777 !important;
}

[data-bs-theme="dark"] .text-purple {
    color: #c084fc !important;
}

[data-bs-theme="dark"] .text-indigo {
    color: #818cf8 !important;
}

[data-bs-theme="dark"] .text-teal {
    color: #2dd4bf !important;
}

[data-bs-theme="dark"] .text-pink {
    color: #f472b6 !important;
}

/* ── 9. Általános Ikon és Szöveg Térköz Biztonsági Szabályok ─────────────────── */
.nexus-header-card h4 i,
.nexus-section-card .fw-bold i,
.card-nexus-title i,
.spec-box-header i,
.section-heading i {
    margin-right: 0.5rem;
    flex-shrink: 0;
    display: inline-block;
}

.badge>i:first-child:not(:only-child),
.btn>i:first-child:not(:only-child),
.btn>i:not(:last-child),
.btn>.spinner-border:not(:last-child),
.nav-link>i:first-child:not(:only-child),
.dropdown-item>i:first-child:not(:only-child) {
    margin-right: 0.4rem;
    display: inline-block;
}

/* A csengő ikonja mellett ott a számláló jelvény is, ezért a fenti szabály eltolná az ikont;
   a kör alakú gombban az ikonnak pontosan középen kell állnia. */
.btn.notification-bell>i.bi:first-child {
    margin: 0;
}

/* ── 10. Dashboard Modal Testreszabó Stílusok ─────────────────────────────── */
.customizer-card-box {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border: 1px solid var(--nexus-card-border, #e2e8f0);
}

.customizer-card-box:hover {
    border-color: var(--nexus-accent-blue, #2563eb);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.customizer-drag-handle {
    user-select: none;
    cursor: grab;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.customizer-drag-handle:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--nexus-accent-blue, #2563eb) !important;
}

.customizer-drag-handle:active {
    cursor: grabbing;
}

.customizer-card-col {
    position: relative;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.customizer-card-col.is-dragging {
    opacity: 0.35;
    transform: scale(0.98);
}

.customizer-card-col.drop-indicator-left::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    width: 8px;
    background: var(--nexus-accent-blue, #2563eb);
    border-radius: 4px;
    z-index: 30;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.7);
    pointer-events: none;
}

.customizer-card-col.drop-indicator-right::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: -4px;
    width: 8px;
    background: var(--nexus-accent-blue, #2563eb);
    border-radius: 4px;
    z-index: 30;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.7);
    pointer-events: none;
}

.customizer-resize-edge {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 14px;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    user-select: none;
    touch-action: none;
}

.customizer-resize-edge .resize-handle-bar {
    width: 3px;
    height: 32px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.4);
    transition: background-color 0.15s ease, height 0.15s ease;
}

.customizer-resize-edge:hover .resize-handle-bar,
.customizer-resize-edge:active .resize-handle-bar {
    background: var(--nexus-accent-blue, #2563eb);
    height: 48px;
}

/* ── 11. Dashboard Kártyák Egységes Magassága (Equal Height Alignment) ─── */
#dashboardCardGrid > [data-widget-id] {
    display: flex;
    flex-direction: column;
}

#dashboardCardGrid > [data-widget-id] > * {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}

nexus-card,
nexus-dashboard-shortcuts,
nexus-dashboard-approvals,
nexus-dashboard-tickets,
nexus-dashboard-computer,
nexus-dashboard-quicklinks,
nexus-dashboard-team-vacations,
nexus-dashboard-agenda {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}

nexus-card > .card-nexus,
.nexus-card-content,
.card-nexus-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
}

.card-nexus-footer {
    margin-top: auto !important;
}

/* ── 12. Közelgő Céges Szabadságok: a mini naptárat a <nexus-calendar weeks="5"> adja (17. szakasz) ── */

/* ── 13. Napi Megbeszélések (Agenda) Widget ───────────────────────────── */
.agenda-pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: agendaPulse 1.8s infinite;
    flex-shrink: 0;
}

@keyframes agendaPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ── 14. Jelenlét modul (<nexus-presence-board>, <nexus-presence-item>) ─────── */
nexus-presence-board {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 100%;
}

nexus-presence-board[variant="full"] {
    display: block;
    height: auto;
}

.nexus-presence {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}

.nexus-presence--full {
    display: block;
    height: auto;
}

/* A kompakt kártya nem görget és nem vág: a lista a saját magasságában nő,
   a hosszú listát a "+N további" gomb rövidíti. */
.nexus-presence--compact .card-nexus-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

nexus-presence-item {
    display: block;
    min-width: 0;
    overflow: visible;
}

/* A rács a kártya szélességéhez igazodik: keskenyen 1, szélesebben 2+ oszlop. */
.presence-grid {
    display: grid;
    width: 100%;
    gap: 0.5rem;
}

.presence-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
}

.presence-grid--card {
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}

/* Kompakt sor */
.presence-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border-radius: 0.75rem;
    background: var(--nexus-accent-blue-subtle);
    border: 1px solid var(--nexus-accent-blue-border);
    color: var(--nexus-text-main);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.presence-row:hover {
    background: var(--nexus-card-border);
}

.presence-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.presence-name,
.presence-activity {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.presence-name {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--nexus-text-main);
}

.presence-activity {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--nexus-text-muted);
}

/* Részletes kártya (teljes oldal) */
.presence-card {
    min-width: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.presence-card:hover {
    transform: translateY(-2px);
    border-color: var(--nexus-accent-blue-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.presence-note {
    background: var(--nexus-accent-blue-subtle);
    border: 1px solid var(--nexus-accent-blue-border);
    border-radius: 0.65rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    color: var(--nexus-text-main);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Helyszín szerinti szűrőcsipek */
.presence-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.presence-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.4rem 0.2rem 0.65rem;
    border: 1px solid var(--nexus-card-border);
    border-radius: 999px;
    background: transparent;
    color: var(--nexus-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.presence-chip:hover {
    color: var(--nexus-text-main);
    border-color: var(--nexus-accent-blue-border);
}

.presence-chip:focus-visible,
.presence-more:focus-visible {
    outline: 2px solid var(--nexus-accent-blue);
    outline-offset: 2px;
}

.presence-chip.is-selected {
    background: var(--nexus-accent-blue-subtle);
    border-color: var(--nexus-accent-blue);
    color: var(--nexus-accent-blue);
}

.presence-chip-count {
    min-width: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--nexus-card-border);
    color: var(--nexus-text-main);
    font-size: 0.68rem;
    text-align: center;
}

.presence-chip.is-selected .presence-chip-count {
    background: var(--nexus-blue-solid);
    color: var(--nexus-on-solid);
}

.presence-more {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding: 0.25rem 0.75rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--nexus-accent-blue);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.presence-more:hover {
    background: var(--nexus-accent-blue-subtle);
}

.presence-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--nexus-text-muted);
}

/* "Frissítve" jelző */
.presence-live {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--nexus-text-muted);
    white-space: nowrap;
}

.presence-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--nexus-accent-green);
    animation: presence-live-pulse 2.4s ease-in-out infinite;
}

.presence-live.is-busy .presence-live-dot {
    animation-duration: 0.8s;
}

.presence-live.is-error .presence-live-dot {
    background: #f59e0b;
    animation: none;
}

.nexus-spin {
    display: inline-block;
    animation: nexus-spin 0.8s linear infinite;
}

/* Érkező és távozó munkatársak: visszafogott animáció */
nexus-presence-item.is-entering {
    animation: presence-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

nexus-presence-item.is-entering .presence-row,
nexus-presence-item.is-entering .presence-card {
    animation: presence-glow 1.4s ease-out;
}

nexus-presence-item.is-leaving {
    animation: presence-out 0.4s ease-in forwards;
    pointer-events: none;
}

@keyframes presence-in {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

@keyframes presence-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: scale(0.94); }
}

@keyframes presence-glow {
    from { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
    to   { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

@keyframes presence-live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@keyframes nexus-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    nexus-presence-item.is-entering,
    nexus-presence-item.is-entering .presence-row,
    nexus-presence-item.is-entering .presence-card,
    nexus-presence-item.is-leaving,
    .presence-live-dot {
        animation: none;
    }

    .presence-row,
    .presence-card,
    .presence-chip {
        transition: none;
    }
}


/* ── Téma kapcsoló (<nexus-theme-switch>) ─────────────────────────────────────── */
nexus-theme-switch {
    display: block;
}

.nexus-theme-switch {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--nexus-card-border);
    border-radius: 999px;
    background: var(--nexus-card-bg-elevated);
}

.nexus-theme-switch button {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.32rem 0.45rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--nexus-text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.nexus-theme-switch button:hover {
    color: var(--nexus-text-main);
}

.nexus-theme-switch button[aria-checked="true"] {
    background: var(--nexus-blue-solid);
    color: var(--nexus-on-solid);
}

.nexus-theme-switch button:focus-visible {
    outline: 2px solid var(--nexus-accent-blue);
    outline-offset: 2px;
}

.nexus-theme-switch.is-compact button span {
    display: none;
}

/* ── Harmadik féltől származó widgetek sötét módban ───────────────────────────── */

/* flatpickr (naptár választó) */
[data-bs-theme="dark"] .flatpickr-calendar {
    background: var(--nexus-card-bg);
    border: 1px solid var(--nexus-card-border);
    box-shadow: var(--nexus-shadow-md);
    color: var(--nexus-text-main);
}

[data-bs-theme="dark"] .flatpickr-calendar.arrowTop::before,
[data-bs-theme="dark"] .flatpickr-calendar.arrowTop::after {
    border-bottom-color: var(--nexus-card-bg);
}

[data-bs-theme="dark"] .flatpickr-calendar.arrowBottom::before,
[data-bs-theme="dark"] .flatpickr-calendar.arrowBottom::after {
    border-top-color: var(--nexus-card-bg);
}

[data-bs-theme="dark"] .flatpickr-months .flatpickr-month,
[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months,
[data-bs-theme="dark"] .flatpickr-current-month input.cur-year,
[data-bs-theme="dark"] span.flatpickr-weekday {
    background: transparent;
    color: var(--nexus-text-main);
    fill: var(--nexus-text-main);
}

[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background: var(--nexus-card-bg);
}

[data-bs-theme="dark"] .flatpickr-months .flatpickr-prev-month,
[data-bs-theme="dark"] .flatpickr-months .flatpickr-next-month {
    color: var(--nexus-text-muted);
    fill: var(--nexus-text-muted);
}

[data-bs-theme="dark"] .flatpickr-months .flatpickr-prev-month:hover svg,
[data-bs-theme="dark"] .flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--nexus-accent-blue);
}

[data-bs-theme="dark"] .flatpickr-day {
    color: var(--nexus-text-main);
}

[data-bs-theme="dark"] .flatpickr-day.prevMonthDay,
[data-bs-theme="dark"] .flatpickr-day.nextMonthDay,
[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled,
[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled:hover {
    color: var(--nexus-text-muted);
    opacity: 0.55;
}

[data-bs-theme="dark"] .flatpickr-day:hover,
[data-bs-theme="dark"] .flatpickr-day:focus {
    background: var(--nexus-card-bg-elevated);
    border-color: var(--nexus-card-border);
}

[data-bs-theme="dark"] .flatpickr-day.today {
    border-color: var(--nexus-accent-blue);
}

[data-bs-theme="dark"] .flatpickr-day.selected,
[data-bs-theme="dark"] .flatpickr-day.startRange,
[data-bs-theme="dark"] .flatpickr-day.endRange {
    background: var(--nexus-blue-solid);
    border-color: var(--nexus-blue-solid);
    color: var(--nexus-on-solid);
}

[data-bs-theme="dark"] .flatpickr-day.inRange {
    background: var(--nexus-accent-blue-subtle);
    border-color: transparent;
    box-shadow: -5px 0 0 var(--nexus-accent-blue-subtle), 5px 0 0 var(--nexus-accent-blue-subtle);
}

/* Leaflet (térkép): a világos csempéket sötét módban invertáljuk, a vezérlők a témát követik */
[data-bs-theme="dark"] .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

[data-bs-theme="dark"] .leaflet-container {
    background: var(--nexus-bg-secondary);
}

[data-bs-theme="dark"] .leaflet-popup-content-wrapper,
[data-bs-theme="dark"] .leaflet-popup-tip {
    background: var(--nexus-card-bg);
    color: var(--nexus-text-main);
}

[data-bs-theme="dark"] .leaflet-bar a {
    background: var(--nexus-card-bg);
    color: var(--nexus-text-main);
    border-bottom-color: var(--nexus-card-border);
}

[data-bs-theme="dark"] .leaflet-bar a:hover {
    background: var(--nexus-card-bg-elevated);
}

[data-bs-theme="dark"] .leaflet-control-attribution {
    background: rgba(21, 30, 50, 0.8);
    color: var(--nexus-text-muted);
}

[data-bs-theme="dark"] .leaflet-control-attribution a {
    color: var(--nexus-accent-blue);
}

/* ── 15. Modális ablak (<nexus-modal>) ──────────────────────────────────────── */
/* A host maga az átfedő háttér. Szándékosan nincs backdrop-filter: az a benne lévő fix pozíciójú
   elemeket (pl. a <nexus-select> lenyíló menüjét) rossz helyre tenné. */
nexus-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    background: var(--nexus-overlay);
}

nexus-modal[open] {
    display: flex;
}

body.nexus-overlay-open {
    overflow: hidden;
}

.nexus-modal__dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    background: var(--nexus-card-bg);
    color: var(--nexus-text-main);
    border: 1px solid var(--nexus-card-border);
    border-radius: 1.25rem;
    box-shadow: var(--nexus-shadow-md);
    overflow: hidden;
    outline: 0;
    animation: nexus-modal-in 0.18s ease-out;
}

.nexus-modal__dialog--sm { max-width: 420px; }
.nexus-modal__dialog--lg { max-width: 820px; }
.nexus-modal__dialog--xl { max-width: 1140px; }

/* Háttérre kattintás szerkesztő ablakon: rövid mozdulat (a meglévő x-nexus-modal overlay ablakokhoz is) */
.nexus-bump {
    animation: nexus-modal-bump 0.22s ease-in-out;
}

.nexus-modal__dialog.is-bumped {
    animation: nexus-modal-bump 0.22s ease-in-out;
}

@keyframes nexus-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes nexus-modal-bump {
    0%, 100% { transform: none; }
    50% { transform: scale(1.012); }
}

.nexus-modal__header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    background: var(--nexus-card-bg-elevated);
    border-bottom: 1px solid var(--nexus-card-border);
    flex: 0 0 auto;
}

.nexus-modal__icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nexus-modal__titles {
    flex: 1 1 auto;
    min-width: 0;
}

.nexus-modal__heading {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--nexus-text-main);
}

.nexus-modal__subheading {
    font-size: 0.82rem;
    color: var(--nexus-text-muted);
}

.nexus-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
}

.nexus-modal__footer {
    flex: 0 0 auto;
    padding: 0.85rem 1.25rem;
    background: var(--nexus-card-bg-elevated);
    border-top: 1px solid var(--nexus-card-border);
}

/* A lábléc gombjai alapból jobbra zártak; két csoportnál (pl. Törlés balra) a slot elem kapjon
   justify-content-between osztályt */
.nexus-modal__footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    nexus-modal {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .nexus-modal__dialog {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .nexus-modal__header,
    .nexus-modal__body,
    .nexus-modal__footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nexus-modal__dialog,
    .nexus-modal__dialog.is-bumped,
    .nexus-bump,
    .nexus-dialog,
    .nexus-toast {
        animation: none;
    }
}

@media print {
    nexus-modal,
    .nexus-dialog-overlay,
    .nexus-toast-container {
        display: none !important;
    }
}

/* ── 16. Megerősítő ablak és toast (NexusUI.confirm / alert / toast) ────────── */
.nexus-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--nexus-overlay);
}

.nexus-dialog {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem 1.5rem 1.25rem;
    text-align: center;
    background: var(--nexus-card-bg);
    color: var(--nexus-text-main);
    border: 1px solid var(--nexus-card-border);
    border-radius: 1.25rem;
    box-shadow: var(--nexus-shadow-md);
    animation: nexus-modal-in 0.16s ease-out;
}

.nexus-dialog__icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.85rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.nexus-dialog__icon--danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.nexus-dialog__icon--warning { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.nexus-dialog__icon--success { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.nexus-dialog__icon--info { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }

.nexus-dialog__title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}

.nexus-dialog__message {
    font-size: 0.92rem;
    color: var(--nexus-text-muted);
    overflow-wrap: anywhere;
}

.nexus-dialog__message:empty {
    display: none;
}

.nexus-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.nexus-toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.nexus-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    background: var(--nexus-card-bg);
    color: var(--nexus-text-main);
    border: 1px solid var(--nexus-card-border);
    border-left: 4px solid var(--nexus-green-solid);
    border-radius: 0.85rem;
    box-shadow: var(--nexus-shadow-md);
    pointer-events: auto;
    animation: nexus-toast-in 0.2s ease-out;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nexus-toast.is-leaving {
    opacity: 0;
    transform: translateX(12px);
}

@keyframes nexus-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.nexus-toast__icon {
    font-size: 1.1rem;
    line-height: 1.35;
    color: var(--nexus-accent-green);
}

.nexus-toast--error { border-left-color: var(--nexus-red-solid); }
.nexus-toast--error .nexus-toast__icon { color: var(--nexus-accent-red); }
.nexus-toast--warning { border-left-color: var(--nexus-amber-solid); }
.nexus-toast--warning .nexus-toast__icon { color: var(--nexus-accent-amber); }
.nexus-toast--info { border-left-color: var(--nexus-blue-solid); }
.nexus-toast--info .nexus-toast__icon { color: var(--nexus-accent-blue); }

.nexus-toast__content {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.nexus-toast__title {
    font-weight: 700;
}

.nexus-toast__close {
    flex: 0 0 auto;
    font-size: 0.65rem;
    margin-top: 0.3rem;
}

@media (max-width: 575.98px) {
    .nexus-toast-container {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: auto;
    }
}

/* ── 17. Naptár (<nexus-calendar>) ──────────────────────────────────────────── */
nexus-calendar {
    display: block;
    --nexus-cal-cell: 2.1rem;
    --nexus-cal-font: 0.82rem;
    --nexus-cal-month-min: 230px;
}

nexus-calendar[size="sm"] {
    --nexus-cal-cell: 1.75rem;
    --nexus-cal-font: 0.76rem;
    --nexus-cal-month-min: 200px;
}

nexus-calendar[size="lg"] {
    --nexus-cal-cell: 5.2rem;
    --nexus-cal-font: 0.85rem;
    --nexus-cal-month-min: 420px;
}

.nexus-calendar__nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.nexus-calendar__nav-title {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 700;
    color: var(--nexus-text-main);
}

.nexus-calendar__months {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

nexus-calendar[data-months="many"] .nexus-calendar__months {
    grid-template-columns: repeat(var(--nexus-cal-columns, auto-fill), minmax(min(var(--nexus-cal-month-min), 100%), 1fr));
}

nexus-calendar[data-months="many"] .nexus-calendar__month {
    border: 1px solid var(--nexus-card-border);
    border-radius: 0.9rem;
    padding: 0.6rem 0.6rem 0.45rem;
    background: var(--nexus-card-bg);
}

.nexus-calendar__month-title {
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--nexus-text-main);
}

.nexus-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.nexus-calendar__head {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--nexus-text-muted);
    padding: 0.1rem 0 0.2rem;
}

.nexus-calendar__day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--nexus-cal-cell);
    min-width: 0;
    padding: 0.15rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--nexus-text-main);
    font-size: var(--nexus-cal-font);
    line-height: 1;
}

button.nexus-calendar__day {
    cursor: pointer;
}

button.nexus-calendar__day:hover:not(:disabled) {
    outline: 1px solid var(--nexus-accent-blue);
}

button.nexus-calendar__day:focus-visible {
    outline: 2px solid var(--nexus-accent-blue);
    outline-offset: 1px;
}

button.nexus-calendar__day:disabled {
    cursor: default;
}

.nexus-calendar__day.is-weekend {
    background: var(--nexus-card-bg-elevated);
    color: var(--nexus-text-muted);
}

.nexus-calendar__day.is-out {
    opacity: 0.4;
}

.nexus-calendar__day[data-tone] { font-weight: 700; }
.nexus-calendar__day[data-tone="primary"] { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.nexus-calendar__day[data-tone="success"] { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.nexus-calendar__day[data-tone="warning"] { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.nexus-calendar__day[data-tone="danger"] { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.nexus-calendar__day[data-tone="info"] { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.nexus-calendar__day[data-tone="secondary"] { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }

.nexus-calendar__day[data-outline="primary"] { box-shadow: inset 0 0 0 1.5px var(--bs-primary); }
.nexus-calendar__day[data-outline="success"] { box-shadow: inset 0 0 0 1.5px var(--bs-success); }
.nexus-calendar__day[data-outline="warning"] { box-shadow: inset 0 0 0 1.5px var(--bs-warning); }
.nexus-calendar__day[data-outline="danger"] { box-shadow: inset 0 0 0 1.5px var(--bs-danger); }
.nexus-calendar__day[data-outline="info"] { box-shadow: inset 0 0 0 1.5px var(--bs-info); }
.nexus-calendar__day[data-outline="secondary"] { box-shadow: inset 0 0 0 1.5px var(--bs-secondary); }

/* Tömör (kitöltött) nap, pl. jóváhagyott / függő szabadság */
.nexus-calendar__day[data-solid] { color: var(--nexus-on-solid); }
.nexus-calendar__day[data-solid][data-tone="primary"],
.nexus-calendar__day[data-solid][data-tone="info"] { background: var(--nexus-blue-solid); }
.nexus-calendar__day[data-solid][data-tone="success"] { background: var(--nexus-green-solid); }
.nexus-calendar__day[data-solid][data-tone="warning"] { background: var(--nexus-amber-solid); }
.nexus-calendar__day[data-solid][data-tone="danger"] { background: var(--nexus-red-solid); }
.nexus-calendar__day[data-solid][data-tone="secondary"] { background: var(--bs-secondary); }

/* Heti nézet: múltbeli napok és a hónap első napjának rövid hónapneve */
.nexus-calendar__day.is-past {
    opacity: 0.5;
}

.nexus-calendar__month-tag {
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.8;
}

.nexus-calendar__day.is-today {
    box-shadow: inset 0 0 0 2px var(--nexus-accent-blue);
    font-weight: 700;
}

.nexus-calendar__day.is-in-range {
    background: var(--nexus-accent-blue-subtle);
    color: var(--nexus-blue-text);
    border-radius: 0;
}

.nexus-calendar__day.is-selected {
    background: var(--nexus-blue-solid);
    color: var(--nexus-on-solid);
    font-weight: 700;
    box-shadow: none;
}

.nexus-calendar__count {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.85;
}

.nexus-calendar__dots {
    display: flex;
    gap: 2px;
    height: 4px;
}

.nexus-calendar__dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--bs-secondary);
}

.nexus-calendar__dots i[data-tone="primary"] { background: var(--bs-primary); }
.nexus-calendar__dots i[data-tone="success"] { background: var(--bs-success); }
.nexus-calendar__dots i[data-tone="warning"] { background: var(--bs-warning); }
.nexus-calendar__dots i[data-tone="danger"] { background: var(--bs-danger); }
.nexus-calendar__dots i[data-tone="info"] { background: var(--bs-info); }

.nexus-calendar__day.is-selected .nexus-calendar__dots i {
    background: var(--nexus-on-solid);
}

/* Nagy cellák (size="lg"): a szám fent, alatta feliratok */
nexus-calendar[size="lg"] .nexus-calendar__day {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.3rem;
    border: 1px solid var(--nexus-card-border);
    text-align: left;
}

nexus-calendar[size="lg"] .nexus-calendar__num {
    font-weight: 700;
    margin-bottom: 2px;
}

.nexus-calendar__item {
    display: block;
    padding: 1px 4px;
    border-radius: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.nexus-calendar__item[data-tone="success"] { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.nexus-calendar__item[data-tone="warning"] { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.nexus-calendar__item[data-tone="danger"] { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.nexus-calendar__item[data-tone="info"] { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.nexus-calendar__item[data-tone="secondary"] { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }

.nexus-calendar__more {
    font-size: 0.65rem;
    color: var(--nexus-text-muted);
}

@media (max-width: 767.98px) {
    nexus-calendar[size="lg"] {
        --nexus-cal-cell: 3.4rem;
        --nexus-cal-month-min: 280px;
    }
}

/* Jelmagyarázat a naptárhoz */
.nexus-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--nexus-text-muted);
}

.nexus-calendar-legend > span::before {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 0.35rem;
    vertical-align: -0.2rem;
    border-radius: 0.3rem;
    border: 1px solid var(--nexus-card-border);
    background: var(--nexus-card-bg);
}

.nexus-calendar-legend > span[data-tone="primary"]::before { background: var(--bs-primary-bg-subtle); }
.nexus-calendar-legend > span[data-tone="success"]::before { background: var(--bs-success-bg-subtle); }
.nexus-calendar-legend > span[data-tone="warning"]::before { background: var(--bs-warning-bg-subtle); }
.nexus-calendar-legend > span[data-tone="danger"]::before { background: var(--bs-danger-bg-subtle); }
.nexus-calendar-legend > span[data-tone="info"]::before { background: var(--bs-info-bg-subtle); }
.nexus-calendar-legend > span[data-tone="secondary"]::before { background: var(--bs-secondary-bg-subtle); }
.nexus-calendar-legend > span[data-tone="weekend"]::before { background: var(--nexus-card-bg-elevated); }
.nexus-calendar-legend > span[data-tone="today"]::before { border: 2px solid var(--nexus-accent-blue); }
.nexus-calendar-legend > span[data-tone="success"][data-solid]::before { background: var(--nexus-green-solid); border-color: var(--nexus-green-solid); }
.nexus-calendar-legend > span[data-tone="warning"][data-solid]::before { background: var(--nexus-amber-solid); border-color: var(--nexus-amber-solid); }
.nexus-calendar-legend > span[data-tone="selected"]::before { background: var(--nexus-blue-solid); border-color: var(--nexus-blue-solid); }
.nexus-calendar-legend > span[data-outline="primary"]::before { border: 1.5px solid var(--bs-primary); }
.nexus-calendar-legend > span[data-outline="success"]::before { border: 1.5px solid var(--bs-success); }
.nexus-calendar-legend > span[data-outline="warning"]::before { border: 1.5px solid var(--bs-warning); }
.nexus-calendar-legend > span[data-outline="danger"]::before { border: 1.5px solid var(--bs-danger); }

/* ── 18. Betöltés / üres / hiba állapot (<nexus-state>) ─────────────────────── */
nexus-state {
    display: block;
    position: relative;
}

.nexus-state__status {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    padding: 2.5rem 1rem;
}

nexus-state[compact="true"] > .nexus-state__status {
    padding: 1.25rem 0.75rem;
}

nexus-state[state="loading"] > .nexus-state__status,
nexus-state[state="error"] > .nexus-state__status,
nexus-state[state="empty"] > .nexus-state__status {
    display: flex;
}

/* Amíg nem "ready", a tartalom rejtve marad (a jelzés és az üres állapot műveletei kivételével) */
nexus-state[state="loading"]:not([refreshing]) > :not(.nexus-state__status),
nexus-state[state="error"] > :not(.nexus-state__status),
nexus-state[state="empty"] > :not(.nexus-state__status):not([slot="empty-actions"]) {
    display: none !important;
}

nexus-state:not([state="empty"]) > [slot="empty-actions"] {
    display: none !important;
}

nexus-state[state="empty"] > [slot="empty-actions"] {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: -1.75rem;
    padding-bottom: 2.5rem;
}

/* Frissítés: a meglévő tartalom halványítva látszik, a jelzés fölötte lebeg */
nexus-state[refreshing] > :not(.nexus-state__status) {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

nexus-state[refreshing] > .nexus-state__status {
    position: absolute;
    inset: 0;
    z-index: 5;
    justify-content: flex-start;
    padding-top: 2rem;
}

.nexus-state__icon {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--nexus-text-muted);
    opacity: 0.6;
    margin-bottom: 0.25rem;
}

.nexus-state__icon--error {
    color: var(--nexus-accent-red);
    opacity: 1;
}

.nexus-state__title {
    font-weight: 600;
    color: var(--nexus-text-main);
}

.nexus-state__text {
    font-size: 0.875rem;
    color: var(--nexus-text-muted);
    max-width: 46ch;
    overflow-wrap: anywhere;
}

.nexus-state__text:empty {
    display: none;
}

/* Egysoros változat kis helyre (pl. szekción belüli rövid lista): ikon és szöveg egy sorban, halványan */
nexus-state[inline="true"] > .nexus-state__status {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.8rem;
}

nexus-state[inline="true"] > .nexus-state__status .nexus-state__icon {
    font-size: 1rem;
    margin-bottom: 0;
}

nexus-state[inline="true"] > .nexus-state__status .nexus-state__title {
    font-weight: 400;
    color: var(--nexus-text-muted);
}

nexus-state[inline="true"] > .nexus-state__status .nexus-state__text {
    font-size: inherit;
}

nexus-state[inline="true"] > .nexus-state__status .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ── 19. Táblázat (<nexus-table>) ───────────────────────────────────────────── */
nexus-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nexus-table > thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--nexus-text-muted);
    white-space: nowrap;
    border-bottom-width: 1px;
}

nexus-table[sticky="true"] .nexus-table > thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--nexus-card-bg);
}

.nexus-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.nexus-table th[data-sort]::after {
    content: "\2195";
    display: inline-block;
    margin-left: 0.3rem;
    opacity: 0.35;
}

.nexus-table th[data-sort][aria-sort="ascending"]::after { content: "\2191"; opacity: 1; }
.nexus-table th[data-sort][aria-sort="descending"]::after { content: "\2193"; opacity: 1; }

.nexus-table th[data-sort]:hover,
.nexus-table th[data-sort][aria-sort] {
    color: var(--nexus-text-main);
}

.nexus-table th[data-sort]:focus-visible {
    outline: 2px solid var(--nexus-accent-blue);
    outline-offset: -2px;
}

.nexus-table .nexus-table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: end;
}

.nexus-table.is-empty > thead {
    display: none;
}

.nexus-table__empty {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--nexus-text-muted);
}

/* Kártyás (egymás alá tördelt) sorok: az is-stacked attribútumot a komponens állítja a stacked
   töréspont alatt. Nyomtatásban mindig rendes táblázat marad. */
@media screen {
    nexus-table[is-stacked] .nexus-table > thead {
        display: none;
    }

    nexus-table[is-stacked] .nexus-table > tbody > tr {
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.35rem 0.85rem;
        border: 1px solid var(--nexus-card-border);
        border-radius: 0.85rem;
        background: var(--nexus-card-bg);
    }

    nexus-table[is-stacked] .nexus-table > tbody > tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        width: auto;
        padding: 0.4rem 0;
        text-align: end;
        white-space: normal;
        background: transparent;
        box-shadow: none;
        /* Az asztali nézetre szánt oszlopszélesség (pl. style="max-width: 260px") kártyában nem korlátoz */
        max-width: none !important;
    }

    nexus-table[is-stacked] .nexus-table > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    nexus-table[is-stacked] .nexus-table > tbody > tr > td.nexus-table-actions {
        justify-content: flex-end;
    }

    nexus-table[is-stacked] .nexus-table > tbody > tr > td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--nexus-text-muted);
        text-align: start;
    }
}

/* ── 20. Státuszjelvény (<nexus-badge>) ─────────────────────────────────────── */
nexus-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--nexus-card-border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--nexus-card-bg-elevated);
    color: var(--nexus-text-main);
}

nexus-badge[hidden] {
    display: none;
}

nexus-badge[size="sm"] {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
}

nexus-badge[tone="primary"] { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); border-color: var(--bs-primary-border-subtle); }
nexus-badge[tone="success"] { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
nexus-badge[tone="warning"] { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
nexus-badge[tone="danger"] { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); }
nexus-badge[tone="info"] { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); border-color: var(--bs-info-border-subtle); }
nexus-badge[tone="secondary"] { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); border-color: var(--bs-secondary-border-subtle); }

nexus-badge[solid="true"] { border-color: transparent; color: var(--nexus-on-solid); background: var(--bs-secondary); }
nexus-badge[solid="true"][tone="primary"] { background: var(--nexus-blue-solid); }
nexus-badge[solid="true"][tone="success"] { background: var(--nexus-green-solid); }
nexus-badge[solid="true"][tone="warning"] { background: var(--nexus-amber-solid); }
nexus-badge[solid="true"][tone="danger"] { background: var(--nexus-red-solid); }
nexus-badge[solid="true"][tone="info"] { background: var(--nexus-blue-solid); }

nexus-badge[dot="true"]::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

/* ── 21. Űrlapmező (<nexus-field>) ──────────────────────────────────────────── */
/* A címke és a visszajelzések a DOM-ban a vezérlő előtt állnak; a sorrendet az order adja */
nexus-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

nexus-field > * {
    order: 1;
}

nexus-field > .nexus-field__label {
    order: 0;
    margin-bottom: 0.3rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nexus-text-main);
}

nexus-field > .nexus-field__feedback {
    order: 2;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.nexus-field__messages {
    flex: 1 1 auto;
    min-width: 0;
}

.nexus-field__hint {
    margin-top: 0.25rem;
    color: var(--nexus-text-muted);
}

.nexus-field__hint:empty {
    display: none;
}

.nexus-field__error {
    margin-top: 0.25rem;
    font-weight: 600;
    color: var(--bs-danger-text-emphasis);
}

.nexus-field__counter {
    flex: 0 0 auto;
    margin-top: 0.25rem;
    color: var(--nexus-text-muted);
    font-variant-numeric: tabular-nums;
}

.nexus-field__counter.is-full {
    color: var(--bs-warning-text-emphasis);
    font-weight: 600;
}

.nexus-field__required {
    color: var(--nexus-accent-red);
}

.nexus-field__optional {
    font-weight: 400;
    color: var(--nexus-text-muted);
}

/* ── 22. Személyjelvény (<nexus-avatar>) ────────────────────────────────────── */
nexus-avatar {
    --nexus-avatar-size: 42px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--nexus-avatar-size);
    height: var(--nexus-avatar-size);
    border: 1px solid var(--bs-primary-border-subtle);
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: calc(var(--nexus-avatar-size) * 0.36);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    vertical-align: middle;
    user-select: none;
}

nexus-avatar[size="sm"] { --nexus-avatar-size: 32px; }
nexus-avatar[size="lg"] { --nexus-avatar-size: 48px; }
nexus-avatar[size="xl"] { --nexus-avatar-size: 64px; }

nexus-avatar > i {
    font-size: calc(var(--nexus-avatar-size) * 0.44);
}

nexus-avatar > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

nexus-avatar > [hidden] {
    display: none !important;
}

nexus-avatar[tone="success"] { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
nexus-avatar[tone="warning"] { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
nexus-avatar[tone="danger"] { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); }
nexus-avatar[tone="info"] { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); border-color: var(--bs-info-border-subtle); }
nexus-avatar[tone="secondary"] { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); border-color: var(--bs-secondary-border-subtle); }
nexus-avatar[tone="neutral"] { background: var(--nexus-card-bg-elevated); color: var(--nexus-text-muted); border-color: var(--nexus-card-border); }

nexus-avatar[solid="true"] { border-color: transparent; color: var(--nexus-on-solid); background: var(--nexus-blue-solid); }
nexus-avatar[solid="true"][tone="success"] { background: var(--nexus-green-solid); }
nexus-avatar[solid="true"][tone="warning"] { background: var(--nexus-amber-solid); }
nexus-avatar[solid="true"][tone="danger"] { background: var(--nexus-red-solid); }
nexus-avatar[solid="true"][tone="secondary"],
nexus-avatar[solid="true"][tone="neutral"] { background: var(--bs-secondary); }

/* Állapotpötty a jobb alsó sarokban, a kártya hátterével keretezve */
.nexus-avatar__dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: max(10px, calc(var(--nexus-avatar-size) * 0.26));
    height: max(10px, calc(var(--nexus-avatar-size) * 0.26));
    border: 2px solid var(--nexus-card-bg);
    border-radius: 50%;
    background: var(--bs-secondary);
}

.nexus-avatar__dot[data-tone="primary"],
.nexus-avatar__dot[data-tone="info"] { background: var(--nexus-blue-solid); }
.nexus-avatar__dot[data-tone="success"] { background: var(--nexus-green-solid); }
.nexus-avatar__dot[data-tone="warning"] { background: var(--nexus-amber-solid); }
.nexus-avatar__dot[data-tone="danger"] { background: var(--nexus-red-solid); }
