/* ============================================================================
   ALZAR LOGIC – CRM SPLIT-VIEW (Sales Hub)
   Master-Detail layout for Client Directory
   ============================================================================ */

/* ── Top-level view container ─────────────────────────────────────── */
.sales-hub-root {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Shell ────────────────────────────────────────────────────────── */
.crm-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

/* ── Header Bar ───────────────────────────────────────────────────── */
.crm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.crm-header .alzar-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.crm-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.crm-search-wrap {
    position: relative;
}
.crm-search-wrap i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}
.crm-search-wrap input {
    padding: 8px 8px 8px 32px;
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-main, #f8fafc);
    font-size: 13px;
    width: 200px;
}

/* ── Split View ───────────────────────────────────────────────────── */
.crm-split {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left Column (List) ──────────────────────────────────────────── */
.crm-list-col {
    width: 340px;
    min-width: 260px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg-base);
}

/* ── Segmentation Tabs ───────────────────────────────────────────── */
.crm-seg-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.crm-seg-tab {
    flex: 1;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
}
.crm-seg-tab:hover {
    color: var(--color-text-main);
}
.crm-seg-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ── Scrollable List ─────────────────────────────────────────────── */
.crm-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* ── List Item ───────────────────────────────────────────────────── */
.crm-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.12s;
}
.crm-list-item:hover {
    background: rgba(255,255,255,0.05);
}
.crm-list-item--active {
    background: var(--color-primary-dim, rgba(0,168,232,0.10));
    border-left: 3px solid var(--color-primary);
}

.crm-list-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary-dim, rgba(0,168,232,0.12));
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.crm-list-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.crm-list-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-list-company {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-list-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.crm-list-date {
    font-size: 10px;
    color: var(--color-text-muted);
}

/* ── Inline info columns in list rows ─────────────────────────── */
.crm-list-info {
    flex-shrink: 1;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.crm-list-info--center {
    text-align: center;
    flex-shrink: 0;
    min-width: 70px;
}
.crm-list-addr {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 240px;
}
.crm-list-quotes {
    font-weight: 600;
    font-size: 0.78rem;
}
.crm-list-contacted {
    font-size: 0.78rem;
}
.crm-list-email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(0, 168, 232, 0.12);
    color: var(--color-primary);
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.crm-list-email-btn:hover {
    background: var(--color-primary);
    color: #fff;
}
.crm-list-email-btn--disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* Lead-stage pill */
.crm-stage {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.crm-stage--cold       { background: rgba(148,163,184,0.18); color: #94a3b8; }
.crm-stage--contacted  { background: rgba(56,189,248,0.15); color: #38bdf8; }
.crm-stage--quoted     { background: rgba(250,204,21,0.15); color: #facc15; }
.crm-stage--negotiating{ background: rgba(249,115,22,0.15); color: #f97316; }
.crm-stage--won        { background: rgba(34,197,94,0.15); color: #22c55e; }
.crm-stage--lost       { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Follow-up badge (cold leads) */
.crm-badge-followup {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(239,68,68,0.18);
    color: #ef4444;
    white-space: nowrap;
    animation: followup-pulse 2s ease-in-out infinite;
}
.crm-badge-followup i { font-size: 0.75rem; }
.crm-badge-followup--header {
    font-size: 0.75rem;
    padding: 3px 10px;
}
@keyframes followup-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .6; }
}

/* ── Right Column (Detail) ───────────────────────────────────────── */
.crm-detail-col {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: var(--color-bg-surface);
}

.crm-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    gap: 8px;
    font-size: 14px;
}
.crm-detail-empty i { font-size: 40px; opacity: 0.4; }

/* ── Detail Pane Sections ────────────────────────────────────────── */
.crm-detail-pane {
    padding: 20px 24px;
}

/* Header */
.crm-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.crm-detail-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-primary-dim, rgba(0,168,232,0.12));
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.crm-detail-title {
    flex: 1;
    min-width: 0;
}
.crm-detail-title h3 {
    margin: 0;
    font-size: 18px;
    color: var(--color-text-main);
}
.crm-detail-company {
    font-size: 13px;
    color: var(--color-text-muted);
}
.crm-detail-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.crm-detail-actions {
    display: flex;
    gap: 4px;
}

/* Warning badge for inactive clients */
.badge-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(250,204,21,0.15);
    color: #facc15;
}

/* Contact fields */
.crm-detail-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-bottom: 20px;
    padding: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.crm-detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.crm-detail-field label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    font-weight: 600;
}
.crm-detail-field span {
    font-size: 13px;
    color: var(--color-text-main);
    word-break: break-word;
}
.crm-detail-field select {
    font-size: 13px;
}

/* Section headings */
.crm-detail-section {
    margin-bottom: 20px;
}
.crm-detail-section h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

/* Stats row */
.crm-detail-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}
.crm-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.crm-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}
.crm-stat-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-top: 2px;
    letter-spacing: 0.4px;
}

