:root {
    --bs-primary: #0186be;
    --bs-primary-rgb: 1, 134, 190;
    --bs-secondary: #2f4a5b;
    --bs-secondary-rgb: 47, 74, 91;
    --bs-info: #009fe3;
    --bs-info-rgb: 0, 159, 227;
    --bs-danger: #e3071c;
    --bs-danger-rgb: 227, 7, 28;
    --bs-link-color: #009fe3;
    --bs-link-color-rgb: 0, 159, 227;
    --bs-link-hover-color: #e3071c;
    --bs-link-hover-color-rgb: 227, 7, 28;
    --bs-body-color: #575757;
    --bs-body-bg: #f4f4f4;
    --bs-box-shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .485);
    --mcrm-primary: #0186be;
    --mcrm-primary-bright: #009fe3;
    --mcrm-primary-soft: #66b6d8;
    --mcrm-sidebar: #2f4a5b;
    --mcrm-accent: #e3071c;
}

.btn-primary {
    --bs-btn-bg: var(--mcrm-primary);
    --bs-btn-border-color: var(--mcrm-primary);
    --bs-btn-hover-bg: var(--mcrm-primary-bright);
    --bs-btn-hover-border-color: var(--mcrm-primary-bright);
    --bs-btn-active-bg: #0069b4;
    --bs-btn-active-border-color: #0069b4;
}

.btn-outline-secondary {
    --bs-btn-color: var(--mcrm-primary-bright);
    --bs-btn-border-color: var(--mcrm-primary-bright);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: var(--mcrm-primary-bright);
    --bs-btn-hover-border-color: var(--mcrm-primary-bright);
    --bs-btn-focus-shadow-rgb: var(--bs-info-rgb);
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: var(--mcrm-primary-bright);
    --bs-btn-active-border-color: var(--mcrm-primary-bright);
    --bs-btn-disabled-color: var(--mcrm-primary-bright);
    --bs-btn-disabled-border-color: var(--mcrm-primary-bright);
}

.form-control,
.form-select {
    border-color: var(--mcrm-primary-bright);
    background-color: #ffffff;
}

.form-control::placeholder,
.contacts-search input::placeholder {
    color: #929ca2;
    opacity: 1;
}

[data-crud-form] .form-control.is-empty,
[data-crud-form] .form-select.is-empty {
    border-color: #c9d0d4;
}

[data-crud-form] .form-control.is-empty:focus,
[data-crud-form] .form-select.is-empty:focus {
    border-color: var(--mcrm-primary-bright);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mcrm-primary-bright);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-info-rgb), .18);
}

.dashboard-cards .card {
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
    border-left: 5px solid;
}

body {
    background: var(--bs-body-bg);
}

.card-body {
    background-color: #ffffff;
}

.card > .card-body:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.card > .card-body:last-child {
    border-bottom-right-radius: inherit;
    border-bottom-left-radius: inherit;
}

.table {
    --bs-table-bg: #ffffff;
    background-color: #ffffff;
}

.app-shell {
    min-height: 100vh;
}

.login-panel {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    letter-spacing: 0;
}

.login-logo {
    width: 9rem;
    height: auto;
}

.two-factor-qr {
    display: flex;
    justify-content: center;
}

.two-factor-qr img {
    width: 100%;
    max-width: 280px;
    height: auto;
    padding: .75rem;
    border: 1px solid #d7d7d7;
    border-radius: .5rem;
    background: #ffffff;
}

.backup-codes-panel {
    max-width: 520px;
}

.backup-code-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.backup-code-list code {
    display: block;
    padding: .75rem;
    border: 1px solid #d7d7d7;
    border-radius: .5rem;
    color: var(--mcrm-sidebar);
    background: #ffffff;
    text-align: center;
}

.layout-shell {
    display: flex;
    min-height: 100vh;
}

.layout-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 260px;
    height: 100vh;
    flex: 0 0 260px;
    padding: 1.25rem;
    color: #ffffff;
    background: var(--mcrm-sidebar);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.sidebar-brand-logo {
    width: 4.75rem;
    height: auto;
    padding: .35rem;
    border-radius: .375rem;
    background: #ffffff;
}

.sidebar-brand-title {
    font-weight: 700;
}

.sidebar-brand-subtitle {
    color: var(--mcrm-primary-soft);
    font-size: .875rem;
}

.sidebar-nav {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
}

.sidebar-nav-main,
.sidebar-section {
    display: grid;
    gap: .25rem;
}

.sidebar-section + .sidebar-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
}

.sidebar-section-admin {
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .28);
}

.sidebar-section-account {
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .28);
}

