/*
 * Modern look: refreshed dark sidebar, calmer buttons and cards, one style for every list and form,
 * dashboard, company list and company view.
 * Loaded after style.css / site.css, only overrides.
 */
:root {
    --app-accent: #2d6cb5;
    --app-accent-soft: #e8f0fa;
    --app-bg: #f4f6f9;
    --app-paper: #ffffff;
    --app-line: #e1e6ee;
    --app-muted: #5e6b7c;
    --app-text: #1f2834;
    --app-warn: #9a6200;
    --app-warn-soft: #fcf2dd;
    --app-ok: #1f8a5b;
    --app-radius: 10px;

    /* CoreUI's own primary (purple by default) follows the logo blue everywhere: links, pills, checkboxes */
    --cui-primary: #2d6cb5;
    --cui-primary-rgb: 45, 108, 181;
    --cui-link-color: #2d6cb5;
    --cui-link-color-rgb: 45, 108, 181;
    --cui-link-hover-color: #214f87;
    --cui-link-hover-color-rgb: 33, 79, 135;
    --cui-primary-text-emphasis: #1f4f86;
    --cui-primary-bg-subtle: #e8f0fa;
    --cui-primary-border-subtle: #cfe0f4;
}

.nav-pills {
    --cui-nav-pills-link-active-bg: var(--app-accent);
}

.nav-pills .nav-link {
    border-radius: 8px;
}