/* Quotes feed */
.crm-quotes-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-quote-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    font-size: 12px;
}
.crm-quote-num {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 70px;
}
.crm-quote-status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.crm-qs--quoted   { background: rgba(250,204,21,0.12); color: #facc15; }
.crm-qs--won      { background: rgba(34,197,94,0.12);  color: #22c55e; }
.crm-qs--lost     { background: rgba(239,68,68,0.12);  color: #ef4444; }
.crm-qs--sent,.crm-qs--pending { background: rgba(56,189,248,0.12); color: #38bdf8; }
.crm-quote-val {
    margin-left: auto;
    font-weight: 600;
    color: var(--color-text-main);
}

/* Quick actions */
.crm-detail-quick-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
}

/* ── Action Log ──────────────────────────────────────────────────── */
.crm-action-log-input {
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 14px;
}
.crm-action-log-input textarea {
    width: 100%;
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-main, #f8fafc);
    padding: 8px 10px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 8px;
}
.crm-action-log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.crm-action-log-controls input[type="date"] {
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-main, #f8fafc);
    padding: 6px 10px;
    font-size: 12px;
    flex: 1;
    max-width: 180px;
}

/* Timeline feed */
.crm-action-log-feed {
    position: relative;
    padding-left: 18px;
}
.crm-action-log-feed::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
    border-radius: 2px;
}

.crm-log-entry {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
}
.crm-log-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}
.crm-log-body {
    flex: 1;
    min-width: 0;
}
.crm-log-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.crm-log-text {
    font-size: 13px;
    color: var(--color-text-main);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Reminder badge */
.crm-log-reminder {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
}
.crm-log-reminder--overdue {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .crm-split {
        flex-direction: column;
    }
    .crm-list-col {
        width: 100%;
        max-width: none;
        max-height: 260px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .crm-detail-contact {
        grid-template-columns: 1fr;
    }
    .crm-detail-stats {
        flex-wrap: wrap;
    }
}

/* ============================================================================
   ACTION CENTER DRAWER (Slide-out panel)
   ============================================================================ */

/* ── Overlay ─────────────────────────────────────────────────────── */
.ac-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.ac-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Drawer ──────────────────────────────────────────────────────── */
.ac-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 95vw;
    background: var(--color-bg-surface, #1A1B1E);
    border-left: 1px solid var(--color-border);
    z-index: 9991;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
.ac-drawer--open {
    transform: translateX(0);
}

.ac-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.ac-drawer-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ac-drawer-header h5 i {
    color: var(--color-primary);
    font-size: 18px;
}

.ac-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.ac-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: var(--color-text-muted);
    text-align: center;
}
.ac-empty i {
    font-size: 40px;
    opacity: 0.35;
    margin-bottom: 8px;
}
.ac-empty p {
    font-size: 13px;
    margin: 0;
}

/* ── Action Item Card ────────────────────────────────────────────── */
.ac-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}
.ac-item:hover {
    border-color: var(--color-primary);
}
.ac-item--overdue {
    border-left: 3px solid #ef4444;
}

.ac-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.ac-client-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-align: left;
}
.ac-client-link:hover {
    text-decoration: underline;
}

.ac-overdue-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    letter-spacing: 0.3px;
}
.ac-today-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
    letter-spacing: 0.3px;
}

