/* ===================== CSS VÁLTOZÓK (arculat: smtech.hu) ===================== */
:root {
    --primary-color: #2b5797;
    --primary-hover: #234679;
    --primary-soft: #e7f6ff;
    --primary-tint: #eef3fa;
    --secondary-color: #6ea8f0;
    --ink: #0f172a;
    --ink-muted: #69727d;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 0px;
    --topbar-height: 70px;
    --transition: all 0.2s ease;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --border-color: #e3e7ee;

    /* Bootstrap „primary" és link-szín a márkaszínre (badge, text-primary, spinner, linkek) */
    --bs-primary: #2b5797;
    --bs-primary-rgb: 43, 87, 151;
    --bs-link-color: #2b5797;
    --bs-link-color-rgb: 43, 87, 151;
    --bs-link-hover-color: #234679;
    --bs-link-hover-color-rgb: 35, 70, 121;
    --bs-body-color: #0f172a;
    --bs-border-color: #e3e7ee;
    --bs-focus-ring-color: rgba(43, 87, 151, 0.2);
}

/* ===================== ALAP ===================== */
html { font-size: 14px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }
body { margin: 0; font-family: 'Karla', 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f4f6f9; color: var(--ink); }

.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }
.spinner-border.text-primary { color: var(--primary-color) !important; }

