@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --crm-sidebar-bg: #0b1f33;
    --crm-sidebar-hover: #132d44;
    --crm-sidebar-active: linear-gradient(90deg, rgba(20,184,166,0.22), rgba(255,255,255,0.08));
    --crm-accent: #0f9f8f;
    --crm-accent-dark: #0b8175;
    --crm-accent-light: #d8f3f0;
    --crm-bg: #eef3f8;
    --crm-card: #ffffff;
    --crm-border: #e5edf5;
    --crm-text: #102033;
    --crm-muted: #6b7a90;
    --crm-warning: #f97316;
    --crm-danger: #ef4444;
    --crm-success: #10b981;
    --crm-radius: 18px;
    --crm-radius-sm: 12px;
    --crm-shadow: 0 10px 25px rgba(15, 34, 51, 0.06);
    --crm-sidebar-width: 280px;
    --crm-sidebar-width-collapsed: 76px;
    --crm-topbar-height: 64px;
    --crm-primary: var(--crm-accent);
    --crm-primary-dark: var(--crm-accent-dark);
    --crm-card-bg: var(--crm-card);
}

*, *::before, *::after { box-sizing: border-box; }

body.crm-body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    color: var(--crm-text);
    background: var(--crm-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--crm-accent); text-decoration: none; }
a:hover { color: var(--crm-accent-dark); }

/* App shell */
.crm-app { min-height: 100vh; display: flex; }

.crm-sidebar {
    width: var(--crm-sidebar-width);
    background: var(--crm-sidebar-bg);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width .25s ease, transform .25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.crm-brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-brand-link {
    display: block;
    text-decoration: none;
}

.crm-brand-logo {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
    max-height: 42px;
    object-fit: contain;
    object-position: left center;
    filter: brightness(0) invert(1);
    opacity: .95;
}

.crm-brand-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #5eead4;
    background: rgba(15, 159, 143, 0.15);
    border: 1px solid rgba(15, 159, 143, 0.25);
    border-radius: 999px;
}

.crm-nav {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.crm-nav-section {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
    padding: 18px 14px 8px;
    margin: 0;
}

.crm-nav-section:first-child { padding-top: 8px; }

.crm-nav-group {
    margin-bottom: 2px;
}

.crm-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
    padding: 18px 14px 8px;
    cursor: pointer;
    text-align: left;
    transition: color .15s ease;
}

.crm-nav-group:first-child .crm-nav-group-toggle {
    padding-top: 8px;
}

.crm-nav-group-toggle:hover,
.crm-nav-group-toggle:focus-visible {
    color: #94a3b8;
    outline: none;
}

.crm-nav-group-chevron {
    font-size: 12px;
    transition: transform .2s ease;
    opacity: .75;
}

.crm-nav-group.is-open .crm-nav-group-chevron {
    transform: rotate(180deg);
}

.crm-nav-group-items {
    display: none;
}

.crm-nav-group.is-open .crm-nav-group-items {
    display: block;
}

.crm-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 14px;
    margin-bottom: 4px;
    border-radius: 12px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 14px;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    border-left: 3px solid transparent;
}

.crm-nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    opacity: .9;
}

.crm-nav-link:hover {
    background: var(--crm-sidebar-hover);
    color: #fff;
}

.crm-nav-link.is-active {
    background: var(--crm-sidebar-active);
    color: #fff;
    border-left-color: var(--crm-accent);
    box-shadow: inset 0 0 0 1px rgba(15, 159, 143, 0.12);
}

.crm-nav-link.active {
    background: var(--crm-sidebar-active);
    color: #fff;
    border-left-color: var(--crm-accent);
    box-shadow: inset 0 0 0 1px rgba(15, 159, 143, 0.12);
}

.crm-nav-link.is-active i,
.crm-nav-link.active i { color: #5eead4; }

.crm-nav-link.is-disabled {
    opacity: .45;
    pointer-events: none;
    cursor: default;
}

.crm-nav-sublink {
    height: 40px;
    padding-left: 46px;
    font-size: 13px;
    color: #94a3b8;
}

.crm-nav-sublink.is-active {
    color: #fff;
    border-left-color: var(--crm-accent);
}

.crm-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-sidebar-footer .text-muted {
    color: #94a3b8 !important;
    font-size: 13px;
}

.crm-sidebar-footer .btn-crm-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.crm-sidebar-footer .btn-crm-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.crm-main {
    flex: 1;
    margin-left: var(--crm-sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.crm-sidebar-collapse-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.crm-sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.crm-app.sidebar-collapsed .crm-sidebar {
    width: var(--crm-sidebar-width-collapsed);
}

.crm-app.sidebar-collapsed .crm-main {
    margin-left: var(--crm-sidebar-width-collapsed);
}

.crm-app.sidebar-collapsed .crm-brand-badge,
.crm-app.sidebar-collapsed .crm-nav-section,
.crm-app.sidebar-collapsed .crm-nav-group-toggle,
.crm-app.sidebar-collapsed .crm-sidebar-footer {
    display: none;
}

.crm-app.sidebar-collapsed .crm-nav-group-items {
    display: block !important;
}

.crm-app.sidebar-collapsed .crm-brand-logo {
    max-width: 42px;
    margin: 0 auto;
}

.crm-app.sidebar-collapsed .crm-brand-link {
    display: flex;
    justify-content: center;
}

.crm-app.sidebar-collapsed .crm-nav-link {
    justify-content: center;
    padding-inline: 0;
    font-size: 0;
    gap: 0;
}

.crm-app.sidebar-collapsed .crm-nav-link i {
    font-size: 1.15rem;
    color: #cbd5e1;
}

.crm-app.sidebar-collapsed .crm-nav-link.is-active i {
    color: #5eead4;
}

.crm-app.sidebar-collapsed .crm-nav-sublink {
    padding-left: 0;
}

.crm-app.sidebar-collapsed .crm-sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.crm-ops-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.crm-ops-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--crm-border);
    background: var(--crm-card);
    border-radius: var(--crm-radius);
    padding: 1rem;
    box-shadow: var(--crm-shadow-sm);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.crm-ops-card:hover {
    border-color: #b8e8e2;
    box-shadow: var(--crm-shadow);
    transform: translateY(-1px);
}

.crm-ops-card.is-active {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 2px rgba(15, 159, 143, .15);
}

.crm-ops-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-ops-card-icon.teal { background: rgba(15, 159, 143, .12); color: var(--crm-accent-dark); }
.crm-ops-card-icon.blue { background: rgba(59, 130, 246, .12); color: #1d4ed8; }

.crm-ops-card-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--crm-text);
}

.crm-ops-card-label {
    font-size: .78rem;
    color: var(--crm-muted);
    line-height: 1.3;
}

.crm-ops-filters .btn-crm-secondary.active {
    background: var(--crm-accent-light);
    border-color: #b8e8e2;
    color: var(--crm-accent-dark);
}

.crm-topbar {
    height: var(--crm-topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--crm-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.crm-topbar-left { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.crm-topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--crm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-topbar-sub { font-size: .82rem; color: var(--crm-muted); margin: 0; }
.crm-topbar-right { display: flex; align-items: center; gap: .75rem; }

.crm-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--crm-border);
    background: #fff;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-muted);
    cursor: pointer;
    transition: .15s;
    text-decoration: none;
}

.crm-icon-btn.is-active {
    background: var(--crm-accent-light);
    color: var(--crm-accent-dark);
    border-color: #b8e8e2;
}

.crm-icon-btn:hover {
    background: var(--crm-accent-light);
    color: var(--crm-accent-dark);
    border-color: #b8e8e2;
}

.crm-user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    background: #fff;
}

.crm-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--crm-accent), var(--crm-accent-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}