.sidebar-section-label {
    padding: 0 .75rem .25rem;
    color: var(--mcrm-primary-soft);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar-user {
    padding: .25rem .75rem .5rem;
    color: rgba(255, 255, 255, .82);
    font-size: .8125rem;
    overflow-wrap: anywhere;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 2.75rem;
    padding: .625rem .75rem;
    border-radius: .5rem;
    color: #ffffff;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.is-active,
.sidebar-link.active {
    color: #ffffff;
    background: var(--mcrm-primary);
}

.sidebar-link-warning {
    color: #ffe7a7;
}

.sidebar-link.is-disabled {
    color: var(--mcrm-primary-soft);
    cursor: default;
}

.sidebar-icon {
    width: 1.25rem;
    text-align: center;
}

.layout-main {
    min-width: 0;
    flex: 1;
}

.layout-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 80px;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #d7d7d7;
}

.layout-content {
    padding: 1.5rem;
}

.content-panel {
    max-width: 720px;
}

.account-form {
    max-width: 460px;
}

.contacts-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.contacts-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.5rem;
    flex: 1;
    padding: 0 .75rem;
    border: 1px solid #d7d7d7;
    border-radius: .375rem;
    background: #ffffff;
    color: var(--bs-secondary);
}

.contacts-search input {
    width: 100%;
    border: 0;
    background: transparent;
}

.contacts-workspace {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 520px;
    border: 1px solid #d7d7d7;
    background: #ffffff;
}

.contacts-filter-panel {
    padding: 1rem;
    border-right: 1px solid #d7d7d7;
    background: #fafafa;
}

.contacts-save-filter {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #d7d7d7;
}

.filter-group {
    margin-bottom: 1.25rem;
}

.contacts-results {
    min-width: 0;
    padding: 1rem;
}

.contact-list-table {
    border: 1px solid #d7d7d7;
    border-radius: .375rem;
    background: #ffffff;
}

.contact-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #eef3f4;
    color: var(--mcrm-sidebar);
    font-size: .75rem;
    font-weight: 700;
    object-fit: cover;
}

.contact-photo-crop {
    position: relative;
    width: min(100%, 24rem);
    aspect-ratio: 1;
    margin-inline: auto;
    overflow: hidden;
    border-radius: .5rem;
    background: #e9ecef;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.contact-photo-crop:active {
    cursor: grabbing;
}

.contact-photo-crop img {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none;
    transform-origin: center;
}

.contact-photo-crop-guide {
    position: absolute;
    inset: 6%;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
    pointer-events: none;
}

.contact-tag,
.media-position {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: .125rem .5rem;
    border: 1px solid #d7d7d7;
    border-radius: 999px;
    font-size: .75rem;
}

.contact-tag {
    color: var(--mcrm-primary);
    border-color: var(--mcrm-primary);
}

.relationship-stars {
    display: inline-flex;
    gap: .125rem;
}

.relationship-stars span {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #d7d7d7;
}

.relationship-stars .is-on {
    background: var(--mcrm-primary);
}

.media-position-pro-gewerkschaft {
    color: #3f8f4a;
    border-color: #3f8f4a;
}

.media-position-neutral,
.media-position-unklar {
    color: var(--bs-secondary);
}

.media-position-kritisch {
    color: var(--mcrm-accent);
    border-color: var(--mcrm-accent);
}

#contactSectionModal [data-contact-section-form] {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#contactSectionModal .modal-body {
    min-height: 0;
    overflow-y: auto;
}

.contact-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.contact-detail-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 1rem;
}

.contact-business-card {
    grid-column: 1 / -1;
    min-width: 0;
    border: 1px solid #d7d7d7;
    border-top: 3px solid var(--mcrm-accent);
}

.contact-business-card-header {
    padding: 1rem 1.5rem 0;
    background: transparent;
    border-bottom: 0;
}

.contact-business-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    gap: 2rem;
    padding: 1.25rem 1.5rem 1.75rem;
}

.contact-business-card-identity {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.contact-business-card .contact-detail-avatar {
    width: 6rem;
    height: 6rem;
    flex-basis: 6rem;
    font-size: 1.75rem;
}

.contact-business-card-name {
    margin-bottom: .35rem;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 650;
    color: var(--mcrm-sidebar);
}

.contact-business-card-position {
    font-size: 1.1rem;
}

.contact-business-card-meta {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid #e5e9eb;
}

.contact-profile-column,
.contact-activity-column {
    display: grid;
    align-content: start;
    gap: 1rem;
}

.contact-detail-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    flex: 0 0 4.5rem;
    border-radius: 50%;
    background: #eef3f4;
    color: var(--mcrm-sidebar);
    font-weight: 700;
    object-fit: cover;
}

.contact-facts {
    display: grid;
    gap: .4rem;
    font-size: .9rem;
}

.contact-muted-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: .1rem .45rem;
    border: 1px solid #d7d7d7;
    border-radius: 999px;
    color: var(--bs-secondary);
    font-size: .75rem;
}

.contact-media-banner {
    border-left: .25rem solid #3f8f4a !important;
}

.contact-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid #d7d7d7;
}

.contact-tabs span {
    padding: .75rem 1rem;
    color: var(--bs-secondary);
}

.contact-tabs .is-active {
    color: var(--mcrm-primary);
    border-bottom: 2px solid var(--mcrm-primary);
    font-weight: 600;
}