.ac-item-note {
    font-size: 12px;
    color: var(--color-text-main);
    line-height: 1.4;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ac-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ac-item-date {
    font-size: 11px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.ac-done-btn {
    background: none;
    border: 1px solid rgba(34,197,94,0.3);
    color: #22c55e;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s;
}
.ac-done-btn:hover {
    background: rgba(34,197,94,0.12);
    border-color: #22c55e;
}

/* ══════════════════════════════════════════════════════════════
   DETAIL PANE — TAB SWITCHER
   ══════════════════════════════════════════════════════════════ */
.crm-detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 12px;
}
.crm-dtab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, border-color 0.2s;
}
/* ══════════════════════════════════════════════════════════════
   BOOTSTRAP-STYLE NAV TABS (no Bootstrap JS required)
   ══════════════════════════════════════════════════════════════ */
.nav.nav-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
    border-bottom: 1px solid var(--color-border, #495057);
}
.nav-item { margin-bottom: -1px; }
.nav-link {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    color: var(--color-text-muted, #9ca3af);
    background: transparent;
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--color-text-main, #e5e7eb); }
.nav-link.active {
    color: var(--color-text-main, #f3f4f6) !important;
    background: var(--color-bg-surface, #1e1e2e) !important;
    border-color: var(--color-border, #495057) var(--color-border, #495057) transparent !important;
}
.tab-content { position: relative; }
.tab-pane { display: none; }
.tab-pane.show.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   NATIVE TASK CALENDAR
   ══════════════════════════════════════════════════════════════ */
.cal-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cal-month-label {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text-main);
    margin: 0;
}
.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted, #adb5bd);
    font-weight: 600;
    margin-bottom: 4px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}
.calendar-day {
    min-height: 100px;
    padding: 5px;
    border: 1px solid var(--color-border, #495057);
    border-radius: 4px;
    background: #212529;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ── Master Calendar (full-page) ── */
.master-cal-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.master-cal-label {
    font-weight: 700;
    font-size: 16px;
    min-width: 180px;
    text-align: center;
    color: var(--color-text-main);
}
.master-cal-dayrow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted, #adb5bd);
    padding: 8px 0;
}
.master-calendar-grid {
    flex: 1;
    min-height: 0;
}
.master-calendar-grid .calendar-day {
    min-height: 120px;
}
.master-calendar-grid .cal-event {
    white-space: normal;
    line-height: 1.25;
}
.calendar-day.empty {
    background: transparent;
    border: none;
    min-height: 0;
}
.calendar-day.today {
    border-color: var(--color-primary, #6366f1);
    background: #2c3034;
}
.calendar-day-num {
    font-size: 0.85rem;
    color: #adb5bd;
    text-align: right;
    margin-bottom: 5px;
    font-weight: bold;
}
.calendar-day.today .calendar-day-num {
    color: var(--color-primary, #6366f1);
}
.cal-event {
    font-size: 0.75rem;
    padding: 4px;
    border-radius: 4px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    cursor: pointer;
    transition: filter 0.15s;
}
.cal-event:hover {
    filter: brightness(1.2);
}
/* Color classes (Bootstrap-style, no Bootstrap needed) */
.bg-danger  { background-color: #dc3545 !important; }
.bg-warning { background-color: #ffc107 !important; }
.bg-primary { background-color: #0d6efd !important; }
.bg-success { background-color: #198754 !important; }
.bg-info    { background-color: #0dcaf0 !important; }
.bg-secondary { background-color: #8b5cf6 !important; }
.text-dark  { color: #212529 !important; }

/* Calendar event inner layout */
.cal-event-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    line-height: 1.2;
}
.cal-event-row i { font-size: 12px; flex-shrink: 0; }
.cal-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event-sub {
    font-size: 0.7rem;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* Calendar legend bar */
.calendar-legend {
    display: flex;
    gap: 18px;
    padding: 6px 0 10px;
    font-size: 12px;
    color: var(--color-text-muted, #9ca3af);
    flex-wrap: wrap;
}
.calendar-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.calendar-legend i { font-size: 14px; color: #0d6efd; }
.calendar-legend .cal-leg--job i { color: #198754; }
.calendar-legend .cal-leg--delivery i { color: #0dcaf0; }
.calendar-legend .cal-leg--note i { color: #8b5cf6; }
.calendar-legend .cal-leg--overdue i { color: #dc3545; }

/* ── Schedule 60/40 Split Layout ──────────────────────────────────── */
.schedule-split {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.schedule-cal-col {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--color-border, #333);
}
.schedule-detail-col {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px;
    background: var(--color-bg-surface, #1a1a2e);
}
.calendar-day.selected {
    border-color: var(--color-active, #3b82f6);
    box-shadow: inset 0 0 0 1px var(--color-active, #3b82f6);
    background: rgba(59,130,246,0.08);
}

/* Detail panel header */
.schedule-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
}
.schedule-detail-date {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-main, #f8fafc);
}

/* Section blocks */
.schedule-detail-section {
    margin-bottom: 16px;
}
.schedule-detail-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border, #333);
}
.schedule-detail-section-title i { font-size: 14px; }

/* Event cards (colored) */
.schedule-detail-card {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    color: white;
    font-size: 0.8rem;
}
.schedule-detail-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.schedule-detail-card-head i { font-size: 13px; }
.schedule-detail-card-sub {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* Task items */
.schedule-detail-task {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border, #333);
    background: var(--color-bg-card, #1e1e2e);
    margin-bottom: 6px;
}
.schedule-detail-task-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-main, #f8fafc);
}
.schedule-detail-task-client {
    font-size: 0.75rem;
    color: var(--color-text-muted, #9ca3af);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.schedule-detail-task-client i { font-size: 12px; }
.schedule-detail-task-meta {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.sched-task--done {
    opacity: 0.5;
    text-decoration: line-through;
}
.sched-task--active {
    border-color: var(--color-active, #3b82f6);
}

/* Reminder items */
.schedule-detail-reminder {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border, #333);
    border-left: 3px solid #f59e0b;
    background: var(--color-bg-card, #1e1e2e);
    margin-bottom: 6px;
}
.schedule-detail-reminder-text {
    font-size: 0.8rem;
    color: var(--color-text-main, #f8fafc);
}
.schedule-detail-reminder-meta {
    display: flex;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--color-text-muted, #9ca3af);
    margin-top: 3px;
}
.schedule-detail-reminder-meta i { font-size: 12px; }
.sched-reminder--done {
    opacity: 0.45;
    border-left-color: #555;
}

/* Empty states */
.schedule-detail-empty,
.schedule-detail-empty-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    color: var(--color-text-muted, #9ca3af);
    gap: 8px;
    font-size: 0.85rem;
}
.schedule-detail-empty-day p {
    margin: 0;
    font-size: 0.85rem;
}

.crm-cal-legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.crm-cal-leg {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--color-text-muted);
}
.crm-cal-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════
   SAC ALERT ACTION BUTTONS (dashboard widget)
   ══════════════════════════════════════════════════════════════ */
.sac-alert-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 8px;
}
.sac-act-btn {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s;
}
.sac-act-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
}
.sac-act-btn--note:hover {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

/* ══════════════════════════════════════════════════════════════
   SALES HUB COMMAND CENTER + CLIENT PROFILE
   3-tab top-level (Clients · Schedule · Tasks) with full-width
   client profile drill-down
   ══════════════════════════════════════════════════════════════ */

/* ── Sales Hub main container ─────────────────────────────────── */
.sales-hub-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Pill nav in view-header ───────────────────────────────── */
#sales-hub-header-actions {
    flex-shrink: 0;
}

/* ── Top pill nav (Clients / Schedule / Tasks) ────────────────── */
.sales-hub-top-nav {
    display: flex;
    gap: 4px;
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 3px;
}
.sales-hub-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.sales-hub-pill:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.04);
}
.sales-hub-pill.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sales-hub-pill i {
    font-size: 1rem;
}

/* ── Tab panes ────────────────────────────────────────────────── */
.sales-hub-tab-pane {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.sales-hub-tab-pane.active {
    display: flex;
}

/* ── Directory toolbar (seg tabs + search + add) ──────────────── */
.crm-directory-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    gap: 12px;
}
.crm-directory-toolbar .crm-seg-tabs {
    border-bottom: none;
}
.crm-directory-toolbar .crm-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ══════════════════════════════════════════════════════════════
   CLIENTS HUB — 60 / 40 Split Layout
   60% client list  ·  40% informational panel
   ══════════════════════════════════════════════════════════════ */
.crm-directory-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── 60% left column — client list ────────────────────────── */
.crm-directory-main {
    flex: 6;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--color-border);
}

/* ── 40% right column — info cards ───────────────────────── */
.crm-info-panel {
    flex: 4;
    min-width: 260px;
    overflow-y: auto;
    padding: 14px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-bg-base);
}

/* ── Info card wrapper ──────────────────────────────────── */
.crm-info-card {
    background: var(--color-bg-surface, #1e1e2e);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}
.crm-info-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.crm-info-card-title i {
    color: var(--color-primary);
    font-size: 0.95rem;
}

/* ── Stat grid (2-column) ───────────────────────────────── */
.crm-ip-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--color-border);
}
.crm-ip-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    background: var(--color-bg-surface, #1e1e2e);
    text-align: center;
    gap: 4px;
}
.crm-ip-stat--wide {
    grid-column: span 2;
    padding: 12px 8px;
}
.crm-ip-stat-val {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--color-primary);
}
.crm-ip-stat-val--lead  { color: #38bdf8; }
.crm-ip-stat-val--warn  { color: #f59e0b; }
.crm-ip-stat-val--conv  { color: #a855f7; }
.crm-ip-stat-val--money { color: #22c55e; }
.crm-ip-stat-val--won   { color: #22c55e; }
.crm-ip-stat-val--big   { font-size: 1.3rem; color: #22c55e; }
.crm-ip-stat-lbl {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* ── Activity feed ──────────────────────────────────────── */
.crm-ip-activity-feed {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}
.crm-ip-activity-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.crm-ip-activity-row:last-child { border-bottom: none; }
.crm-ip-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 5px;
}
.crm-ip-activity-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.crm-ip-activity-client {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-main);
}
.crm-ip-activity-text {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-ip-activity-date {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}
.crm-ip-empty {
    padding: 20px 14px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
}
.crm-ip-loading {
    padding: 40px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.2rem;
}

/* ── Full-width directory scroll ──────────────────────────────── */
.crm-directory-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
}
.crm-directory-scroll .crm-list-item {
    max-width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   CLIENT PROFILE – Jobber-style two-column layout
   ══════════════════════════════════════════════════════════════ */
.client-profile-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

/* ── Profile header (back + name | action buttons) ────────────── */
.client-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    gap: 16px;
}
.client-profile-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.client-profile-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.client-profile-name {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.client-profile-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}
.client-profile-company {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.client-profile-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── Two-column body ──────────────────────────────────────────── */
.cp-two-col {
    display: grid;
    grid-template-columns: 3fr 2fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.cp-main {
    overflow-y: auto;
    padding: 20px 24px;
    border-right: 1px solid var(--color-border);
}
.cp-sidebar {
    overflow-y: auto;
    padding: 20px;
}

/* ── Cards (Address, Contacts, Overview) ──────────────────────── */
.cp-card {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}
.cp-card--flush .cp-overview-body {
    /* no padding on overview body — rows are full-width */
}
.cp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
}
.cp-card-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}
.cp-card-body {
    padding: 14px 18px;
}

/* Address row */
.cp-address-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--color-text-main);
    font-size: 0.88rem;
}
.cp-address-row i {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    flex-shrink: 0;
}

/* Contacts table */
.cp-contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.cp-contacts-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
}
.cp-contacts-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}
.cp-contacts-table a {
    color: var(--color-primary);
    text-decoration: none;
}
.cp-contacts-table a:hover {
    text-decoration: underline;
}

/* ── Overview sub-tabs (Active Work / Quotes / Jobs / Comms) ──── */
.cp-overview-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    padding: 0 18px;
    overflow-x: auto;
}
.cp-overview-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}
.cp-overview-tab:hover {
    color: var(--color-text-main);
}
.cp-overview-tab.active {
    color: var(--color-text-main);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}
.cp-overview-body {
    min-height: 120px;
}
.cp-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ── Job/quote rows (Jobber-style list) ───────────────────────── */
.cp-job-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.12s;
    gap: 16px;
}
.cp-job-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.cp-job-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.cp-job-num {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--color-text-main);
}
.cp-job-date {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.cp-job-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.cp-job-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
}
.cp-job-addr {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-align: right;
}
.cp-job-val {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text-main);
}

/* ── Sidebar sections ─────────────────────────────────────────── */
.cp-sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}
.cp-sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.cp-sidebar-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cp-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.cp-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
}
.cp-info-row:last-child {
    border-bottom: none;
}
.cp-info-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.cp-info-value {
    font-size: 0.85rem;
    color: var(--color-text-main);
    text-align: right;
    word-break: break-word;
}
.cp-info-value a {
    color: var(--color-primary);
    text-decoration: none;
}
.cp-info-value a:hover {
    text-decoration: underline;
}
.cp-val-highlight {
    font-weight: 700;
    color: var(--color-primary);
}
.cp-inline-select {
    height: 28px;
    font-size: 0.8rem;
    padding: 0 8px;
}

/* ── Last communication block ─────────────────────────────────── */
.cp-last-comm {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.cp-last-comm i {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    flex-shrink: 0;
}
.cp-comm-date {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.cp-comm-text {
    font-size: 0.85rem;
    color: var(--color-text-main);
}

/* ── Quote status badges (reused) ─────────────────────────────── */
.crm-quote-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.crm-qs--draft { background: rgba(148,163,184,0.15); color: #94a3b8; }
.crm-qs--sent, .crm-qs--awaiting-response { background: rgba(59,130,246,0.15); color: #3b82f6; }
.crm-qs--signed { background: rgba(34,197,94,0.15); color: #22c55a; }
.crm-qs--production { background: rgba(168,85,247,0.15); color: #a855f7; }
.crm-qs--in-route { background: rgba(245,158,11,0.15); color: #f59e0b; }
.crm-qs--invoiced, .crm-qs--completed { background: rgba(34,197,94,0.1); color: #16a34a; }
.crm-qs--lost { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Work History table (kept for legacy) ─────────────────────── */
.crm-history-table-wrap {
    overflow-x: auto;
}
.crm-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.crm-history-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.crm-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}
.crm-history-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.crm-history-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.crm-history-link:hover {
    text-decoration: underline;
    color: var(--color-primary-hover, #4ade80);
}

/* ── Tasks list ───────────────────────────────────────────────── */
.crm-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crm-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card, #1e1e2e);
    gap: 12px;
}
.crm-task-item.crm-task--overdue {
    border-left: 3px solid #ef4444;
}
.crm-task-item.crm-task--today {
    border-left: 3px solid #f59e0b;
}
.crm-task-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.crm-task-client {
    font-weight: 600;
    font-size: 0.85rem;
}
.crm-task-text {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-task-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.crm-task-date {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.crm-task-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.crm-task-badge.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.crm-task-badge.today {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sales-hub-top-nav {
        overflow-x: auto;
    }
    .crm-directory-body {
        flex-direction: column;
    }
    .crm-directory-main {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .crm-info-panel {
        max-width: none;
        min-width: 0;
        max-height: 280px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        padding: 12px;
        gap: 10px;
    }
    .crm-info-card {
        flex-shrink: 0;
        min-width: 220px;
    }
    .crm-directory-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 12px;
    }
    .client-profile-header {
        flex-direction: column;
        padding: 12px 16px;
        gap: 10px;
    }
    .client-profile-header-left {
        flex-direction: column;
        gap: 8px;
    }
    .client-profile-header-right {
        align-self: flex-start;
    }
    .cp-two-col {
        grid-template-columns: 1fr;
    }
    .cp-main {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 16px;
    }
    .cp-sidebar {
        padding: 16px;
    }
    .cp-overview-nav {
        padding: 0 12px;
    }
    .cp-job-row {
        flex-direction: column;
        gap: 8px;
    }
    .cp-job-right {
        align-items: flex-start;
    }
}

/* ─── Client Profile: Tasks sub-tab ─── */
.cp-client-tasks {
    display: flex;
    flex-direction: column;
}
.cp-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: default;
    transition: background 0.15s;
}
.cp-task-row:hover {
    background: var(--color-bg-hover);
}
.cp-task-row--overdue {
    border-left: 3px solid var(--color-danger);
}
.cp-task-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.cp-task-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-main);
}
.cp-task-desc {
    font-size: 12px;
    color: var(--color-text-muted);
}
.cp-task-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.cp-task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
}
.cp-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   KANBAN TASK BOARD  (unified with Pipeline board styling)
   ═══════════════════════════════════════════════════════════════ */

/* Toolbar */
.kb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}
.kb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kb-toolbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.kb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kb-vis-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
}

/* Board container — matches .pipeline-board */
.kb-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 20px;
    min-height: calc(100vh - 280px);
    overflow-x: auto;
}

/* Column — matches .pipeline-col */
.kb-column {
    background: var(--color-bg-surface);
    border-radius: 8px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: 100%;
    border: 1px solid var(--color-border);
}

/* Column header — matches .col-header */
.kb-col-head {
    padding: 14px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px 8px 0 0;
    border-top: 3px solid #3b82f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kb-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-main);
}
.kb-col-title i {
    font-size: 18px;
}
.kb-column[data-status="todo"] .kb-col-head        { border-top-color: #3b82f6; }
.kb-column[data-status="in-progress"] .kb-col-head  { border-top-color: #f59e0b; }
.kb-column[data-status="review"] .kb-col-head       { border-top-color: #8b5cf6; }
.kb-column[data-status="done"] .kb-col-head         { border-top-color: #22c55e; }

/* Count badge — matches .count-badge */
.kb-col-count {
    background: rgba(255,255,255,0.1);
    color: var(--color-text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Column body — drop target — matches .col-body */
.kb-col-body {
    padding: 12px;
    min-height: 100px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background .15s;
}
.kb-col-body--over {
    background: rgba(59, 130, 246, 0.1);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
}

/* Empty state */
.kb-empty {
    text-align: center;
    padding: 28px 8px;
    color: var(--color-text-muted);
    font-size: 13px;
    font-style: italic;
}

/* Card — matches .pipeline-card */
.kb-card {
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}
.kb-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}
.kb-card:active {
    cursor: grabbing;
}
.kb-card--dragging {
    opacity: 0.5;
    cursor: grabbing;
}
.kb-card--overdue {
    border-left: 3px solid var(--color-danger);
}

/* Card internals — matches Pipeline card structure */
.kb-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}
.kb-card-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-main);
    line-height: 1.35;
}
.kb-lock-icon {
    color: var(--color-text-muted);
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}
.kb-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}
.kb-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.kb-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-active-dim);
    color: var(--color-active);
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.kb-tag--removable button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: inherit;
    padding: 0 2px;
    line-height: 1;
}
.kb-client {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--color-active);
    cursor: pointer;
    margin-bottom: 8px;
}
.kb-client:hover {
    text-decoration: underline;
}

/* Card footer — matches .card-actions */
.kb-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}
.kb-due {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--color-text-muted);
}
.kb-due--overdue {
    color: var(--color-danger);
    font-weight: 600;
}
.kb-card-actions {
    display: flex;
    gap: 6px;
}
.kb-card-actions .btn-icon-xs {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.2s;
    font-size: 14px;
}
.kb-card-actions .btn-icon-xs:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-main);
}
.kb-card-actions .btn-icon-xs.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ── View Toggle (Kanban / Table) ────────────────────────────────── */
.kb-view-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border, #333);
    border-radius: 6px;
    overflow: hidden;
    margin-left: 10px;
}
.kb-view-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted, #9ca3af);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}
.kb-view-btn:hover {
    background: var(--color-bg-hover, #2a2a3a);
    color: var(--color-text-main, #f8fafc);
}
.kb-view-btn.active {
    background: var(--color-primary, #22c55e);
    color: white;
}

/* ── Task Ledger Table ───────────────────────────────────────────── */
.task-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    padding: 0 16px 16px;
}
.task-ledger {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}
.task-ledger thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-bg-surface, #1a1a2e);
    color: var(--color-text-muted, #9ca3af);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--color-border, #333);
    white-space: nowrap;
}
.task-ledger tbody tr {
    transition: background 0.12s;
}
.task-ledger tbody tr:hover {
    background: var(--color-bg-hover, rgba(255,255,255,0.04));
}
.task-ledger td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border, #333);
    vertical-align: top;
    color: var(--color-text-main, #f8fafc);
}

/* Column widths */
.tl-status { width: 120px; }
.tl-title  { min-width: 200px; }
.tl-client { width: 160px; }
.tl-due    { width: 140px; white-space: nowrap; }
.tl-tags   { width: 150px; }
.tl-actions { width: 80px; text-align: center; }

/* Status badge pills */
.tl-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.tl-status--todo        { background: rgba(148,163,184,0.15); color: #94a3b8; }
.tl-status--in-progress { background: rgba(59,130,246,0.15); color: #3b82f6; }
.tl-status--review      { background: rgba(250,204,21,0.15); color: #facc15; }
.tl-status--done        { background: rgba(34,197,94,0.15); color: #22c55e; }

/* Title + description */
.tl-title-text {
    font-weight: 600;
    color: var(--color-text-main);
    line-height: 1.3;
}
.tl-desc {
    font-size: 0.72rem;
    color: var(--color-text-muted, #9ca3af);
    margin-top: 2px;
    line-height: 1.3;
}

/* Client link */
.tl-client-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--color-active, #3b82f6);
    font-size: 0.8rem;
    transition: color 0.15s;
}
.tl-client-link:hover { color: #60a5fa; text-decoration: underline; }
.tl-client-link i { font-size: 12px; }

/* Overdue badge */
.tl-overdue-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ef4444;
    font-weight: 600;
}
.tl-overdue-badge i { font-size: 13px; }

/* Row states */
.tl-row--overdue td { background: rgba(239,68,68,0.05); }
.tl-row--overdue td:first-child { border-left: 3px solid #ef4444; }
.tl-row--done td { opacity: 0.5; }
.tl-row--done .tl-title-text { text-decoration: line-through; }

/* Tags reuse .kb-tag */
.tl-tags .kb-tag { margin: 1px 2px; }

/* Actions column */
.tl-actions .btn-icon-xs {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.2s;
    font-size: 14px;
}
.tl-actions .btn-icon-xs:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-main);
}
.tl-actions .btn-icon-xs.danger:hover {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
}

/* Alternating row shading (ledger style) */
.task-ledger tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}
.task-ledger tbody tr:nth-child(even):hover {
    background: var(--color-bg-hover, rgba(255,255,255,0.06));
}

/* New Task modal */
/* New Task modal — use ID selector for specificity over estimator.js .alzar-modal rule */
#newTaskModal,
#dailyActionModal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10002;
    align-items: center;
    justify-content: center;
    background: transparent;
    pointer-events: auto;
}
#newTaskModal.alzar-modal--open,
#dailyActionModal.alzar-modal--open {
    display: flex;
}
.calendar-day:not(.empty) {
    cursor: pointer;
    transition: background-color 0.15s;
}
.calendar-day:not(.empty):hover {
    background: rgba(255,255,255,0.06);
}
.alzar-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}
.alzar-modal-panel {
    position: relative;
    z-index: 1;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}
.alzar-modal-panel .alzar-modal-body {
    overflow-y: auto;
}
.alzar-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}
.alzar-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    color: var(--color-text-main);
}
.alzar-modal-body {
    padding: 20px;
    flex: 1;
}
.alzar-modal-body .form-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
}
.alzar-modal-body .form-control {
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}
.alzar-modal-body .form-control:focus {
    border-color: var(--color-active);
    outline: none;
    box-shadow: 0 0 0 2px var(--color-active-dim);
}
.alzar-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
}

/* Responsive */
@media (max-width: 900px) {
    .kb-board {
        grid-template-columns: 1fr;
    }
}