.crm-status-pill {
    display: inline-block;
    border: 1px solid #b8e8e2;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--crm-accent-light);
    color: var(--crm-accent-dark);
}

.crm-user-chip-toggle {
    cursor: pointer;
}

.crm-user-chip-toggle:hover {
    border-color: var(--crm-accent);
}

.crm-user-chip-chevron {
    font-size: .7rem;
    color: var(--crm-muted, #94a3b8);
    transition: transform .15s ease;
}

.crm-user-chip-toggle[aria-expanded="true"] .crm-user-chip-chevron {
    transform: rotate(180deg);
}

.crm-user-menu {
    margin-top: 10px;
    padding: 6px;
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
    min-width: 200px;
}

.crm-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .88rem;
}

.crm-user-menu .dropdown-item:hover,
.crm-user-menu .dropdown-item:focus {
    background: var(--crm-accent-light);
    color: var(--crm-accent-dark);
}

.crm-user-menu .dropdown-item.text-danger:hover,
.crm-user-menu .dropdown-item.text-danger:focus {
    background: #fee2e2;
    color: #b91c1c;
}

/* Read-only presence indicator: available while logged in, offline otherwise — no manual toggle. */
.crm-status-pill-available { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.crm-status-pill-offline { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }

.crm-content { padding: 28px 32px 40px; flex: 1; }

.crm-sidebar-toggle {
    display: none;
    border: 1px solid var(--crm-border);
    background: #fff;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    color: var(--crm-text);
}

.crm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 51, 0.45);
    z-index: 1035;
}

/* Welcome & dashboard extras */
.crm-welcome-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 16px;
    background: var(--crm-accent-light);
    border: 1px solid #b8e8e2;
    color: var(--crm-accent-dark);
    font-weight: 600;
    font-size: 14px;
}

.crm-welcome-alert i {
    font-size: 1.1rem;
    color: var(--crm-accent);
}

.crm-welcome-card {
    background: linear-gradient(135deg, #f8fcfb 0%, #eef8f7 100%);
    border: 1px solid #cce9e5;
    border-radius: var(--crm-radius);
    padding: 24px 26px;
    margin-bottom: 24px;
    box-shadow: var(--crm-shadow);
}

.crm-welcome-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--crm-text);
}

.crm-welcome-card p {
    margin: 0;
    color: var(--crm-muted);
    font-size: 14px;
}

.crm-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(15, 159, 143, 0.12);
    color: var(--crm-accent-dark);
    border: 1px solid rgba(15, 159, 143, 0.2);
    margin-bottom: 10px;
}

.crm-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.crm-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 18px;
    border: 1px solid var(--crm-border);
    background: #fff;
    color: var(--crm-text);
    font-weight: 600;
    font-size: 13px;
    transition: .15s;
    text-decoration: none;
}

.crm-pill-btn:hover {
    background: #f8fbfd;
    color: var(--crm-text);
    border-color: #cfd9e6;
}

.crm-pill-btn.is-primary {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
    color: #fff;
}

.crm-pill-btn.is-primary:hover {
    background: var(--crm-accent-dark);
    border-color: var(--crm-accent-dark);
    color: #fff;
}

.crm-stat-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

@media (max-width: 1399.98px) {
    .crm-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
    .crm-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 479.98px) {
    .crm-stat-grid { grid-template-columns: 1fr; }
}

/* Cards */
.crm-card,
.crm-section-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
}

.crm-card { padding: 24px 26px; margin-bottom: 24px; }

.crm-section-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 24px;
}

.crm-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--crm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    background: #fff;
}

.crm-card-header h2,
.crm-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--crm-text);
}

.crm-card-body { padding: 24px 26px; }

.crm-stat-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 22px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.crm-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.crm-stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.crm-stat-icon.green { background: #d1fae5; color: var(--crm-success); }
.crm-stat-icon.teal { background: var(--crm-accent-light); color: var(--crm-accent); }
.crm-stat-icon.amber { background: #ffedd5; color: var(--crm-warning); }
.crm-stat-icon.red { background: #fee2e2; color: var(--crm-danger); }
.crm-stat-icon.gray { background: #f1f5f9; color: #64748b; }
.crm-stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.crm-stat-label {
    font-size: 13px;
    color: var(--crm-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.crm-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--crm-text);
}

.crm-stat-sub {
    font-size: 12px;
    color: var(--crm-muted);
    margin-top: 4px;
}

/* Page header */
.crm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 24px;
}

.crm-page-header h1,
.crm-page-header .page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--crm-text);
}

.crm-page-header p {
    margin: 0;
    color: var(--crm-muted);
    font-size: 14px;
}

/* Buttons */
.btn-crm-primary,
.btn-crm-secondary,
.btn-crm-success,
.btn-crm-warning,
.btn-crm-danger,
.btn-crm-light,
.btn-crm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .15s ease;
    text-decoration: none;
    line-height: 1.2;
}

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

.btn-crm-primary:hover {
    background: var(--crm-accent-dark);
    border-color: var(--crm-accent-dark);
    color: #fff;
}

.btn-crm-secondary {
    background: #fff;
    color: var(--crm-text);
    border-color: var(--crm-border);
}

.btn-crm-secondary:hover {
    background: #f8fbfd;
    color: var(--crm-text);
    border-color: #cfd9e6;
}