.contact-timeline {
    position: relative;
    display: grid;
    gap: 1rem;
    padding-left: 1rem;
}

.contact-timeline::before {
    position: absolute;
    top: .25rem;
    bottom: .25rem;
    left: .2rem;
    width: 1px;
    background: #d7d7d7;
    content: "";
}

.contact-timeline-item {
    position: relative;
}

.contact-timeline-item::before {
    position: absolute;
    top: .35rem;
    left: -1rem;
    width: .55rem;
    height: .55rem;
    border: 2px solid var(--mcrm-primary);
    border-radius: 50%;
    background: #ffffff;
    content: "";
}

.contact-form {
    max-width: 1100px;
}

.contact-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.contact-form-grid {
    display: grid;
    gap: 1rem;
}

.contact-form-grid > [data-cluster-order="1"] { order: 1; }
.contact-form-grid > [data-cluster-order="2"] { order: 2; }
.contact-form-grid > [data-cluster-order="3"] { order: 3; }
.contact-form-grid > [data-cluster-order="7"] { order: 7; }
.contact-form-grid > [data-cluster-order="8"] { order: 8; }
.contact-form-grid > [data-cluster-order="9"] { order: 9; }
.contact-form-grid > [data-cluster-order="10"] { order: 10; }
.contact-form-grid > [data-cluster-order="11"] { order: 11; }

.interaction-contact-picker {
    overflow: hidden;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
}

.interaction-contact-picker .input-group > * {
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
}

.interaction-contact-results {
    max-height: 18rem;
    overflow-y: auto;
    border-bottom: 1px solid #dee2e6;
}

.interaction-contact-result {
    display: flex;
    width: 100%;
    align-items: center;
    margin: 0;
    padding: .65rem .85rem;
    border: 0;
    border-bottom: 1px solid #eeeeee;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
}

.interaction-contact-result:last-of-type {
    border-bottom: 0;
}

.interaction-contact-result:hover,
.interaction-contact-result:focus {
    background: #f3f7fb;
}

.interaction-contact-selected {
    display: flex;
    min-height: 3.25rem;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .65rem .85rem;
}

.interaction-contact-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .4rem .3rem .65rem;
    font-size: .875rem;
}

.interaction-contact-badge button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    opacity: .7;
    cursor: pointer;
}

.interaction-contact-badge button:hover,
.interaction-contact-badge button:focus {
    background: transparent;
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .layout-shell {
        display: block;
    }

    .layout-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 1rem;
    }

    .sidebar-brand {
        margin-bottom: 1rem;
    }

    .sidebar-nav {
        display: grid;
        gap: 1rem;
    }

    .sidebar-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-section-label,
    .sidebar-user {
        grid-column: 1 / -1;
    }

    .layout-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .contacts-toolbar,
    .contacts-workspace {
        display: block;
    }

    .contacts-filter-panel {
        border-right: 0;
        border-bottom: 1px solid #d7d7d7;
    }

    .contact-detail-grid {
        grid-template-columns: 1fr;
    }

    .contact-business-card-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.25rem;
        padding: 1rem;
    }

    .contact-business-card-header {
        padding: 1rem 1rem 0;
    }

    .contact-business-card-identity {
        align-items: flex-start;
        gap: 1rem;
    }

    .contact-business-card .contact-detail-avatar {
        width: 4.5rem;
        height: 4.5rem;
        flex-basis: 4.5rem;
    }

    .contact-business-card-meta {
        padding: 1rem 0 0;
        border-left: 0;
        border-top: 1px solid #e5e9eb;
    }
}

.contact-channel-row { display: flex; align-items: baseline; gap: .5rem; }
.contact-channel-row > span { min-width: 0; overflow-wrap: anywhere; }
.contact-channel-icon { width: 1rem; height: 1rem; flex: 0 0 1rem; align-self: flex-start; margin-top: .25rem; }
.contact-change-detail { font-size: .875rem; overflow-wrap: anywhere; }
.contact-text-diff { max-height: 18rem; overflow: auto; font-family: monospace; }
.contact-diff-line { display: flex; gap: .5rem; padding: .125rem .375rem; }
.contact-diff-line > span:first-child { flex: 0 0 1ch; }
.contact-diff-line > span:last-child { white-space: pre-wrap; min-width: 0; }
.contact-diff-removed { background: #ffebe9; color: #82071e; }
.contact-diff-added { background: #dafbe1; color: #116329; }

.contact-change-disclosure > summary { cursor: pointer; }
.contact-change-disclosure > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.contacts-more-filters > summary { cursor: pointer; }
.contacts-more-filters > summary:hover { text-decoration: underline; }
.contacts-more-filters .contacts-more-filters-hide,
.contacts-more-filters[open] .contacts-more-filters-show { display: none; }
.contacts-more-filters[open] .contacts-more-filters-hide { display: inline; }

.icon-action-button { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; }
.icon-action-button > svg { flex-shrink: 0; }
