:root {
    --crm-brand: #4f46e5;
    --crm-brand-hover: #4338ca;
    --crm-brand-soft: #eef2ff;
    --crm-surface: #f8fafc;
    --crm-card: #ffffff;
    --crm-border: #e2e8f0;
    --crm-text: #0f172a;
    --crm-muted: #64748b;
    --crm-radius: 12px;
    --crm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 72px;
}

/* Tailwind CDN fallbacks */
html.h-full, html.h-full body { height: 100%; }
.h-full { height: 100%; }
.min-h-full { min-height: 100%; }
.flex-1 { flex: 1 1 0%; }
.flex { display: flex; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.bg-slate-50 { background-color: #f8fafc; }
.text-slate-800 { color: #1e293b; }
.p-6 { padding: 1.5rem; }
@media (min-width: 1024px) {
    .lg\:p-8 { padding: 2rem; }
}

/* layout/sidebar.css (inlined) */
body.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width);
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100%;
    min-height: 0;
    transition: grid-template-columns 0.2s ease;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.crm-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    min-width: 0;
    height: 100%;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
    transition: width 0.2s ease;
}

.crm-sidebar__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 14px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.crm-sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
}
.crm-sidebar__brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.15s;
}
.crm-sidebar__brand-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-sidebar__brand-sub {
    margin: 2px 0 0;
    font-size: 0.6875rem;
    color: #64748b;
    white-space: nowrap;
}
.crm-sidebar__collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.crm-sidebar__collapse:hover { background: #f8fafc; color: #334155; }
.crm-sidebar__collapse svg.lucide { width: 18px; height: 18px; }

.sidebar-collapse-icon { display: inline-flex; align-items: center; justify-content: center; }
.sidebar-collapse-icon--open { display: none; }
body.sidebar-collapsed .sidebar-collapse-icon--close { display: none; }
body.sidebar-collapsed .sidebar-collapse-icon--open { display: inline-flex; }

.crm-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
}
.crm-sidebar__nav::-webkit-scrollbar { width: 4px; }
.crm-sidebar__nav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.crm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 12px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.crm-nav-item:hover {
    background: #f8fafc;
    color: #1e293b;
}
.crm-nav-item.is-active {
    background: #eef2ff;
    color: #4f46e5;
}
.crm-nav-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #4f46e5;
}
.crm-nav-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.crm-nav-item__icon svg.lucide {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}
.crm-nav-item.is-active .crm-nav-item__icon { color: #4f46e5; }
.crm-nav-item__label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s, width 0.15s;
}

.crm-sidebar__foot {
    flex-shrink: 0;
    padding: 10px 12px 14px;
    border-top: 1px solid #f1f5f9;
}
.crm-sidebar__version {
    display: inline-flex;
    padding: 4px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
}

/* Collapsed */
body.sidebar-collapsed .crm-sidebar__brand,
body.sidebar-collapsed .crm-nav-item__label,
body.sidebar-collapsed .crm-sidebar__version span { display: none; }
body.sidebar-collapsed .crm-sidebar__head { justify-content: center; padding: 14px 8px; }
body.sidebar-collapsed .crm-sidebar__logo,
.crm-sidebar.is-collapsed .crm-sidebar__logo {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
}
body.sidebar-collapsed .crm-sidebar__collapse { margin: 0 auto; }
body.sidebar-collapsed .crm-nav-item {
    justify-content: center;
    padding: 10px;
}
body.sidebar-collapsed .crm-nav-item.is-active::before { display: none; }
body.sidebar-collapsed .crm-sidebar__foot { text-align: center; }

/* Mobile drawer */
.crm-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8990;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

@media (max-width: 1023px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .crm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 9000;
        width: min(280px, 85vw);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
    }
    body.sidebar-mobile-open .crm-sidebar {
        transform: translateX(0);
    }
    body.sidebar-mobile-open .crm-sidebar-overlay {
        display: block;
    }
    .crm-sidebar__collapse { display: none; }
}

/* ═══ App Header ═══ */

.crm-topbar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 16px;
    height: 72px;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.crm-topbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 1 auto;
}
.crm-topbar__menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s;
}
.crm-topbar__menu-btn:hover { background: #f8fafc; color: #334155; }
.crm-topbar__menu-btn svg.lucide { width: 20px; height: 20px; }

.crm-topbar__titles { min-width: 0; }
.crm-topbar__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-topbar__subtitle {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.3;
}

.crm-topbar__search {
    flex: 1 1 auto;
    display: none;
    max-width: 420px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .crm-topbar__search { display: flex; }
}
.crm-topbar__search-form {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    position: relative;
}
.crm-topbar__search-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    pointer-events: none;
}
.crm-topbar__search-icon svg.lucide { width: 18px; height: 18px; }
.crm-topbar__search-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 44px 10px 42px;
    font-size: 0.875rem;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.crm-topbar__search-input::placeholder { color: #94a3b8; }
.crm-topbar__search-input:focus {
    outline: none;
    background: #fff;
    border-color: #5b4df5;
    box-shadow: 0 0 0 3px rgba(91, 77, 245, 0.1);
}
.crm-topbar__search-submit {
    position: absolute;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.crm-topbar__search-submit:hover { background: #eef2ff; color: #4f46e5; }
.crm-topbar__search-submit svg.lucide { width: 16px; height: 16px; }

.crm-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.crm-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.crm-header-icon-btn:hover {
    background: #f8fafc;
    border-color: #dbe3ef;
    color: #334155;
}
.crm-header-icon-btn svg.lucide { width: 18px; height: 18px; stroke-width: 2; }

.crm-notifications {
    position: relative;
}
.crm-notifications__toggle {
    position: relative;
}
.crm-notifications__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.crm-notifications__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(380px, calc(100vw - 24px));
    max-height: min(480px, calc(100vh - 96px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, .14);
    z-index: 60;
}
.crm-notifications__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.crm-notifications__head-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.crm-notifications__head-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.crm-notifications__head-sub {
    font-size: 12px;
    color: #64748b;
}
.crm-notifications__mark-all {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
}
.crm-notifications__mark-all:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
.crm-notifications__loading {
    padding: 28px 16px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}
.crm-notifications__empty {
    margin: 0;
    padding: 36px 20px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}
.crm-notifications__empty::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.crm-notifications__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    flex: 1;
}
.crm-notifications__item {
    border-bottom: 1px solid #f1f5f9;
}
.crm-notifications__item:last-child {
    border-bottom: 0;
}
.crm-notifications__item.is-unread {
    background: linear-gradient(90deg, rgba(37, 99, 235, .06) 0%, rgba(37, 99, 235, .02) 100%);
}
.crm-notifications__link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px 12px 16px;
    color: inherit;
    text-decoration: none;
    transition: background .15s ease;
}
.crm-notifications__link:hover {
    background: #f8fafc;
}
.crm-notifications__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
}
.crm-notifications__icon svg {
    width: 18px;
    height: 18px;
}
.crm-notifications__icon--ticket {
    background: #fef3c7;
    color: #d97706;
}
.crm-notifications__icon--bell {
    background: #f1f5f9;
    color: #64748b;
}
.crm-notifications__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-notifications__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.crm-notifications__title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.crm-notifications__type-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.crm-notifications__dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #2563eb;
    margin-left: auto;
}
.crm-notifications__message {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.crm-notifications__time {
    font-size: 11px;
    color: #94a3b8;
}
.crm-notifications__chevron {
    flex-shrink: 0;
    align-self: center;
    color: #cbd5e1;
    margin-left: 2px;
}
.crm-notifications__chevron svg {
    width: 16px;
    height: 16px;
}
.crm-notifications__link:hover .crm-notifications__chevron {
    color: #64748b;
}

.crm-user-menu {
    position: relative;
}
.crm-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 220px;
    padding: 4px 8px 4px 4px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.crm-user-menu__trigger:hover,
.crm-user-menu.is-open .crm-user-menu__trigger {
    background: #f8fafc;
    border-color: #e5e7eb;
}
.crm-user-menu__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.crm-user-menu__meta {
    min-width: 0;
    text-align: left;
}
.crm-user-menu__name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-user-menu__role {
    display: inline-flex;
    margin-top: 2px;
    padding: 1px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: capitalize;
    color: #4338ca;
    background: #eef2ff;
    border-radius: 9999px;
}
.crm-user-menu__chevron {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.15s;
}
.crm-user-menu.is-open .crm-user-menu__chevron { transform: rotate(180deg); }
.crm-user-menu__chevron svg.lucide { width: 16px; height: 16px; }

.crm-user-menu__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    min-width: 200px;
    padding: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.crm-user-menu.is-open .crm-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.crm-user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}