.btn-crm-success { background: var(--crm-success); color: #fff; border-color: var(--crm-success); }
.btn-crm-success:hover { background: #059669; color: #fff; }
.btn-crm-warning { background: var(--crm-warning); color: #fff; border-color: var(--crm-warning); }
.btn-crm-warning:hover { background: #ea580c; color: #fff; }
.btn-crm-danger { background: var(--crm-danger); color: #fff; border-color: var(--crm-danger); }
.btn-crm-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-crm-light { background: #f8fafc; color: var(--crm-text); border-color: var(--crm-border); }
.btn-crm-light:hover { background: #f1f5f9; color: var(--crm-text); }
.btn-crm-sm { min-height: 34px; padding: 7px 14px; font-size: 13px; }
.btn-crm-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 999px; }

.btn-crm-flat {
    border-radius: 8px;
    box-shadow: none;
}

.btn-crm-primary:disabled,
.btn-crm-secondary:disabled,
.btn-crm-success:disabled,
.btn-crm-warning:disabled,
.btn-crm-danger:disabled,
.btn-crm-light:disabled,
[class*="btn-crm-"][disabled] {
    background: #edf1f5 !important;
    color: #94a3b8 !important;
    border-color: #dfe6ee !important;
    cursor: not-allowed;
    opacity: 1;
}

/* Forms */
.crm-body .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--crm-text);
    margin-bottom: 6px;
}

.crm-body .form-control,
.crm-body .form-select,
.crm-body textarea.form-control {
    min-height: 44px;
    border-radius: var(--crm-radius-sm);
    border: 1px solid #d7e2ee;
    background: #fff;
    font-size: 14px;
    padding: 10px 14px;
    color: var(--crm-text);
}

.crm-body textarea.form-control { min-height: 110px; }

.crm-body .form-control:focus,
.crm-body .form-select:focus,
.crm-body textarea.form-control:focus {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 4px rgba(15, 159, 143, 0.14);
}

.crm-form-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--crm-muted);
    margin: 24px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-form-section-title:first-child { margin-top: 0; }

.crm-filter-bar {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 18px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.crm-filter-bar .form-control,
.crm-filter-bar .form-select {
    min-width: 160px;
}

.crm-code-block {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Tables */
.crm-table-wrap {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
}

.crm-table-wrap .table {
    margin-bottom: 0;
    font-size: 14px;
    width: max-content;
    min-width: 100%;
}

.crm-table-wrap .table.crm-table--fluid,
.crm-table-wrap .table:has(.ck-editor) {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.crm-table-wrap .table.crm-table--fluid td,
.crm-table-wrap .table:has(.ck-editor) td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.crm-table-wrap .form-control-sm,
.crm-table-wrap .form-select-sm {
    min-width: 5.5rem;
}

.crm-table-wrap .form-select-sm {
    min-width: 9rem;
}

.crm-table-wrap input[type="date"].form-control-sm {
    min-width: 9.5rem;
}

.crm-table-wrap td.text-nowrap {
    white-space: nowrap;
}

.crm-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    padding-bottom: 0.25rem;
}

.crm-scroll-x > .row {
    flex-wrap: nowrap;
    min-width: max-content;
    margin-right: 0;
    margin-left: 0;
}

.crm-scroll-x > .row > [class*="col-"] {
    flex: 0 0 auto;
}

.crm-table-wrap thead th {
    background: #f8fafc;
    color: var(--crm-text);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--crm-border);
    padding: 14px 16px;
    white-space: nowrap;
}

.crm-table-wrap thead th.crm-sortable-th,
table.crm-table thead th.crm-sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s;
}

.crm-table-wrap thead th.crm-sortable-th:hover,
table.crm-table thead th.crm-sortable-th:hover {
    background: #eef6f5;
    color: var(--crm-accent-dark);
}

.crm-table-wrap thead th.crm-sortable-th::after,
table.crm-table thead th.crm-sortable-th::after {
    content: '↕';
    display: inline-block;
    margin-left: .35rem;
    font-size: 11px;
    opacity: .35;
    vertical-align: middle;
}

.crm-table-wrap thead th.crm-sortable-th.is-sorted-asc::after,
table.crm-table thead th.crm-sortable-th.is-sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--crm-accent-dark);
}

.crm-table-wrap thead th.crm-sortable-th.is-sorted-desc::after,
table.crm-table thead th.crm-sortable-th.is-sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--crm-accent-dark);
}

.crm-table-wrap tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f7;
}

