:root {
    --mg-ink: #14211f;
    --mg-muted: #64736e;
    --mg-cypress: #173c34;
    --mg-eucalyptus: #6f9a88;
    --mg-rose: #b85f6b;
    --mg-rose-dark: #914753;
    --mg-surface: #f6faf7;
    --mg-line: #dce8e0;
    --mg-card: #ffffff;
    --mg-radius: 24px;
    --mg-radius-sm: 16px;
    --mg-pill: 999px;
    --mg-shadow-soft: 0 14px 36px rgba(23, 60, 52, 0.08);
    --mg-shadow-lift: 0 22px 52px rgba(23, 60, 52, 0.14);
    --bs-primary: var(--mg-rose);
    --bs-primary-rgb: 184, 95, 107;
}

body {
    background:
        radial-gradient(circle at 8% 8%, rgba(111, 154, 136, 0.2), transparent 28%),
        radial-gradient(circle at 92% 0%, rgba(184, 95, 107, 0.13), transparent 26%),
        linear-gradient(180deg, rgba(232, 241, 236, 0.9), rgba(246, 250, 247, 0.94) 320px),
        var(--mg-surface);
    color: var(--mg-ink);
    font-family: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.layout-wrapper {
    background: var(--mg-surface);
    min-height: 100vh;
    overflow-x: clip;
    position: relative;
}

.crm-shell-backdrop {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(232, 241, 236, 0.4)),
        radial-gradient(circle at 64% 0%, rgba(184, 95, 107, 0.08), transparent 30%);
    border: 1px solid rgba(220, 232, 224, 0.72);
    border-radius: 36px;
    box-shadow: 0 28px 90px rgba(23, 60, 52, 0.08);
    inset: 18px 18px 18px 278px;
    pointer-events: none;
    position: fixed;
    z-index: 0;
}

.main-menu {
    background:
        linear-gradient(180deg, #102d27 0%, #173c34 52%, #102d27 100%);
    border-right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    box-shadow: 18px 0 56px rgba(20, 33, 31, 0.14);
    width: 260px;
    z-index: 1035;
}

.logo-box {
    align-items: center;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    min-height: 76px;
    padding: 0 16px;
}

.crm-sidebar-scroll {
    height: calc(100vh - 76px);
    overflow-y: auto;
    padding: 14px 0 18px;
}

.app-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    list-style: none;
}

.app-menu .menu-title {
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.9rem 1.55rem 0.45rem;
}

.app-menu .menu-link {
    align-items: center;
    border-radius: var(--mg-radius-sm);
    color: rgba(255, 255, 255, 0.74);
    display: flex;
    font-weight: 700;
    gap: 0.65rem;
    margin-inline: 12px;
    min-height: 42px;
    padding: 0.62rem 0.78rem;
    position: relative;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.app-menu .menu-link:hover,
.app-menu .menu-item.active .menu-link,
.app-menu .menu-link[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
    transform: translateX(2px);
}

.app-menu .menu-item.active .menu-link::before {
    background: var(--mg-rose);
    border-radius: var(--mg-pill);
    content: "";
    height: 22px;
    left: -5px;
    position: absolute;
    width: 3px;
}

.crm-nav-count {
    align-items: center;
    background: rgba(230, 184, 95, 0.18);
    border: 1px solid rgba(230, 184, 95, 0.34);
    border-radius: var(--mg-pill);
    color: #ffe7a5;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 900;
    height: 24px;
    justify-content: center;
    min-width: 24px;
    padding: 0 0.45rem;
}

.menu-icon svg,
.menu-icon i {
    color: inherit;
    stroke-width: 1.8;
}

.crm-icon,
[data-lucide] {
    display: inline-block;
    flex: 0 0 auto;
    height: 18px;
    vertical-align: -0.2em;
    width: 18px;
}

.menu-icon .crm-icon {
    height: 19px;
    width: 19px;
}

.button-toggle-menu .crm-icon {
    height: 21px;
    width: 21px;
}

.help-box {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--mg-radius);
    color: rgba(255, 255, 255, 0.78);
    margin: 18px 12px;
    padding: 16px;
}

.help-box h5 {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 850;
    margin-bottom: 0.4rem;
}

.help-box p {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    line-height: 1.55;
    margin-bottom: 0.9rem;
}

.navbar-custom {
    background: rgba(246, 250, 247, 0.92);
    border-bottom: 1px solid var(--mg-line);
    backdrop-filter: blur(18px);
    left: 260px;
    min-height: 72px;
    position: sticky;
    right: 0;
    top: 0;
    z-index: 1020;
}

.page-content {
    margin-left: 260px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 1.25rem;
}