/* ===================== KÁRTYÁK ===================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    background: #fff;
}
.card.shadow-sm { box-shadow: var(--shadow) !important; }
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    font-weight: 600;
    color: var(--ink);
}
.card-header strong, .card-header .card-title { font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif; font-weight: 600; letter-spacing: -.01em; font-size: 1.02rem; }
.card-header a.small { font-weight: 600; text-decoration: none; }
.card-header a.small:hover { text-decoration: underline; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--border-color); border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg) !important; }
.card-title { font-weight: 600; color: var(--ink); }
.card-body > .table-responsive:first-child > .table thead th:first-child { border-top-left-radius: var(--border-radius-lg); }
.card-body > .table-responsive:first-child > .table thead th:last-child { border-top-right-radius: var(--border-radius-lg); }

/* ===================== ŰRLAPOK ===================== */
.form-label {
    font-weight: 600;
    color: #3f4a5a;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}
.form-control, .form-select {
    border-color: #d6dbe4;
    border-radius: var(--border-radius);
    color: var(--ink);
}
.form-control::placeholder { color: #9aa3b2; }
.input-group-text {
    background: #fff;
    border: 1px solid #d6dbe4;
    color: #8a94a6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    border-radius: var(--border-radius);
}
.input-group > .form-control:focus + .input-group-text,
.input-group:focus-within .input-group-text { border-color: var(--primary-color); color: var(--primary-color); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 .2rem rgba(43, 87, 151, .15);
}
.form-control[readonly], .form-control:disabled, .form-select:disabled { background-color: #f3f5f8; color: #5b6472; }
.form-text { color: var(--ink-muted); }

/* ===================== CHECKBOX / SWITCH ===================== */
.form-check-input { border-radius: 4px; border: 1.5px solid #c3cad6; }
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.form-switch .form-check-input { border-radius: 2em; }

/* ===================== VALIDÁCIÓ ===================== */
.field-validation-error {
    color: #dc3545;
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

/* ===================== TÁBLÁZAT ===================== */
.table { --bs-table-hover-bg: #f5f8fc; --bs-table-border-color: #e9edf3; }
.table th { font-weight: 600; font-size: 0.875rem; color: var(--gray-700); }
.table td { vertical-align: middle; font-size: 0.875rem; }
.table thead.table-light th,
.table > thead > tr > th {
    --bs-table-bg: #f6f8fb;
    background-color: #f6f8fb;
    color: #4b5563;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-bottom: 1px solid #e3e7ee;
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.table thead th .sort-icon { color: inherit !important; }
.table thead th .sort-icon .fa-sort { opacity: .45; }
.table thead th .sort-icon:hover { color: var(--primary-color) !important; }
.table thead th .sort-icon .fa-sort-up, .table thead th .sort-icon .fa-sort-down { color: var(--primary-color); }
.sort-icon { cursor: pointer; user-select: none; }
.table tbody td a:not(.btn) { font-weight: 600; text-decoration: none; }
.table tbody td a:not(.btn):hover { text-decoration: underline; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }

/* ===================== BADGE-EK ===================== */
.badge { border-radius: 50px; font-weight: 600; padding: .32em .7em; letter-spacing: .01em; }
.badge.bg-secondary { background-color: #69727d !important; }
.badge.bg-light { background-color: #eef1f5 !important; color: #5b6472 !important; }
.badge.bg-light.border { border-color: #dde2ea !important; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ===================== GOMBOK ===================== */
.btn { font-weight: 600; }
.btn-primary { background: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-secondary { --bs-btn-color: #4b5563; --bs-btn-border-color: #cfd5de; --bs-btn-hover-bg: #eef1f5; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #cfd5de; --bs-btn-active-bg: #e3e7ee; --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #cfd5de; }
.btn-link { font-weight: 500; }
.btn:focus-visible { box-shadow: 0 0 0 .2rem rgba(43, 87, 151, .25); }
/* Fejléc-műveletek (Új ügyfél, Lista) is pill alakúak, mint az önálló gombok */
.page-actions .btn { border-radius: 50px; padding-left: .9rem; padding-right: .9rem; }
.dropdown-menu { border-radius: 10px; border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); padding: .35rem; font-size: .92rem; }
.dropdown-item { border-radius: 6px; padding: .45rem .75rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--primary-tint); color: var(--ink); }
.dropdown-item.active, .dropdown-item:active { background: var(--primary-color); color: #fff; }

/* ===================== LAPOZÁS ===================== */
.pagination { --bs-pagination-border-radius: 50px; gap: 4px; }
.pagination .page-link { color: var(--primary-color); border-color: transparent; border-radius: 50px !important; min-width: 2.1rem; text-align: center; font-weight: 600; }
.pagination .page-link:hover { background: var(--primary-tint); border-color: transparent; }
.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.pagination .page-item.disabled .page-link { border-color: transparent; background: transparent; }

/* ===================== FÜLEK (nav-tabs: aláhúzásos) ===================== */
.nav-tabs { border-bottom: 1px solid var(--border-color); gap: 2px; }
.nav-tabs .nav-link {
    color: var(--ink-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 600;
    padding: .6rem .9rem;
    border-radius: 0;
    background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--primary-color); border-color: transparent; border-bottom-color: #c9d6ea; }
.nav-tabs .nav-link.active { color: var(--primary-color); background: transparent; border-color: transparent; border-bottom-color: var(--primary-color); }
.nav-tabs .nav-link .badge { background-color: #e3e8f0 !important; color: #4b5563; font-size: .68em; vertical-align: middle; }
.nav-tabs .nav-link.active .badge { background-color: var(--primary-color) !important; color: #fff; }
.nav-pills .nav-link { color: var(--ink-muted); border-radius: 50px; font-weight: 600; }
.nav-pills .nav-link.active { background-color: var(--primary-color); border-color: var(--primary-color); }

/* ===================== LIST-GROUP ===================== */
.list-group-item { border-color: var(--border-color); color: var(--ink); }
.list-group-item-action:hover { background: var(--primary-tint); }
.list-group-item.active { background-color: var(--primary-color); border-color: var(--primary-color); }
.card > .list-group-flush:first-child .list-group-item:first-child { border-top-left-radius: var(--border-radius-lg); border-top-right-radius: var(--border-radius-lg); }
.card > .list-group-flush:last-child .list-group-item:last-child { border-bottom-left-radius: var(--border-radius-lg); border-bottom-right-radius: var(--border-radius-lg); }

/* ===================== MODÁLIS ABLAK ===================== */
.modal-content { border: 0; border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border-color); padding: 1rem 1.25rem; }
.modal-title { font-weight: 600; font-size: 1.15rem; }
.modal-footer { border-top: 1px solid var(--border-color); }
.modal-backdrop.show { opacity: .55; background: #0f172a; }

/* ===================== ALERT ===================== */
.alert { border-radius: 10px; border-width: 0; border-left: 4px solid transparent; }
.alert-info { background: var(--primary-soft); color: #1e3a5f; border-left-color: var(--primary-color); }
.alert-info a, .alert-info code { color: var(--primary-hover); }
.alert-warning { border-left-color: #d9a21b; }
.alert-danger { border-left-color: #dc3545; }
.alert-success { border-left-color: #198754; }

/* ===================== SWEETALERT2 ===================== */
.swal2-popup { font-family: 'Karla', 'Segoe UI', sans-serif; border-radius: 16px; color: var(--ink); }
.swal2-popup.swal2-toast { border-radius: 10px; box-shadow: var(--shadow-lg); }
.swal2-title { font-weight: 600; letter-spacing: -.01em; }
.swal2-styled.swal2-confirm, .swal2-styled.swal2-cancel, .swal2-styled.swal2-deny { border-radius: 50px; font-weight: 600; padding: .6rem 1.4rem; }
/* Alapértelmezett gombszínek változón keresztül, hogy a hívásonkénti confirmButtonColor (pl. piros törlés) érvényesüljön */
:root { --swal2-confirm-button-background-color: #2b5797; --swal2-cancel-button-background-color: #8a94a6; --swal2-deny-button-background-color: #69727d; }
.swal2-styled:focus { box-shadow: 0 0 0 .2rem rgba(43, 87, 151, .25); }
.swal2-input, .swal2-textarea, .swal2-select { border-radius: var(--border-radius) !important; border-color: #d6dbe4 !important; font-size: 1rem !important; }
.swal2-input:focus, .swal2-textarea:focus, .swal2-select:focus { border-color: var(--primary-color) !important; box-shadow: 0 0 0 .2rem rgba(43, 87, 151, .15) !important; }

/* ===================== KEZDŐLAP CSEMPÉK ===================== */
.stat-tile { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 1.1rem 1.25rem; height: 100%; transition: var(--transition); }
a.stat-tile:hover { box-shadow: 0 8px 24px rgba(43, 87, 151, .14); transform: translateY(-1px); border-color: #c9d6ea; }
.stat-tile .stat-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}
.stat-tile .stat-label { color: var(--ink-muted); font-size: .82rem; font-weight: 600; line-height: 1.2; }
.stat-tile .stat-value { font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--ink); }
.stat-tile.stat-warning .stat-icon { background: #fff4d6; color: #a86a00; }
.stat-tile.stat-warning .stat-value { color: #a86a00; }
.stat-tile.stat-danger .stat-icon { background: #fde8e8; color: #b42318; }
.stat-tile.stat-danger .stat-value { color: #b42318; }
.stat-tile.stat-success .stat-icon { background: #e3f5ec; color: #1f8a5b; }
.stat-tile.stat-info .stat-icon { background: var(--primary-color); color: #fff; }
/* Vezetői KPI-csempe: hosszabb pénzérték + alsó magyarázó sor */
.stat-tile.stat-kpi .stat-value { font-size: 1.45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile .stat-sub { color: var(--ink-muted); font-size: .78rem; line-height: 1.3; margin-top: 2px; }
.stat-trend { display: inline-block; font-weight: 700; font-size: .75rem; padding: 0 .4rem; border-radius: 50px; margin-left: .25rem; }
.stat-trend.trend-up { background: #e3f5ec; color: #1f8a5b; }
.stat-trend.trend-down { background: #fde8e8; color: #b42318; }

/* ===================== KEZDŐLAP: SZAKASZOK, DIAGRAMOK ===================== */
.dash-section { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 .6rem .15rem; }
.chart-box { position: relative; height: 240px; }
.chart-box.chart-tall { height: 320px; }
.chart-box.chart-donut { height: 200px; }
.chart-mode .btn { font-weight: 600; }
.chart-legend { list-style: none; padding: 0; margin: 0; }
.chart-legend li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed var(--border-color); font-size: .9rem; }
.chart-legend li:last-child { border-bottom: 0; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-right: .35rem; }
.split-bar .split-labels { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--ink-muted); margin-bottom: .35rem; }
.split-bar .split-track { height: 10px; border-radius: 50px; background: #c96f12; overflow: hidden; }
.split-bar .split-fill { height: 100%; background: var(--primary-color); border-right: 2px solid #fff; }
.dash-table td, .dash-table th { padding: .5rem .9rem; }
.dash-table tr > td:first-child, .dash-table tr > th:first-child { padding-left: 1.25rem; }
.dash-table tr > td:last-child, .dash-table tr > th:last-child { padding-right: 1.25rem; }
.dash-table .dash-cust { max-width: 0; width: 100%; }
.dash-table .dash-cust > div { max-width: 100%; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 1.5rem; min-height: 320px; }
.empty-state .empty-icon { width: 84px; height: 84px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 1rem; }
.empty-state h5 { font-family: 'Bricolage Grotesque', 'Segoe UI', sans-serif; }
.empty-state p { max-width: 380px; }
@media (max-width: 575.98px) {
    .stat-tile { padding: .8rem .85rem; gap: 10px; }
    .stat-tile .stat-icon { width: 38px; height: 38px; font-size: 1rem; border-radius: 10px; }
    .stat-tile .stat-label { font-size: .74rem; }
    .stat-tile .stat-value, .stat-tile.stat-kpi .stat-value { font-size: 1.2rem; }
    .stat-tile .stat-sub { font-size: .72rem; }
    .chart-box.chart-tall { height: 260px; }
}

/* ===================== BETÖLTŐ ===================== */
.component-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* ===================== RESZPONZÍV ===================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }

    /* Table to card */
    .responsive-table thead { display: none; }
    .responsive-table tr {
        display: block;
        margin: 0 0 0.75rem 0;
        padding: 0.5rem 0.75rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--gray-200) !important;
        border-radius: var(--border-radius);
        background: #fff;
    }
    /* Kártyanézet: „Oszlopnév: érték" sorok; az első oszlop a kártya címe, üres cella nem jelenik meg */
    .responsive-table td {
        display: block;
        position: relative;
        padding: 0.3rem 0 0.3rem 40%;
        border: 0;
        word-break: break-word;
    }
    .responsive-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0.35rem;
        width: 37%;
        color: #6c757d;
        font-size: 0.8rem;
    }
    .responsive-table td:empty { display: none; }
    .responsive-table td:first-child {
        padding-left: 0;
        font-weight: 600;
        font-size: 1rem;
        padding-bottom: 0.4rem;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 0.2rem;
    }
    .responsive-table td:first-child::before,
    .responsive-table td:not([data-label])::before { content: none; }
    .responsive-table td:not([data-label]) { padding-left: 0; }
    .responsive-table tr > td:last-child[class~="text-end"] {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        padding-top: 0.5rem;
    }
    .responsive-table .btn-group-sm > .btn { padding: 0.4rem 0.7rem; }

    /* Szerkesztő-fülek egy görgethető sorban */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
    }
    .nav-tabs .nav-link { white-space: nowrap; }

    /* Adatsor-rács (gép/ajánlat): olvasható mezőszélesség, a táblázat vízszintesen görgethető */
    .line-grid { min-width: 600px; }

    /* Listaszűrők: a további szűrők a „Szűrők" gombbal nyílnak (site.js mobileFilters) */
    .filter-extra { display: none; }
    .filters-open .filter-extra { display: block; }

    .navbar-page-actions .btn span { display: none; }
}

/* Grid: fejléc egy sorban, telefonszám nem törik */
.responsive-table thead th { white-space: nowrap; }
.responsive-table td { vertical-align: middle; }

/* Ajánlat-szerkesztő: a fejléc-sáv görgetéskor is látszik */
.quote-header { position: sticky; top: 70px; z-index: 900; }
/* Mobilon a fejléc-sáv magas, ragadósan a tartalom felét eltakarná — ezért a Mentés lebegő gomb lesz,
   a gép/partner adatlap mentés-sávja pedig a képernyő aljára ragad */
@media (max-width: 767.98px) {
    .quote-header { position: static; }
    #btnSave {
        position: fixed;
        right: 16px;
        bottom: 16px;
        z-index: 1020;
        border-radius: 50px;
        padding: 0.65rem 1.2rem;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    }
    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 1010;
        background: #f4f6f9;
        padding: 10px 0;
        margin-bottom: 0 !important;
        border-top: 1px solid #e0e0e0;
    }
    .form-actions .btn { white-space: nowrap; }
}
.quote-tabs .nav-link { padding: .5rem .7rem; font-size: .92rem; }
.line-grid input.form-control-sm { min-width: 60px; }