.crm-table-wrap tbody tr:hover { background: #f8fbfd; }
.crm-table-wrap tbody tr:last-child td { border-bottom: 0; }

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

/* Badges */
.badge-stage,
.badge-priority {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-new { background: #f1f5f9; color: #475569; }
.badge-assigned { background: #dbeafe; color: #1d4ed8; }
.badge-contact-attempted { background: #e0e7ff; color: #4338ca; }
.badge-conversation-started { background: #cffafe; color: #0e7490; }
.badge-details-received { background: #ccfbf1; color: #0f766e; }
.badge-package-sent { background: #ede9fe; color: #6d28d9; }
.badge-negotiating { background: #fef3c7; color: #b45309; }
.badge-waiting-payment { background: #ffedd5; color: #c2410c; }
.badge-confirmed { background: #d1fae5; color: #047857; }
.badge-lost { background: #fee2e2; color: #b91c1c; }
.badge-invalid { background: #e2e8f0; color: #334155; }
.badge-duplicate { background: #f1f5f9; color: #64748b; }

.badge-priority-low { background: #f1f5f9; color: #64748b; }
.badge-priority-normal { background: #dbeafe; color: #1d4ed8; }
.badge-priority-high { background: #fef3c7; color: #b45309; }
.badge-priority-urgent { background: #fee2e2; color: #b91c1c; }

.badge-overdue { background: #fee2e2; color: #b91c1c; }
.badge-due-today { background: #fef3c7; color: #b45309; }
.badge-upcoming { background: #dbeafe; color: #1d4ed8; }

.badge-staff-available { background: #d1fae5; color: #047857; }
.badge-staff-offline { background: #f1f5f9; color: #64748b; }

/* Stage pipeline */
.crm-stage-pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.crm-stage-step {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--crm-border);
    background: #fff;
    color: var(--crm-muted);
}

.crm-stage-step.is-done {
    background: var(--crm-accent-light);
    border-color: #b8e8e2;
    color: var(--crm-accent-dark);
}

.crm-stage-step.is-current {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(15, 159, 143, 0.28);
}

.crm-stage-step.is-lost,
.crm-stage-step.is-lost.is-current {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
    box-shadow: none;
}

/* Lead detail */
.crm-lead-header {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 24px 26px;
    margin-bottom: 24px;
}

.crm-lead-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--crm-text);
}

.crm-lead-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--crm-muted);
    font-size: 14px;
    margin-top: 8px;
}

.crm-lead-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.crm-lead-detail-grid .col-lg-8,
.crm-lead-detail-grid .col-lg-4 {
    min-width: 0;
}

@media (min-width: 992px) {
    .crm-lead-detail-grid .col-lg-8 { flex: 0 0 60%; max-width: 60%; }
    .crm-lead-detail-grid .col-lg-4 { flex: 0 0 40%; max-width: 40%; }
}

/* Timeline */
.crm-timeline {
    position: relative;
    padding-left: 28px;
}

.crm-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--crm-border);
}

.crm-timeline-item {
    position: relative;
    padding: 0 0 18px 12px;
}

.crm-timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--crm-accent);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--crm-border);
}

.crm-timeline-card {
    background: #f8fbfd;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    padding: 14px 16px;
}

.crm-timeline-time {
    font-size: 12px;
    color: var(--crm-muted);
    margin-bottom: 6px;
}

.crm-timeline-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.crm-timeline-note {
    font-size: 14px;
    color: var(--crm-text);
    line-height: 1.5;
}

/* Reminders */
.crm-reminder-item {
    padding: 14px 16px;
    border: 1px solid var(--crm-border);
    border-radius: 14px;
    margin-bottom: 10px;
    background: #fff;
}

.crm-reminder-item.is-overdue {
    border-color: #fecaca;
    background: #fef2f2;
}

.crm-reminder-item.is-today {
    border-color: #fde68a;
    background: #fffbeb;
}

/* Notifications */
.crm-notify-wrap {
    position: relative;
}

.crm-notify-btn {
    position: relative;
}

.crm-notify-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.crm-notify-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: 420px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    z-index: 1200;
}

.crm-notify-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-border);
}

.crm-notify-list {
    max-height: 340px;
    overflow-y: auto;
}

.crm-notify-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    cursor: pointer;
}

.crm-notify-item:last-child {
    border-bottom: 0;
}

.crm-notify-item:hover,
.crm-notify-item.is-unread {
    background: #f8fafc;
}

.crm-notify-item.is-unread {
    border-left: 3px solid var(--crm-accent);
}

.crm-notify-item-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text);
}

.crm-notify-item-body {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--crm-muted);
}

.crm-notify-item-time {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.crm-notify-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--crm-muted);
    font-size: 14px;
}

.crm-reminder-popup .modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.crm-hotel-mail-modal .modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.crm-hotel-mail-body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.crm-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crm-subnav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 13px;
    text-decoration: none;
}

.crm-subnav-link.is-active,
.crm-subnav-link:hover {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

/* Activity feed */
.crm-activity-item {
    padding: 12px 0;
    border-bottom: 1px solid #eef2f7;
}

.crm-activity-item:last-child { border-bottom: 0; }

/* Alerts */
.crm-alert {
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 14px;
}

.crm-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.crm-alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Login (legacy class names — kept for reference) */
.crm-login-body { min-height: 100vh; background: var(--crm-bg); }

.crm-login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.crm-login-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    overflow: hidden;
    color: #fff;
}

.crm-login-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,.1) 0%, transparent 45%),
        linear-gradient(145deg, #0b1f33 0%, #0f9f8f 100%);
    z-index: 0;
}

.crm-login-hero-inner { position: relative; z-index: 1; max-width: 420px; }

.crm-login-hero-logo {
    height: 52px;
    width: auto;
    filter: brightness(0) invert(1);
    margin-bottom: 1.5rem;
}

.crm-login-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: .75rem;
}

.crm-login-hero-tagline {
    font-size: .95rem;
    line-height: 1.6;
    color: rgba(255,255,255,.88);
    margin-bottom: 2rem;
}

.crm-login-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2.5rem;
}

.crm-login-features li {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem 0;
    font-size: .9rem;
    color: rgba(255,255,255,.92);
}

.crm-login-features i {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.crm-login-hero-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: .78rem;
    color: rgba(255,255,255,.7);
}

.crm-login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--crm-bg);
}

.crm-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 2.25rem 2rem;
}

.crm-login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}

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

.crm-input-wrap { position: relative; }

.crm-input-wrap i {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-muted);
    pointer-events: none;
}

.crm-input-wrap .form-control { padding-left: 2.5rem; }

.crm-login-submit {
    height: 46px;
    width: 100%;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 159, 143, 0.25);
}

.crm-login-submit:hover {
    box-shadow: 0 10px 24px rgba(15, 159, 143, 0.32);
    transform: translateY(-1px);
}

.crm-login-note {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: .78rem;
    color: var(--crm-muted);
}

.crm-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--crm-muted);
}

/* Auth pages (login, invite, change password) */
.crm-auth {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: var(--crm-bg);
}

.crm-auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 20%, rgba(15, 159, 143, 0.08) 0%, transparent 42%),
        radial-gradient(circle at 85% 75%, rgba(11, 31, 51, 0.06) 0%, transparent 40%),
        linear-gradient(160deg, #eef6f5 0%, #f4f7fa 45%, #eef3f7 100%);
}

.crm-auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
}

.crm-auth-orb--1 {
    width: 420px;
    height: 420px;
    top: -120px;
    left: -80px;
    background: rgba(15, 159, 143, 0.22);
}

.crm-auth-orb--2 {
    width: 360px;
    height: 360px;
    bottom: 10%;
    right: 8%;
    background: rgba(11, 31, 51, 0.12);
}

.crm-auth-orb--3 {
    width: 280px;
    height: 280px;
    top: 40%;
    left: 45%;
    background: rgba(94, 234, 212, 0.18);
}

.crm-auth-inner {
    position: relative;
    z-index: 1;
}

.crm-auth-brand {
    position: relative;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 45%),
        linear-gradient(145deg, #0b1f33 0%, #0f766e 55%, #0f9f8f 100%);
    min-height: 100vh;
}

.crm-auth-brand-content {
    max-width: 440px;
}

.crm-auth-form-panel {
    min-height: 100vh;
    background: transparent;
}

.crm-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 2rem 1.75rem;
}

.crm-demo-box {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    border: 1px dashed var(--crm-border);
    background: #f8fafc;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.crm-demo-box code {
    font-size: 0.75rem;
    word-break: break-all;
}

.form-control-modern {
    min-height: 44px;
}

.form-control-modern:focus {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 0.2rem rgba(15, 159, 143, 0.15);
}

.animate-fade-in {
    animation: crmFadeIn 0.5s ease both;
}

.animate-scale-in {
    animation: crmScaleIn 0.45s ease both;
}