.button-toggle-menu {
    align-items: center;
    background: #fff;
    border: 1px solid var(--mg-line);
    box-shadow: 0 10px 28px rgba(23, 60, 52, 0.08);
    color: var(--mg-cypress);
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.crm-topbar-subtitle {
    color: var(--mg-muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
}

.crm-search {
    align-items: center;
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-pill);
    box-shadow: 0 10px 30px rgba(23, 60, 52, 0.06);
    gap: 0.5rem;
    min-height: 38px;
    padding: 0 0.95rem;
    width: min(34vw, 390px);
}

.crm-search svg {
    color: var(--mg-muted);
    height: 16px;
    width: 16px;
}

.crm-search input {
    background: transparent;
    border: 0;
    color: var(--mg-ink);
    font-size: 0.88rem;
    font-weight: 700;
    min-width: 0;
    outline: 0;
    width: 100%;
}

.crm-search input::placeholder {
    color: #8a9993;
}

.crm-main {
    max-width: 1480px;
    margin-inline: auto;
    position: relative;
    z-index: 1;
}

.crm-page-head {
    align-items: flex-end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.crm-page-head h1 {
    font-size: clamp(1.65rem, 2.6vw, 2.35rem);
    font-weight: 900;
    line-height: 1.05;
    margin: 0 0 0.35rem;
}

.crm-page-head p {
    color: var(--mg-muted);
    font-weight: 650;
    margin: 0;
}

.crm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
}

.crm-kpi {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
    overflow: hidden;
    position: relative;
}

.crm-kpi::after {
    background: linear-gradient(135deg, rgba(111, 154, 136, 0.18), rgba(184, 95, 107, 0.12));
    border-radius: var(--mg-pill);
    content: "";
    height: 94px;
    position: absolute;
    right: -36px;
    top: -42px;
    width: 94px;
}

.crm-kpi-label {
    color: var(--mg-muted);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.crm-kpi-value {
    color: var(--mg-ink);
    font-size: clamp(1.8rem, 3.2vw, 2.55rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
}

.crm-kpi-note {
    color: var(--mg-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.crm-section-title {
    align-items: center;
    display: flex;
    gap: 0.65rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.crm-section-title h2 {
    font-size: 1.05rem;
    margin: 0;
}

.crm-table-card {
    overflow: hidden;
}

.crm-table-card .card-body {
    padding: 0;
}

.crm-table-card .table {
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.crm-table-card .table td,
.crm-table-card .table th {
    padding: 1.05rem 1.15rem;
    vertical-align: middle;
}

.crm-table-card .table thead th:first-child {
    border-top-left-radius: calc(var(--mg-radius) - 2px);
}

.crm-table-card .table thead th:last-child {
    border-top-right-radius: calc(var(--mg-radius) - 2px);
}

.crm-table-card .table tbody tr {
    background: rgba(255, 255, 255, 0.72);
    border-radius: var(--mg-radius-sm);
}

.crm-table-card .table tbody td {
    border-color: rgba(220, 232, 224, 0.74);
}

.crm-table-card .btn-sm {
    min-height: 34px;
    padding-inline: 0.85rem;
}

.crm-person {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    min-width: 180px;
}

.crm-avatar {
    align-items: center;
    background: linear-gradient(135deg, var(--mg-cypress), var(--mg-eucalyptus));
    border-radius: var(--mg-pill);
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.crm-person strong,
.crm-card-title {
    color: var(--mg-ink);
    font-weight: 850;
}

.crm-person span,
.crm-meta {
    color: var(--mg-muted);
    font-size: 0.86rem;
    font-weight: 650;
}

.crm-empty {
    align-items: center;
    border: 1px dashed var(--mg-line);
    border-radius: var(--mg-radius);
    color: var(--mg-muted);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    justify-content: center;
    min-height: 180px;
    padding: 2rem;
    text-align: center;
}

.crm-empty svg {
    color: var(--mg-eucalyptus);
    height: 34px;
    width: 34px;
}

.crm-filter-row {
    align-items: center;
    border-bottom: 1px solid var(--mg-line);
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    justify-content: space-between;
    padding: 1rem 1.1rem;
}

.crm-filter-row .form-check {
    margin-bottom: 0;
}

.crm-card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.crm-card-heading {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: space-between;
    min-width: 0;
}

.crm-card-heading .crm-card-title {
    flex: 1 1 180px;
    min-width: 0;
}

.crm-card-heading .crm-badge {
    flex: 0 0 auto;
}

.crm-card-media {
    aspect-ratio: 16 / 10;
    border-radius: calc(var(--mg-radius) - 1px) calc(var(--mg-radius) - 1px) 0 0;
    display: block;
    object-fit: cover;
    width: 100%;
}

.crm-card-media-preview {
    aspect-ratio: 16 / 11;
    border-radius: calc(var(--mg-radius) - 1px) calc(var(--mg-radius) - 1px) 0 0;
}

.crm-item-card .list-group-item {
    align-items: center;
    background: transparent;
    border-color: var(--mg-line);
    color: var(--mg-ink-soft, var(--mg-ink));
    display: flex;
    gap: 0.55rem;
    padding-inline: 0;
}

.crm-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.crm-badge {
    align-items: center;
    border-radius: var(--mg-pill);
    display: inline-flex;
    font-size: 0.76rem;
    gap: 0.28rem;
    justify-content: center;
    letter-spacing: 0;
    line-height: 1;
    min-height: 28px;
    white-space: nowrap;
}

.crm-level-badge,
.crm-role-badge,
.crm-rating-badge,
.crm-discount-badge,
.crm-scope-badge,
.crm-chip {
    border: 1px solid transparent;
    font-weight: 850;
    padding: 0.42rem 0.68rem;
}

.crm-level-bronze {
    background: rgba(184, 95, 107, 0.1) !important;
    border-color: rgba(184, 95, 107, 0.24);
    color: var(--mg-rose-dark) !important;
}

.crm-level-silver {
    background: rgba(111, 154, 136, 0.13) !important;
    border-color: rgba(111, 154, 136, 0.28);
    color: var(--mg-cypress) !important;
}

.crm-level-gold,
.crm-rating-badge {
    background: rgba(230, 184, 95, 0.18) !important;
    border-color: rgba(230, 184, 95, 0.34);
    color: #5b4618 !important;
}

.crm-role-badge {
    background: rgba(23, 60, 52, 0.1) !important;
    border-color: rgba(23, 60, 52, 0.18);
    color: var(--mg-cypress) !important;
}

.crm-discount-badge {
    background: rgba(184, 95, 107, 0.14) !important;
    border-color: rgba(184, 95, 107, 0.28);
    color: var(--mg-rose-dark) !important;
    min-width: 58px;
}

.crm-scope-badge {
    background: rgba(23, 60, 52, 0.1) !important;
    border-color: rgba(23, 60, 52, 0.2);
    color: var(--mg-cypress) !important;
}

.crm-chip {
    background: #fff !important;
    border-color: var(--mg-line);
    color: var(--mg-ink) !important;
}

.crm-form-card,
.crm-search-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88)),
        var(--mg-card);
}

.crm-search-panel .crm-search {
    box-shadow: none;
    width: 100%;
}

.crm-schedule-chip {
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    padding: 0.7rem 0.75rem;
}

.crm-price {
    color: var(--mg-cypress);
    font-size: 1.25rem;
    font-weight: 900;
}

.crm-insight-list {
    display: grid;
    gap: 0.75rem;
}

.crm-insight-item {
    align-items: center;
    background: #f7fbf8;
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    display: flex;
    gap: 0.8rem;
    justify-content: space-between;
    padding: 0.95rem 1rem;
}

.crm-insight-item strong {
    color: var(--mg-ink);
    display: block;
    font-weight: 850;
    line-height: 1.25;
}

.crm-insight-item span,
.crm-report-breakdown span {
    color: var(--mg-muted);
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.crm-insight-count {
    align-items: center;
    background: rgba(111, 154, 136, 0.13);
    border-radius: var(--mg-pill);
    color: var(--mg-cypress);
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    min-width: 38px;
    padding: 0 0.7rem;
}

.crm-report-breakdown {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-report-breakdown > div {
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    min-width: 0;
    padding: 0.8rem;
}

.crm-report-breakdown strong {
    color: var(--mg-ink);
    display: block;
    font-size: 1.15rem;
    font-weight: 900;
    margin-top: 0.15rem;
}

.crm-status-new,
.crm-status-pending {
    background-color: #e6b85f !important;
    color: #2f2614 !important;
}

.crm-status-confirmed,
.crm-status-processed {
    background-color: var(--mg-eucalyptus) !important;
}

.crm-status-completed {
    background-color: var(--mg-cypress) !important;
}

.crm-status-cancelled,
.crm-status-spam {
    background-color: var(--mg-rose) !important;
}

.crm-status-closed {
    background-color: #74827d !important;
}

.content-page,
.content {
    background: var(--mg-surface);
}

.page-title-box h4,
.card-title,
h1,
h2,
h3,
h4,
h5 {
    color: var(--mg-ink);
    font-weight: 850;
    letter-spacing: 0;
}

.text-muted,
.card-subtitle {
    color: var(--mg-muted) !important;
}

.card {
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius) !important;
    box-shadow: var(--mg-shadow-soft) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
    border-color: rgba(111, 154, 136, 0.42);
    box-shadow: var(--mg-shadow-lift) !important;
}

.card-body {
    padding: 1.35rem;
}

.crm-form-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.88));
}

.crm-form-card .card-body {
    padding: clamp(1.25rem, 2.2vw, 1.85rem);
}

.crm-side-card {
    background:
        linear-gradient(180deg, #ffffff 0%, rgba(238, 245, 240, 0.72) 100%);
    overflow: hidden;
}

.crm-summary-tile {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    padding: 1rem;
}

.crm-summary-tile strong {
    color: var(--mg-ink);
    display: block;
    font-weight: 850;
    line-height: 1.25;
    margin-top: 0.2rem;
}

.btn,
.form-control,
.form-select,
.crm-badge,
.dataTables_filter input,
.dataTables_length select {
    border-radius: var(--mg-pill);
}

.btn {
    font-weight: 800;
    letter-spacing: 0;
    min-height: 38px;
    padding-inline: 1rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:active {
    transform: translateY(1px);
}

.crm-button {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.crm-button-sm {
    min-height: 34px;
    padding-inline: 0.85rem;
}

.crm-button-secondary,
.btn-light {
    background: rgba(255, 255, 255, 0.86);
    border-color: var(--mg-line);
    color: var(--mg-ink);
    box-shadow: 0 10px 24px rgba(23, 60, 52, 0.06);
}

.crm-button-secondary:hover,
.crm-button-secondary:focus,
.btn-light:hover,
.btn-light:focus {
    background: #fff;
    border-color: rgba(111, 154, 136, 0.38);
    color: var(--mg-cypress);
    box-shadow: 0 14px 30px rgba(23, 60, 52, 0.1);
}

.crm-button-primary,
.btn-primary,
.bg-primary {
    background: linear-gradient(135deg, var(--mg-rose), var(--mg-rose-dark)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 12px 24px rgba(184, 95, 107, 0.2);
}

.crm-button-primary:hover,
.crm-button-primary:focus,
.btn-primary:hover {
    background: linear-gradient(135deg, var(--mg-rose-dark), var(--mg-rose)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 16px 32px rgba(184, 95, 107, 0.26);
}

.crm-muted-state {
    color: var(--mg-muted) !important;
    font-weight: 750;
}

.crm-button-danger,
.btn-soft-logout {
    background: rgba(184, 95, 107, 0.08);
    border-color: rgba(184, 95, 107, 0.22);
    color: var(--mg-rose-dark) !important;
    box-shadow: none;
}

.crm-button-danger:hover,
.crm-button-danger:focus,
.btn-soft-logout:hover {
    background: rgba(184, 95, 107, 0.14);
    border-color: rgba(184, 95, 107, 0.34);
    color: var(--mg-rose-dark) !important;
}

.btn-soft-logout {
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--mg-line);
    color: var(--mg-cypress) !important;
}

.btn-soft-logout:hover {
    background: #fff;
    border-color: rgba(111, 154, 136, 0.34);
    color: var(--mg-cypress) !important;
}

.btn-success,
.bg-success {
    background-color: var(--mg-cypress) !important;
    border-color: var(--mg-cypress) !important;
}

.btn-warning,
.bg-warning {
    background-color: #e6b85f !important;
    border-color: #e6b85f !important;
    color: #2f2614 !important;
}

.btn-danger,
.bg-danger {
    background-color: #b85f6b !important;
    border-color: #b85f6b !important;
}

.crm-alert {
    border: 1px solid rgba(184, 95, 107, 0.18);
    border-radius: var(--mg-radius-sm);
    box-shadow: 0 12px 28px rgba(23, 60, 52, 0.08);
    font-weight: 750;
    letter-spacing: 0;
    padding: 0.85rem 1rem;
}

.crm-alert.alert-success {
    background: rgba(111, 154, 136, 0.14);
    border-color: rgba(111, 154, 136, 0.28);
    color: #173c34;
}

.crm-alert.alert-danger {
    background: rgba(184, 95, 107, 0.12);
    border-color: rgba(184, 95, 107, 0.28);
    color: #7d3944;
}

.crm-alert.alert-warning {
    background: rgba(230, 184, 95, 0.16);
    border-color: rgba(230, 184, 95, 0.34);
    color: #684b12;
}

.crm-alert.alert-info {
    background: rgba(111, 154, 136, 0.1);
    border-color: rgba(111, 154, 136, 0.24);
    color: var(--mg-cypress);
}

.bg-info {
    background-color: var(--mg-eucalyptus) !important;
}

.bg-secondary {
    background-color: #74827d !important;
}

.form-control,
.form-select,
.dataTables_filter input,
.dataTables_length select {
    border-color: var(--mg-line);
    min-height: 42px;
}

.form-label {
    color: var(--mg-ink);
    font-weight: 850;
    letter-spacing: 0;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mg-eucalyptus);
    box-shadow: 0 0 0 0.2rem rgba(111, 154, 136, 0.18);
}

.form-control[readonly] {
    background: #f1f6f3;
    color: var(--mg-muted);
}

.form-select[multiple] {
    border-radius: var(--mg-radius-sm);
    min-height: 132px;
    padding: 0.65rem;
}

.form-check-input:checked {
    background-color: var(--mg-rose);
    border-color: var(--mg-rose);
}

.crm-toggle-card {
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    box-shadow: 0 10px 24px rgba(23, 60, 52, 0.05);
    display: block;
    padding: 1rem 1rem 1rem 2.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.crm-toggle-card:hover {
    border-color: rgba(111, 154, 136, 0.42);
    box-shadow: 0 14px 30px rgba(23, 60, 52, 0.08);
    transform: translateY(-1px);
}

.crm-toggle-card .form-check-input {
    margin-left: -1.75rem;
    margin-top: 0.15rem;
}

.crm-toggle-card .form-check-input:checked {
    background-color: var(--mg-rose);
    border-color: var(--mg-rose);
}

.table {
    color: var(--mg-ink);
}

.table thead th {
    background: #eef5f0;
    border-bottom: 0;
    color: var(--mg-muted);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr {
    border-color: var(--mg-line);
    transition: background-color 0.16s ease;
}

.table tbody tr:hover {
    background: rgba(111, 154, 136, 0.08);
}

.table a {
    font-weight: 800;
}

.table-responsive {
    border-radius: var(--mg-radius);
}

.crm-dialog {
    border: 1px solid rgba(220, 232, 224, 0.9);
    border-radius: 28px;
    box-shadow: 0 26px 70px rgba(20, 33, 31, 0.2);
    color: var(--mg-ink);
    padding: 1.35rem 1.35rem 1.1rem;
}

.crm-dialog-title {
    color: var(--mg-ink);
    font-family: "Manrope", "Inter", sans-serif;
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: 0;
}

.crm-dialog-text {
    color: var(--mg-muted);
    font-family: "Manrope", "Inter", sans-serif;
    line-height: 1.6;
}

.crm-dialog-actions {
    gap: 0.65rem;
    margin-top: 1.35rem;
}

.crm-dialog-confirm,
.crm-dialog-cancel {
    border-radius: var(--mg-pill);
    min-width: 112px;
}

.crm-toast {
    background: var(--mg-card);
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius);
    box-shadow: var(--mg-shadow-lift);
    color: var(--mg-ink);
    display: grid;
    gap: 0.18rem;
    max-width: min(360px, calc(100vw - 2rem));
    padding: 1rem 1.1rem;
    position: fixed;
    right: 1rem;
    top: 1rem;
    z-index: 1100;
}

.crm-toast span {
    color: var(--mg-muted);
}

.crm-toast-error {
    border-color: rgba(184, 95, 107, 0.36);
}

.crm-confirm-overlay {
    align-items: center;
    background: rgba(20, 33, 31, 0.32);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 1090;
}

.crm-confirm-card {
    background: var(--mg-card);
    border-radius: 28px;
    box-shadow: 0 26px 70px rgba(20, 33, 31, 0.2);
    max-width: 420px;
    padding: 1.4rem;
    width: 100%;
}

.crm-confirm-card h2 {
    font-size: 1.35rem;
    font-weight: 850;
    margin: 0 0 0.45rem;
}

.crm-confirm-card p {
    color: var(--mg-muted);
    margin: 0;
}

.crm-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
    margin-top: 1.35rem;
}

.footer {
    background: transparent;
    border-top: 1px solid var(--mg-line);
    color: var(--mg-muted);
}

.auth-logo img {
    max-height: 38px;
}

.logo-light img,
.logo-dark img,
.auth-logo img {
    display: none;
}

.logo-light,
.logo-dark {
    align-items: center;
    color: #fff;
    display: inline-flex;
    font-size: 1.05rem;
    font-weight: 850;
    gap: 0.5rem;
    letter-spacing: 0;
    text-decoration: none;
}

.logo-box .logo-light,
.logo-box .logo-dark {
    gap: 0.7rem;
    width: 100%;
}

.logo-box .logo-light::before,
.logo-box .logo-light::after,
.logo-box .logo-dark::before,
.logo-box .logo-dark::after {
    display: none;
}

.crm-brand-mark {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.68)),
        linear-gradient(135deg, var(--mg-rose), var(--mg-eucalyptus));
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(20, 33, 31, 0.24);
    color: var(--mg-cypress);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.1rem;
    font-weight: 950;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.crm-brand-copy {
    display: grid;
    gap: 0.02rem;
    min-width: 0;
}

.crm-brand-copy span {
    color: #fff;
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1;
}

.crm-brand-copy small {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
}

.logo-dark {
    color: var(--mg-ink);
}

.logo-box .logo-dark {
    display: none;
}

.logo-light::before,
.logo-dark::before,
.auth-logo .logo-dark::before,
.auth-logo .logo-light::before {
    background: linear-gradient(135deg, var(--mg-rose), var(--mg-eucalyptus));
    border-radius: var(--mg-radius-sm);
    box-shadow: 0 10px 24px rgba(184, 95, 107, 0.26);
    content: "";
    height: 34px;
    width: 34px;
}

.logo-light::after,
.logo-dark::after,
.auth-logo .logo-dark::after,
.auth-logo .logo-light::after {
    content: "Medigrace";
}

.bg-login {
    background:
        linear-gradient(135deg, rgba(20, 33, 31, 0.34), rgba(184, 95, 107, 0.22)),
        url("../images/bg-login.jpg") center / cover;
}

body.crm-auth {
    background:
        radial-gradient(circle at 15% 18%, rgba(111, 154, 136, 0.2), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(184, 95, 107, 0.14), transparent 26%),
        var(--mg-surface);
    min-height: 100vh;
}

.crm-auth-shell {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: clamp(1rem, 4vw, 3rem);
}

.crm-auth-card {
    background: #fff;
    border: 1px solid rgba(220, 232, 224, 0.9);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(20, 33, 31, 0.14);
    display: grid;
    grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1fr);
    margin: 0 auto;
    max-width: 1060px;
    min-height: 640px;
    overflow: hidden;
    width: 100%;
}

.crm-auth-visual {
    background:
        linear-gradient(150deg, rgba(18, 49, 43, 0.9), rgba(18, 49, 43, 0.58)),
        url("../images/bg-login.jpg") center / cover;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(1.75rem, 4vw, 3rem);
}

.crm-auth-logo::before,
.crm-auth-logo-mobile::before {
    box-shadow: 0 14px 32px rgba(184, 95, 107, 0.3);
}

.crm-auth-visual-copy span,
.crm-auth-heading span {
    color: var(--mg-rose);
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: 0.85rem;
    text-transform: uppercase;
}

.crm-auth-visual-copy span {
    color: rgba(255, 255, 255, 0.78);
}

.crm-auth-visual-copy h1 {
    color: #fff;
    font-size: clamp(2.05rem, 4vw, 3.4rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 0.98;
    margin-bottom: 1rem;
    max-width: 520px;
}

.crm-auth-visual-copy p {
    color: rgba(255, 255, 255, 0.76);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.7;
    margin: 0;
    max-width: 430px;
}

.crm-auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.75rem, 5vw, 4rem);
}

.crm-auth-logo-mobile {
    display: none;
    margin-bottom: 2rem;
}

.crm-auth-heading {
    margin-bottom: 2rem;
}

.crm-auth-heading h2 {
    color: var(--mg-ink);
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.crm-auth-heading p {
    color: var(--mg-muted);
    font-size: 0.98rem;
    font-weight: 650;
    line-height: 1.65;
    margin: 0;
}

.crm-auth-form .form-label {
    color: var(--mg-ink);
    font-weight: 850;
    margin-bottom: 0.45rem;
}

.crm-auth-form .form-control {
    border-radius: var(--mg-radius-sm);
    min-height: 48px;
}

.crm-auth-form .form-check {
    align-items: center;
    display: flex;
    gap: 0.3rem;
}

.crm-auth-toggle {
    background: rgba(246, 250, 247, 0.9);
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    padding: 0.9rem 1rem;
}

.crm-auth-toggle .form-check-input {
    border-color: rgba(111, 154, 136, 0.48);
    flex: 0 0 auto;
    margin-left: 0;
    margin-right: 0.35rem;
}

.crm-auth-toggle .form-check-input:checked {
    background-color: var(--mg-rose);
    border-color: var(--mg-rose);
}

.crm-auth-form .btn {
    border-radius: var(--mg-pill);
    min-height: 48px;
}

.crm-auth-alerts .crm-alert {
    margin-bottom: 0.75rem;
}

.crm-auth-footer {
    align-items: center;
    color: var(--mg-muted);
    display: flex;
    flex-wrap: wrap;
    font-weight: 700;
    gap: 0.45rem;
    justify-content: center;
    margin-top: 1.5rem;
    text-align: center;
}

.crm-auth-footer a,
.crm-auth-link {
    background: transparent;
    border: 0;
    color: var(--mg-rose-dark);
    cursor: pointer;
    font-weight: 850;
    padding: 0;
}

@media (max-width: 991px) {
    .crm-shell-backdrop {
        inset: 12px;
    }

    .main-menu {
        box-shadow: 20px 0 50px rgba(20, 33, 31, 0.18);
    }

    .crm-auth-card {
        grid-template-columns: 1fr;
        min-height: 0;
        max-width: 620px;
    }

    .crm-auth-visual {
        display: none;
    }

    .crm-auth-logo-mobile {
        display: inline-flex;
    }
}

@media (max-width: 767px) {
    .crm-shell-backdrop {
        display: none;
    }

    .main-menu,
    .main-menu.active {
        bottom: 0;
        left: -260px !important;
        position: fixed;
        top: 0;
        transition: left 0.18s ease;
        z-index: 1045;
    }

    body.sidebar-enable .main-menu,
    body.sidebar-enable .main-menu.active {
        left: 0 !important;
    }

    .page-content,
    .navbar-custom {
        left: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
    }

    .page-content {
        min-width: 0;
    }

    .topbar {
        gap: 0.75rem;
        padding-inline: 0.75rem;
    }

    .topbar > .topbar-menu:last-child {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .crm-auth-shell {
        align-items: stretch;
        padding: 0;
    }

    .crm-auth-card {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .crm-auth-panel {
        padding: 1.35rem;
    }

    .crm-page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-actions {
        justify-content: flex-start;
    }

    .crm-actions .btn {
        flex: 1 1 auto;
    }

    .crm-main {
        padding-top: 1.2rem !important;
    }

    .crm-table-card .table td,
    .crm-table-card .table th {
        padding: 0.85rem;
    }

    .table-responsive {
        max-width: 100%;
        overflow-x: auto;
    }

    .crm-empty {
        min-width: 0;
    }

    .crm-report-breakdown {
        grid-template-columns: 1fr;
    }
}

/* Chocolate CRM direction */
:root {
    --mg-ink: #2a1a14;
    --mg-muted: #7a675b;
    --mg-cypress: #3f2418;
    --mg-eucalyptus: #a87963;
    --mg-rose: #b87655;
    --mg-rose-dark: #8f4a35;
    --mg-surface: #fffaf7;
    --mg-line: #eadbd1;
    --mg-shadow-soft: 0 14px 36px rgba(63, 36, 24, 0.08);
    --mg-shadow-lift: 0 22px 52px rgba(63, 36, 24, 0.14);
    --bs-primary: var(--mg-rose);
    --bs-primary-rgb: 184, 118, 85;
}

body {
    background:
        radial-gradient(circle at 8% 8%, rgba(168, 121, 99, 0.18), transparent 28%),
        radial-gradient(circle at 92% 0%, rgba(184, 118, 85, 0.13), transparent 26%),
        linear-gradient(180deg, rgba(243, 233, 226, 0.9), rgba(255, 250, 247, 0.94) 320px),
        var(--mg-surface);
}

.layout-wrapper,
.navbar-custom {
    background-color: var(--mg-surface);
}

.crm-shell-backdrop {
    background:
        linear-gradient(135deg, rgba(255, 250, 247, 0.78), rgba(243, 233, 226, 0.42)),
        radial-gradient(circle at 64% 0%, rgba(184, 118, 85, 0.08), transparent 30%);
    border-color: rgba(234, 219, 209, 0.72);
    box-shadow: 0 28px 90px rgba(63, 36, 24, 0.08);
}

.main-menu {
    background: linear-gradient(180deg, #2b1710 0%, #3f2418 52%, #2b1710 100%);
    box-shadow: 18px 0 56px rgba(43, 23, 16, 0.16);
}

.navbar-custom,
.crm-search,
.button-toggle-menu,
.card,
.crm-form-card,
.crm-search-panel,
.crm-table-card .table tbody td,
.crm-filter-row,
.crm-empty,
.crm-schedule-chip {
    border-color: var(--mg-line) !important;
}

.navbar-custom {
    background: rgba(255, 250, 247, 0.92);
}

.button-toggle-menu,
.crm-search {
    box-shadow: 0 10px 30px rgba(63, 36, 24, 0.06);
}

.crm-kpi::after {
    background: linear-gradient(135deg, rgba(168, 121, 99, 0.18), rgba(184, 118, 85, 0.12));
}

.crm-avatar {
    background: linear-gradient(135deg, #2b1710, #b87655) !important;
}

.crm-level-bronze,
.crm-discount-badge {
    background: rgba(184, 118, 85, 0.1) !important;
    border-color: rgba(184, 118, 85, 0.24) !important;
    color: var(--mg-rose-dark) !important;
}

.crm-level-silver,
.crm-role-badge,
.crm-scope-badge {
    background: rgba(63, 36, 24, 0.1) !important;
    border-color: rgba(63, 36, 24, 0.18) !important;
    color: var(--mg-cypress) !important;
}

.crm-row-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.crm-row-actions form {
    margin: 0;
}

.crm-message-stack {
    display: grid;
    gap: 0.6rem;
    padding: 1rem 1.1rem 0;
}

.crm-alert {
    border: 1px solid var(--mg-line);
    border-radius: var(--mg-radius-sm);
    color: var(--mg-ink);
    font-size: 0.88rem;
    font-weight: 760;
    padding: 0.75rem 0.9rem;
}

.crm-alert-success {
    background: rgba(83, 122, 85, 0.12);
    border-color: rgba(83, 122, 85, 0.22);
}

.crm-alert-warning {
    background: rgba(184, 118, 85, 0.12);
    border-color: rgba(184, 118, 85, 0.22);
}

.crm-alert-error {
    background: rgba(154, 79, 58, 0.12);
    border-color: rgba(154, 79, 58, 0.24);
}

.crm-receipt-draft {
    background: rgba(63, 36, 24, 0.08) !important;
    border: 1px solid rgba(63, 36, 24, 0.14);
    color: var(--mg-muted) !important;
    padding: 0.42rem 0.68rem;
}

.crm-receipt-queued {
    background: rgba(184, 118, 85, 0.12) !important;
    border: 1px solid rgba(184, 118, 85, 0.24);
    color: var(--mg-rose-dark) !important;
    padding: 0.42rem 0.68rem;
}

.crm-receipt-done {
    background: rgba(83, 122, 85, 0.12) !important;
    border: 1px solid rgba(83, 122, 85, 0.24);
    color: #456b48 !important;
    padding: 0.42rem 0.68rem;
}

.crm-receipt-error {
    background: rgba(154, 79, 58, 0.12) !important;
    border: 1px solid rgba(154, 79, 58, 0.24);
    color: #9a4f3a !important;
    padding: 0.42rem 0.68rem;
}

.crm-appointments-table {
    table-layout: fixed;
    width: 100%;
}

.crm-appointments-table th,
.crm-appointments-table td {
    font-size: 0.88rem;
    padding: 0.95rem 0.72rem;
    word-break: normal;
}

.crm-appointments-table th:nth-child(1),
.crm-appointments-table td:nth-child(1) {
    width: 20%;
}

.crm-appointments-table th:nth-child(2),
.crm-appointments-table td:nth-child(2) {
    width: 20%;
}

.crm-appointments-table th:nth-child(3),
.crm-appointments-table td:nth-child(3) {
    width: 11%;
}

.crm-appointments-table th:nth-child(4),
.crm-appointments-table td:nth-child(4) {
    width: 12%;
}

.crm-appointments-table th:nth-child(5),
.crm-appointments-table td:nth-child(5) {
    width: 9%;
}

.crm-appointments-table th:nth-child(6),
.crm-appointments-table td:nth-child(6) {
    width: 8%;
}

.crm-appointments-table th:nth-child(7),
.crm-appointments-table td:nth-child(7) {
    width: 6%;
}

.crm-appointments-table th:nth-child(8),
.crm-appointments-table td:nth-child(8) {
    width: 11%;
}

.crm-appointments-table th:nth-child(9),
.crm-appointments-table td:nth-child(9) {
    width: 16%;
}

.crm-appointments-table .crm-person {
    min-width: 0;
}

.crm-appointments-table .crm-person > div {
    min-width: 0;
}

.crm-appointments-table .crm-person strong,
.crm-appointments-table .crm-person span {
    overflow-wrap: normal;
    word-break: normal;
}

.crm-appointments-table .crm-row-actions .crm-button-sm,
.crm-appointments-table [class*="crm-receipt"],
.crm-appointments-table .crm-muted-state,
.crm-appointments-table td:nth-child(4),
.crm-appointments-table td:nth-child(6) {
    white-space: nowrap;
}

.crm-appointments-table .crm-row-actions .crm-button-sm {
    min-width: 76px;
}

@media (max-width: 1439px) {
    .crm-appointments-table th:nth-child(3),
    .crm-appointments-table td:nth-child(3),
    .crm-appointments-table th:nth-child(7),
    .crm-appointments-table td:nth-child(7) {
        display: none;
    }

    .crm-appointments-table th,
    .crm-appointments-table td {
        font-size: 0.84rem;
        padding-inline: 0.62rem;
    }

    .crm-appointments-table .crm-avatar {
        height: 34px;
        width: 34px;
    }

    .crm-appointments-table .crm-row-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 1199px) {
    .crm-appointments-table {
        min-width: 980px;
        table-layout: auto;
    }

    .crm-appointments-table th:nth-child(3),
    .crm-appointments-table td:nth-child(3),
    .crm-appointments-table th:nth-child(7),
    .crm-appointments-table td:nth-child(7) {
        display: table-cell;
    }
}

/* Classic readable admin badge palette and overflow guard. */
.crm-badge {
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: center;
    white-space: normal;
}

.crm-table-card .crm-badge,
.crm-card-heading .crm-badge,
.crm-tag-list .crm-badge,
.crm-report-breakdown .crm-badge {
    line-height: 1.15;
}

.crm-status-new,
.crm-status-pending {
    background-color: #ffc107 !important;
    border: 1px solid #e0a800 !important;
    color: #212529 !important;
}

.crm-status-confirmed,
.crm-status-processed {
    background-color: #0d6efd !important;
    border: 1px solid #0b5ed7 !important;
    color: #fff !important;
}

.crm-status-completed,
.crm-receipt-done {
    background-color: #198754 !important;
    border: 1px solid #157347 !important;
    color: #fff !important;
}

.crm-status-cancelled,
.crm-status-spam,
.crm-receipt-error {
    background-color: #dc3545 !important;
    border: 1px solid #bb2d3b !important;
    color: #fff !important;
}

.crm-status-closed,
.crm-receipt-draft {
    background-color: #6c757d !important;
    border: 1px solid #5c636a !important;
    color: #fff !important;
}

.crm-receipt-queued,
.crm-rating-badge {
    background-color: #0dcaf0 !important;
    border: 1px solid #0aa2c0 !important;
    color: #052c33 !important;
}

.crm-level-bronze {
    background-color: #fd7e14 !important;
    border-color: #dc6502 !important;
    color: #fff !important;
}

.crm-level-silver,
.crm-role-badge,
.crm-scope-badge {
    background-color: #6c757d !important;
    border-color: #5c636a !important;
    color: #fff !important;
}

.crm-level-gold,
.crm-discount-badge {
    background-color: #ffc107 !important;
    border-color: #e0a800 !important;
    color: #212529 !important;
}

.crm-chip {
    background-color: #f8f9fa !important;
    border-color: #ced4da !important;
    color: #212529 !important;
}

.crm-card-heading .crm-badge {
    flex: 0 1 auto;
}

.crm-row-actions .crm-button-sm {
    white-space: normal;
}

.crm-appointments-table .crm-badge,
.crm-appointments-table [class*="crm-receipt"] {
    white-space: normal;
}
