:root {
    --mcm-sidebar-bg: #3b3f51;
    --mcm-sidebar-text: #aeb2c4;
    --mcm-sidebar-hover: #3f4457;
    --mcm-sidebar-active: #2d3140;
    --mcm-topbar-bg: #fff;
    --mcm-border: #e7e9f0;
    --mcm-content-bg: #f2f4f8;
    --mcm-accent: #4b6cb7;
    --mcm-sidebar-width: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--mcm-content-bg);
    color: #444;
    font-size: 14px;
}

.mcm-app {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.mcm-sidebar {
    width: var(--mcm-sidebar-width);
    background: var(--mcm-sidebar-bg);
    color: var(--mcm-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
    z-index: 1050;
}
.mcm-logo {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mcm-logo a { color: #fff; text-decoration: none; font-size: 18px; }
.mcm-logo small { color: var(--mcm-sidebar-text); font-size: 11px; margin-top: 2px; }
.mcm-sidebar-close {
    display: none;
    background: none;
    border: 0;
    color: var(--mcm-sidebar-text);
    font-size: 20px;
    padding: 0 4px;
    cursor: pointer;
}
.mcm-sidebar-close:hover { color: #fff; }

.mcm-nav { padding: 8px 0; flex: 1; overflow-y: auto; }
.mcm-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--mcm-sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}
.mcm-nav-item:hover { background: var(--mcm-sidebar-hover); color: #fff; }
.mcm-nav-item.active {
    background: var(--mcm-sidebar-active);
    color: #fff;
    border-left-color: var(--mcm-accent);
}
.mcm-nav-item.disabled { opacity: 0.45; pointer-events: none; }
.mcm-nav-item i { width: 18px; font-size: 15px; }

.mcm-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mcm-topbar {
    background: var(--mcm-topbar-bg);
    border-bottom: 1px solid var(--mcm-border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 12px;
}
.mcm-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mcm-sidebar-toggle {
    display: none;
    background: none;
    border: 0;
    color: #555;
    font-size: 22px;
    padding: 4px 8px;
    cursor: pointer;
}
.mcm-breadcrumb { color: #999; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcm-topbar-right { display: flex; gap: 16px; align-items: center; }
.mcm-tenant-pill {
    background: #eef0f7;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}
.mcm-tenant-pill i { margin-right: 5px; color: var(--mcm-accent); }
.mcm-user { font-size: 13px; color: #666; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.mcm-user-dropdown .dropdown-menu { min-width: 220px; padding: 10px 0; }
.mcm-user-dropdown > .mcm-user { cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: background 0.15s; }
.mcm-user-dropdown > .mcm-user:hover { background: #f5f6f8; }

.mcm-content { padding: 24px; flex: 1; }
.mcm-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--mcm-border);
    color: #aaa;
    background: #fff;
}

.mcm-page-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.mcm-page-title { font-size: 22px; font-weight: 600; margin: 0; color: #2c3e50; }
.mcm-page-sub { color: #888; font-size: 13px; }

.mcm-card {
    background: #fff;
    border: 1px solid var(--mcm-border);
    border-radius: 6px;
    padding: 18px 20px;
}
.mcm-card + .mcm-card { margin-top: 16px; }
.mcm-card-title { font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px; font-weight: 600; }
.mcm-stat-value { font-size: 28px; font-weight: 600; color: #2c3e50; word-break: break-word; }
.mcm-stat-sub { font-size: 12px; color: #aaa; }

.mcm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mcm-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13.5px; }
.mcm-table th, .mcm-table td { padding: 10px 14px; border-bottom: 1px solid var(--mcm-border); text-align: left; white-space: nowrap; }
.mcm-table th { background: #fafbfd; color: #666; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.mcm-table tr:hover td { background: #f7f9fc; }

.mcm-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.mcm-badge-active { background: #e3f5ea; color: #27ae60; }
.mcm-badge-inactive { background: #fbe9e9; color: #c0392b; }

.mcm-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
}
.mcm-backdrop.show { display: block; }

@media (max-width: 991.98px) {
    .mcm-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    }
    .mcm-sidebar.show { transform: translateX(0); }
    .mcm-sidebar-close { display: block; }
    .mcm-sidebar-toggle { display: inline-flex; }
    .mcm-topbar { padding: 10px 14px; }
    .mcm-content { padding: 14px; }
    .mcm-footer { padding: 10px 14px; font-size: 12px; }
    .mcm-tenant-pill { max-width: 55vw; font-size: 11.5px; padding: 4px 10px; }
    .mcm-user { display: none; }
    .mcm-tenant-pill i { margin-right: 3px; }
    .mcm-page-title { font-size: 18px; }
    .mcm-stat-value { font-size: 22px; }
    .mcm-card { padding: 14px 16px; }
    .mcm-table th, .mcm-table td { padding: 8px 10px; font-size: 12.5px; }
}

@media (max-width: 575.98px) {
    .mcm-topbar-right { gap: 8px; }
    .mcm-breadcrumb { display: none; }
    .mcm-tenant-pill { max-width: 70vw; }
}

/* ─── Dashboard: stat cards (incoming / interior / outgoing / dncalled) ─── */
.mcm-dash-grid { display: grid; gap: 14px; }
.mcm-dash-grid--4 { grid-template-columns: repeat(4, 1fr); }
.mcm-dash-grid--3 { grid-template-columns: repeat(3, 1fr); }
.mcm-dash-grid--2 { grid-template-columns: repeat(2, 1fr); }

.mcm-section { margin-bottom: 22px; }
.mcm-section-title { font-size: 14px; font-weight: 600; color: #95a5a6; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px; }

.mcm-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--mcm-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.08s, box-shadow 0.08s;
    min-height: 84px;
}
.mcm-stat-card:hover { transform: translateY(-1px); box-shadow: 0 2px 10px rgba(0,0,0,0.06); color: inherit; text-decoration: none; }
.mcm-stat-card__icon {
    width: 52px; height: 52px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff; flex-shrink: 0;
}
.mcm-stat-card__icon--blue   { background: linear-gradient(135deg,#3498db 0%,#2980b9 100%); }
.mcm-stat-card__icon--purple { background: linear-gradient(135deg,#9b59b6 0%,#8e44ad 100%); }
.mcm-stat-card__icon--green  { background: linear-gradient(135deg,#2ecc71 0%,#27ae60 100%); }
.mcm-stat-card__icon--red    { background: linear-gradient(135deg,#e74c3c 0%,#c0392b 100%); }

.mcm-stat-card__body { flex: 1; min-width: 0; }
.mcm-stat-card__value { font-size: 26px; font-weight: 700; color: #2c3e50; line-height: 1.1; }
.mcm-stat-card__label { font-size: 12.5px; color: #7f8c8d; margin-top: 2px; }
.mcm-stat-card__arrow { color: #bdc3c7; font-size: 18px; }

/* ─── Panel card (missed / charts / last calls) ─── */
.mcm-panel { background: #fff; border: 1px solid var(--mcm-border); border-radius: 8px; }
.mcm-panel__head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--mcm-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.mcm-panel__title { font-size: 14px; font-weight: 600; color: #2c3e50; display: flex; align-items: center; gap: 8px; margin: 0; }
.mcm-panel__title i { color: var(--mcm-accent); }
.mcm-panel__body { padding: 14px 16px; }

.mcm-live {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: #e74c3c; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.mcm-live__dot {
    width: 8px; height: 8px; border-radius: 50%; background: #e74c3c;
    box-shadow: 0 0 0 0 rgba(231,76,60,0.7);
    animation: mcm-pulse 2s infinite;
}
@keyframes mcm-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(231,76,60,0.55); }
    70%  { box-shadow: 0 0 0 10px rgba(231,76,60,0); }
    100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}

/* ─── Chart wrapper ─── */
.mcm-chart-wrap { position: relative; height: 260px; }

/* ─── Grouped nav items ─── */
.mcm-nav-group-title {
    padding: 10px 18px 4px;
    font-size: 11px; font-weight: 600; color: #6c7a95;
    text-transform: uppercase; letter-spacing: 0.5px;
}

@media (max-width: 991.98px) {
    .mcm-dash-grid--4 { grid-template-columns: repeat(2, 1fr); }
    .mcm-dash-grid--3 { grid-template-columns: 1fr; }
    .mcm-dash-grid--2 { grid-template-columns: 1fr; }
    .mcm-stat-card__value { font-size: 22px; }
    .mcm-stat-card__icon { width: 44px; height: 44px; font-size: 18px; }
    .mcm-chart-wrap { height: 220px; }
}
@media (max-width: 575.98px) {
    .mcm-dash-grid--4 { grid-template-columns: 1fr 1fr; }
    .mcm-stat-card { padding: 12px 14px; min-height: 72px; gap: 10px; }
    .mcm-stat-card__icon { width: 40px; height: 40px; font-size: 16px; }
    .mcm-stat-card__value { font-size: 20px; }
    .mcm-stat-card__label { font-size: 11.5px; }
    .mcm-stat-card__arrow { display: none; }
}

/* ─── Sidebar dropdown groups (like mcm4) ─── */
.mcm-nav-group { display: flex; flex-direction: column; }
.mcm-nav-toggle {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.mcm-nav-toggle .mcm-nav-arrow {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.15s;
    color: var(--mcm-sidebar-text);
}
.mcm-nav-group.open > .mcm-nav-toggle .mcm-nav-arrow { transform: rotate(90deg); color: #fff; }
.mcm-nav-group.open > .mcm-nav-toggle { background: var(--mcm-sidebar-hover); color: #fff; }

.mcm-nav-sub {
    display: none;
    background: rgba(0,0,0,0.12);
    padding: 4px 0 6px;
}
.mcm-nav-group.open > .mcm-nav-sub { display: block; }

.mcm-nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 42px;
    color: var(--mcm-sidebar-text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
}
.mcm-nav-subitem:hover { background: var(--mcm-sidebar-hover); color: #fff; }
.mcm-nav-subitem.active { background: var(--mcm-sidebar-active); color: #fff; }
.mcm-nav-subitem.disabled { opacity: 0.45; pointer-events: none; }
.mcm-nav-subitem i { width: 14px; font-size: 12px; }

/* ─── /statistic filter row + CDR table pills + pager ─── */
.mcm-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.mcm-filter { display: flex; flex-direction: column; min-width: 130px; }
.mcm-filter label { font-size: 11px; color: #7f8c8d; margin-bottom: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.mcm-filter--grow { flex: 1 1 200px; }
.mcm-filter--submit { flex-direction: row; gap: 6px; min-width: auto; }

.mcm-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.mcm-type-pill i { font-size: 10px; }
.mcm-type-pill--blue  { background: #e8f0fe; color: #3498db; }
.mcm-type-pill--green { background: #e3f5ea; color: #27ae60; }
.mcm-type-pill--gray  { background: #ecf0f1; color: #7f8c8d; }

.mcm-nowrap { white-space: nowrap; }

.mcm-panel__foot { padding: 10px 16px; border-top: 1px solid var(--mcm-border); background: #fafbfd; }
.mcm-pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.mcm-pager__info { font-size: 12.5px; color: #7f8c8d; }
.mcm-pager__perpage { width: auto; min-width: 110px; }

@media (max-width: 575.98px) {
    .mcm-filter { min-width: 0; flex: 1 1 45%; }
    .mcm-filter--grow { flex: 1 1 100%; }
    .mcm-filter--submit { flex: 1 1 100%; justify-content: space-between; }
    .mcm-pager { justify-content: center; }
    .mcm-table--cdr th, .mcm-table--cdr td { font-size: 12px; padding: 6px 8px; }
}

/* ─── /statistic specific ─── */
.mcm-cdr-toolbar { display: flex; flex-wrap: wrap; gap: 12px; }
.mcm-cdr-toolbar__left { flex: 1 1 auto; min-width: 0; }
.mcm-daterange-presets .btn { white-space: nowrap; }

.mcm-table--cdr .mcm-cdr-head th {
    position: sticky; top: 0; background: #fff; z-index: 2;
    border-bottom: 2px solid var(--mcm-border);
}
.mcm-table--cdr .mcm-cdr-filters th {
    padding: 4px 6px !important; background: #fafbfd; border-bottom: 1px solid var(--mcm-border);
}
.mcm-table--cdr .mcm-cdr-filters .form-control,
.mcm-table--cdr .mcm-cdr-filters .form-select,
.mcm-table--cdr .mcm-cdr-filters .btn { min-width: 80px; }

.mcm-multi .dropdown-toggle { font-weight: 400; min-width: 110px; }
.mcm-multi__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 140px; vertical-align: bottom; }
.mcm-col-picker { max-height: 70vh; overflow-y: auto; }

.mcm-cdr-row--incoming td[data-col="2"] { border-left: 3px solid #3498db; }
.mcm-cdr-row--outgoing td[data-col="2"] { border-left: 3px solid #27ae60; }
.mcm-cdr-row--interior td[data-col="2"] { border-left: 3px solid #bdc3c7; }

.mcm-badge-callback { background: #fff3cd; color: #856404; }

@media (max-width: 991.98px) {
    .mcm-cdr-toolbar .btn-group { flex-wrap: wrap; }
    .mcm-cdr-toolbar .btn-group .btn { border-radius: 4px !important; }
    .mcm-multi__label { max-width: 100px; }
}

/* ─── /calls — live activity ─── */
.mcm-dash-grid--5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1199.98px) { .mcm-dash-grid--5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767.98px)  { .mcm-dash-grid--5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 419.98px)  { .mcm-dash-grid--5 { grid-template-columns: 1fr; } }

.mcm-stat-card--sla { display: flex; align-items: center; gap: 10px; padding: 12px; }
.mcm-stat-card--sla .mcm-sla-ring { flex: 0 0 auto; }

.mcm-live-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 12px;
    background: #27ae60; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.mcm-live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #fff;
    animation: mcm-pulse 1.5s ease-out infinite;
}
.mcm-type-pill--orange { background: #fff5e6; color: #f39c12; }

.mcm-panel__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--mcm-border);
}
.mcm-panel__title { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* /calls - live activity */
.mcm-dash-grid--5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1199.98px) { .mcm-dash-grid--5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767.98px)  { .mcm-dash-grid--5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 419.98px)  { .mcm-dash-grid--5 { grid-template-columns: 1fr; } }

.mcm-stat-card--sla { display: flex; align-items: center; gap: 10px; padding: 12px; }
.mcm-stat-card--sla .mcm-sla-ring { flex: 0 0 auto; }

.mcm-live-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 12px;
    background: #27ae60; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.mcm-live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #fff;
    animation: mcm-pulse 1.5s ease-out infinite;
}
.mcm-type-pill--orange { background: #fff5e6; color: #f39c12; }

.mcm-panel__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--mcm-border);
}
.mcm-panel__title { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