@keyframes crmFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes crmScaleIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 991.98px) {
    .crm-auth-brand {
        min-height: auto;
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .crm-auth-form-panel {
        min-height: auto;
    }
}

/* Responsive */
@media (max-width: 991.98px) {
    .crm-sidebar { transform: translateX(-100%); width: var(--crm-sidebar-width); }
    .crm-sidebar.is-open { transform: translateX(0); }
    .crm-main { margin-left: 0 !important; }
    .crm-sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .crm-sidebar-collapse-btn { display: none; }
    .crm-overlay.is-visible { display: block; }
    .crm-content { padding: 20px 16px 32px; }
    .crm-topbar { padding: 0 16px; }
    .crm-app.sidebar-collapsed .crm-sidebar { width: var(--crm-sidebar-width); }
}

@media (max-width: 991.98px) {
    .crm-login-shell { grid-template-columns: 1fr; }
    .crm-login-hero { padding: 2rem 1.5rem; min-height: auto; }
    .crm-login-hero-tagline,
    .crm-login-features { display: none; }
}

@media (max-width: 767.98px) {
    .crm-lead-actions .btn-crm-primary,
    .crm-lead-actions .btn-crm-secondary { flex: 1 1 calc(50% - 8px); }
}

/* Quote Builder */
.crm-back-link {
    color: var(--crm-muted);
    text-decoration: none;
    font-size: .875rem;
}
.crm-back-link:hover { color: var(--crm-accent); }

.crm-quote-package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.crm-quote-package-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--crm-shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.crm-quote-package-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--crm-shadow);
}
.crm-quote-package-img-wrap {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #e8eef3;
}
.crm-quote-package-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.crm-quote-package-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}
.crm-quote-package-body {
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.crm-quote-package-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: .35rem 0;
    line-height: 1.35;
}
.crm-quote-tag {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--crm-accent);
    background: rgba(15, 159, 143, .1);
    padding: .2rem .55rem;
    border-radius: 999px;
}
.crm-quote-duration { font-size: .85rem; color: var(--crm-muted); margin-bottom: .35rem; }
.crm-quote-route { font-size: .82rem; color: var(--crm-muted); flex: 1; }

.crm-pill-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.crm-pill-btn {
    display: inline-flex;
    align-items: center;
    padding: .45rem 1rem;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    font-size: .875rem;
    cursor: pointer;
    background: #fff;
    transition: all .15s;
}
.crm-pill-btn:has(input:checked) {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
    color: #fff;
}
.crm-pill-btn input { margin-right: .35rem; }

.crm-ferry-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
}
.crm-ferry-row-override .crm-ferry-selects {
    grid-template-columns: 1fr 1fr auto;
}
.crm-ferry-selects .form-select {
    width: 100%;
    min-width: 0;
}
.crm-ferry-row-categories {
    margin-top: 0.5rem;
}
.crm-ferry-cat-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
}
.crm-ferry-cat-check {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.2;
    color: var(--crm-muted);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.crm-ferry-cat-check .form-check-input {
    float: none;
    margin: 0;
    width: 0.8rem;
    height: 0.8rem;
}

.crm-quote-thumb {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
}
.crm-quote-hotel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.crm-quote-hotel-card {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
    background: #fff;
}
.crm-quote-hotel-card.is-selected {
    border-color: var(--crm-accent);
    box-shadow: 0 0 0 2px rgba(15, 159, 143, .2);
}
.crm-quote-hotel-img {
    aspect-ratio: 4/3;
    background: #e8eef3;
}
.crm-quote-hotel-img img { width: 100%; height: 100%; object-fit: cover; }
.crm-quote-hotel-body { padding: .85rem; }
.crm-quote-hotel-body h4 { font-size: .95rem; margin: .25rem 0; }
.crm-quote-rate-line { font-size: .82rem; color: var(--crm-muted); }
.crm-quote-hotel-body .crm-hotel-room-select {
    min-height: 36px;
    padding: 6px 10px;
    font-size: .82rem;
}

.crm-rate-breakdown { font-size: .9rem; }
.crm-rate-row {
    display: flex;
    justify-content: space-between;
    padding: .45rem 0;
    border-bottom: 1px solid var(--crm-border);
}
.crm-rate-subtotal { font-weight: 600; }
.crm-rate-shared-last { border-bottom: none; padding-bottom: 0; }
.crm-rate-category-block {
    margin-top: .85rem;
    padding-top: .65rem;
    border-top: 2px solid var(--crm-border);
}
.crm-rate-category-block .crm-rate-row:first-child { padding-top: 0; }
.crm-rate-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--crm-accent);
    border-bottom: none;
    padding-top: .65rem;
}
.crm-rate-discount strong { color: #f87171; }
.crm-discount-grid {
    display: grid;
    gap: .65rem;
}
.crm-discount-field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .82rem;
    margin: 0;
}
.crm-discount-field-wide { grid-column: 1 / -1; }
.crm-discount-field input { min-height: 34px; }
.crm-rate-discount-input {
    padding: .55rem 0 .35rem;
    border-bottom: 1px solid var(--crm-border);
}
.crm-rate-discount-input .crm-discount-field span {
    font-size: .78rem;
    color: var(--crm-muted);
}
.crm-rate-include-check {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .55rem 0 0;
    padding-bottom: .15rem;
    font-size: .82rem;
    color: var(--crm-text);
    cursor: pointer;
}
.crm-rate-include-check input {
    margin: 0;
    accent-color: var(--crm-accent);
}

.crm-status-story-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem 1.25rem;
}
.crm-status-story-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
    color: var(--crm-text);
}
.crm-status-story-legend-item i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}
.crm-status-story-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}
.crm-status-story-total-card {
    background: var(--crm-bg);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: .75rem .9rem;
}
.crm-status-story-total-label {
    display: block;
    font-size: .78rem;
    color: var(--crm-muted);
    margin-bottom: .2rem;
}
.crm-status-story-total-card strong {
    font-size: 1rem;
}
.crm-status-story-chart {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: .75rem .75rem .5rem;
    background: #fff;
    overflow-x: auto;
}
.crm-status-story-grid {
    min-width: 640px;
}
.crm-status-story-hours-row,
.crm-status-story-row {
    display: grid;
    grid-template-columns: 96px minmax(520px, 1fr);
    gap: .75rem;
    align-items: center;
}
.crm-status-story-hours-row {
    margin-bottom: .35rem;
}
.crm-status-story-day-spacer {
    width: 96px;
}
.crm-status-story-hours {
    position: relative;
    height: 22px;
    border-bottom: 1px solid var(--crm-border);
}
.crm-status-story-hours span {
    position: absolute;
    transform: translateX(-50%);
    font-size: .7rem;
    color: var(--crm-muted);
    white-space: nowrap;
}
.crm-status-story-row {
    min-height: 34px;
    margin-bottom: .45rem;
}
.crm-status-story-day {
    width: 96px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--crm-text);
}
.crm-status-story-track {
    position: relative;
    width: 100%;
    height: 22px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
}
.crm-status-story-seg-hit {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    height: 100%;
    min-width: 2px;
    background: transparent;
    cursor: help;
    z-index: 1;
}