body {
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5,
.dash-hello h1 {
    font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    text-wrap: balance;
}

.wrapper {
    background: var(--app-bg);
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---------- Sidebar (dark, refreshed) ---------- */
.sidebar.sidebar-dark {
    --cui-sidebar-bg: #1b2230;
    --cui-sidebar-nav-link-color: rgba(255, 255, 255, 0.72);
    --cui-sidebar-nav-link-icon-color: rgba(255, 255, 255, 0.45);
    --cui-sidebar-nav-link-hover-bg: rgba(255, 255, 255, 0.06);
    --cui-sidebar-nav-link-hover-color: #fff;
    --cui-sidebar-nav-link-hover-icon-color: #fff;
    --cui-sidebar-nav-link-active-bg: rgba(91, 155, 224, 0.16);
    --cui-sidebar-nav-link-active-color: #fff;
    --cui-sidebar-nav-link-active-icon-color: #7db4f0;
    background: #1b2230 !important;
    border-right: 0 !important;
}

.sidebar.sidebar-dark .sidebar-header {
    padding-bottom: 0.75rem;
}

.sidebar.sidebar-dark .sidebar-nav {
    padding: 0.75rem;
}

.sidebar.sidebar-dark .nav-link {
    border-radius: 8px;
    margin-bottom: 2px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    font-weight: 500;
    position: relative;
}

.sidebar.sidebar-dark .nav-link i {
    padding-right: 14px;
    color: var(--cui-sidebar-nav-link-icon-color);
    transition: color 0.15s;
}

.sidebar.sidebar-dark .nav-link:hover i {
    color: #fff;
}

.sidebar.sidebar-dark .nav-link.active {
    font-weight: 600;
    color: #fff;
    background: rgba(91, 155, 224, 0.16);
}

.sidebar.sidebar-dark .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar.sidebar-dark .nav-link.active::before {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #5b9be0;
}

.sidebar.sidebar-dark .nav-link.active i {
    color: #7db4f0;
}

.sidebar.sidebar-dark .sidebar-nav i.fal {
    color: rgba(255, 255, 255, 0.45);
}

.sidebar.sidebar-dark .nav-group.border-top {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar.sidebar-dark .nav-group-items .nav-link {
    font-size: 0.88rem;
    font-weight: 400;
}

.sidebar.sidebar-dark .border-bottom,
.sidebar.sidebar-dark .border-top,
.sidebar.sidebar-dark .sidebar-footer {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar.sidebar-dark .profile-menu-box > a {
    border-radius: 8px;
}

.sidebar.sidebar-dark .profile-menu-box > a:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* ---------- Header and breadcrumbs ---------- */
.header.header-sticky {
    box-shadow: none;
    border-bottom: 1px solid var(--app-line);
    background: var(--app-paper);
}

.breadcrumb {
    font-size: 0.85rem;
}

.breadcrumb a {
    color: var(--app-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--app-accent);
}

/* ---------- Buttons and cards ---------- */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary {
    --cui-btn-bg: var(--app-accent);
    --cui-btn-border-color: var(--app-accent);
    --cui-btn-hover-bg: #255d9e;
    --cui-btn-hover-border-color: #255d9e;
    --cui-btn-active-bg: #214f87;
    --cui-btn-color: #fff;
    --cui-btn-hover-color: #fff;
    --cui-btn-active-color: #fff;
}

.btn-light-outline {
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    color: var(--app-text);
}

.btn-light-outline:hover,
.btn-light-outline:focus-visible,
.btn-light-outline.show {
    background: var(--app-bg);
    border-color: #cfd6e0;
    color: var(--app-text);
}

.card {
    border-color: var(--app-line);
    border-radius: var(--app-radius);
}

.card.shadow-sm {
    box-shadow: none !important;
}

.badge-soft {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    white-space: nowrap;
}

.badge-soft.badge-grey {
    background: var(--app-bg);
    color: var(--app-muted);
    border: 1px solid var(--app-line);
}

.avatar-initials {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-grid;
    place-items: center;
}

.value-empty {
    font-family: inherit;
    color: var(--app-muted);
    font-style: italic;
    opacity: 0.85;
}

.cell-mono {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.85rem;
}

.cell-muted {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.cell-sub {
    color: var(--app-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.cell-warn {
    color: var(--app-warn);
    font-size: 0.82rem;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-title h1 {
    margin: 0;
}

/* ---------- Dashboard ---------- */
.dashboard {
    display: grid;
    gap: 1.25rem;
}

.dash-hello {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.dash-hello h1 {
    margin: 0;
}

.dash-date {
    color: var(--app-muted);
    font-size: 0.9rem;
}

.dash-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.kpi {
    display: grid;
    gap: 2px;
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    padding: 14px 16px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.kpi:hover {
    border-color: var(--app-accent);
    box-shadow: 0 4px 14px rgba(45, 108, 181, 0.12);
    color: inherit;
}

.kpi-label {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.kpi-value {
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--app-muted);
}

.kpi.kpi-warn {
    background: var(--app-warn-soft);
    border-color: #ecd3a0;
}

.kpi.kpi-warn .kpi-value {
    color: var(--app-warn);
}

.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.dash-side {
    display: grid;
    gap: 12px;
}

.dash-panel {
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    padding: 16px 18px;
}

.dash-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.dash-panel-head h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.dash-panel-head a {
    font-size: 0.85rem;
    text-decoration: none;
}

.dash-empty {
    color: var(--app-muted);
    margin: 0;
}

.dash-feed {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-feed li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--app-line);
}

.dash-feed li:first-child {
    border-top: 0;
    padding-top: 0;
}

.dash-feed-what {
    font-size: 0.9rem;
}

.dash-feed-what a {
    font-weight: 600;
    text-decoration: none;
}

.dash-feed-change {
    font-size: 0.82rem;
    color: var(--app-muted);
    overflow-wrap: anywhere;
}

.dash-feed-change del {
    color: #b3363b;
}

.dash-feed-change ins {
    color: var(--app-ok);
    text-decoration: none;
}

.dash-feed time {
    font-size: 0.8rem;
    color: var(--app-muted);
    white-space: nowrap;
}

.dash-bars {
    display: grid;
    gap: 6px;
}

.dash-bar {
    display: grid;
    grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 30px;
    gap: 10px;
    align-items: center;
    font-size: 0.87rem;
    color: inherit;
    text-decoration: none;
    padding: 3px 4px;
    border-radius: 6px;
}

.dash-bar:hover {
    background: var(--app-bg);
    color: inherit;
}

.dash-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-bar-track {
    height: 10px;
    background: var(--app-accent-soft);
    border-radius: 5px;
    overflow: hidden;
}

.dash-bar-track span {
    display: block;
    height: 100%;
    background: var(--app-accent);
    border-radius: 5px;
}

.dash-bar-value {
    text-align: right;
    color: var(--app-muted);
    font-variant-numeric: tabular-nums;
}

.dash-todo {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.dash-todo li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--app-bg);
    font-size: 0.88rem;
}

.dash-todo a {
    text-decoration: none;
    color: var(--app-text);
    font-weight: 500;
    min-width: 0;
}

.dash-todo a:hover {
    color: var(--app-accent);
}

.dash-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chip-warn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--app-warn-soft);
    color: var(--app-warn);
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .dash-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Company list ---------- */
.quick-search {
    display: grid;
    gap: 10px;
    margin-bottom: 1rem;
}

.quick-search-input {
    position: relative;
    max-width: 640px;
}

.quick-search-input i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-muted);
}

.quick-search-input .form-control {
    padding-left: 40px;
    border-radius: 10px;
    height: 46px;
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.filter-pill {
    border: 1px solid var(--app-line);
    background: var(--app-paper);
    color: var(--app-text);
    border-radius: 99px;
    padding: 4px 12px;
    font-size: 0.85rem;
    text-decoration: none;
}

.filter-pill:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.filter-pill.active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.filter-more {
    font-size: 0.85rem;
    margin-left: 6px;
    text-decoration: none;
}

.filter-more i {
    font-size: 0.7rem;
}

#advanced-search .card {
    margin-bottom: 1rem;
}

/* ---------- Lists (every GridView) ---------- */
.kv-grid-panel > .card {
    border: 1px solid var(--app-line) !important;
    border-radius: var(--app-radius);
    overflow: hidden;
    box-shadow: none;
}

.kv-grid-panel .kv-panel-before {
    padding: 8px 12px;
    border-bottom: 1px solid var(--app-line);
    background: var(--app-paper);
}

.grid-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.grid-summary,
.grid-summary .summary {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.grid-summary b {
    color: var(--app-text);
    font-weight: 600;
}

.grid-toolbar-row .kv-grid-toolbar {
    float: none !important;
    gap: 6px;
    margin: 0;
}

.grid-toolbar-row .kv-grid-toolbar .btn {
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    color: var(--app-muted);
}

.grid-toolbar-row .kv-grid-toolbar .btn:hover {
    background: var(--app-bg);
    color: var(--app-text);
}

.kv-grid-panel .kv-grid-container {
    min-height: 0;
}

.kv-grid-panel table.table {
    margin-bottom: 0;
}

.kv-grid-panel table.table thead th {
    background: var(--app-bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--app-line);
    vertical-align: middle;
}

.kv-grid-panel table.table thead th a {
    color: var(--app-muted);
    text-decoration: none;
}

.kv-grid-panel table.table td {
    vertical-align: middle;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    border-color: var(--app-line);
}

.kv-grid-panel .table-striped > tbody > tr:nth-of-type(odd) > *,
.kv-grid-panel .table-bordered > :not(caption) > * > * {
    --cui-table-bg-type: transparent;
}

.kv-grid-panel .table-bordered > :not(caption) > * {
    border-width: 0;
}

.kv-grid-panel .table-bordered > :not(caption) > * > * {
    border-left-width: 0;
    border-right-width: 0;
}

/* Footer: pager on the left, a small page-size picker on the right, one divider line */
.kv-grid-panel .card-footer {
    background: var(--app-paper);
    border-top: 1px solid var(--app-line);
    padding: 10px 12px;
}

.grid-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.grid-page-size {
    display: flex;
    align-items: center;
    margin-left: auto;
    color: var(--app-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.grid-page-size label {
    margin: 0 8px 0 0;
}

.grid-page-size .form-select,
.grid-toolbar-row .per-page-selector {
    min-height: 32px;
    padding: 0.25rem 2rem 0.25rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 8px;
    border-color: var(--app-line);
}

.kv-grid-panel .pagination {
    margin: 0;
    gap: 4px;
}

.kv-grid-panel .pagination .page-link {
    border-radius: 8px;
    border-color: var(--app-line);
    color: var(--app-text);
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
}

.kv-grid-panel .pagination .page-item.active .page-link {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.kv-grid-panel .pagination .page-item.disabled .page-link {
    color: var(--app-muted);
    background: var(--app-paper);
}

tr.row-link {
    cursor: pointer;
}

tr.row-link:hover > td {
    background: var(--app-accent-soft) !important;
}

.company-link,
.record-link {
    font-weight: 600;
    text-decoration: none;
    color: var(--app-accent);
}

.company-link:hover,
.record-link:hover {
    text-decoration: underline;
}

/* The per-row "Műveletek" menu stays available but quiet */
.kv-grid-panel .dropdown-toggle.btn-outline-secondary {
    border-color: transparent;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.kv-grid-panel .dropdown-toggle.btn-outline-secondary:hover,
.kv-grid-panel .dropdown-toggle.btn-outline-secondary.show {
    background: var(--app-bg);
    border-color: var(--app-line);
    color: var(--app-text);
}

/* Search forms above lists */
.list-filters {
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    padding: 12px 16px 14px;
    margin-bottom: 1rem;
}

.list-filters .mb-3,
.list-filters .form-group {
    margin-bottom: 0 !important;
}

.user-search .form-control,
.company-search .form-control {
    border-radius: 8px;
}

label.form-label,
.control-label {
    font-weight: 500;
    color: var(--app-muted);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

/* ---------- Company view ---------- */
.company-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    padding: 18px 20px;
    margin-bottom: 1rem;
}

.company-head-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.company-head h1 {
    font-size: 1.5rem;
    margin: 0;
    overflow-wrap: anywhere;
}

.company-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.company-meta-tax {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    color: var(--app-text);
}

.company-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.company-view .nav-underline,
.company-view #company-tabs {
    border-bottom: 1px solid var(--app-line);
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.company-view #company-tabs .nav-link {
    color: var(--app-muted);
    padding-left: 0;
    padding-right: 0;
}

.company-view #company-tabs .nav-link.active {
    color: var(--app-accent);
    font-weight: 600;
}

.company-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 12px;
    align-items: start;
}

.company-details-side {
    display: grid;
    gap: 12px;
}

.info-card .card-body {
    padding: 16px 18px;
}

.info-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.info-card-head a {
    font-size: 0.85rem;
    text-decoration: none;
}

.info-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.info-list {
    display: grid;
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
    gap: 8px 14px;
    margin: 0;
    font-size: 0.9rem;
}

.info-list dt {
    color: var(--app-muted);
    font-weight: 400;
}

.info-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.contact-line > i {
    color: #8794a5;
    width: 14px;
    flex-shrink: 0;
}

.contact-line > span,
.contact-line > div {
    min-width: 0;
}

.person {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--app-line);
}

.person:first-of-type {
    border-top: 0;
    padding-top: 4px;
}

.person-role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
}

.person-name {
    font-weight: 600;
}

.mini-feed {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--app-muted);
}

.mini-feed strong {
    color: var(--app-text);
    font-weight: 500;
}

/* Missing data warning + inline "quick add" forms on the company view */
.missing-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: var(--app-radius);
    background: var(--app-warn-soft);
    color: var(--app-warn);
    font-size: 0.9rem;
}

.missing-banner-text {
    flex: 1 1 220px;
}

.missing-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.missing-banner-actions .btn {
    background: var(--app-paper);
}

.quick-add-toggle {
    font-size: 0.82rem;
    text-decoration: none;
}

.info-list dd > .quick-add-toggle {
    display: block;
    width: fit-content;
}

/* Always visible "…" menu, so it is obvious that the item can be edited / deleted right here */
.quick-edit-menu {
    display: inline-block;
    flex-shrink: 0;
}

.quick-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    font-size: 0.72rem;
    vertical-align: middle;
    text-decoration: none;
    color: var(--app-accent);
    background: var(--app-accent-soft);
}

/* site.css turns every .btn:hover text white */
.quick-edit-btn:hover,
.quick-edit-btn:focus-visible {
    color: #fff;
    background: var(--app-accent);
}

.info-card-actions {
    display: flex;
    gap: 12px;
}

/* The edit form's list widgets on the company view: only their modals are used */
.company-quick-edit .dynamic-field-card {
    display: none;
}

@media (max-width: 991.98px) {
    .company-details {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Forms (every form) ---------- */
.form-page {
    width: 100%;
    padding-bottom: 8px;
}

.form-page-head {
    margin-bottom: 1rem;
}

.form-page-head h1 {
    margin: 0;
    font-size: 1.6rem;
    overflow-wrap: anywhere;
}

.form-eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-accent);
    margin-bottom: 2px;
}

.form-section {
    background: var(--app-paper);
    border: 1px solid #d9e0ea;
    border-radius: 12px;
    padding: 0 20px 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
    overflow: hidden;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
    margin: 0 -20px 18px;
    padding: 12px 20px;
    background: #f3f6fa;
    border-bottom: 1px solid #d9e0ea;
}

.form-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--app-accent);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.form-section .row > [class*="col-"] {
    margin-bottom: 0.6rem;
}

.form-section label.form-label,
.form-section .control-label {
    color: #334155;
    font-weight: 600;
}

/* Inputs: one size and look everywhere (plain inputs, masked inputs, selects, Select2) */
.form-control,
.form-select {
    border-color: #c3ccd9;
    background-color: #fff;
    border-radius: 8px;
    min-height: 42px;
    line-height: 1.5;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:hover,
.form-select:hover {
    border-color: #b9c2cf;
}

.form-control:focus,
.form-select:focus,
.select2-container--krajee-bs5.select2-container--focus .select2-selection,
.select2-container--krajee-bs5.select2-container--open .select2-selection {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 0.2rem rgba(45, 108, 181, 0.15) !important;
}

.form-control::placeholder {
    color: #9aa5b4;
}

.select2-container--krajee-bs5 .select2-selection--single {
    height: 42px !important;
    min-height: 42px;
    border-color: #c3ccd9;
    border-radius: 8px !important;
}

.select2-container--krajee-bs5 .select2-selection--single .select2-selection__rendered {
    line-height: 26px;
    padding-left: 0.1rem;
}

.select2-container--krajee-bs5 .select2-dropdown {
    border-color: #d5dbe4;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(20, 30, 50, 0.12);
    overflow: hidden;
}

.select2-container--krajee-bs5 .select2-results__option--highlighted {
    background: var(--app-accent) !important;
}

.has-error .form-control,
.form-control.is-invalid {
    border-color: #d0484d;
}

.invalid-feedback,
.help-block-error {
    font-size: 0.82rem;
}

/* Dynamic lists in forms (central emails, phones, contacts): tinted sub-panels */
.dynamic-field-card {
    border: 0;
    border-radius: 10px;
    background: #f3f6fa;
    box-shadow: none;
    height: 100%;
}

.dynamic-field-card .card-body {
    padding: 12px 14px 14px;
}

.dynamic-field-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    margin-bottom: 10px;
}

.dynamic-field-card .list-group {
    gap: 6px;
}

.dynamic-field-card .list-group-item {
    border: 1px solid #d9e0ea !important;
    border-radius: 8px !important;
    background: var(--app-paper);
    font-size: 0.93rem;
    font-weight: 500;
    padding: 9px 12px;
    margin: 0 !important;
}

.dynamic-field-card .actions .btn-link {
    color: #64748b !important;
    padding: 2px 6px !important;
    border-radius: 6px;
}

.dynamic-field-card .actions .btn-link:hover {
    background: var(--app-bg);
    color: var(--app-accent) !important;
}

.dynamic-field-card .actions .delete-dynamic-field:hover {
    color: #b3363b !important;
    background: #fbeaea;
}

.dynamic-field-card .list-group-item.active[id$="-add-item"] {
    background: transparent;
    border: 1px dashed #9fb8d8 !important;
    color: var(--app-accent);
    font-weight: 600;
    font-size: 0.88rem;
    text-align: center;
}

.dynamic-field-card .list-group-item.active[id$="-add-item"]:hover {
    background: var(--app-accent-soft);
    border-color: var(--app-accent) !important;
}

/* ---------- Modals: white card like the login card, no blue header bar ---------- */
/* Colour set on the base class (not .show) so the fade-out keeps it instead of flashing black */
.modal-backdrop {
    --cui-backdrop-bg: #1b2230;
    --cui-backdrop-opacity: 0.45;
}

.modal-content {
    border: 1px solid var(--app-line);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(20, 30, 50, 0.22);
    overflow: hidden;
}

.modal-header {
    background: var(--app-paper);
    color: var(--app-text);
    border-bottom: 1px solid #ccd5e1;
    padding: 1.1rem 1.5rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-header .btn-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    background-size: 0.75rem;
    opacity: 0.55;
    filter: none;
}

.modal-header .btn-close:hover {
    background-color: var(--app-bg);
    opacity: 1;
}

.modal-header .btn-close:focus {
    box-shadow: 0 0 0 3px var(--app-accent-soft);
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-body .form-label {
    font-weight: 500;
    font-size: 0.88rem;
}

.modal-body > :last-child,
.modal-body > :last-child > :last-child {
    margin-bottom: 0 !important;
}

.modal-footer {
    background: var(--app-bg);
    border-top: 1px solid var(--app-line);
    padding: 0.8rem 1.5rem;
    gap: 8px;
}

.modal-footer > * {
    margin: 0;
}

.modal-footer .btn-primary {
    min-width: 110px;
}

.alert {
    border-radius: var(--app-radius);
}

.alert-info {
    background: var(--app-accent-soft);
    border-color: #cfe0f4;
    color: #1f4f86;
}

.form-actions-sticky {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 1rem;
    padding: 10px 14px;
    background: var(--app-paper);
    border: 1px solid #d9e0ea;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(20, 30, 50, 0.12);
}

.form-actions-sticky .btn-primary {
    min-width: 120px;
}

/* ---------- Detail views (DetailView tables) ---------- */
table.detail-view {
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

table.detail-view > tbody > tr > * {
    --cui-table-bg-type: transparent;
    border-width: 0;
    border-top: 1px solid var(--app-line);
    padding: 0.7rem 1rem;
}

table.detail-view > tbody > tr:first-child > * {
    border-top: 0;
}

table.detail-view th {
    width: 220px;
    color: var(--app-muted);
    font-weight: 400;
}

table.detail-view.table-striped > tbody > tr:nth-of-type(odd) > * {
    --cui-table-bg-type: transparent;
    --cui-table-color-type: inherit;
}

/* ---------- Login ---------- */
body.login-page {
    background: var(--app-bg) !important;
    background-image: none !important;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    /* A brand panel stays narrow on wide screens, so it does not become a big empty area */
    grid-template-columns: clamp(340px, 34vw, 520px) minmax(0, 1fr);
}

.login-brand {
    background: #1b2230;
    color: #fff;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 155, 224, 0.28), rgba(91, 155, 224, 0) 70%);
    pointer-events: none;
}

.login-logo {
    width: 180px;
    max-width: 100%;
}

.login-brand-text h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-brand-text p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    max-width: 36ch;
    margin: 0;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
    gap: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(20, 30, 50, 0.08);
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.login-sub {
    color: var(--app-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-card .mb-3,
.login-card .form-group {
    margin-bottom: 1rem;
}

.login-input {
    position: relative;
}

.login-input > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa5b4;
    pointer-events: none;
}

.login-input .form-control {
    padding-left: 40px;
    height: 46px;
}

.login-submit {
    height: 46px;
    margin-top: 0.5rem;
}

.login-footer {
    color: var(--app-muted);
    font-size: 0.8rem;
}

/* OAuth consent page (MCP): same shell as the login page */
.consent-card {
    max-width: 460px;
}

.consent-card h2 {
    font-size: 1.3rem;
    line-height: 1.35;
}

.consent-scopes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}

.consent-scope {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--app-line);
    border-radius: 10px;
    cursor: pointer;
    margin: 0;
}

.consent-scope .form-check-input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.consent-scope:has(.form-check-input:checked) {
    border-color: var(--app-accent);
    background: rgba(91, 155, 224, 0.06);
}

.consent-scope.is-disabled {
    cursor: not-allowed;
    color: var(--app-muted);
    background: var(--app-bg);
}

.consent-note {
    color: var(--app-muted);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-brand {
        padding: 28px 24px;
        gap: 18px;
    }

    .login-brand-text h1 {
        font-size: 1.4rem;
    }
}

/* ---------- Page width: content centered with a max width ---------- */
.wrapper > .body > .container-fluid,
.wrapper > .header > .container-fluid {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
}

/* Company view: actions on the left, under the name, where people look for them */
.company-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

/* Legacy override in site.css used another blue */
.text-primary {
    color: var(--app-accent) !important;
}

/* ---------- Sidebar profile menu ---------- */
.sidebar.sidebar-dark .profile-menu-container {
    padding: 8px 10px;
}

.sidebar.sidebar-dark .profile-menu-box {
    border-radius: 8px;
}

.sidebar.sidebar-dark .profile-menu-box:hover,
.sidebar.sidebar-dark .profile-menu-box:has(.show) {
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar.sidebar-dark .profile-menu-who strong {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.sidebar-dark .profile-menu-who .avatar-initials {
    background: #5b9be0;
    color: #fff;
}

.profile-menu-caret {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar.sidebar-dark .profile-menu-box .dropdown-menu {
    --cui-dropdown-bg: #242d3e;
    --cui-dropdown-link-color: rgba(255, 255, 255, 0.85);
    --cui-dropdown-link-hover-bg: rgba(255, 255, 255, 0.08);
    --cui-dropdown-link-hover-color: #fff;
    --cui-dropdown-divider-bg: rgba(255, 255, 255, 0.1);
    background-color: #242d3e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35) !important;
}

.sidebar.sidebar-dark .profile-menu-box .dropdown-item {
    border-radius: 6px;
    padding: 8px 10px;
    color: rgba(255, 255, 255, 0.85);
}

.sidebar.sidebar-dark .profile-menu-box .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar.sidebar-dark .profile-menu-box .dropdown-item.text-danger {
    color: #f19a9d !important;
}

.sidebar.sidebar-dark .profile-menu-box .dropdown-item.text-danger:hover {
    background: rgba(241, 154, 157, 0.12);
}

/* ---------- "Új" badge (menu, help, dashboard) ---------- */
.badge-new {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 99px;
    background: #f59f0b;
    color: #fff;
    white-space: nowrap;
}

.sidebar .nav-link .badge-new {
    margin-left: auto;
    box-shadow: 0 0 0 3px rgba(245, 159, 11, 0.18);
}

/* ---------- Dashboard news banner ---------- */
.dash-news {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(100deg, #1b2230 0%, #24406a 100%);
    color: #fff;
    flex-wrap: wrap;
}

.dash-news-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dash-news-text {
    flex: 1;
    min-width: 240px;
}

.dash-news-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.02rem;
}

.dash-news-text p {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
}

.dash-news-btn {
    --cui-btn-bg: #fff;
    --cui-btn-color: #1b2230;
    --cui-btn-border-color: #fff;
    --cui-btn-hover-bg: #e8f0fa;
    --cui-btn-hover-color: #1b2230;
    --cui-btn-hover-border-color: #e8f0fa;
    --cui-btn-active-bg: #d6e4f5;
    --cui-btn-active-color: #1b2230;
    --cui-btn-active-border-color: #d6e4f5;
    --cui-btn-focus-box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

/* site.css forces white text on every .btn:hover; keep the light button readable in all states */
.dash-news .dash-news-btn:hover,
.dash-news .dash-news-btn:focus,
.dash-news .dash-news-btn:focus-visible,
.dash-news .dash-news-btn:active {
    color: #1b2230;
}

/* ---------- Help page ---------- */
.help-page {
    display: grid;
    gap: 16px;
}

.help-hero {
    display: grid;
    gap: 14px;
}

.help-hero h1 {
    margin: 0;
}

.help-hero p {
    margin: 4px 0 0;
    color: var(--app-muted);
}

.help-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.help-topic {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 99px;
    background: var(--app-paper);
    border: 1px solid var(--app-line);
    color: var(--app-text);
    font-size: 0.87rem;
    text-decoration: none;
}

.help-topic i {
    color: var(--app-accent);
}

.help-topic:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    gap: 16px;
    align-items: start;
}

.help-card {
    background: var(--app-paper);
    border: 1px solid #d9e0ea;
    border-radius: 12px;
    overflow: hidden;
    scroll-margin-top: 80px;
}

.help-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #f3f6fa;
    border-bottom: 1px solid #d9e0ea;
}

.help-card-head h2 {
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0;
}

.help-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--app-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.help-card-body {
    padding: 16px 18px;
    line-height: 1.6;
}

.help-card-body ul {
    padding-left: 1.2rem;
}

.help-card-featured {
    border: 2px solid var(--app-accent);
    box-shadow: 0 10px 30px rgba(45, 108, 181, 0.12);
}

.help-card-featured .help-card-head {
    background: linear-gradient(100deg, #1b2230 0%, #24406a 100%);
    border-bottom: 0;
    color: #fff;
}

.help-card-featured .help-card-head h2 {
    font-size: 1.15rem;
}

.help-card-featured .help-icon {
    background: rgba(255, 255, 255, 0.15);
}

.help-lead {
    font-size: 1rem;
    max-width: 80ch;
}

.help-mcp-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 24px;
    margin-top: 8px;
}

@media (max-width: 991.98px) {
    .help-mcp-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.help-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    margin-bottom: 6px;
}

.help-url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f3f6fa;
    border: 1px dashed #9fb8d8;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
    overflow-wrap: anywhere;
}

.help-steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.help-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 44px;
}

.help-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-weight: 700;
    display: grid;
    place-items: center;
}

.help-steps li strong {
    display: block;
}

.help-chip {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 1px 9px;
    margin: 2px 0;
    border-radius: 99px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    white-space: nowrap;
}

.help-side {
    display: grid;
    gap: 12px;
    align-content: start;
}

.help-side-box {
    background: #f3f6fa;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.9rem;
}

.help-side-box p {
    margin-bottom: 0.5rem;
}

.help-checklist {
    list-style: none;
    padding: 0 !important;
    margin: 0;
    display: grid;
    gap: 6px;
}

.help-checklist li {
    position: relative;
    padding-left: 22px;
}

.help-checklist li::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Pro", "Font Awesome 6 Free", "Font Awesome 5 Pro", "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    color: var(--app-ok);
    font-size: 0.8rem;
}

.help-note {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.help-tip,
.help-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.help-tip {
    background: var(--app-accent-soft);
    color: #1f4f86;
}

.help-warning {
    background: var(--app-warn-soft);
    color: #6b4500;
    margin: 1rem 0 0;
}

.help-tip i,
.help-warning i {
    margin-top: 3px;
}

/* Inline "button" pictures inside the help text: look like buttons, but are not clickable */
.help-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--app-line);
    background: var(--app-paper);
    white-space: nowrap;
}

.help-btn-primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.help-btn-success {
    background: #2eb85c;
    border-color: #2eb85c;
    color: #fff;
}

.help-btn-dashed {
    border: 1px dashed #9fb8d8;
    color: var(--app-accent);
    background: transparent;
}