.crm-user-menu__item:hover { background: #f8fafc; color: #0f172a; }
.crm-user-menu__item svg.lucide { width: 16px; height: 16px; color: #64748b; }
.crm-user-menu__item--danger { color: #b91c1c; }
.crm-user-menu__item--danger:hover { background: #fef2f2; color: #991b1b; }
.crm-user-menu__item--danger svg.lucide { color: #b91c1c; }
.crm-user-menu__divider {
    margin: 4px 0;
    border: none;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 640px) {
    .crm-topbar { padding: 12px 16px; gap: 10px; }
    .crm-topbar__menu-btn { display: inline-flex; }
    .crm-user-menu__meta { display: none; }
    .crm-user-menu__chevron { display: none; }
    .crm-topbar__subtitle { display: none; }
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--crm-text);
    background: var(--crm-surface);
}

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

.crm-card { padding: 1.5rem; }
.crm-panel { padding: 1.25rem 1.5rem; }
.crm-panel-title { font-size: 0.9375rem; font-weight: 600; color: var(--crm-text); }

.crm-stat-card {
    background: var(--crm-card);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--crm-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.crm-stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08); }

.crm-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--crm-muted);
    margin-bottom: 0.375rem;
}

.crm-input, .crm-select, select.crm-input {
    width: 100%;
    border: 1px solid var(--crm-border);
    border-radius: 0.625rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.crm-input:focus, .crm-select:focus {
    outline: none;
    border-color: var(--crm-brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.crm-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--crm-brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.625rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.crm-btn-primary:hover { background: var(--crm-brand-hover); }
.crm-btn-sm {
    font-size: .75rem;
    padding: .375rem .75rem;
    border-radius: 8px;
}

.crm-btn-ghost {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--crm-border);
    color: var(--crm-muted);
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.crm-btn-ghost:hover { background: #f8fafc; color: var(--crm-text); }

.crm-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--crm-border);
    background: #fff;
    cursor: pointer;
}

.crm-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.crm-table th {
    text-align: left;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--crm-border);
}
.crm-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.crm-table tr:hover td { background: #fafbfc; }

.crm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
}
.crm-badge-blue { background: #dbeafe; color: #1d4ed8; }
.crm-badge-sky { background: #e0f2fe; color: #0369a1; }
.crm-badge-amber { background: #fef3c7; color: #b45309; }
.crm-badge-green { background: #dcfce7; color: #15803d; }
.crm-badge-red { background: #fee2e2; color: #b91c1c; }
.crm-badge-slate { background: #f1f5f9; color: #475569; }

.crm-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}
.crm-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.crm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.crm-bar-chart { display: flex; flex-direction: column; gap: 0.75rem; }
.crm-bar-row { display: grid; grid-template-columns: 100px 1fr 40px; gap: 0.75rem; align-items: center; font-size: 0.8125rem; }
.crm-bar-track { height: 8px; background: #f1f5f9; border-radius: 9999px; overflow: hidden; }
.crm-bar-fill { height: 100%; background: linear-gradient(90deg, var(--crm-brand), #818cf8); border-radius: 9999px; }

.crm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}
.crm-modal-backdrop.is-open { display: flex; }
.crm-modal { background: #fff; border-radius: var(--crm-radius); max-width: 480px; width: 100%; padding: 1.5rem; box-shadow: 0 25px 50px rgba(0,0,0,0.15); }

.crm-req-ok { color: #15803d; }
.crm-req-fail { color: #b91c1c; }

/* Client Modular Workspace */
main:has(.client-modular-workspace) {
    --cws-gap: 16px;
    --cws-inset: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--cws-gap) var(--cws-inset) var(--cws-inset);
}
@media (min-width: 1024px) {
    main:has(.client-modular-workspace) { --cws-inset: 2rem; }
}

.client-modular-workspace {
    --cws-gap: 16px;
    --cws-inset: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
@media (min-width: 1024px) {
    .client-modular-workspace { --cws-inset: 2rem; }
}

.client-workspace-grid {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(280px, 320px);
    gap: var(--cws-gap);
    align-items: start;
    width: 100%;
}
@media (max-width: 1199px) {
    .client-workspace-grid { grid-template-columns: 1fr; }
}
.client-workspace-col {
    display: flex;
    flex-direction: column;
    gap: var(--cws-gap);
    min-width: 0;
}
.client-workspace-full {
    display: flex;
    flex-direction: column;
    gap: var(--cws-gap);
    margin-top: var(--cws-gap);
    min-width: 0;
    width: 100%;
}

/* Client header — fixed in layout, does NOT scroll or overlap modules */
.cws-topbar {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    position: relative;
    z-index: 2;
    margin: 0 0 var(--cws-gap);
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

/* Only modules scroll — header stays put */
.client-modular-workspace__body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.cws-topbar__left {
    display: flex;
    align-items: center;
    gap: .625rem;
    min-width: 0;
    flex: 1;
}
.cws-topbar__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.cws-topbar__back:hover { background: #f8fafc; color: #334155; }
.cws-topbar__back svg { width: 16px; height: 16px; }
.cws-topbar__flag {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.cws-topbar__identity { min-width: 0; }
.cws-topbar__id {
    display: block;
    font-size: .6875rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: .03em;
}
.cws-topbar__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cws-topbar__nav {
    display: flex;
    align-items: center;
    gap: .375rem;
}
.cws-topbar__nav-count {
    font-size: .8125rem;
    font-weight: 600;
    color: #64748b;
    min-width: 3.5rem;
    text-align: center;
}
.cws-topbar__nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    text-decoration: none;
}
.cws-topbar__nav-btn:hover { background: #f1f5f9; }
.cws-topbar__nav-btn.is-disabled { opacity: .4; pointer-events: none; }
.cws-topbar__nav-btn svg { width: 16px; height: 16px; }
.cws-topbar__actions {
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-shrink: 0;
}
.cws-topbar__action {
    padding: .375rem .5rem;
    min-width: 32px;
    justify-content: center;
}
.cws-topbar__action svg { width: 16px; height: 16px; }
@media (max-width: 1199px) {
    .cws-topbar__action--desktop { display: none !important; }
    .cws-topbar__action--mobile { display: block; }
}
@media (min-width: 1200px) {
    .cws-topbar__action--mobile { display: none !important; }
}

/* Module cards */
.module-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.module-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #eef2ff;
}
.module-card-header__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #7c3aed;
    flex-shrink: 0;
}
.module-card-header__icon svg { width: 18px; height: 18px; stroke-width: 2; }
.module-card-header__title {
    margin: 0;
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}
.module-card-header__actions { margin-left: auto; flex-shrink: 0; }
.module-card-header__link {
    font-size: .75rem;
    font-weight: 600;
    color: #7c3aed;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: .125rem .25rem;
}
.module-card-header__link:hover { text-decoration: underline; }
.module-card-body { padding: 14px; }

/* Module min-heights */
.module-card--lead { min-height: 180px; }
.module-card--finance { min-height: 260px; }
.module-card--calendar { min-height: 420px; display: flex; flex-direction: column; }
.module-card--calendar .module-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
    min-width: 0;
}
.module-card--local-time { min-height: auto; }
.module-card--local-time .module-card-body { padding: 14px 16px 16px; }

/* Local time */
.cws-local-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 56px;
}
.cws-local-time__clock {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.cws-local-time__meta {
    display: flex;
    align-items: center;
    gap: .625rem;
    min-width: 0;
}
.cws-local-time__flag {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    object-fit: cover;
    border: 1px solid #e8edf4;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    flex-shrink: 0;
}
.cws-local-time__info {
    display: flex;
    flex-direction: column;
    gap: .1875rem;
    min-width: 0;
}
.cws-local-time__geo {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: #64748b;
    line-height: 1.2;
}
.cws-local-time__tz {
    font-size: .6875rem;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1.2;
}
@media (max-width: 640px) {
    .cws-local-time__clock { font-size: 1.75rem; }
    .cws-local-time__flag { width: 36px; height: 36px; }
}
.module-card--referral .cws-empty { min-height: 72px; }

/* Fields — shared */
.cws-field-list { display: flex; flex-direction: column; margin: 0; padding: 0; }
.cws-field { display: flex; margin: 0; }
.cws-field__label {
    font-size: .8125rem;
    font-weight: 500;
    color: #94a3b8;
    margin: 0;
}
.cws-field__value {
    font-size: .8125rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    min-width: 0;
}
.cws-muted { font-size: .8125rem; color: #94a3b8; margin: 0; }
.cws-field-empty { font-size: .8125rem; color: #cbd5e1; font-weight: 500; }
.cws-field-action {
    font-size: .8125rem;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
}
.cws-field-action:hover { color: #7c3aed; }

/* Lead / Client */
.cws-field-list--lead { gap: .875rem; }
.cws-field-list--lead .cws-field {
    flex-direction: column;
    gap: .3125rem;
}
.cws-field-list--lead .cws-field__value { width: 100%; }
.cws-field-list--lead .ct-contact-item--boxed {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .5rem .625rem;
    background: #f8fafc;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    box-sizing: border-box;
}
.cws-field-list--lead .ct-contact-item--boxed .ct-contact-trigger {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.cws-field-list--lead .ct-contact-item--boxed .ct-contact-item__text {
    flex: 1;
    min-width: 0;
    font-size: .8125rem;
    font-weight: 500;
    color: #1e293b;
}
.cws-field-list--lead .ct-contact-item--empty .ct-contact-item__icon--add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #7c3aed;
    flex-shrink: 0;
    text-decoration: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    transition: background .12s, border-color .12s, color .12s;
}
.cws-field-list--lead .ct-contact-item--empty a.ct-contact-item__icon--add:hover,
.cws-field-list--lead .ct-contact-item--empty button.ct-contact-item__icon--add:hover {
    background: #f5f3ff;
    border-color: #c4b5fd;
    color: #6d28d9;
}
.cws-field-list--lead .ct-contact-item--empty .ct-contact-item__icon--add svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}
.cws-field-list--lead .ct-contact-item__text--placeholder {
    color: #94a3b8;
    font-weight: 500;
}
.cws-field-list--lead .cws-field--status .cws-field__value {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.cws-field-list--lead .cws-field--status .status-pill-select,
.cws-field-list--lead .cws-field--status .status-pill {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
}
.cws-field-list--lead .cws-field--status .status-pill-select__trigger,
.cws-field-list--lead .cws-field--status .status-pill {
    width: 100%;
    min-width: 0;
    min-height: 2.375rem;
    height: auto;
    padding: .5rem .625rem;
    padding-right: 2rem;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: .8125rem;
}
.cws-field-list--lead .cws-field--status .status-pill-select__label,
.cws-field-list--lead .cws-field--status .status-pill__label {
    flex: 1;
    text-align: left;
}

/* Information — label left, value right */
.cws-field-list--info { gap: 0; }
.cws-field-list--info .cws-field--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .4375rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.cws-field-list--info .cws-field--row:last-child { border-bottom: none; }
.cws-field-list--info .cws-field__label {
    flex-shrink: 0;
    font-weight: 400;
    color: #94a3b8;
}
.cws-field-list--info .cws-field__value {
    flex: 1;
    text-align: right;
    font-weight: 600;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cws-field-list--info .cws-field__value--badge {
    display: flex;
    justify-content: flex-end;
}
.cws-field-list--info .cws-field__value--badge .crm-badge {
    font-size: .6875rem;
    font-weight: 600;
}

/* Empty states */
.cws-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: .75rem;
    gap: .375rem;
}
.cws-empty--sm { padding: .5rem; }
.cws-empty__icon { color: #cbd5e1; display: inline-flex; }
.cws-empty__icon svg { width: 24px; height: 24px; }
.cws-empty__text { font-size: .8125rem; color: #94a3b8; margin: 0; }

/* Finance */
.cws-finance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .625rem;
    margin-bottom: .75rem;
}
.cws-finance-stat {
    padding: .625rem .75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2ff;
}
.cws-finance-stat__label {
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #94a3b8;
}
.cws-finance-stat__value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: .125rem;
}
.cws-finance-stat__value--green { color: #059669; }
.cws-finance-stat__unit { font-size: .6875rem; color: #94a3b8; }

/* Calendar workspace */
.cws-calendar { width: 100%; min-width: 0; }
.cws-calendar__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: .375rem;
}
.cws-calendar__hint {
    margin: 0 0 .625rem;
    font-size: .6875rem;
    font-weight: 500;
    color: #94a3b8;
}
.cws-calendar__btn {
    display: inline-flex;
    align-items: center;
    gap: .3125rem;
    height: 30px;
    padding: 0 .625rem;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    font-size: .75rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
}
.cws-calendar__btn svg { width: 14px; height: 14px; }
.cws-calendar__btn:hover { background: #f8fafc; border-color: #c4b5fd; color: #6d28d9; }
.cws-calendar__btn--primary {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}
.cws-calendar__btn--primary:hover { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.cws-calendar__view-switch {
    display: inline-flex;
    padding: 2px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    margin-left: auto;
}
.cws-calendar__view-btn {
    height: 26px;
    padding: 0 .5rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: .6875rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
}
.cws-calendar__view-btn.is-active {
    background: #fff;
    color: #6d28d9;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.cws-calendar__nav {
    display: flex;
    align-items: center;
    gap: .375rem;
    width: 100%;
    order: 3;
    flex-basis: 100%;
}
@media (min-width: 900px) {
    .cws-calendar__nav { width: auto; order: 0; flex-basis: auto; margin-left: auto; }
}
.cws-calendar__nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    padding: 0;
}
.cws-calendar__nav-btn svg { width: 14px; height: 14px; }
.cws-calendar__title {
    flex: 1;
    text-align: center;
    font-size: .8125rem;
    font-weight: 700;
    color: #0f172a;
}
.cws-calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 4px;
}
.cws-calendar__weekdays span {
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    text-align: center;
}
.cws-calendar__grid--month {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}
.cws-cal-day {
    position: relative;
    min-height: 72px;
    padding: .25rem;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: .1875rem;
    overflow: hidden;
}
.cws-cal-day.is-other-month { background: #fafbfc; opacity: .75; }
.cws-cal-day.is-today { border-color: #c4b5fd; background: #faf5ff; }
.cws-cal-day.is-selected {
    border-color: #7c3aed;
    background: #f5f3ff;
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .15);
}
.cws-cal-day.is-clickable {
    cursor: pointer;
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.cws-cal-day.is-clickable:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}
.cws-cal-day.is-empty .cws-cal-day__num { color: #94a3b8; }
.cws-cal-day__num {
    position: relative;
    z-index: 2;
    align-self: flex-start;
    font-size: .6875rem;
    font-weight: 700;
    color: #334155;
    padding: 0 .125rem;
    line-height: 1.2;
}
.cws-cal-day__events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.cws-cal-event {
    display: flex;
    align-items: center;
    gap: .25rem;
    width: 100%;
    min-width: 0;
    padding: .125rem .3125rem;
    border: none;
    border-radius: 4px;
    background: var(--ev-bg, #f1f5f9);
    color: var(--ev-text, #475569);
    font-size: .625rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    line-height: 1.2;
}
.cws-cal-event__time { flex-shrink: 0; opacity: .85; }
.cws-cal-event__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cws-cal-event__more {
    border: none;
    background: transparent;
    color: #7c3aed;
    font-size: .625rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0 .125rem;
    text-align: left;
    font-family: inherit;
}
.cws-cal-day__add-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 1;
}
.cws-cal-week-col__body .cws-cal-day__add-overlay {
    inset: 0;
}
.cws-cal-day__add-overlay svg {
    width: 32px;
    height: 32px;
    color: #7c3aed;
    opacity: .85;
}
.cws-cal-day.is-clickable:hover .cws-cal-day__add-overlay,
.cws-cal-week-col.is-clickable:hover .cws-cal-day__add-overlay {
    opacity: 1;
}
.cws-cal-day__placeholder { font-size: .75rem; color: #cbd5e1; margin: 0; }
.cws-cal-day-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: .375rem;
    padding: .5rem .625rem;
    border: 1px dashed #ddd6fe;
    border-radius: 8px;
    background: #faf5ff;
    color: #7c3aed;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.cws-cal-day-add:hover { background: #f5f3ff; border-color: #c4b5fd; }
.cws-calendar__grid--week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .375rem;
}
.cws-cal-week-col {
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #fff;
    min-height: 100px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cws-cal-week-col.is-clickable { cursor: pointer; transition: border-color .12s, background .12s; }
.cws-cal-week-col.is-clickable:hover { border-color: #c4b5fd; background: #faf5ff; }
.cws-cal-week-col.is-today { border-color: #c4b5fd; background: #faf5ff; }
.cws-cal-week-col.is-selected {
    border-color: #7c3aed;
    background: #f5f3ff;
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .15);
}
.cws-cal-week-col__head {
    font-size: .6875rem;
    font-weight: 700;
    padding: .3125rem .375rem;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f6;
}
.cws-cal-week-col__body {
    position: relative;
    padding: .25rem;
    display: flex;
    flex-direction: column;
    gap: .1875rem;
    flex: 1;
    min-height: 64px;
}
.cws-cal-week-col__body.is-empty {
    align-items: stretch;
    justify-content: stretch;
}
.cws-calendar__grid--day .cws-cal-day-view {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .375rem;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    background: #fff;
    min-height: 80px;
}
.cws-calendar__list { display: flex; flex-direction: column; gap: .375rem; }
.cws-cal-list-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .5rem .625rem;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.cws-cal-list-item__type {
    flex-shrink: 0;
    font-size: .625rem;
    font-weight: 700;
    padding: .1875rem .375rem;
    border-radius: 999px;
}
.cws-cal-list-item__body {
    display: flex;
    flex-direction: column;
    gap: .125rem;
    min-width: 0;
}
.cws-cal-list-item__body strong {
    font-size: .8125rem;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cws-cal-list-item__body span { font-size: .6875rem; color: #94a3b8; }
.cws-calendar__agenda {
    margin-top: .75rem;
    padding-top: .625rem;
    border-top: 1px solid #eef2f6;
}
.cws-calendar__agenda-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: .4375rem;
}
.cws-calendar__agenda-tab {
    height: 26px;
    padding: 0 .625rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-size: .6875rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
}
.cws-calendar__agenda-tab.is-active {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}
.cws-calendar__agenda-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .3125rem;
}
.cws-cal-agenda-item {
    display: flex;
    align-items: flex-start;
    gap: .4375rem;
    width: 100%;
    padding: .375rem .5rem;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.cws-cal-agenda-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    margin-top: .3125rem;
    flex-shrink: 0;
}
.cws-cal-agenda-item__body {
    display: flex;
    flex-direction: column;
    gap: .0625rem;
    min-width: 0;
}
.cws-cal-agenda-item__body strong {
    font-size: .8125rem;
    color: #334155;
}
.cws-cal-agenda-item__body span { font-size: .6875rem; color: #94a3b8; }
.cws-cal-agenda-empty { font-size: .75rem; color: #cbd5e1; padding: .25rem 0; }
.cws-cal-client-link { color: #7c3aed; font-weight: 600; text-decoration: none; }
.cws-cal-client-link:hover { text-decoration: underline; }
.cal-type-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    margin-top: .375rem;
}
.cal-type-picker__btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .1875rem;
    padding: .375rem .4375rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    min-width: 56px;
}
.cal-type-picker__btn.is-selected {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124,58,237,.15);
}
.cal-type-picker__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
}
.cal-type-picker__icon svg { width: 14px; height: 14px; }
.cal-type-picker__label { font-size: .625rem; font-weight: 600; color: #64748b; }
.cal-event-detail__title { font-size: 1rem; font-weight: 700; color: #0f172a; margin: .375rem 0 .75rem; }
.cal-event-detail__meta { display: grid; gap: .5rem; margin: 0; }
.cal-event-detail__meta div { display: grid; grid-template-columns: 88px 1fr; gap: .5rem; }
.cal-event-detail__meta dt { font-size: .75rem; font-weight: 600; color: #94a3b8; margin: 0; }
.cal-event-detail__meta dd { font-size: .8125rem; color: #334155; margin: 0; }
.cws-cal-type-badge {
    display: inline-block;
    font-size: .6875rem;
    font-weight: 700;
    padding: .25rem .5rem;
    border-radius: 999px;
}
.cw-create-field--grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
}
@media (max-width: 640px) {
    .cws-cal-day { min-height: 56px; }
    .cws-cal-event__time { display: none; }
    .cw-create-field--grid { grid-template-columns: 1fr; }
    .cws-calendar__view-switch { margin-left: 0; width: 100%; justify-content: space-between; }
    .cws-calendar__view-btn { flex: 1; padding: 0 .25rem; }
}

/* Documents */
.cws-doc-slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.cws-doc-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .4375rem .5rem;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    background: #fafbfc;
}
.cws-doc-slot__info { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.cws-doc-slot__icon { color: #7c3aed; display: inline-flex; }
.cws-doc-slot__icon svg { width: 14px; height: 14px; }
.cws-doc-slot__label { font-size: .8125rem; font-weight: 500; color: #334155; }
.cws-doc-slot__file { font-size: .75rem; color: #64748b; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cws-doc-slot__upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #7c3aed;
    cursor: pointer;
}
.cws-doc-slot__upload svg { width: 14px; height: 14px; }
.cws-file-upload { margin-top: .625rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Services grid */
.cws-services-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}
.cws-service-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    min-height: 72px;
    padding: .625rem .5rem;
    border-radius: 10px;
    border: 1px solid #eef2ff;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
    box-sizing: border-box;
}
.cws-service-btn:hover:not(:disabled) { border-color: #c4b5fd; box-shadow: 0 2px 8px rgba(124, 58, 237, .12); }
.cws-service-btn.is-locked { opacity: .55; cursor: not-allowed; }
.cws-service-btn.is-active {
    border-color: #86efac;
    background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.08);
}
.cws-service-btn.is-active:hover:not(:disabled) {
    border-color: #4ade80;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.14);
}
.cws-service-btn.is-active.is-pending {
    border-color: #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.08);
}
.cws-service-btn.is-active.is-pending:hover:not(:disabled) {
    border-color: #fbbf24;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.14);
}
.cws-service-btn.is-active.is-blocked {
    border-color: #fca5a5;
    background: linear-gradient(180deg, #fef2f2 0%, #fff 100%);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.08);
}
.cws-service-btn.is-active.is-blocked:hover:not(:disabled) {
    border-color: #f87171;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12);
}
.cws-service-btn__icon { color: #7c3aed; display: inline-flex; }
.cws-service-btn.is-active .cws-service-btn__icon { color: #059669; }
.cws-service-btn.is-active.is-pending .cws-service-btn__icon { color: #d97706; }
.cws-service-btn.is-active.is-blocked .cws-service-btn__icon { color: #dc2626; }
.cws-service-btn__icon svg { width: 18px; height: 18px; }
.cws-service-btn__label { font-size: .6875rem; font-weight: 600; color: #334155; text-align: center; line-height: 1.2; }
.cws-service-btn__status-dot {
    position: absolute;
    top: .4375rem;
    right: .4375rem;
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff;
}
.cws-service-btn.is-pending .cws-service-btn__status-dot { background: #f59e0b; }
.cws-service-btn.is-blocked .cws-service-btn__status-dot { background: #ef4444; }
.cws-service-btn__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.125rem;
    padding: 0 .375rem;
    border-radius: 999px;
    font-size: .5625rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #047857;
    background: #dcfce7;
}
.cws-service-btn.is-pending .cws-service-btn__badge {
    color: #b45309;
    background: #fef3c7;
}
.cws-service-btn.is-blocked .cws-service-btn__badge {
    color: #b91c1c;
    background: #fee2e2;
}
.cws-service-btn__lock {
    position: absolute;
    top: .375rem;
    right: .375rem;
    color: #94a3b8;
    display: inline-flex;
}
.cws-service-btn__lock svg { width: 12px; height: 12px; }

/* Client service pages (shared back link; bank layout lives in bank.css) */
.client-service-page__body {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 0 1.5rem;
}
.client-service-page__back {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    margin-bottom: .875rem;
    font-size: .8125rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
}
.client-service-page__back:hover { color: #7c3aed; }
.client-service-page__back svg { width: 16px; height: 16px; }

/* Progress stepper */
.cws-progress-stepper {
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    overflow-x: auto;
}
.cws-progress-step {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    text-align: center;
}
.cws-progress-step__dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #94a3b8;
    font-size: .6875rem;
    font-weight: 700;
    z-index: 1;
}
.cws-progress-step__dot svg { width: 14px; height: 14px; }
.cws-progress-step.is-done .cws-progress-step__dot {
    border-color: #10b981;
    background: #ecfdf5;
    color: #059669;
}
.cws-progress-step.is-current .cws-progress-step__dot {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .2);
}
.cws-progress-step__label {
    margin-top: .375rem;
    font-size: .6875rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}
.cws-progress-step.is-current .cws-progress-step__label { color: #7c3aed; }
.cws-progress-step.is-done .cws-progress-step__label { color: #334155; }
.cws-progress-step__line {
    position: absolute;
    top: 14px;
    left: calc(50% + 14px);
    width: calc(100% - 28px);
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}
.cws-progress-step.is-done .cws-progress-step__line { background: #10b981; }

/* Comments */
.cws-comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 .375rem;
    border-radius: 9999px;
    background: #f5f3ff;
    color: #6d28d9;
    font-size: .6875rem;
    font-weight: 700;
}
.cws-comment-compose { margin-bottom: 1rem; }
.cws-comment-compose__field { margin-bottom: .625rem; }
.cws-comment-compose__input {
    width: 100%;
    font-size: .875rem;
    resize: vertical;
    height: 110px;
    min-height: 110px;
    border-radius: 10px;
    border: 1px solid #dbe3ef;
    background: #fff;
    line-height: 1.5;
    padding: .75rem .875rem;
    box-sizing: border-box;
}
.cws-comment-compose__input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .14);
}
.cws-comment-templates { margin-bottom: .625rem; }
.cws-comment-templates__label {
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: .4375rem;
}
.cws-comment-templates__row {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    align-items: center;
}
.comment-template-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #dbe3ef;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
    position: relative;
    max-width: 100%;
}
.comment-template-btn:hover {
    background: #f8fafc;
    border-color: #c4b5fd;
    color: #6d28d9;
}
.comment-template-btn.is-active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, .22);
}
.comment-template-btn.is-active:hover {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}
.comment-template-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comment-template-btn__icon svg { width: 14px; height: 14px; stroke-width: 2.25; }
.comment-template-btn__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 9rem;
}
.comment-template-btn--custom { padding-right: 8px; }
.comment-template-btn__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: -2px;
    transition: background .12s, color .12s;
}
.comment-template-btn__remove svg { width: 10px; height: 10px; stroke-width: 2.5; }
.comment-template-btn--custom:hover .comment-template-btn__remove { color: #64748b; }
.comment-template-btn__remove:hover { background: #fee2e2; color: #dc2626; }
.comment-template-btn.is-active .comment-template-btn__remove { color: rgba(255,255,255,.8); }
.comment-template-btn.is-active .comment-template-btn__remove:hover { background: rgba(255,255,255,.18); color: #fff; }
.comment-template-btn--add {
    width: 32px;
    padding: 0;
    justify-content: center;
    border-style: dashed;
    border-color: #ddd6fe;
    background: #faf5ff;
    color: #7c3aed;
}
.comment-template-btn--add:hover {
    background: #f5f3ff;
    border-color: #c4b5fd;
    color: #6d28d9;
}
@media (max-width: 640px) {
    .comment-template-btn:not(.comment-template-btn--add) {
        width: 32px;
        padding: 0;
        justify-content: center;
    }
    .comment-template-btn__text { display: none; }
    .comment-template-btn--custom { padding-right: 0; }
    .comment-template-btn__remove {
        position: absolute;
        top: -4px;
        right: -4px;
        width: 14px;
        height: 14px;
        background: #fff;
        border: 1px solid #e2e8f0;
        margin: 0;
    }
    .comment-template-btn__remove svg { width: 8px; height: 8px; }
}
.cws-comment-compose__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: .625rem;
}
.cws-comment-save {
    display: inline-flex;
    align-items: center;
    gap: .4375rem;
    font-size: .8125rem;
    padding: .5rem 1rem;
    border-radius: 10px;
}
.cws-comment-save svg { width: 15px; height: 15px; stroke-width: 2.25; }
.cws-comments-history {
    padding-top: .875rem;
    border-top: 1px solid #eef2f6;
}
.cws-comments-history__title {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 .5rem;
}
.cws-comments-empty {
    font-size: .8125rem;
    color: #cbd5e1;
    margin: 0;
    text-align: center;
    padding: 1rem 0 .25rem;
}
.cws-comments-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .625rem;
}
.cws-comment-card {
    display: flex;
    gap: .625rem;
    padding: .75rem;
    border-radius: 12px;
    border: 1px solid #eef2ff;
    background: #fff;
}
.cws-comment-card__avatar {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cws-comment-card__body { min-width: 0; flex: 1; }
.cws-comment-card__text {
    font-size: .875rem;
    color: #334155;
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.5;
}
.cws-comment-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    color: #94a3b8;
    margin: .375rem 0 0;
}
.cws-comment-card__author { font-weight: 600; color: #64748b; }
.cws-comment-card__dot { opacity: .6; }

/* Comment template modal — icon picker */
.comment-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    margin-top: .375rem;
}
.comment-icon-picker__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.comment-icon-picker__btn svg { width: 16px; height: 16px; stroke-width: 2.25; }
.comment-icon-picker__btn:hover {
    background: #f8fafc;
    border-color: #c4b5fd;
    color: #6d28d9;
}
.comment-icon-picker__btn.is-selected {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, .22);
}
.comment-icon-picker__btn.is-selected:hover {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}

/* Timeline */
.cws-timeline { list-style: none; margin: 0; padding: 0; }
.cws-timeline--scroll { max-height: 360px; overflow-y: auto; padding-right: .25rem; }
.cws-timeline__item {
    display: flex;
    gap: .625rem;
    padding: .4375rem 0 .4375rem .625rem;
    border-left: 2px solid #e2e8f0;
    margin-left: .5rem;
}
.cws-timeline__item:last-child { border-left-color: transparent; }
.cws-timeline__icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    margin-left: -1.3125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 9999px;
    color: #7c3aed;
}
.cws-timeline__icon svg { width: 11px; height: 11px; }
.cws-timeline__body { min-width: 0; flex: 1; }
.cws-timeline__title { font-size: .8125rem; font-weight: 600; color: #334155; margin: 0; }
.cws-timeline__detail { font-size: .75rem; color: #64748b; margin: .125rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cws-timeline__meta { font-size: .6875rem; color: #94a3b8; margin: .125rem 0 0; }

/* Inline forms & tasks */
.cws-inline-form {
    width: 100%;
    padding: .625rem;
    border-radius: 10px;
    border: 1px solid #eef2ff;
    background: #fafbfc;
    margin-bottom: .625rem;
}
.cws-inline-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cws-inline-form__submit { margin-top: .5rem; font-size: .8125rem; }
.cws-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.cws-task-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .4375rem .5rem;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    font-size: .8125rem;
}
.cws-task-list__done {
    font-size: .6875rem;
    font-weight: 600;
    color: #7c3aed;
    background: none;
    border: none;
    cursor: pointer;
}

/* Locked modules */
.module-card--locked .module-card-body--locked { position: relative; min-height: 100px; padding: 0; }
.cws-locked-preview {
    pointer-events: none;
    user-select: none;
    opacity: .35;
    filter: blur(1px);
    padding: 14px;
    max-height: 100px;
    overflow: hidden;
}
.cws-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .75rem;
    background: rgba(255, 255, 255, .85);
    text-align: center;
}
.cws-locked-overlay__icon { width: 18px; height: 18px; color: #94a3b8; margin-bottom: .25rem; }
.cws-locked-overlay__title { font-size: .8125rem; font-weight: 600; color: #334155; margin: 0; }
.cws-locked-overlay__desc { font-size: .6875rem; color: #64748b; margin: .25rem 0 0; }
.cws-locked-overlay__hint { font-size: .6875rem; color: #b45309; margin: .25rem 0 0; }

.crm-input--compact { font-size: .8125rem; padding: .375rem .5rem; width: 100%; }

/* Client profile shared actions */
.client-workspace { --cw-gap: 1rem; }
.client-action-btn {
    display: inline-flex; align-items: center; gap: .375rem;
    padding: .4375rem .75rem; border-radius: .5rem; font-size: .8125rem; font-weight: 500;
    border: 1px solid #e2e8f0; background: #fff; color: #334155;
    transition: background .15s, border-color .15s, box-shadow .15s;
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.client-action-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.client-action-btn__icon {
    display: inline-flex; align-items: center; justify-content: center;
    color: #64748b; width: 16px; height: 16px;
}
.client-action-btn__icon svg { width: 16px; height: 16px; stroke-width: 2; }
.client-action-btn:hover .client-action-btn__icon { color: inherit; }
.client-action-btn--primary {
    background: var(--crm-brand, #3d5a80); border-color: var(--crm-brand, #3d5a80); color: #fff;
}
.client-action-btn--primary:hover { background: var(--crm-brand-hover, #2c4563); color: #fff; }
.client-dropdown-menu {
    position: absolute; right: 0; top: calc(100% + .25rem); min-width: 200px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: .5rem;
    box-shadow: 0 10px 25px rgba(15,23,42,.12); padding: .375rem; z-index: 30;
}
.client-dropdown-item {
    display: block; padding: .5rem .75rem; font-size: .8125rem; color: #334155;
    border-radius: .375rem; text-decoration: none; background: none; border: none;
    cursor: pointer; width: 100%; text-align: left;
}
.client-dropdown-item:hover { background: #f1f5f9; }
.client-dropdown-item.is-disabled { color: #94a3b8; cursor: not-allowed; }

.client-status-chip, .client-kyc-chip, .client-template-chip {
    padding: .25rem .5rem; font-size: .6875rem; font-weight: 500;
    border-radius: 9999px; border: 1px solid #e2e8f0; background: #fff; color: #475569;
    transition: all .15s; cursor: pointer;
}
.client-status-chip:hover, .client-kyc-chip:hover, .client-template-chip:hover {
    border-color: var(--crm-brand, #3d5a80); color: var(--crm-brand, #3d5a80);
}
.client-status-chip.is-active.status-new { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.client-status-chip.is-active.status-call-again { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.client-status-chip.is-active.status-no-answer { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.client-status-chip.is-active.status-no-answer-2 { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.client-status-chip.is-active.status-no-answer-3 { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.client-status-chip.is-active.status-interested { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.client-status-chip.is-active.status-not-interested { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.client-status-chip.is-active.status-converted { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.client-status-chip.is-active.status-archived { background: #f9fafb; color: #6b7280; border-color: #e5e7eb; }
.client-kyc-chip.is-active {
    background: var(--crm-brand, #3d5a80); border-color: var(--crm-brand, #3d5a80); color: #fff;
}

.client-toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 50;
    padding: .75rem 1.25rem; border-radius: .5rem; font-size: .875rem; font-weight: 500;
    box-shadow: 0 10px 25px rgba(15,23,42,.15);
}
.client-toast.is-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.client-toast.is-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Clients workspace */
.clients-workspace { --cw-gap: 1rem; margin-top: -0.5rem; }
@media (min-width: 1024px) { .clients-workspace { margin-top: -1rem; } }
.clients-workspace-header {
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.25rem;
}
.clients-workspace-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.clients-workspace-subtitle { margin-top: .25rem; font-size: .875rem; color: #64748b; }
.clients-workspace-header__actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.clients-stats-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem;
}
@media (min-width: 768px) { .clients-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .clients-stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.clients-stat-card {
    display: flex; flex-direction: column; padding: .875rem 1rem; border-radius: .75rem;
    border: 1px solid #e2e8f0; background: #fff; transition: box-shadow .15s, border-color .15s;
}
.clients-stat-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.06); border-color: #cbd5e1; }
.clients-stat-card.is-active { border-color: var(--crm-brand, #3d5a80); box-shadow: 0 0 0 1px var(--crm-brand, #3d5a80); }
.clients-stat-card__value { font-size: 1.375rem; font-weight: 700; color: #0f172a; }
.clients-stat-card__label { font-size: .75rem; color: #64748b; margin-top: .125rem; }

.clients-toolbar { margin-bottom: 1rem; padding: 1rem; }
.clients-toolbar__row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.clients-toolbar__search { flex: 1 1 220px; min-width: 200px; }
.clients-toolbar__saved { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-width: 180px; }
.clients-toolbar__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.clients-filters-details summary { list-style: none; }
.clients-filters-details summary::-webkit-details-marker { display: none; }

/* Compact toolbar — modern workspace controls */
.cw-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
    margin-bottom: 1rem;
    padding: .875rem 1rem;
    background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
    border: 1px solid #e2e8f0; border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.04);
}
.cw-toolbar__search-wrap { flex: 1 1 260px; min-width: 220px; }
.cw-toolbar__divider {
    width: 1px; align-self: stretch; min-height: 2rem;
    background: linear-gradient(180deg, transparent, #e2e8f0 20%, #e2e8f0 80%, transparent);
    display: none;
}
@media (min-width: 768px) { .cw-toolbar__divider { display: block; } }
.cw-toolbar__actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    margin-left: auto;
}

.cw-search {
    position: relative; display: flex; align-items: center;
}
.cw-search__icon {
    position: absolute; left: .75rem; width: 1rem; height: 1rem; max-width: 1rem; max-height: 1rem;
    color: #94a3b8; pointer-events: none; display: block; flex-shrink: 0;
}
.cw-search__input {
    width: 100%; padding: .5625rem .875rem .5625rem 2.375rem;
    font-size: .875rem; line-height: 1.25; color: #0f172a;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.cw-search__input::placeholder { color: #94a3b8; }
.cw-search__input:hover { background: #fff; border-color: #cbd5e1; }
.cw-search__input:focus {
    outline: none; background: #fff; border-color: var(--crm-brand, #3d5a80);
    box-shadow: 0 0 0 3px rgba(61,90,128,.12);
}

.cw-btn-group {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px;
    padding: 3px; background: #f1f5f9; border-radius: 11px;
    border: 1px solid #e2e8f0;
}
.cw-btn {
    display: inline-flex; align-items: center; gap: .4375rem;
    padding: .5rem .75rem; font-size: .8125rem; font-weight: 500; line-height: 1;
    color: #334155; background: transparent; border: none; border-radius: 8px;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}
.cw-btn:hover:not(:disabled) {
    background: #fff; color: #0f172a;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.cw-btn:active:not(:disabled) { transform: scale(.98); }
.cw-btn:disabled, .cw-btn--muted:disabled { opacity: .45; cursor: not-allowed; }
.cw-btn__icon { width: 1rem; height: 1rem; max-width: 1rem; max-height: 1rem; flex-shrink: 0; display: block; opacity: .85; }
.cw-btn__caret { width: .875rem; height: .875rem; max-width: .875rem; max-height: .875rem; flex-shrink: 0; display: block; color: #94a3b8; }
.cw-btn__label { font-weight: 500; }
.cw-btn__meta {
    max-width: 7rem; overflow: hidden; text-overflow: ellipsis;
    font-weight: 400; color: #64748b; font-size: .75rem;
}
.cw-btn--primary {
    background: linear-gradient(135deg, var(--crm-brand, #3d5a80) 0%, #4a6fa5 100%);
    color: #fff; font-weight: 600; padding: .5625rem 1rem;
    border-radius: 10px; box-shadow: 0 1px 2px rgba(61,90,128,.2), 0 4px 12px rgba(61,90,128,.18);
}
.cw-btn--primary:hover {
    background: linear-gradient(135deg, #345070 0%, var(--crm-brand, #3d5a80) 100%);
    color: #fff; box-shadow: 0 2px 8px rgba(61,90,128,.28);
}
.cw-btn--primary .cw-btn__icon { opacity: 1; }

.cw-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.125rem; height: 1.125rem; padding: 0 .3125rem;
    font-size: .625rem; font-weight: 700; letter-spacing: .02em;
    border-radius: 9999px; background: var(--crm-brand, #3d5a80); color: #fff;
}
.cw-badge--warn { background: linear-gradient(135deg, #f59e0b, #ea580c); }

.cw-dropdown { position: relative; }
.cw-dropdown__panel,
.clients-dropdown__menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
    min-width: 300px; max-width: 400px; max-height: 380px; overflow-y: auto;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15,23,42,.14), 0 2px 8px rgba(15,23,42,.06);
    padding: .375rem;
}

.clients-modals-root { display: contents; }

.clients-active-filters {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    margin-bottom: .75rem; padding: .5rem .75rem;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
}
.clients-active-filters__label { font-size: .75rem; font-weight: 600; color: #64748b; }
.clients-active-filters__chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.clients-filter-chip {
    display: inline-flex; align-items: center; gap: .375rem;
    padding: .25rem .625rem; font-size: .75rem; font-weight: 500;
    border-radius: 9999px; border: 1px solid #cbd5e1; background: #fff; color: #475569;
    text-decoration: none; transition: background .15s, border-color .15s;
}
.clients-filter-chip:hover { background: #f1f5f9; border-color: #94a3b8; color: #1e293b; }
.clients-filter-chip__x { color: #94a3b8; font-size: .875rem; line-height: 1; }
.clients-filter-chip--clear { border-style: dashed; color: #64748b; background: transparent; }

.clients-saved-list { list-style: none; margin: 0; padding: .25rem; }
.clients-saved-item { padding: .625rem .75rem; border-radius: 10px; border: 1px solid transparent; }
.clients-saved-item.is-active { background: #eff6ff; border-color: #bfdbfe; }
.clients-saved-item + .clients-saved-item { margin-top: .25rem; }
.clients-saved-item__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.clients-saved-item__name { font-size: .875rem; font-weight: 600; color: #0f172a; }
.clients-saved-item__badges { display: flex; gap: .25rem; flex-shrink: 0; }
.clients-saved-item__actions { display: flex; flex-wrap: wrap; gap: .375rem .625rem; margin-top: .375rem; }
.clients-saved-action {
    font-size: .75rem; font-weight: 500; color: var(--crm-brand, #3d5a80);
    background: none; border: none; padding: 0; cursor: pointer; text-decoration: none;
}
.clients-saved-action:hover { text-decoration: underline; }
.clients-saved-action--danger { color: #b91c1c; }
.clients-dropdown__footer { border-top: 1px solid #e2e8f0; padding: .5rem; margin-top: .25rem; }

/* Saved views dropdown */
.cw-saved-views { padding: 0; min-width: 280px; max-width: 320px; }
.cw-saved-views__header {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .625rem .875rem .5rem; border-bottom: 1px solid #f1f5f9;
}
.cw-saved-views__title {
    font-size: .6875rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: #64748b;
}
.cw-saved-views__count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.25rem; height: 1.25rem; padding: 0 .375rem;
    font-size: .6875rem; font-weight: 600; color: #64748b;
    background: #f1f5f9; border-radius: 9999px;
}
.cw-saved-views__list {
    list-style: none; margin: 0; padding: .375rem;
    max-height: 280px; overflow-y: auto;
}
.cw-saved-view {
    border-radius: 10px; border: 1px solid transparent;
    overflow: hidden; transition: background .15s, border-color .15s;
}
.cw-saved-view + .cw-saved-view { margin-top: .25rem; }
.cw-saved-view.is-active {
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    border-color: #bfdbfe;
}
.cw-saved-view__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
    padding: .625rem .75rem .375rem;
}
.cw-saved-view__info { min-width: 0; flex: 1; }
.cw-saved-view__name {
    display: block; font-size: .875rem; font-weight: 600; color: #0f172a;
    line-height: 1.3; word-break: break-word;
}
.cw-saved-view__badges {
    display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3125rem;
}
.cw-saved-view__badge {
    display: inline-flex; align-items: center; padding: .0625rem .375rem;
    font-size: .625rem; font-weight: 600; letter-spacing: .02em;
    border-radius: 9999px; line-height: 1.4;
}
.cw-saved-view__badge--default { background: #dcfce7; color: #166534; }
.cw-saved-view__badge--shared { background: #e0f2fe; color: #0369a1; }
.cw-saved-view__active-dot {
    flex-shrink: 0; width: .5rem; height: .5rem; margin-top: .3125rem;
    border-radius: 9999px; background: var(--crm-brand, #3d5a80);
    box-shadow: 0 0 0 3px rgba(61,90,128,.15);
}
.cw-saved-view__actions {
    display: flex; flex-direction: column; gap: 1px;
    padding: 0 .375rem .375rem;
}
.cw-saved-view__form { margin: 0; }
.cw-saved-view__form--danger { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid #f1f5f9; }
.cw-saved-view__action {
    display: flex; align-items: center; gap: .5rem; width: 100%;
    padding: .4375rem .5rem; font-size: .8125rem; font-weight: 500; line-height: 1.25;
    color: #334155; background: transparent; border: none; border-radius: 8px;
    cursor: pointer; text-decoration: none; text-align: left;
    transition: background .12s, color .12s;
}
.cw-saved-view__action:hover {
    background: rgba(255,255,255,.85); color: #0f172a;
}
.cw-saved-view.is-active .cw-saved-view__action:hover { background: rgba(255,255,255,.7); }
.cw-saved-view__action-icon {
    display: flex; align-items: center; justify-content: center;
    width: 1.625rem; height: 1.625rem; flex-shrink: 0;
    border-radius: 6px; background: #f1f5f9; color: #64748b;
    transition: background .12s, color .12s;
}
.cw-saved-view__action-icon svg { width: .875rem; height: .875rem; display: block; }
.cw-saved-view__action:hover .cw-saved-view__action-icon {
    background: #e2e8f0; color: var(--crm-brand, #3d5a80);
}
.cw-saved-view__action-label { flex: 1; min-width: 0; }
.cw-saved-view__action--danger { color: #b91c1c; }
.cw-saved-view__action--danger .cw-saved-view__action-icon { background: #fef2f2; color: #dc2626; }
.cw-saved-view__action--danger:hover { background: #fef2f2; color: #991b1b; }
.cw-saved-view__action--danger:hover .cw-saved-view__action-icon { background: #fee2e2; color: #b91c1c; }
.cw-saved-views__empty { padding: 1.25rem 1rem; text-align: center; }
.cw-saved-views__empty-text { margin: 0; font-size: .875rem; font-weight: 600; color: #334155; }
.cw-saved-views__empty-hint { margin: .375rem 0 0; font-size: .75rem; line-height: 1.45; color: #94a3b8; }
.cw-saved-views__footer {
    padding: .5rem; border-top: 1px solid #e2e8f0;
    background: #fafbfc; border-radius: 0 0 11px 11px;
}
.cw-saved-views__save-btn {
    display: flex; align-items: center; justify-content: center; gap: .4375rem;
    width: 100%; padding: .5625rem .75rem;
    font-size: .8125rem; font-weight: 600; color: #fff;
    background: var(--crm-brand, #3d5a80); border: none; border-radius: 9px;
    cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.cw-saved-views__save-btn svg { width: .875rem; height: .875rem; flex-shrink: 0; display: block; }
.cw-saved-views__save-btn:hover { background: var(--crm-brand-hover, #334e68); box-shadow: 0 2px 6px rgba(15,23,42,.12); }
.cw-saved-views__save-btn:active { transform: scale(.98); }

.clients-bulk-bar.is-hidden { display: none !important; }
.clients-toast.is-hidden,
.clients-toast.hidden { display: none !important; }

.clients-table-wrap--compact .clients-table td,
.clients-table-wrap--compact .clients-table th { padding-top: .375rem; padding-bottom: .375rem; font-size: .8125rem; }
.clients-table-wrap--spacious .clients-table td,
.clients-table-wrap--spacious .clients-table th { padding-top: .875rem; padding-bottom: .875rem; }

.clients-bulk-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    padding: .75rem 1rem; margin-bottom: .75rem; border-radius: .75rem;
    background: #eff6ff; border: 1px solid #bfdbfe;
}
.clients-bulk-bar.hidden,
.clients-bulk-bar.is-hidden { display: none !important; }
.clients-bulk-bar__actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.clients-table-wrap { padding: 0; overflow: hidden; }
.clients-table-scroll {
    overflow: auto;
    max-height: calc(100vh - 320px);
    scrollbar-gutter: stable;
}
.clients-table.crm-table {
    table-layout: fixed;
    width: 100%;
    min-width: 68rem;
    border-collapse: separate;
    border-spacing: 0;
}
.clients-table col.clients-col-check { width: 2.5rem; }
.clients-table col.clients-col-client { width: 14rem; }
.clients-table col.clients-col-contact { width: 11rem; }
.clients-table col.clients-col-source { width: 10rem; }
.clients-table col.clients-col-manager { width: 8rem; }
.clients-table col.clients-col-department { width: 9rem; }
.clients-table col.clients-col-status { width: 9.5rem; }
.clients-table col.clients-col-comment { width: 8.5rem; }
.clients-table col.clients-col-next { width: 9rem; }
.clients-table col.clients-col-dates { width: 7.5rem; }
.clients-table col.clients-col-actions { width: 9.5rem; }
.clients-table thead th {
    position: sticky; top: 0; z-index: 2; background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; font-size: .6875rem; text-transform: uppercase;
    letter-spacing: .04em; color: #64748b; padding: .5rem .875rem; white-space: nowrap;
    font-weight: 600; box-sizing: border-box;
}
.clients-table tbody td {
    padding: .4375rem .875rem; vertical-align: middle;
    border-bottom: 1px solid #f1f5f9; font-size: .8125rem; color: #334155;
    box-sizing: border-box;
}
.clients-table__row { transition: background .12s; }
.clients-table__row:hover { background: #f8fafc; }
.clients-table__row:hover td { background: transparent; }
.ct-th-check { width: 2.5rem; text-align: center; }
.ct-th-actions { text-align: right; width: 1%; white-space: nowrap; }
.ct-td-actions { text-align: right; white-space: nowrap; }

/* Client cell */
.ct-client-cell {
    display: flex; align-items: center; gap: .625rem;
    text-decoration: none; color: inherit; min-width: 0;
}
.ct-client-cell__avatar {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; flex-shrink: 0;
    border-radius: 9999px; font-size: .75rem; font-weight: 700;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: var(--crm-brand, #4f46e5);
    border: 1px solid #c7d2fe;
}
.ct-client-cell__flag {
    width: 2rem; height: 2rem; flex-shrink: 0;
    border-radius: 9999px; object-fit: cover;
    border: 1px solid #e2e8f0; background: #f8fafc;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.ct-client-cell__flag--unknown { opacity: .92; }
.ct-client-cell__body { min-width: 0; }
.ct-client-cell__name {
    display: block; font-weight: 600; font-size: .875rem; color: #0f172a;
    line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ct-client-cell:hover .ct-client-cell__name { color: var(--crm-brand, #4f46e5); }
.ct-client-cell__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .375rem;
    margin-top: .125rem; font-size: .6875rem; color: #94a3b8; line-height: 1.3;
}
.ct-client-cell__geo {
    display: inline-flex; padding: .0625rem .3125rem; border-radius: 4px;
    background: #f1f5f9; color: #64748b; font-weight: 600; font-size: .625rem;
}

/* Contact */
.ct-contact-list { display: flex; flex-direction: column; gap: .25rem; min-width: 0; max-width: 11rem; }
.ct-contact-item {
    display: inline-flex; align-items: center; gap: .375rem; max-width: 100%;
    font-size: .8125rem; color: #334155;
}
.ct-contact-item--muted { color: #64748b; }
.ct-contact-item__icon,
.ct-contact-trigger {
    display: flex; align-items: center; justify-content: center;
    width: 1.625rem; height: 1.625rem; flex-shrink: 0;
    border-radius: 8px; background: #f1f5f9; color: #64748b;
    border: 0; padding: 0; cursor: pointer;
    transition: background .12s, color .12s, box-shadow .12s;
}
.ct-contact-item__icon svg.lucide,
.ct-contact-trigger svg.lucide { width: 14px; height: 14px; stroke-width: 2; }
.ct-contact-trigger:hover,
.ct-contact-trigger.is-open {
    background: #eef2ff; color: var(--crm-brand, #4f46e5);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .12);
}
.ct-contact-item__text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ct-contact-popover {
    position: fixed; z-index: 70; min-width: 220px; max-width: 320px;
    padding: .625rem; border-radius: 12px;
    background: #fff; border: 1px solid #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
}
.ct-contact-popover.is-hidden { display: none !important; }
.ct-contact-popover__value {
    margin: 0 0 .5rem; padding: .375rem .5rem;
    font-size: .8125rem; font-weight: 500; color: #0f172a;
    word-break: break-all; line-height: 1.35;
    background: #f8fafc; border-radius: 8px;
}
.ct-contact-popover__actions { display: flex; flex-direction: column; gap: .25rem; }
.ct-contact-popover__btn {
    display: inline-flex; align-items: center; gap: .5rem;
    width: 100%; padding: .4375rem .625rem;
    border: 1px solid #e2e8f0; border-radius: 8px;
    background: #fff; color: #334155;
    font-size: .8125rem; font-weight: 500; text-decoration: none;
    cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.ct-contact-popover__btn:hover {
    background: #f8fafc; border-color: #cbd5e1; color: #0f172a;
}
.ct-contact-popover__btn.is-hidden { display: none !important; }
.ct-contact-popover__btn-icon { width: 14px; height: 14px; flex-shrink: 0; }
.ct-contact-popover__btn svg.lucide { width: 14px; height: 14px; stroke-width: 2; }

/* Stack cells (source, assignment) */
.ct-stack { display: flex; flex-direction: column; gap: .125rem; min-width: 0; }
.ct-stack__primary { font-size: .8125rem; font-weight: 500; color: #334155; line-height: 1.35; }
.ct-stack__secondary { font-size: .6875rem; color: #94a3b8; line-height: 1.35; }
.ct-empty { color: #cbd5e1; font-size: .8125rem; }

/* Pills (KYC, read-only status) */
.ct-pill {
    display: inline-flex; align-items: center; padding: .1875rem .5625rem;
    border-radius: 9999px; font-size: .6875rem; font-weight: 600;
    line-height: 1.4; white-space: nowrap;
}
.ct-pill--not_started, .ct-pill--status-archived, .ct-pill--status-not_interested { background: #f1f5f9; color: #475569; }
.ct-pill--pending, .ct-pill--status-call_again { background: #e0f2fe; color: #0369a1; }
.ct-pill--approved, .ct-pill--status-interested, .ct-pill--status-converted { background: #dcfce7; color: #15803d; }
.ct-pill--rejected, .ct-pill--status-no_answer, .ct-pill--status-no_answer_2, .ct-pill--status-no_answer_3 { background: #fee2e2; color: #b91c1c; }
.ct-pill--status-new { background: #dbeafe; color: #1d4ed8; }

/* Status select (pill style) */
.ct-status-select {
    appearance: none; -webkit-appearance: none;
    min-width: 7.5rem; max-width: 10rem;
    padding: .3125rem 1.625rem .3125rem .5625rem;
    font-size: .6875rem; font-weight: 600; line-height: 1.35;
    border: none; border-radius: 9999px; cursor: pointer;
    background-repeat: no-repeat;
    background-position: right .4375rem center;
    background-size: .875rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M4.427 6.427a.75.75 0 0 1 1.06 0L8 8.94l2.513-2.513a.75.75 0 1 1 1.06 1.06l-3.043 3.043a.75.75 0 0 1-1.06 0L4.427 7.487a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
    transition: box-shadow .12s, opacity .12s;
}
.ct-status-select:focus { outline: none; box-shadow: 0 0 0 2px rgba(79,70,229,.25); }
.ct-status-select:disabled { opacity: .6; cursor: wait; }
.ct-status-select--new { background-color: #dbeafe; color: #1d4ed8; }
.ct-status-select--call_again { background-color: #e0f2fe; color: #0369a1; }
.ct-status-select--interested, .ct-status-select--converted { background-color: #dcfce7; color: #15803d; }
.ct-status-select--not_interested, .ct-status-select--archived { background-color: #f1f5f9; color: #475569; }
.ct-status-select--no_answer, .ct-status-select--no_answer_2, .ct-status-select--no_answer_3 { background-color: #fee2e2; color: #b91c1c; }

/* Comment preview */
.ct-comment { max-width: 14rem; }
.ct-comment__text {
    margin: 0; font-size: .8125rem; color: #334155; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ct-comment__meta { margin: .25rem 0 0; font-size: .6875rem; color: #94a3b8; line-height: 1.3; }

.ct-comment-cell { display: inline-flex; align-items: center; gap: .375rem; }
.ct-comment-cell__date { font-size: .8125rem; color: #334155; white-space: nowrap; }
.ct-comment-view-btn { width: 34px; height: 34px; border-radius: 10px; }

/* Task cell — compact count + add */
.ct-task-cell { display: inline-flex; align-items: center; gap: .375rem; }
.ct-task-count {
    display: inline-flex; align-items: center; gap: .3125rem;
    min-height: 34px;
    padding: .3125rem .5625rem; border-radius: 10px; border: 1px solid #e2e8f0;
    background: #f8fafc; cursor: pointer; font: inherit; color: #334155;
    transition: background .15s, border-color .15s;
    position: relative; z-index: 1;
}
.ct-task-count__icon { width: 15px !important; height: 15px !important; opacity: .75; flex-shrink: 0; }
.ct-task-count:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.ct-task-count:hover .ct-task-count__icon { opacity: 1; }
.ct-task-count--empty { color: #94a3b8; }
.ct-task-count--overdue { border-color: #fecaca; background: #fef2f2; }
.ct-task-count--overdue:hover { border-color: #fca5a5; background: #fee2e2; color: #b91c1c; }
.ct-task-count__num { font-size: .8125rem; font-weight: 700; line-height: 1; }
.ct-task-count__label { font-size: .6875rem; font-weight: 500; }
.ct-task-add { flex-shrink: 0; }

.cw-tasks-skeleton { display: flex; flex-direction: column; gap: .625rem; }
.cw-tasks-skeleton__card {
    height: 4.25rem; border-radius: 12px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%; animation: cw-shimmer 1.2s ease-in-out infinite;
}
@keyframes cw-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.cw-tasks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .625rem; }
.cw-tasks-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
}
.cw-tasks-empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #94a3b8;
    margin-bottom: 12px;
}
.cw-tasks-empty__icon svg.lucide { width: 24px; height: 24px; }
.cw-tasks-empty__title { margin: 0; font-size: .875rem; font-weight: 600; color: #334155; }
.cw-tasks-empty__desc { margin: .375rem 0 0; font-size: .75rem; color: #94a3b8; max-width: 16rem; line-height: 1.45; }

.cw-task-card {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .75rem .875rem; border-radius: 12px;
    background: #fff; border: 1px solid #e8edf2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .15s, box-shadow .15s;
}
.cw-task-card:hover { border-color: #cbd5e1; box-shadow: 0 2px 8px rgba(15, 23, 42, .06); }
.cw-task-card--overdue { border-color: #fecaca; background: linear-gradient(180deg, #fff 0%, #fffbfb 100%); }
.cw-task-card--overdue:hover { border-color: #fca5a5; }
.cw-task-card__body { flex: 1; min-width: 0; }
.cw-task-card__title {
    margin: 0 0 .375rem; font-size: .8125rem; font-weight: 600; color: #0f172a; line-height: 1.35;
}
.cw-task-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.cw-task-card__due {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .6875rem; color: #64748b;
}
.cw-task-card__due svg { width: .75rem; height: .75rem; opacity: .7; flex-shrink: 0; }
.cw-task-card__assignee {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .6875rem; color: #64748b;
}
.cw-task-card__assignee-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1rem; height: 1rem; border-radius: 9999px;
    background: #e2e8f0; color: #475569; font-size: .5625rem; font-weight: 700;
}
.cw-task-card__done {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.cw-task-card__done:hover {
    background: #ecfdf5; border-color: #86efac; color: #059669;
}
.cw-task-card__done svg { width: .875rem; height: .875rem; }

/* Legacy aliases */
.cw-tasks-list-item { display: contents; }
.cw-tasks-list-wrap { display: contents; }
.cw-tasks-list-loading { display: none; }
.cw-tasks-list-empty { display: none; }
.cw-tasks-list-item__done { display: none; }

.is-hidden { display: none !important; }

/* Task cell — legacy detail (client card) */
.ct-task { display: flex; flex-direction: column; gap: .25rem; max-width: 14rem; }
.ct-task--overdue .ct-task__title { color: #b91c1c; }
.ct-task__head { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.ct-task__title { font-size: .8125rem; font-weight: 600; color: #0f172a; line-height: 1.35; }
.ct-task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; font-size: .6875rem; color: #94a3b8; }
.ct-task__due, .ct-task__assignee { color: #64748b; }
.ct-task-link {
    font-size: .8125rem; font-weight: 600; color: #2563eb; background: none; border: none; padding: 0; cursor: pointer;
}
.ct-task-link:hover:not(:disabled) { text-decoration: underline; }
.ct-task-link:disabled { opacity: .45; cursor: not-allowed; }
.ct-overdue-badge {
    display: inline-flex; align-items: center; padding: .1rem .4rem; border-radius: 9999px;
    font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
}
.ct-priority, .ct-status {
    display: inline-flex; align-items: center; padding: .1rem .4rem; border-radius: 9999px;
    font-size: .625rem; font-weight: 600; text-transform: capitalize;
}
.ct-priority--urgent { background: #fef2f2; color: #b91c1c; }
.ct-priority--high { background: #fffbeb; color: #b45309; }
.ct-priority--medium { background: #f0f9ff; color: #0369a1; }
.ct-priority--low { background: #f8fafc; color: #64748b; }
.ct-status--todo { background: #f1f5f9; color: #475569; }
.ct-status--progress { background: #eff6ff; color: #1d4ed8; }
.ct-status--done { background: #ecfdf5; color: #047857; }
.ct-status--cancelled { background: #f8fafc; color: #94a3b8; }

#create-task-submit.is-loading { opacity: .7; pointer-events: none; }

/* Dates */
.ct-dates { display: flex; flex-direction: column; gap: .1875rem; white-space: nowrap; }
.ct-dates__row { display: flex; align-items: baseline; gap: .375rem; font-size: .6875rem; }
.ct-dates__label { color: #94a3b8; font-weight: 500; min-width: 2.75rem; }
.ct-dates__row > span:last-child { color: #64748b; }

/* Row actions */
.ct-row-actions {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .25rem; border-radius: 12px;
    background: #f8fafc; border: 1px solid #e2e8f0;
}
.ct-td-actions { vertical-align: middle; }

.clients-cell-client__name { display: block; font-weight: 600; color: #0f172a; }
.clients-cell-client__name:hover { color: var(--crm-brand, #3d5a80); }
.clients-cell-client__meta { display: block; font-size: .6875rem; color: #94a3b8; margin-top: .125rem; }
.clients-cell-contact { display: flex; flex-direction: column; gap: .125rem; }
.clients-contact-link { color: #334155; font-size: .8125rem; text-decoration: none; }
.clients-contact-link:hover { color: var(--crm-brand, #3d5a80); text-decoration: underline; }
.clients-status-select { min-width: 120px; max-width: 150px; padding-top: .25rem; padding-bottom: .25rem; }
.clients-row-actions { display: inline-flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.clients-empty-state { padding: 3rem 1rem; text-align: center; }

.clients-dropdown { position: relative; }
.clients-dropdown__menu {
    position: absolute; top: 100%; left: 0; z-index: 30; min-width: 160px;
    margin-top: .25rem; background: #fff; border: 1px solid #e2e8f0; border-radius: .5rem;
    box-shadow: 0 10px 25px rgba(15,23,42,.1); padding: .25rem;
}
.clients-dropdown__menu--right { left: auto; right: 0; }
.clients-dropdown__item {
    display: block; width: 100%; padding: .5rem .75rem; font-size: .8125rem; text-align: left;
    border: none; background: none; cursor: pointer; border-radius: .375rem; color: #334155;
}
.clients-dropdown__item:hover:not(:disabled) { background: #f1f5f9; }
.clients-dropdown__item:disabled { opacity: .5; cursor: not-allowed; }
a.clients-dropdown__item { text-decoration: none; }

.clients-toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 100;
    padding: .75rem 1.25rem; border-radius: .5rem; font-size: .875rem; font-weight: 500;
    box-shadow: 0 10px 25px rgba(15,23,42,.15);
}
.clients-toast.is-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.clients-toast.is-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.clients-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.clients-modal.hidden { display: none; }
.clients-modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.clients-modal__panel {
    position: relative; z-index: 1; width: 100%; max-width: 480px; background: #fff;
    border-radius: .75rem; padding: 1.25rem; box-shadow: 0 25px 50px rgba(0,0,0,.15);
}
.crm-badge-purple { background: #f3e8ff; color: #6b21a8; }
.clients-stat-card--brand .clients-stat-card__value { color: var(--crm-brand, #3d5a80); }
.clients-stat-card--green .clients-stat-card__value { color: #15803d; }
.clients-stat-card--amber .clients-stat-card__value { color: #b45309; }
.clients-stat-card--red .clients-stat-card__value { color: #b91c1c; }
.clients-stat-card--blue .clients-stat-card__value { color: #1d4ed8; }
.clients-stat-card--purple .clients-stat-card__value { color: #7e22ce; }

/* ── Lucide icons ── */
svg.lucide {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

/* ── Icon buttons ── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .1s;
}
.icon-btn svg.lucide { width: 16px; height: 16px; stroke-width: 2; pointer-events: none; }
.icon-btn:hover:not(:disabled) { background: #f8fafc; color: #0f172a; }
.icon-btn:active:not(:disabled) { transform: scale(.96); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(99, 102, 241, .25); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn-primary { color: #2563eb; }
.icon-btn-primary:hover:not(:disabled) { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.icon-btn-danger { color: #64748b; }
.icon-btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.icon-btn-muted { color: #64748b; }
.icon-btn-success { color: #059669; }
.icon-btn-success:hover:not(:disabled) { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }

.client-action-btn__icon svg.lucide {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

/* Sidebar collapsed — logo must stay hidden (also in layout/sidebar.css) */
body.sidebar-collapsed .crm-sidebar__logo,
.crm-sidebar.is-collapsed .crm-sidebar__logo,
.crm-sidebar__logo[hidden] {
    display: none !important;
}

/* Status pill — see css/components/status-pill.css */
.clients-th-status,.clients-td-status{min-width:0;width:auto;vertical-align:middle;white-space:nowrap;overflow:hidden}

/* Organization */
.org-header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}
.org-header__title{margin:0;font-size:1.5rem;font-weight:700;color:#0f172a;line-height:1.2}
.org-header__subtitle{margin:.25rem 0 0;font-size:.875rem;color:#64748b}
.org-header__actions{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.org-btn-icon{width:1rem;height:1rem;margin-right:.25rem;display:inline-block;vertical-align:-2px}
.org-tabs{display:inline-flex;gap:.25rem;padding:.25rem;background:#f1f5f9;border-radius:12px;margin-bottom:1rem}
.org-tabs__item{padding:.5rem 1rem;border-radius:10px;font-size:.8125rem;font-weight:600;color:#64748b;text-decoration:none;transition:background .12s,color .12s}
.org-tabs__item:hover{color:#334155}
.org-tabs__item.is-active{background:#fff;color:#0f172a;box-shadow:0 1px 2px rgba(15,23,42,.06)}
.org-panel{padding:0;overflow:hidden}
.org-table-scroll{overflow-x:auto}
.org-table th,.org-table td{padding:.625rem 1rem;vertical-align:middle}
.org-th-actions,.org-td-actions{text-align:right;width:1%;white-space:nowrap}
.org-row-actions{display:inline-flex;align-items:center;gap:.25rem}
.org-cell-muted{color:#64748b;font-size:.8125rem;max-width:16rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.org-badge{display:inline-flex;align-items:center;padding:.125rem .5rem;border-radius:9999px;font-size:.6875rem;font-weight:600;line-height:1.4}
.org-badge--active{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0}
.org-badge--inactive{background:#f1f5f9;color:#64748b;border:1px solid #e2e8f0}
.org-empty{padding:3rem 1.5rem;text-align:center}
.org-empty__title{margin:0;font-size:.9375rem;font-weight:600;color:#334155}
.org-empty__hint{margin:.375rem 0 0;font-size:.8125rem;color:#94a3b8}
.org-check{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:#334155;cursor:pointer}

/* Users admin */
.usr-workspace{max-width:1200px}
.usr-th-id,.usr-cell-id{width:1%;white-space:nowrap}
.usr-id-badge{display:inline-flex;align-items:center;padding:.125rem .5rem;border-radius:6px;font-size:.75rem;font-weight:600;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color:#475569;background:#f1f5f9;border:1px solid #e2e8f0;vertical-align:middle}
.usr-id-badge--header{font-size:.6875rem;padding:.0625rem .4375rem;margin-left:.125rem}
.usr-role-list{display:flex;flex-wrap:wrap;gap:.25rem}
.usr-role-badge{display:inline-flex;align-items:center;padding:.125rem .5rem;border-radius:9999px;font-size:.6875rem;font-weight:600;line-height:1.4;background:#eef2ff;color:#4338ca;border:1px solid #c7d2fe}
.usr-field-hint{margin:.25rem 0 0;font-size:.75rem;color:#94a3b8}
.usr-form{display:flex;flex-direction:column;min-height:0}
.usr-form-section{margin-bottom:1.25rem}
.usr-form-section:last-child{margin-bottom:0}
.usr-form-section__head{display:flex;align-items:baseline;justify-content:space-between;gap:.75rem;margin-bottom:.625rem}
.usr-form-section__head .crm-modal-section-title{margin:0}
.usr-form-section__hint{font-size:.75rem;color:#94a3b8;white-space:nowrap}
.usr-field{min-width:0}
.usr-role-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;max-height:13.5rem;overflow-y:auto;padding:.125rem}
.usr-role-card.is-locked{opacity:.72;cursor:not-allowed;background:#f8fafc}
.usr-role-card.is-locked:has(.usr-role-card__input:checked){border-color:#cbd5e1;background:#f1f5f9;box-shadow:none}
.usr-role-card.is-locked .usr-role-card__input{cursor:not-allowed}
.usr-role-card:hover{border-color:#cbd5e1;background:#f8fafc}
.usr-role-card:has(.usr-role-card__input:checked){border-color:#818cf8;background:#eef2ff;box-shadow:0 0 0 1px rgba(99,102,241,.12)}
.usr-role-card__input{flex-shrink:0;margin-top:.125rem;width:1rem;height:1rem;accent-color:#4f46e5;cursor:pointer}
.usr-role-card__body{flex:1;min-width:0}
.usr-role-card__name{display:block;font-size:.8125rem;font-weight:600;color:#1e293b;line-height:1.35}
.usr-role-card__meta{display:flex;align-items:center;gap:.375rem;margin-top:.125rem;flex-wrap:wrap}
.usr-role-card__slug{font-size:.6875rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color:#94a3b8;line-height:1.3}
.usr-role-card__tag{font-size:.625rem;font-weight:600;padding:.0625rem .375rem;border-radius:9999px;background:#e0f2fe;color:#0369a1;line-height:1.4}
.usr-modal .crm-modal-lg{max-width:560px}
@media (max-width:640px){
.usr-role-grid{grid-template-columns:1fr}
}