.crm-quote-preview-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
}
.crm-quote-preview-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--crm-border);
}
.crm-quote-logo { height: 40px; }
.crm-quote-customer-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding: .85rem 1.5rem;
    background: #f4f7fa;
    font-size: .875rem;
}
.crm-quote-tabs { padding: 0 1rem; border-bottom: 1px solid var(--crm-border); }
.crm-quote-tabs .nav-link {
    border: none;
    color: var(--crm-muted);
    font-size: .875rem;
    padding: .75rem 1rem;
}
.crm-quote-tabs .nav-link.active {
    color: var(--crm-accent);
    border-bottom: 2px solid var(--crm-accent);
    background: transparent;
}
.crm-quote-dl { font-size: .875rem; }
.crm-quote-dl dt { color: var(--crm-muted); font-weight: 500; margin-top: .5rem; }
.crm-quote-dl dd { margin: 0; font-weight: 600; }
.crm-quote-document-wrap .quote-doc-footer { margin-bottom: 0; }
.crm-itinerary-day-head {
    font-size: .95rem;
    font-weight: 600;
    color: var(--crm-navy);
    margin-bottom: .35rem;
}
.crm-itinerary-day-num {
    color: var(--crm-accent);
    margin-right: .35rem;
}
.crm-itinerary-day-desc {
    font-size: .875rem;
    color: var(--crm-muted);
    line-height: 1.55;
}
.crm-itinerary-day-desc p:last-child { margin-bottom: 0; }
.crm-itinerary-day-desc ul,
.crm-itinerary-day-desc ol { margin: .35rem 0 .35rem 1.25rem; padding: 0; }
.crm-preset-rate-block:last-child { border-bottom: none !important; }

/* Quote rates & hotels cards (preview + print partial) */
.quote-rates-wrap { margin: 0; }
.quote-rate-card {
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    margin-bottom: 1rem;
    overflow: hidden;
    background: #fff;
}
.quote-rate-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #0b1f33 0%, #123552 100%);
    color: #fff;
    padding: .9rem 1.1rem;
}
.quote-rate-category { display: block; font-size: 1rem; font-weight: 700; }
.quote-rate-meal { display: block; font-size: .75rem; opacity: .85; margin-top: .15rem; }
.quote-rate-price { font-size: 1.1rem; font-weight: 700; color: #5eead4; white-space: nowrap; }
.quote-rate-unavailable { font-size: .85rem; color: #fbbf24; }
.quote-hotel-block { padding: .9rem 1.1rem; border-top: 1px solid var(--crm-border); }
.quote-hotel-block h3 { margin: 0 0 .25rem; font-size: .9rem; color: var(--crm-accent); }
.quote-hotel-meta p { margin: 0 0 .65rem; font-size: .82rem; color: var(--crm-muted); }
.quote-photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.quote-photo { margin: 0; }
.quote-photo img,
.quote-photo-placeholder {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--crm-border);
    display: block;
}
.quote-photo-placeholder {
    background: #eef3f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a9bab;
    font-size: .72rem;
    text-align: center;
    padding: .5rem;
}
.quote-rate-note { padding: .9rem 1.1rem; margin: 0; font-size: .85rem; color: var(--crm-muted); }

.quote-inc-exc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.quote-inc-exc-box {
    background: #f8fafc;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 1rem 1.1rem;
}
.quote-inc-exc-box h2 {
    font-size: .95rem;
    margin: 0 0 .75rem;
    color: var(--crm-navy);
}
.quote-inc-exc-inclusions { border-top: 3px solid var(--crm-accent); }
.quote-inc-exc-exclusions { border-top: 3px solid #94a3b8; }
.quote-bullet-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.quote-bullet-list li {
    position: relative;
    padding: 0 0 .65rem 1.35rem;
    font-size: .84rem;
    line-height: 1.55;
    color: #334155;
}
.quote-bullet-list li:last-child { padding-bottom: 0; }
.quote-inc-exc-inclusions .quote-bullet-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: .45em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--crm-accent);
}
.quote-inc-exc-exclusions .quote-bullet-list li::before {
    content: '–';
    position: absolute;
    left: 2px;
    top: 0;
    color: #64748b;
    font-weight: 700;
}
.quote-inc-exc-empty { margin: 0; color: var(--crm-muted); font-size: .84rem; }
@media (max-width: 767.98px) {
    .quote-photo-grid { grid-template-columns: repeat(2, 1fr); }
    .quote-inc-exc-grid { grid-template-columns: 1fr; }
}

.crm-body .ck.ck-editor,
.crm-package-full-description + .ck-editor,
.crm-package-day-description + .ck-editor,
.crm-hotel-description + .ck-editor,
.crm-editor-wrap .ck.ck-editor,
.crm-wysiwyg-field .ck.ck-editor {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.crm-body .ck.ck-editor__main,
.crm-package-full-description + .ck-editor .ck-editor__main,
.crm-package-day-description + .ck-editor .ck-editor__main,
.crm-hotel-description + .ck-editor .ck-editor__main,
.crm-wysiwyg-field .ck.ck-editor__main {
    max-width: 100% !important;
    min-width: 0 !important;
}

.crm-wysiwyg-field {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.crm-body .ck.ck-editor__editable:not(.ck-editor__nested-editable),
.crm-package-full-description + .ck-editor .ck-editor__editable,
.crm-package-day-description + .ck-editor .ck-editor__editable,
.crm-hotel-description + .ck-editor .ck-editor__editable,
.crm-editor-wrap .ck.ck-editor__editable:not(.ck-editor__nested-editable),
.crm-wysiwyg-field .ck.ck-editor__editable {
    background: #fff;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.crm-body .ck.ck-editor__editable:not(.ck-editor__nested-editable) p,
.crm-body .ck.ck-editor__editable:not(.ck-editor__nested-editable) li,
.crm-body .ck.ck-editor__editable:not(.ck-editor__nested-editable) pre,
.crm-body .ck.ck-editor__editable:not(.ck-editor__nested-editable) code,
.crm-wysiwyg-field .ck.ck-editor__editable p,
.crm-wysiwyg-field .ck.ck-editor__editable li {
    max-width: 100% !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.crm-package-full-description + .ck-editor .ck-editor__editable,
.crm-hotel-description + .ck-editor .ck-editor__editable,
.crm-editor-wrap .ck.ck-editor__editable:not(.ck-editor__nested-editable) {
    min-height: 160px;
}

.crm-package-day-description + .ck-editor .ck-editor__editable {
    min-height: 100px;
}

/* Global CRM AJAX toast */
.crm-ajax-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    padding: .55rem 1rem;
    border-radius: var(--crm-radius);
    background: var(--crm-navy);
    color: #fff;
    font-size: .875rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    max-width: min(420px, calc(100vw - 2rem));
}
.crm-ajax-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.crm-ajax-toast.is-success { background: var(--crm-navy); }
.crm-ajax-toast.is-error { background: #b91c1c; }
.crm-ajax-toast.is-warning { background: #b45309; }
.crm-ajax-toast.is-info { background: #0369a1; }

.crm-ajax-feedback.text-success {
    color: #15803d;
}

/* Package edit — section nav (page-specific) */
.crm-package-edit-nav {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    padding: .65rem 1rem;
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}
.crm-package-edit-nav a {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--crm-navy);
    text-decoration: none;
    padding: .2rem .45rem;
    border-radius: 4px;
}
.crm-package-edit-nav a:hover {
    background: #f1f5f9;
    color: var(--crm-accent);
}

#basic-details,
#day-wise-itinerary,
#hotel-nights,
#linked-services,
#review-summary,
[id^="day-"],
[id^="linked-day-"],
[id^="hotel-night-"] {
    scroll-margin-top: 4.5rem;
}

#booking-hotels,
#booking-payments,
#booking-travellers,
#booking-ferries,
#booking-entries,
#booking-vehicles,
#reminders,
[id^="booking-hotel-"],
[id^="booking-ferry-"],
[id^="booking-entry-"],
[id^="booking-vehicle-"] {
    scroll-margin-top: 4.5rem;
}

/* Platform admin shell (layouts/main.php) */
.crm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(15, 159, 143, 0.18);
    color: #5eead4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.crm-sidebar-brand-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.crm-sidebar-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #5eead4;
    background: rgba(15, 159, 143, 0.15);
    border: 1px solid rgba(15, 159, 143, 0.25);
    border-radius: 999px;
}

.crm-sidebar-nav {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.crm-nav-group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
    padding: 18px 14px 8px;
}

.crm-nav-group-items .crm-nav-subgroup-label {
    padding: 14px 14px 4px 22px;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #475569;
}

.crm-nav-group-items .crm-nav-subgroup-label:first-child {
    padding-top: 6px;
}

.crm-nav-link--disabled {
    opacity: .45;
    pointer-events: none;
    cursor: default;
}

.crm-sidebar-footer form {
    margin: 0;
}

.crm-sidebar-footer .btn-crm-secondary {
    width: 100%;
    justify-content: center;
    border-radius: 12px;
    min-height: 42px;
}

.crm-topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}

.crm-topbar-user-name {
    font-size: .84rem;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1.2;
}

.crm-topbar-user-role {
    font-size: .75rem;
    color: var(--crm-muted);
    max-width: 180px;
    line-height: 1.2;
}

.crm-user-chip .crm-topbar-user-role {
    max-width: 160px;
}

.page-breadcrumb {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--crm-muted);
    margin: 0 0 6px;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--crm-muted);
    font-size: 14px;
}

.page-shell {
    max-width: 1400px;
}

.section-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 24px 26px;
}

.platform-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1199.98px) {
    .platform-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .platform-stat-grid {
        grid-template-columns: 1fr;
    }
}

.platform-stat-grid .crm-stat-card {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
}

.platform-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 767.98px) {
    .platform-action-grid {
        grid-template-columns: 1fr;
    }
}

.platform-action-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    background: #fff;
    color: var(--crm-text);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.platform-action-card:hover {
    color: var(--crm-text);
    border-color: #b8e8e2;
    box-shadow: var(--crm-shadow);
    transform: translateY(-1px);
}

.platform-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--crm-accent-light);
    color: var(--crm-accent-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.platform-health-item + .platform-health-item {
    margin-top: 1.25rem;
}

.platform-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e8eef3;
    overflow: hidden;
}

.platform-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease;
}

.table-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}

.table-card .table-toolbar {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--crm-border);
    background: #fff;
}

.table-card > .table-responsive,
.table-card .table-responsive {
    padding: 8px 24px 24px;
}

.table-card .crm-table {
    margin-bottom: 0;
    font-size: 14px;
}

.table-card .crm-table thead th {
    background: #f8fafc;
    color: var(--crm-text);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--crm-border);
    padding: 14px 16px;
    white-space: nowrap;
}

.table-card .crm-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f7;
}

.table-card .crm-table tbody tr:hover {
    background: #f8fbfd;
}

.table-card .crm-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-card .empty-state {
    padding: 48px 24px 56px;
    text-align: center;
}

.company-branding-current-img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--crm-border);
    background: #fff;
}

.btn-crm-ghost {
    border: none;
    background: transparent;
    color: #cbd5e1;
}

.btn-crm-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

@media (max-width: 991.98px) {
    .crm-sidebar {
        transform: translateX(-100%);
    }

    .crm-sidebar.is-open {
        transform: translateX(0);
    }

    .crm-overlay.is-visible {
        display: block;
    }

    .crm-main {
        margin-left: 0;
    }

    .crm-sidebar-toggle,
    .btn.btn-crm-ghost.crm-sidebar-btn {
        display: inline-flex;
    }
}

/* Lead statistics dashboard */
.crm-leadstat-period-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
    color: #0f766e;
    border: 1px solid rgba(20, 184, 166, 0.28);
    font-size: 12px;
    font-weight: 600;
}

.crm-leadstat-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    padding: 18px 20px;
    min-height: 168px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.crm-leadstat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 34, 51, 0.08);
}

.crm-leadstat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: var(--crm-radius) 0 0 var(--crm-radius);
    background: var(--crm-leadstat-accent, var(--crm-accent));
}

.crm-leadstat-card--teal {
    background: linear-gradient(145deg, #f0fdfa 0%, #ffffff 72%);
    --crm-leadstat-accent: #14b8a6;
}

.crm-leadstat-card--blue {
    background: linear-gradient(145deg, #eff6ff 0%, #ffffff 72%);
    --crm-leadstat-accent: #3b82f6;
}

.crm-leadstat-card--green {
    background: linear-gradient(145deg, #ecfdf5 0%, #ffffff 72%);
    --crm-leadstat-accent: #22c55e;
}

.crm-leadstat-card--amber {
    background: linear-gradient(145deg, #fffbeb 0%, #ffffff 72%);
    --crm-leadstat-accent: #f59e0b;
}

.crm-leadstat-card--purple {
    background: linear-gradient(145deg, #f5f3ff 0%, #ffffff 72%);
    --crm-leadstat-accent: #8b5cf6;
}

.crm-leadstat-card--gray {
    background: linear-gradient(145deg, #f8fafc 0%, #ffffff 72%);
    --crm-leadstat-accent: #64748b;
}

.crm-leadstat-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.crm-leadstat-card-top .crm-stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(15, 34, 51, 0.06);
}

.crm-leadstat-card-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1.35;
    padding-top: 2px;
}

.crm-leadstat-card-values {
    display: grid;
    gap: 8px;
    margin-top: auto;
}

.crm-leadstat-card-values div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--crm-muted);
    padding-top: 8px;
    border-top: 1px dashed rgba(15, 34, 51, 0.08);
}

.crm-leadstat-card-values div:first-child {
    border-top: 0;
    padding-top: 0;
}

.crm-leadstat-card-values strong {
    font-size: 16px;
    color: var(--crm-text);
    font-weight: 700;
}

.crm-leadstat-card-values div:last-child strong {
    color: var(--crm-leadstat-accent, var(--crm-accent-dark));
}

.crm-leadstat-mini-card {
    border-top: 3px solid var(--crm-leadstat-accent, var(--crm-accent));
}

.crm-leadstat-mini-card--teal { --crm-leadstat-accent: #14b8a6; }
.crm-leadstat-mini-card--blue { --crm-leadstat-accent: #3b82f6; }
.crm-leadstat-mini-card--green { --crm-leadstat-accent: #22c55e; }
.crm-leadstat-mini-card--amber { --crm-leadstat-accent: #f59e0b; }
.crm-leadstat-mini-card--purple { --crm-leadstat-accent: #8b5cf6; }
.crm-leadstat-mini-card--gray { --crm-leadstat-accent: #64748b; }

.crm-leadstat-mini-card .crm-leadstat-mini-icon {
    width: 36px;
    height: 36px;
    font-size: .95rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(15, 34, 51, 0.06);
}

.crm-leadstat-mini-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.crm-leadstat-mini-values div {
    background: #f8fafc;
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.crm-leadstat-mini-card--teal .crm-leadstat-mini-values div:last-child { background: #f0fdfa; border-color: #99f6e4; }
.crm-leadstat-mini-card--blue .crm-leadstat-mini-values div:last-child { background: #eff6ff; border-color: #bfdbfe; }
.crm-leadstat-mini-card--amber .crm-leadstat-mini-values div:last-child { background: #fffbeb; border-color: #fde68a; }
.crm-leadstat-mini-card--purple .crm-leadstat-mini-values div:last-child,
.crm-leadstat-mini-card--gray .crm-leadstat-mini-values div:last-child { background: #f5f3ff; border-color: #ddd6fe; }

.crm-leadstat-mini-values span {
    display: block;
    font-size: 11px;
    color: var(--crm-muted);
    margin-bottom: 4px;
}

.crm-leadstat-mini-values strong {
    font-size: 20px;
    color: var(--crm-text);
}

.crm-leadstat-mini-card .crm-leadstat-mini-values div:last-child strong {
    color: var(--crm-leadstat-accent, var(--crm-accent-dark));
}

#leadStatsOverviewChart,
#leadStatsConversionChart,
#leadStatsWeeklyTrendChart,
#leadStatsResponseTimeChart,
#leadStatsOverdueChart,
#leadStatsStaffAssignedChart,
#leadStatsStaffConvertedChart,
#leadStatsStaffClosedChart,
#leadStatsStaffFollowupChart,
#leadStatsSourceChart {
    min-height: 280px;
}

.crm-arrivals-scope {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    border: 1px solid var(--crm-border);
    border-radius: 999px;
    background: #f8fafc;
}

.crm-arrivals-scope-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-muted);
    cursor: pointer;
    user-select: none;
}

.crm-arrivals-scope-option input {
    accent-color: var(--crm-accent);
}

.crm-arrivals-scope-option:has(input:checked) {
    background: #fff;
    color: var(--crm-text);
    box-shadow: 0 1px 4px rgba(15, 34, 51, 0.08);
}

/* Activity Pulse (ECG) report — dark "monitor" strips, one per day */
.crm-ecg-strip {
    border: 1px solid #0d3320;
    border-radius: var(--crm-radius);
    overflow: hidden;
    background: #04170c;
}
.crm-ecg-strip-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    background: #06210f;
    border-bottom: 1px solid #0d3320;
}
.crm-ecg-strip-date {
    color: #eafff2;
    font-weight: 600;
    font-size: .85rem;
}
.crm-ecg-strip-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: .76rem;
    color: #4ade80;
    font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
}
.crm-ecg-monitor {
    position: relative;
    height: 90px;
    padding: 6px 10px 2px;
    background-image:
        repeating-linear-gradient(to right, rgba(57, 255, 136, .08) 0, rgba(57, 255, 136, .08) 1px, transparent 1px, transparent 24px),
        repeating-linear-gradient(to bottom, rgba(57, 255, 136, .08) 0, rgba(57, 255, 136, .08) 1px, transparent 1px, transparent 18px);
}
.crm-ecg-monitor canvas {
    filter: drop-shadow(0 0 3px rgba(57, 255, 136, .75));
}

/* Quote Options — collapsible configuration sections (presentation only) */
.crm-quote-accordion {
    margin-bottom: 1rem;
}

.crm-quote-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 14px 20px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: #fff;
    text-align: left;
    cursor: pointer;
    color: inherit;
    transition: background-color .15s ease;
}

.crm-quote-accordion-toggle:hover {
    background: #f8fafb;
}

.crm-quote-accordion-toggle:focus-visible {
    outline: 2px solid var(--crm-primary, #0f9f8f);
    outline-offset: -2px;
}

.crm-quote-accordion-toggle[aria-expanded="true"] {
    border-bottom-color: var(--crm-border);
}

.crm-quote-accordion-toggle-main {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 0;
    flex: 1;
}

.crm-quote-accordion-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(15, 159, 143, 0.08);
    color: var(--crm-primary, #0f9f8f);
    font-size: 1rem;
}

.crm-quote-accordion-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.crm-quote-accordion-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1.3;
}

.crm-quote-accordion-summary {
    font-size: .8125rem;
    color: var(--crm-muted, #6c757d);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-quote-accordion-chevron {
    flex-shrink: 0;
    color: var(--crm-muted, #6c757d);
    font-size: 1rem;
    transition: transform .2s ease;
}

.crm-quote-accordion-toggle[aria-expanded="true"] .crm-quote-accordion-chevron {
    transform: rotate(180deg);
}

.crm-quote-accordion .collapse > .crm-card-body,
.crm-quote-accordion .collapsing > .crm-card-body {
    border-top: 0;
}

@media (max-width: 575.98px) {
    .crm-quote-accordion-toggle {
        padding: 12px 14px;
    }

    .crm-quote-accordion-summary {
        white-space: normal;
    }
}
