/* ============================================================
   SIERRA-STYLE CRM THEME
   Complete UI overhaul to match Sierra Interactive design
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --sierra-navy: #1a1a1a;
    --sierra-navy-dark: #111111;
    --sierra-navy-light: #333333;
    --sierra-orange: #dc2626;
    --sierra-orange-hover: #b91c1c;
    --sierra-bg: #f0f0f0;
    --sierra-white: #ffffff;
    --sierra-border: #d1d5db;
    --sierra-border-light: #e5e7eb;
    --sierra-text: #1a1a1a;
    --sierra-text-secondary: #6b7280;
    --sierra-text-muted: #9ca3af;
    --sierra-text-light: #d1d5db;
    --sierra-green: #28a745;
    --sierra-green-light: #e6f7ed;
    --sierra-blue: #3b82f6;
    --sierra-blue-light: #e8f0fe;
    --sierra-red: #dc2626;
    --sierra-red-light: #fef2f2;
    --sierra-yellow: #ffc107;
    --sierra-yellow-light: #fff8e1;
    --sierra-purple: #7c3aed;
    --sierra-purple-light: #f0e8ff;
    --sierra-gray: #6b7280;
    --sierra-gray-light: #f3f4f6;

    /* Keep old variables mapped for compatibility */
    --sidebar-width: 0px;
    --sidebar-collapsed: 0px;
    --topbar-height: 0px;
    --bg-dark: var(--sierra-navy);
    --bg-darker: var(--sierra-navy-dark);
    --bg-card: var(--sierra-white);
    --bg-card-hover: #f7f8f9;
    --bg-input: var(--sierra-white);
    --bg-secondary: var(--sierra-bg);
    --bg-body: var(--sierra-bg);
    --text-primary: var(--sierra-text);
    --text-secondary: var(--sierra-text-secondary);
    --text-muted: var(--sierra-text-muted);
    --border-color: var(--sierra-border);
    --accent: var(--sierra-navy);
    --accent-color: var(--sierra-navy);
    --accent-hover: var(--sierra-navy-dark);
    --accent-light: rgba(26, 26, 26, 0.08);
    --success: var(--sierra-green);
    --warning: var(--sierra-yellow);
    --danger: var(--sierra-red);
    --info: var(--sierra-blue);
    --purple: var(--sierra-purple);
    --gold: var(--sierra-yellow);
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
    --transition: all 0.2s ease;
}

/* Disable legacy dark/light mode toggle — Sierra theme only */
html.light-mode { /* no-op — Sierra theme does not support toggling */ }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--sierra-bg);
    color: var(--sierra-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--sierra-navy); text-decoration: none; }
a:hover { color: var(--sierra-navy-dark); text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
img { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--sierra-bg); }
::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* ============================================================
   HIDE OLD SIDEBAR — Sierra uses top nav
   ============================================================ */
.sidebar { display: none !important; }

/* ============================================================
   SIERRA TOP NAVIGATION BAR
   ============================================================ */
.sierra-topnav {
    background: var(--sierra-navy);
    display: flex;
    align-items: center;
    height: 52px;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.sierra-topnav .nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 24px;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 8px;
    transition: background 0.15s;
}
.sierra-topnav .nav-brand:hover {
    background: rgba(255,255,255,0.08);
}

.sierra-topnav .nav-brand img {
    height: 34px;
    width: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.sierra-topnav .nav-brand-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}

/* Search bar in top nav */
.sierra-topnav .nav-search {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 0 10px;
    margin-right: 16px;
    width: 200px;
    flex-shrink: 1;
    min-width: 100px;
}

.sierra-topnav .nav-search input {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    padding: 7px 8px !important;
    width: 100%;
    outline: none !important;
    font-size: 13px;
    box-shadow: none !important;
}

.sierra-topnav .nav-search input::placeholder {
    color: rgba(255,255,255,0.6);
}

/* Kill Chrome/Edge autofill white box on the dark navbar search */
.sierra-topnav .nav-search input:-webkit-autofill,
.sierra-topnav .nav-search input:-webkit-autofill:hover,
.sierra-topnav .nav-search input:-webkit-autofill:focus,
.sierra-topnav .nav-search input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
    box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff;
    transition: background-color 9999s ease-in-out 0s;
}

.sierra-topnav .nav-search .search-icon {
    color: var(--sierra-orange);
    font-size: 14px;
    cursor: pointer;
}

/* ── Global Search Autocomplete Dropdown ─────────── */
.global-search-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 380px; max-height: 420px; overflow-y: auto;
    background: #fff; border: 1px solid #d1d5db; border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18); z-index: 10000;
}
.global-search-dropdown.show { display: block; }
.gs-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    cursor: pointer; border-bottom: 1px solid #f0f1f3; transition: background 0.1s;
    text-decoration: none; color: inherit;
}
.gs-item:last-child { border-bottom: none; }
.gs-item:hover, .gs-item.active { background: #f3f4f6; }
.gs-avatar {
    width: 32px; height: 32px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 11px;
    font-weight: 700; color: #fff; flex-shrink: 0;
}
.gs-info { flex: 1; min-width: 0; }
.gs-name { font-size: 13px; font-weight: 600; color: #1a1a1a; }
.gs-name mark { background: #fde68a; color: #1a1a1a; border-radius: 2px; padding: 0 1px; }
.gs-meta { font-size: 11px; color: #6b7280; margin-top: 1px; }
.gs-status {
    font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 3px;
    text-transform: capitalize; flex-shrink: 0;
}
.gs-status-new { background: #dbeafe; color: #1d4ed8; }
.gs-status-contacted { background: #fef3c7; color: #92400e; }
.gs-status-qualified { background: #d1fae5; color: #065f46; }
.gs-status-won, .gs-status-converted { background: #d1fae5; color: #065f46; }
.gs-status-lost, .gs-status-unqualified { background: #fee2e2; color: #991b1b; }
.gs-status-nurturing { background: #ede9fe; color: #5b21b6; }
.gs-status-pool, .gs-status-dormant { background: #f3f4f6; color: #6b7280; }
.gs-footer {
    padding: 8px 14px; text-align: center; font-size: 12px; color: #6b7280;
    border-top: 1px solid #e5e7eb; cursor: pointer;
}
.gs-footer:hover { background: #f3f4f6; color: #1a1a1a; }
.gs-empty {
    padding: 24px 14px; text-align: center; font-size: 13px; color: #9ca3af;
}

/* Main navigation links */
.sierra-topnav .nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* Fade right edge as a scroll-affordance hint when content overflows */
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
}
.sierra-topnav .nav-links::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.sierra-topnav .nav-links a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 7px;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.sierra-topnav .nav-links a:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

.sierra-topnav .nav-links a.active {
    color: #ffffff;
    border-bottom-color: var(--sierra-orange);
    background: rgba(255,255,255,0.05);
}

.sierra-topnav .nav-links a i {
    margin-right: 4px;
    font-size: 12px;
}

/* Smaller laptop screens — hide icons in nav links to save horizontal space */
@media (max-width: 1500px) {
    .sierra-topnav .nav-links a i { display: none; }
    .sierra-topnav .nav-links a { padding: 0 6px; }
}
@media (max-width: 1280px) {
    .sierra-topnav .nav-links a { font-size: 11px; padding: 0 5px; letter-spacing: 0; }
}

/* ── Nav responsive breakpoints ─────────────── */
@media (max-width: 1600px) {
    .sierra-topnav .nav-links a i { display: none; }
    .sierra-topnav .nav-search { width: 160px; }
    .sierra-topnav .nav-right .nav-user-name { display: none; }
}
@media (max-width: 1280px) {
    .sierra-topnav .nav-search { width: 120px; margin-right: 12px; }
    .sierra-topnav .nav-brand { margin-right: 12px; }
    .sierra-topnav .nav-links a { padding: 0 8px; font-size: 11px; }
    .sierra-topnav .nav-right .nav-user-name { display: none; }
}
@media (max-width: 1024px) {
    .sierra-topnav .nav-search { display: none; }
    .sierra-topnav .nav-links a { padding: 0 7px; font-size: 11px; }
}

/* Right side nav items */
.sierra-topnav .nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 12px;
}

.sierra-topnav .nav-right .nav-icon-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    position: relative;
    transition: all 0.15s;
}

.sierra-topnav .nav-right .nav-icon-btn:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.sierra-topnav .nav-right .nav-icon-btn .badge-count {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--sierra-orange);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Notification Dropdown ─────────────────────────── */
.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    z-index: 9999;
    overflow: hidden;
    flex-direction: column;
    border-top: 3px solid #dc2626;
}
.notif-dropdown.open {
    display: flex;
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-bottom: none;
}
.notif-header .notif-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.notif-header .notif-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: #dc2626;
    border-radius: 2px;
    flex-shrink: 0;
}
.notif-mark-read {
    background: none;
    border: none;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all .15s;
}
.notif-mark-read:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
}
.notif-tabs {
    display: flex;
    gap: 0;
    padding: 0 18px;
    border-bottom: 2px solid #f0f0f0;
}
.notif-tab {
    background: none;
    border: none;
    padding: 10px 16px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.notif-tab:hover {
    color: var(--sierra-navy, #1a1a1a);
}
.notif-tab.active {
    color: var(--sierra-orange, #dc2626);
    border-bottom-color: var(--sierra-orange, #dc2626);
}
.notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 18px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    transition: background .12s;
}
.notif-item:hover {
    background: #f9fafb;
    border-left: 3px solid #dc2626;
    padding-left: 15px;
}
.notif-item.unread {
    background: #fef2f2;
}
.notif-item.unread:hover {
    background: #fce4e4;
}
.notif-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-item.unread .notif-icon {
    background: rgba(220,38,38,.1);
}
.notif-body {
    flex: 1;
    min-width: 0;
}
.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #111111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-time {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-loading, .notif-empty {
    text-align: center;
    padding: 32px 18px;
    color: #9ca3af;
    font-size: 13px;
}
.notif-empty i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
    color: #d1d5db;
}
.notif-footer {
    padding: 10px 18px;
    text-align: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-top: none;
}
.notif-footer a {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.notif-footer a::after {
    content: '\f061';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 11px;
    color: #dc2626;
    transition: transform .15s;
}
.notif-footer a:hover {
    color: #dc2626;
    text-decoration: none;
}
.notif-footer a:hover::after {
    transform: translateX(3px);
}

/* ── Dropdown Summary Rows (Tasks / Inbox) ─────────── */
.dd-summary-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f5f5f5;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.dd-summary-row:hover {
    background: #fef2f2;
    border-left-color: #dc2626;
}
.dd-summary-row:hover .dd-summary-action {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.sierra-topnav .nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.sierra-topnav .nav-user:hover {
    background: rgba(255,255,255,0.1);
}

.sierra-topnav .nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sierra-orange);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sierra-topnav .nav-user-name {
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
}

.sierra-topnav .nav-user-caret {
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.2s;
}

/* ── User Profile Dropdown ──────────────────────── */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 260px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    z-index: 9999;
    overflow: hidden;
}
.user-dropdown.open {
    display: block;
}
.user-dd-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #dc2626;
    color: #fff;
}
.user-dd-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--sierra-orange);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-dd-info {
    flex: 1;
    min-width: 0;
}
.user-dd-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-dd-role {
    font-size: 11px;
    opacity: 0.75;
    margin-top: 2px;
    text-transform: capitalize;
}
.user-dd-divider {
    height: 1px;
    background: #f0f0f0;
}
.user-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s;
}
.user-dd-item:hover {
    background: #f9fafb;
}
.user-dd-item i {
    width: 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}
.user-dd-logout {
    color: #ef4444;
}
.user-dd-logout i {
    color: #ef4444;
}
.user-dd-logout:hover {
    background: #fef2f2;
}

/* ── Sierra Modal (global) ──────────────────────── */
.sierra-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sierra-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    overflow: hidden;
}
.sierra-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--sierra-navy) 0%, var(--sierra-navy-dark) 100%);
    color: #fff;
}
.sierra-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.sierra-modal-header h3 i {
    margin-right: 8px;
    opacity: 0.8;
}
.sierra-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.sierra-modal-close:hover {
    color: #fff;
}
.sierra-modal-body {
    padding: 24px;
}
.sierra-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}
.sierra-form-group {
    margin-bottom: 16px;
}
.sierra-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sierra-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111111;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.sierra-input:focus {
    outline: none;
    border-color: var(--sierra-orange);
    box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.sierra-input:disabled {
    background: #f5f5f5;
    color: #9ca3af;
}
.profile-avatar-section {
    text-align: center;
    margin-bottom: 20px;
}
.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--sierra-orange);
    color: #fff;
    font-weight: 700;
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    background: var(--sierra-orange);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover {
    background: #b91c1c;
}
.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:hover {
    background: #e5e7eb;
}

/* ============================================================
   SECONDARY NAV / PAGE HEADER
   ============================================================ */
.sierra-page-header {
    background: var(--sierra-white);
    border-bottom: 1px solid var(--sierra-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sierra-page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--sierra-text);
    margin: 0;
}

.sierra-page-header .page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sub-tabs under page header */
.sierra-subtabs {
    background: var(--sierra-white);
    border-bottom: 1px solid var(--sierra-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 0;
}

.sierra-subtabs a,
.sierra-subtabs button {
    display: inline-flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--sierra-text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    background: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.sierra-subtabs a:hover,
.sierra-subtabs button:hover {
    color: var(--sierra-text);
    text-decoration: none;
}

.sierra-subtabs a.active,
.sierra-subtabs button.active {
    color: var(--sierra-navy);
    border-bottom-color: var(--sierra-navy);
    font-weight: 600;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 52px);
    transition: none;
}

.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* Hide old topbar */
.topbar { display: none !important; }

.content-area {
    padding: 24px;
    flex: 1;
    overflow-x: auto;
    max-width: 100%;
}

.sidebar.collapsed ~ .main-content .content-area { max-width: 100%; }

/* ============================================================
   CARDS — Sierra style
   ============================================================ */
.card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--sierra-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sierra-white);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--sierra-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }
.card-body.no-padding { padding: 0; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--sierra-border-light);
    background: var(--sierra-gray-light);
}

.chart-card .card-body { height: 300px; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.kpi-card:hover {
    border-color: var(--sierra-navy);
    box-shadow: var(--shadow-lg);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bg-blue { background: var(--sierra-blue-light); color: var(--sierra-blue); }
.bg-green { background: var(--sierra-green-light); color: var(--sierra-green); }
.bg-gold { background: var(--sierra-yellow-light); color: #d4a007; }
.bg-red { background: var(--sierra-red-light); color: var(--sierra-red); }
.bg-purple { background: var(--sierra-purple-light); color: var(--sierra-purple); }

.kpi-data { display: flex; flex-direction: column; }
.kpi-value { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--sierra-text); }
.kpi-label { font-size: 12px; color: var(--sierra-text-muted); margin-top: 2px; }
.kpi-change { font-size: 12px; color: var(--sierra-text-muted); margin-top: 4px; }
.kpi-change.positive { color: var(--sierra-green); }
.kpi-change.negative { color: var(--sierra-red); }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* ============================================================
   DATA TABLE — Sierra style
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; }

.data-table thead {
    background: var(--sierra-gray-light);
}

.data-table th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--sierra-text-secondary);
    letter-spacing: 0.5px;
    white-space: nowrap;
    user-select: none;
    border-bottom: 2px solid var(--sierra-border);
}

.data-table th[data-sort] { cursor: pointer; }
.data-table th[data-sort]:hover { color: var(--sierra-navy); }
.data-table th i.fa-sort { font-size: 10px; margin-left: 4px; }

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sierra-border-light);
    font-size: 13px;
    color: var(--sierra-text);
}

.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BUTTONS — Sierra style
   ============================================================ */
.btn-primary {
    background: var(--sierra-navy);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: none;
    font-size: 13px;
}

.btn-primary:hover {
    background: var(--sierra-navy-dark);
    box-shadow: 0 2px 8px rgba(26,26,26,0.3);
}

.btn-primary:active {
    box-shadow: none;
}

.btn-primary.btn-orange {
    background: var(--sierra-orange);
}

.btn-primary.btn-orange:hover {
    background: var(--sierra-orange-hover);
}

.btn-primary.btn-green {
    background: var(--sierra-green);
}

.btn-primary.btn-green:hover {
    background: #218838;
}

.btn-secondary {
    background: var(--sierra-white);
    color: var(--sierra-text);
    border: 1px solid var(--sierra-border);
    padding: 9px 18px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.btn-secondary:hover {
    background: var(--sierra-gray-light);
    border-color: var(--sierra-text-muted);
}

.btn-danger {
    background: var(--sierra-red-light);
    color: var(--sierra-red);
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.btn-danger:hover { background: var(--sierra-red); color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 3px; }
.btn-link { color: var(--sierra-navy); background: none; border: none; cursor: pointer; font-weight: 500; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }

.btn-icon {
    background: none;
    border: none;
    color: var(--sierra-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}
.btn-icon:hover { color: var(--sierra-navy); background: var(--sierra-gray-light); }
.btn-icon.active { color: var(--sierra-navy); }

.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   FORMS — Sierra style
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
    font-weight: 600;
    font-size: 12px;
    color: var(--sierra-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-row .flex-2 { flex: 2; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="url"], select, textarea {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    color: var(--sierra-text);
    padding: 9px 13px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--sierra-navy);
    box-shadow: 0 0 0 3px rgba(26,26,26,0.1);
}

input::placeholder, textarea::placeholder { color: var(--sierra-text-muted); opacity: 0.7; }
textarea { resize: vertical; }

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7c93' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.select-sm { padding: 6px 10px; font-size: 12px; border-radius: 3px; background: var(--sierra-white); border: 1px solid var(--sierra-border); color: var(--sierra-text); }
.input-sm { padding: 6px 10px; font-size: 12px; border-radius: 3px; background: var(--sierra-white); border: 1px solid var(--sierra-border); color: var(--sierra-text); }
.input-lg { font-size: 18px; font-weight: 700; padding: 10px 14px; }

/* Toggle Switch */
.toggle-group { flex-direction: row !important; align-items: center; justify-content: space-between; }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--sierra-border); border-radius: 11px; transition: 0.3s;
}
.toggle-slider::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--sierra-green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Checkbox Group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-group label {
    display: flex; align-items: center; gap: 8px;
    font-weight: 400; font-size: 13px; color: var(--sierra-text);
    cursor: pointer; padding: 7px 12px;
    background: var(--sierra-white); border: 1px solid var(--sierra-border);
    border-radius: 4px; transition: all .2s; user-select: none;
}
.checkbox-group label:hover { border-color: var(--sierra-navy); background: rgba(26,26,26,0.04); }
.checkbox-group input[type="checkbox"] { accent-color: var(--sierra-navy); }

/* ============================================================
   MODALS — Sierra style
   ============================================================ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 11000;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.2s ease;
}

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

.modal {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    width: 90%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalSlideUp 0.25s ease;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--sierra-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sierra-gray-light);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--sierra-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--sierra-navy);
    border-radius: 2px;
    flex-shrink: 0;
}

.modal-close {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: 4px;
    color: var(--sierra-text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--sierra-red-light);
    border-color: var(--sierra-red);
    color: var(--sierra-red);
}

.modal-body { padding: 22px; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--sierra-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--sierra-gray-light);
}

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead-count { font-size: 13px; color: var(--sierra-text-muted); font-weight: 500; }

/* ============================================================
   STATUS BADGES — Sierra style
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.badge-new { background: var(--sierra-red); color: #fff; }
.badge-contacted { background: var(--sierra-yellow); color: #333; }
.badge-qualified { background: var(--sierra-blue); color: #fff; }
.badge-proposal_sent, .badge-proposal { background: var(--sierra-purple); color: #fff; }
.badge-won, .badge-active { background: var(--sierra-green); color: #fff; }
.badge-lost { background: #6b7280; color: #fff; }
.badge-dormant { background: #adb5bd; color: #fff; }
.badge-paused { background: var(--sierra-yellow); color: #333; }
.badge-draft { background: #adb5bd; color: #fff; }
.badge-prime { background: var(--sierra-orange); color: #fff; }
.badge-closed { background: #6b7280; color: #fff; }
.badge-qualify { background: var(--sierra-blue); color: #fff; }

.score-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 24px; border-radius: 4px;
    font-weight: 700; font-size: 12px;
}
.score-hot { background: var(--sierra-red-light); color: var(--sierra-red); }
.score-warm { background: var(--sierra-yellow-light); color: #d4a007; }
.score-cold { background: var(--sierra-gray-light); color: var(--sierra-gray); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 12px 0;
}

.pagination button {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    color: var(--sierra-text-secondary);
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.pagination button:hover { border-color: var(--sierra-navy); color: var(--sierra-navy); }
.pagination button.active { background: var(--sierra-navy); color: white; border-color: var(--sierra-navy); }
.pagination-info { font-size: 13px; color: var(--sierra-text-muted); margin-right: 12px; }

/* ============================================================
   TASK LIST
   ============================================================ */
.task-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.task-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--sierra-gray-light); border-radius: 4px; transition: var(--transition);
    border: 1px solid transparent;
}
.task-item:hover { background: #e5e7eb; border-color: var(--sierra-border); }
.task-check {
    width: 18px; height: 18px; border: 2px solid var(--sierra-border);
    border-radius: 4px; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.task-check:hover { border-color: var(--sierra-navy); }
.task-check.completed { background: var(--sierra-green); border-color: var(--sierra-green); }
.task-check.completed::after { content: '✓'; color: white; font-size: 11px; font-weight: 700; }
.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 500; font-size: 13px; color: var(--sierra-text); }
.task-meta { font-size: 11px; color: var(--sierra-text-muted); margin-top: 2px; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-urgent { background: var(--sierra-red); }
.priority-high { background: var(--sierra-yellow); }
.priority-medium { background: var(--sierra-blue); }
.priority-low { background: var(--sierra-text-muted); }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 0; max-height: 400px; overflow-y: auto; }
.activity-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid var(--sierra-border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 13px;
}
.activity-icon.call { background: var(--sierra-green-light); color: var(--sierra-green); }
.activity-icon.email { background: var(--sierra-blue-light); color: var(--sierra-blue); }
.activity-icon.sms { background: var(--sierra-purple-light); color: var(--sierra-purple); }
.activity-icon.note { background: var(--sierra-yellow-light); color: #d4a007; }
.activity-icon.deal { background: rgba(6,182,212,0.15); color: #0891b2; }
.activity-icon.system { background: var(--sierra-gray-light); color: var(--sierra-gray); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; line-height: 1.5; color: var(--sierra-text); }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--sierra-text-muted); margin-top: 2px; }

/* ============================================================
   SLIDE PANEL (Lead Quick View)
   ============================================================ */
.slide-panel {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: 420px; background: var(--sierra-white);
    border-left: 1px solid var(--sierra-border);
    z-index: 1500;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
    transform: translateX(0); transition: transform 0.3s ease;
}
.slide-panel-header {
    padding: 16px 20px; border-bottom: 1px solid var(--sierra-border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--sierra-navy);
    color: #fff;
}
.slide-panel-header h2 { font-size: 18px; font-weight: 700; color: #fff; }
.slide-panel-tabs { display: flex; border-bottom: 1px solid var(--sierra-border); background: var(--sierra-gray-light); }
.tab-btn {
    flex: 1; background: none; border: none; padding: 10px;
    color: var(--sierra-text-muted); font-weight: 600; font-size: 13px;
    cursor: pointer; border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--sierra-text); }
.tab-btn.active { color: var(--sierra-navy); border-bottom-color: var(--sierra-navy); background: var(--sierra-white); }
.slide-panel-body { flex: 1; overflow-y: auto; padding: 20px; }

.lead-score-bar {
    background: var(--sierra-gray-light); border-radius: 20px; height: 24px;
    position: relative; margin-bottom: 20px; overflow: hidden;
}
.score-fill {
    height: 100%; border-radius: 20px;
    background: linear-gradient(90deg, var(--sierra-red), var(--sierra-yellow), var(--sierra-green));
    transition: width 0.5s ease;
}
.score-label {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%); font-weight: 700; font-size: 12px;
    color: var(--sierra-text);
}

.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 12px; text-transform: uppercase; color: var(--sierra-text-muted); margin-bottom: 8px; letter-spacing: 0.5px; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.detail-item { display: flex; flex-direction: column; }
.detail-item .detail-label { font-size: 11px; color: var(--sierra-text-muted); }
.detail-item .detail-value { font-size: 13px; font-weight: 500; color: var(--sierra-text); }

.tags-container { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 3px; font-size: 11px; font-weight: 600;
    background: var(--sierra-navy); color: #fff;
}
.tag .tag-remove {
    cursor: pointer;
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.7;
}
.tag .tag-remove:hover { opacity: 1; }

.tag-green { background: var(--sierra-green); }
.tag-red { background: var(--sierra-red); }
.tag-blue { background: var(--sierra-blue); }
.tag-orange { background: var(--sierra-orange); }
.tag-purple { background: var(--sierra-purple); }
.tag-navy { background: var(--sierra-navy); }
.tag-gray { background: var(--sierra-gray); }

.quick-actions {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding-top: 16px; border-top: 1px solid var(--sierra-border);
    margin-top: 16px;
}

/* ============================================================
   KANBAN BOARD (Pipeline)
   ============================================================ */
.kanban-board {
    display: flex; gap: 12px;
    overflow-x: auto; padding-bottom: 12px;
    min-height: calc(100vh - 240px);
    max-width: 100%;
}
.kanban-column {
    min-width: 220px; width: 220px;
    background: var(--sierra-gray-light);
    border-radius: var(--radius);
    display: flex; flex-direction: column; flex-shrink: 0;
    border: 1px solid var(--sierra-border);
}
.kanban-header {
    padding: 10px 12px;
    border-bottom: 3px solid var(--sierra-navy);
    display: flex; align-items: center; justify-content: space-between;
    gap: 4px;
    background: var(--sierra-white);
    border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-header h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--sierra-text); }
.kanban-count {
    background: var(--sierra-navy); color: #fff; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.kanban-body { flex: 1; padding: 8px; overflow-y: auto; min-height: 150px; }
.kanban-card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.kanban-card:hover { border-color: var(--sierra-navy); box-shadow: var(--shadow-lg); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card-title { font-weight: 600; font-size: 12px; color: var(--sierra-text); margin-bottom: 4px; }
.kanban-card-value { font-size: 15px; font-weight: 700; color: var(--sierra-green); }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; color: var(--sierra-text-muted); }
.kanban-body.drag-over { background: rgba(26,26,26,0.06); }

.pipeline-stats {
    display: flex; gap: 16px; margin-bottom: 16px;
    padding: 14px 18px; background: var(--sierra-white);
    border: 1px solid var(--sierra-border); border-radius: var(--radius-lg);
    flex-wrap: wrap; box-shadow: var(--shadow);
}
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--sierra-text); }
.stat-label { font-size: 11px; color: var(--sierra-text-muted); }

/* ============================================================
   COMMUNICATIONS
   ============================================================ */
.comm-layout { display: flex; gap: 0; height: calc(100vh - 120px); border: 1px solid var(--sierra-border); border-radius: var(--radius-lg); overflow: hidden; }
.comm-list-panel { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--sierra-white); border-right: 1px solid var(--sierra-border); }
.comm-detail-panel { flex: 1; background: var(--sierra-white); overflow: hidden; }
.comm-filters { display: flex; gap: 8px; margin-bottom: 12px; padding: 12px; }
.comm-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0; }

.comm-item {
    display: flex; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--sierra-border-light);
    cursor: pointer; transition: background 0.15s;
}
.comm-item:hover { background: var(--sierra-gray-light); }
.comm-item.active { background: rgba(26,26,26,0.08); border-left: 3px solid var(--sierra-navy); }
.comm-item-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
.comm-item-body { flex: 1; min-width: 0; }
.comm-item-name { font-weight: 600; font-size: 13px; color: var(--sierra-text); }
.comm-item-preview { font-size: 12px; color: var(--sierra-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comm-item-time { font-size: 11px; color: var(--sierra-text-muted); white-space: nowrap; }

.comm-detail-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--sierra-text-muted); gap: 12px;
}
.comm-detail { padding: 24px; }
.comm-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.comm-type-badge { padding: 4px 12px; border-radius: 3px; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.comm-detail-lead { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--sierra-border); }
.comm-detail-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--sierra-text); }

/* ============================================================
   DIALER
   ============================================================ */
.dialer-widget {
    position: fixed; bottom: 20px; right: 20px;
    width: 320px; background: var(--sierra-white);
    border: 1px solid var(--sierra-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); z-index: 1800;
}
.dialer-header {
    padding: 12px 16px; border-bottom: 1px solid var(--sierra-border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--sierra-navy); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.dialer-header h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; color: #fff; }
.dialer-body { padding: 16px; }
.dialer-contact { font-size: 16px; font-weight: 600; text-align: center; margin-bottom: 12px; color: var(--sierra-text); }
.dialer-input {
    width: 100%; text-align: center; font-size: 20px; font-weight: 700;
    letter-spacing: 2px; margin-bottom: 12px;
}
.dialer-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.dial-key {
    background: var(--sierra-gray-light); border: 1px solid var(--sierra-border);
    color: var(--sierra-text); padding: 12px; border-radius: 4px;
    font-size: 18px; font-weight: 700; cursor: pointer; text-align: center;
    transition: var(--transition);
}
.dial-key:hover { background: #e5e7eb; border-color: var(--sierra-navy); }
.dial-key sub { display: block; font-size: 9px; font-weight: 400; color: var(--sierra-text-muted); }
.btn-call {
    width: 100%; padding: 12px; background: var(--sierra-green); color: white;
    border: none; border-radius: 4px; font-weight: 700; font-size: 14px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: var(--transition);
}
.btn-call:hover { background: #218838; }
.call-status { text-align: center; padding-top: 16px; }
.call-timer { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sierra-text); }
.call-controls { display: flex; justify-content: center; gap: 16px; margin-top: 12px; }
.call-outcome { margin-top: 16px; }

/* ============================================================
   CAMPAIGN BUILDER
   ============================================================ */
.campaign-info-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--sierra-border); }
.campaign-steps-section { margin-bottom: 20px; }
.campaign-steps-section h3 { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.steps-timeline { position: relative; }
.step-card {
    display: flex; gap: 16px; padding: 14px;
    background: var(--sierra-gray-light); border: 1px solid var(--sierra-border);
    border-radius: var(--radius); margin-bottom: 8px;
    cursor: pointer; transition: var(--transition);
}
.step-card:hover { border-color: var(--sierra-navy); }
.step-card.active { border-color: var(--sierra-navy); background: rgba(26,26,26,0.05); }
.step-number {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--sierra-navy); color: white; font-weight: 700; font-size: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-info { flex: 1; }
.step-type { font-weight: 600; font-size: 13px; text-transform: capitalize; color: var(--sierra-text); }
.step-delay { font-size: 11px; color: var(--sierra-text-muted); }
.step-placeholder { padding: 40px; text-align: center; color: var(--sierra-text-muted); }

.step-editor {
    background: var(--sierra-gray-light); border: 2px solid var(--sierra-navy);
    border-radius: var(--radius); padding: 16px; margin-top: 12px;
}
.step-editor h4 { margin-bottom: 12px; color: var(--sierra-text); }
.delay-input { display: flex; gap: 8px; }
.delay-input input { width: 80px; }
.merge-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.merge-tag {
    padding: 3px 10px; background: rgba(26,26,26,0.08); color: var(--sierra-navy);
    border-radius: 3px; font-size: 11px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.merge-tag:hover { background: var(--sierra-navy); color: white; }

/* ============================================================
   DOCUMENTS
   ============================================================ */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.doc-card {
    background: var(--sierra-white); border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg); padding: 20px; text-align: center;
    cursor: pointer; transition: var(--transition); box-shadow: var(--shadow);
}
.doc-card:hover { border-color: var(--sierra-navy); box-shadow: var(--shadow-lg); }
.doc-card-icon { font-size: 40px; margin-bottom: 12px; }
.doc-card-icon.pdf { color: var(--sierra-red); }
.doc-card-icon.image { color: var(--sierra-blue); }
.doc-card-icon.doc { color: var(--sierra-blue); }
.doc-card-icon.other { color: var(--sierra-gray); }
.doc-card-name { font-weight: 600; font-size: 13px; color: var(--sierra-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-meta { font-size: 11px; color: var(--sierra-text-muted); margin-top: 6px; }

.upload-zone {
    border: 2px dashed var(--sierra-border); border-radius: var(--radius-lg);
    padding: 40px; text-align: center; margin-bottom: 16px;
    transition: var(--transition); cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--sierra-navy); background: rgba(26,26,26,0.04); }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout { display: flex; gap: 20px; }
.settings-tabs {
    width: 220px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 2px;
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 8px;
}
.settings-tab {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: none; border: none;
    color: var(--sierra-text-secondary); font-weight: 500; font-size: 13px;
    border-radius: 4px; cursor: pointer; text-align: left;
    transition: var(--transition);
}
.settings-tab:hover { background: var(--sierra-gray-light); color: var(--sierra-text); }
.settings-tab.active { background: var(--sierra-navy); color: #fff; }
.settings-tab i { width: 18px; text-align: center; }
.settings-content { flex: 1; min-width: 0; }
.settings-panel { display: block; }

.integration-status { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.connected { background: var(--sierra-green); }
.status-dot.disconnected { background: var(--sierra-red); }

.tags-manager { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; background: var(--sierra-gray-light);
    border: 1px solid var(--sierra-border); border-radius: 3px;
}
.tag-item .tag-color { width: 10px; height: 10px; border-radius: 50%; }
.tag-item .tag-name { font-size: 13px; font-weight: 500; color: var(--sierra-text); }
.tag-item .tag-remove { background: none; border: none; color: var(--sierra-text-muted); cursor: pointer; font-size: 14px; }
.tag-item .tag-remove:hover { color: var(--sierra-red); }

/* ============================================================
   BULK ACTIONS
   ============================================================ */
.bulk-actions {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--sierra-navy); border: none;
    border-radius: var(--radius-lg); padding: 12px 24px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 4px 20px rgba(26,26,26,0.35); z-index: 1600;
    color: #fff;
}

/* ============================================================
   COMPOSE
   ============================================================ */
.compose-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.compose-tabs .tab-btn { border: 1px solid var(--sierra-border); border-radius: 4px; }
.compose-tabs .tab-btn.active { border-color: var(--sierra-navy); background: rgba(26,26,26,0.06); color: var(--sierra-navy); }
.char-count { font-size: 11px; color: var(--sierra-text-muted); text-align: right; display: block; }

.autocomplete-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--sierra-white); border: 1px solid var(--sierra-border);
    border-radius: 4px; max-height: 200px; overflow-y: auto;
    z-index: 10; box-shadow: var(--shadow-lg);
}
.autocomplete-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    transition: background 0.15s; color: var(--sierra-text);
}
.autocomplete-item:hover { background: var(--sierra-gray-light); }

/* ============================================================
   DEAL DETAIL GRID
   ============================================================ */
.deal-detail-grid { display: flex; gap: 20px; }
.deal-main { flex: 2; }
.deal-sidebar { flex: 1; }
.deal-sidebar h4 { font-size: 12px; text-transform: uppercase; color: var(--sierra-text-muted); margin: 16px 0 8px; letter-spacing: 0.5px; font-weight: 600; }
.deal-sidebar h4:first-child { margin-top: 0; }
.detail-card { padding: 10px; background: var(--sierra-gray-light); border-radius: 4px; font-size: 13px; border: 1px solid var(--sierra-border); }
.mini-feed { max-height: 200px; overflow-y: auto; font-size: 12px; color: var(--sierra-text-muted); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--sierra-text-muted) !important; }
.text-success { color: var(--sierra-green) !important; }
.text-danger { color: var(--sierra-red) !important; }
.text-warning { color: var(--sierra-yellow) !important; }
.hidden { display: none !important; }

/* ============================================================
   AUTOMATION STYLES — Sierra style
   ============================================================ */
.auto-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab-pills {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.tab-pill {
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid var(--sierra-border);
    background: var(--sierra-white);
    color: var(--sierra-text-secondary);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-pill:hover { border-color: var(--sierra-navy); color: var(--sierra-navy); }
.tab-pill.active { background: var(--sierra-navy); color: #fff; border-color: var(--sierra-navy); }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input { display: none; }
.toggle-switch .toggle-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc; border-radius: 11px; cursor: pointer; transition: 0.3s;
}
.toggle-switch .toggle-slider::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--sierra-green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.rule-block {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin: 1px 2px;
}

.rule-block.trigger { background: var(--sierra-blue-light); color: var(--sierra-blue); }
.rule-block.criteria { background: var(--sierra-yellow-light); color: #b8860b; }
.rule-block.action { background: var(--sierra-green-light); color: var(--sierra-green); }
.rule-block.no-criteria { background: var(--sierra-gray-light); color: var(--sierra-gray); }

/* ============================================================
   THEME TOGGLE — hide in Sierra theme
   ============================================================ */
.theme-toggle-btn { display: none !important; }

/* ============================================================
   ERROR MESSAGE
   ============================================================ */
.error-message {
    background: var(--sierra-red-light);
    color: var(--sierra-red);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(220,38,38,0.2);
}

/* ============================================================
   LOGIN PAGE — Sierra style
   ============================================================ */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sierra-bg);
    flex-direction: column;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--sierra-border);
}

.login-logo img {
    max-height: 72px;
    width: auto;
    object-fit: contain;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--sierra-text);
}

.login-subtitle {
    text-align: center;
    color: var(--sierra-text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

.login-footer a { color: var(--sierra-navy); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .kanban-column { min-width: 180px; width: 180px; }
    .comm-layout { flex-direction: column; height: auto; }
    .comm-list-panel { width: 100%; }
    .deal-detail-grid { flex-direction: column; }
    .settings-layout { flex-direction: column; }
    .settings-tabs { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .sierra-topnav .nav-links a { padding: 0 10px; font-size: 11px; }
}

@media (max-width: 768px) {
    .sierra-topnav {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
    }
    .sierra-topnav .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-top: 8px;
    }
    .sierra-topnav .nav-search { width: 160px; }
    .content-area { padding: 16px; max-width: 100vw; }
    .kanban-column { min-width: 160px; width: 160px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .slide-panel { width: 100%; }
    .modal { width: 95%; max-width: none; }
    .filters-bar { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   DIALER WIDGET BOTTOM BAR — override colors for Sierra
   ============================================================ */
#dialerWidget .dialer-full-bar {
    background: var(--sierra-navy-dark) !important;
    border-top: 3px solid var(--sierra-orange) !important;
}

#dialerWidget .dialer-lead-panel {
    background: var(--sierra-navy) !important;
    border-right-color: rgba(255,255,255,0.1) !important;
}

/* Lead panel text — must be light on dark navy */
#dialerWidget .dialer-lead-name {
    color: #ffffff !important;
}
#dialerWidget .dialer-lead-phone {
    color: rgba(255,255,255,0.75) !important;
}
#dialerWidget .dialer-lead-sub {
    color: rgba(255,255,255,0.6) !important;
}
#dialerWidget .dialer-open-link {
    color: rgba(255,255,255,0.5) !important;
}
#dialerWidget .dialer-open-link:hover {
    color: var(--sierra-orange) !important;
}

#dialerWidget .dialer-avatar {
    background: linear-gradient(135deg, var(--sierra-orange), #991b1b) !important;
    border-color: rgba(220,38,38,0.4) !important;
}

#dialerWidget .dialer-call-panel {
    border-right-color: rgba(255,255,255,0.1) !important;
}

/* Pipeline track — must be visible on dark navy bg */
#dialerWidget .dp-bubble {
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.4) !important;
    color: rgba(255,255,255,0.8) !important;
}
#dialerWidget .dp-label {
    color: rgba(255,255,255,0.75) !important;
}
#dialerWidget .dp-connector {
    background: rgba(255,255,255,0.25) !important;
}
#dialerWidget .dp-node.dp-done .dp-bubble {
    background: var(--sierra-navy) !important;
    border-color: var(--sierra-orange) !important;
    color: #ffffff !important;
}
#dialerWidget .dp-node.dp-done .dp-label {
    color: var(--sierra-orange) !important;
}
#dialerWidget .dp-connector.dp-done {
    background: var(--sierra-orange) !important;
}
#dialerWidget .dp-node.dp-active .dp-bubble {
    background: #ffffff !important;
    border-color: var(--sierra-orange) !important;
    color: var(--sierra-navy-dark) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.3) !important;
}
#dialerWidget .dp-node.dp-active .dp-label {
    color: #ffffff !important;
    font-weight: 700 !important;
}

#dialerWidget .dial-chip {
    background: var(--sierra-navy) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.7) !important;
}

#dialerWidget .dial-chip i {
    color: var(--sierra-orange) !important;
}

#dialerWidget .dial-call-circle {
    background: var(--sierra-green) !important;
    border-color: rgba(40,167,69,0.4) !important;
    box-shadow: 0 4px 14px rgba(40,167,69,0.2) !important;
    animation: none !important;
}
#dialerWidget .dial-call-circle:hover {
    box-shadow: 0 6px 24px rgba(40,167,69,0.35) !important;
}

#dialerWidget .dialer-right-panel {
    background: var(--sierra-navy) !important;
    border-left-color: rgba(255,255,255,0.1) !important;
}

/* Right panel text — must be light on dark navy */
#dialerWidget .dialer-queue-bar {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 600 !important;
}
#dialerWidget .dialer-queue-bar strong {
    color: #ffffff !important;
    font-size: 12px !important;
}
#dialerWidget #dialerLeadStatus {
    background: rgba(220,38,38,0.15) !important;
    color: var(--sierra-orange) !important;
    border-color: rgba(220,38,38,0.4) !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    padding: 3px 10px !important;
}
#dialerWidget #dialerNotes {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
}
#dialerWidget #dialerNotes::placeholder {
    color: rgba(255,255,255,0.35) !important;
}
#dialerWidget .dial-action-btn {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.7) !important;
}
#dialerWidget .dial-action-btn:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.3) !important;
}
#dialerWidget .dial-action-btn.btn-save-next {
    background: var(--sierra-orange) !important;
    border-color: var(--sierra-orange) !important;
    color: #ffffff !important;
}
#dialerWidget .dial-action-btn.btn-skip {
    color: rgba(245,158,11,0.8) !important;
    border-color: rgba(245,158,11,0.25) !important;
}
#dialerWidget .dialer-chrome-btn {
    color: rgba(255,255,255,0.5) !important;
}
#dialerWidget .dialer-chrome-btn:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,0.1) !important;
}
#dialerWidget .dialer-chrome-btn.close-btn:hover {
    color: #ef4444 !important;
    background: rgba(239,68,68,0.15) !important;
}

/* Center panel call-action buttons (Mute/Hold) */
#dialerWidget .dial-call-action-btn {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.8) !important;
}
#dialerWidget .dial-call-action-btn:hover {
    background: rgba(255,255,255,0.18) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.35) !important;
}
#dialerWidget .dial-call-action-btn.btn-active-mute {
    background: rgba(220,38,38,0.15) !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}
#dialerWidget .dial-call-action-btn.btn-active-hold {
    background: rgba(245,158,11,0.15) !important;
    border-color: #f59e0b !important;
    color: #fde68a !important;
}

/* Disposition & tag section on dark bg */
#dialerWidget .disp-btn {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.7) !important;
}
#dialerWidget .disp-btn:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.35) !important;
}
#dialerWidget .dialer-tag-chip {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.7) !important;
}
#dialerWidget .dialer-tag-chip:hover {
    background: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
}
#dialerWidget .dialer-tag-chip.tag-selected {
    background: var(--sierra-orange) !important;
    border-color: var(--sierra-orange) !important;
    color: #ffffff !important;
}
#dialerWidget .dialer-tag-input {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #ffffff !important;
}
#dialerWidget .dialer-tag-add-btn {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.7) !important;
}

/* Mini bar — dark theme */
#dialerWidget .dialer-mini-bar {
    background: var(--sierra-navy-dark) !important;
    border-top-color: var(--sierra-orange) !important;
}
#dialerWidget .dialer-mini-info {
    color: #ffffff !important;
}
#dialerWidget .dialer-mini-phone {
    color: rgba(255,255,255,0.6) !important;
}
#dialerWidget .dial-mini-icon {
    color: rgba(255,255,255,0.5) !important;
}
#dialerWidget .dial-mini-icon:hover {
    color: #ffffff !important;
}
#dialerWidget .dial-mini-action {
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.7) !important;
}
#dialerWidget .dial-mini-action:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #ffffff !important;
}

/* ============================================================
   AUTOMATION EDIT PAGE — Sierra style overrides
   ============================================================ */
.rule-section {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.rule-section-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--sierra-border);
}

.rule-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.rule-section.triggers .rule-section-icon { background: var(--sierra-blue-light); color: var(--sierra-blue); }
.rule-section.triggers .rule-section-header { background: rgba(59,130,246,0.04); }
.rule-section.criteria .rule-section-icon { background: var(--sierra-yellow-light); color: #b8860b; }
.rule-section.criteria .rule-section-header { background: rgba(255,193,7,0.04); }
.rule-section.actions .rule-section-icon { background: var(--sierra-green-light); color: var(--sierra-green); }
.rule-section.actions .rule-section-header { background: rgba(40,167,69,0.04); }

.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sierra-border-light);
}

.rule-item:last-child { border-bottom: none; }

.add-rule-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--sierra-navy);
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.add-rule-btn:hover { background: var(--sierra-gray-light); }

.option-card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.freq-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.freq-option:hover { background: var(--sierra-gray-light); }

.status-toggle-large {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Picker grid for automation editor */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.picker-card {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.picker-card:hover {
    border-color: var(--sierra-navy);
    background: rgba(26,26,26,0.03);
}

.picker-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--sierra-green-light);
    color: var(--sierra-green);
}

.picker-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--sierra-text);
    margin-bottom: 4px;
}

.picker-card p {
    font-size: 12px;
    color: var(--sierra-text-muted);
    line-height: 1.4;
}

/* ============================================================
   REPORTING / ANALYTICS — Sierra style
   ============================================================ */
.report-tabs {
    display: flex;
    border-bottom: 1px solid var(--sierra-border);
    background: var(--sierra-white);
    margin-bottom: 20px;
}

.report-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    color: var(--sierra-text-secondary);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.report-tab:hover { color: var(--sierra-text); }
.report-tab.active { color: var(--sierra-navy); border-bottom-color: var(--sierra-navy); font-weight: 600; }

.date-range-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.date-range-bar label { color: var(--sierra-text-secondary); font-weight: 500; font-size: 13px; }

.rpt-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.rpt-kpi {
    background: var(--sierra-white);
    border: 1px solid var(--sierra-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
}

/* ============================================================
   FOOTER BAR — Sierra style
   ============================================================ */
.sierra-footer {
    background: var(--sierra-navy);
    color: rgba(255,255,255,0.6);
    padding: 10px 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.sierra-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.sierra-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Copy input */
.copy-input { display: flex; gap: 8px; }
.copy-input input { flex: 1; font-family: 'Consolas', monospace; font-size: 12px; }

/* Webhook URLs */
.webhook-urls { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* Upload file items */
.upload-files { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.upload-file-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--sierra-gray-light); border-radius: 4px; font-size: 13px;
    border: 1px solid var(--sierra-border);
}

/* ============================================================
   CUSTOM CONFIRM MODAL
   ============================================================ */
.crm-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: confirmFadeIn 0.2s ease;
}

.crm-confirm-overlay.closing {
    animation: confirmFadeOut 0.2s ease forwards;
}

@keyframes confirmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes confirmFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.crm-confirm-modal {
    background: var(--sierra-white);
    border-radius: var(--radius-lg, 8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 360px;
    max-width: 440px;
    animation: confirmSlideIn 0.2s ease;
}

.crm-confirm-overlay.closing .crm-confirm-modal {
    animation: confirmSlideOut 0.2s ease forwards;
}

@keyframes confirmSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes confirmSlideOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.crm-confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sierra-border);
}

.crm-confirm-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sierra-text);
}

.crm-confirm-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--sierra-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.crm-confirm-close:hover {
    background: var(--sierra-gray-light);
    color: var(--sierra-text);
}

.crm-confirm-body {
    padding: 24px 20px;
}

.crm-confirm-body p {
    margin: 0;
    font-size: 14px;
    color: var(--sierra-text-secondary);
    line-height: 1.5;
}

.crm-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--sierra-border);
    background: var(--sierra-gray-light);
    border-radius: 0 0 var(--radius-lg, 8px) var(--radius-lg, 8px);
}

.crm-confirm-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.crm-confirm-cancel {
    background: var(--sierra-white);
    color: var(--sierra-text);
    border: 1px solid var(--sierra-border);
}

.crm-confirm-cancel:hover {
    background: var(--sierra-border-light);
}

.crm-confirm-ok {
    background: var(--sierra-navy);
    color: #fff;
}

.crm-confirm-ok:hover {
    background: var(--sierra-navy-light);
}

.crm-confirm-ok.danger {
    background: var(--sierra-red);
}

.crm-confirm-ok.danger:hover {
    background: #b91c1c;
}


/* ============================================
   COMFORTABLE DENSITY MODE  (Sierra-style)
   Bigger, easier-to-read UI — added 2026-05-01
   ============================================ */

/* Base size bump: 14 -> 15 cascades to everything sized in rem/em. */
html { font-size: 15px; }

/* Page headings */
.page-title, h1.page-title, .sierra-page h1 { font-size: 22px !important; font-weight: 700; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* Tables — taller rows, larger names, clearer status text */
table.data-table, table.lead-table, .table, table { font-size: 14px; }
table.data-table th, .table th, table th {
    font-size: 12px !important;
    letter-spacing: .04em;
    padding: 12px 14px !important;
    color: #374151;
    background: #f9fafb;
}
table.data-table td, .table td, table td {
    padding: 14px 14px !important;
    vertical-align: middle;
}
table.data-table tr, .table tr { border-bottom: 1px solid #e5e7eb; }

/* Lead name / primary text in lists */
.lead-name, .lead-row .name, .gs-name, .lead-info .name, td .name,
.lead-list-name, .pipeline-card .lead-name {
    font-size: 15px !important;
    font-weight: 600;
}
.lead-meta, .lead-row .meta, .gs-meta, .lead-sub, .muted-meta {
    font-size: 12.5px !important;
    color: #6b7280;
}

/* Status / priority pills */
.status-badge, .priority-badge, .badge, .pill, .tag-pill {
    font-size: 12px !important;
    padding: 4px 10px !important;
    font-weight: 600;
    border-radius: 4px;
}

/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-danger, button.btn-sm, .btn-sierra {
    font-size: 14px !important;
    padding: 8px 16px !important;
    font-weight: 600;
}
.btn-sm { font-size: 13px !important; padding: 6px 12px !important; }
.btn-lg { font-size: 16px !important; padding: 10px 20px !important; }

/* Form inputs */
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=search], input[type=date], select, textarea,
.form-control {
    font-size: 14px !important;
    padding: 9px 12px !important;
    line-height: 1.4;
}
label, .form-label { font-size: 13px !important; font-weight: 600; color: #374151; }

/* Modal headers / dialog titles */
.modal-header, .modal-title { font-size: 17px !important; font-weight: 700; }

/* Cards (dashboard tiles, stats) */
.card, .stat-card, .kpi-card { font-size: 14px; }
.stat-value, .kpi-value, .metric-value { font-size: 26px !important; font-weight: 700; }
.stat-label, .kpi-label, .metric-label { font-size: 12px !important; color: #6b7280; }

/* Top nav — keep it tight but bump readability slightly */
.sierra-topnav .nav-links a { font-size: 12.5px; }

/* Sidebar / filter buttons */
.filter-btn, .tab-btn, .pill-btn {
    font-size: 13px !important;
    padding: 7px 14px !important;
}

/* Toast notifications (so they're not tiny) */
.toast, .crm-toast { font-size: 14px !important; padding: 12px 18px !important; }


/* ============================================
   COMFORTABLE DENSITY MODE  (Sierra-style)
   Bigger, easier-to-read UI — added 2026-05-01
   ============================================ */

/* Base size bump: 14 -> 15 cascades to everything sized in rem/em. */
html { font-size: 15px; }

/* Page headings */
.page-title, h1.page-title, .sierra-page h1 { font-size: 22px !important; font-weight: 700; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* Tables — taller rows, larger names, clearer status text */
table.data-table, table.lead-table, .table, table { font-size: 14px; }
table.data-table th, .table th, table th {
    font-size: 12px !important;
    letter-spacing: .04em;
    padding: 12px 14px !important;
    color: #374151;
    background: #f9fafb;
}
table.data-table td, .table td, table td {
    padding: 14px 14px !important;
    vertical-align: middle;
}
table.data-table tr, .table tr { border-bottom: 1px solid #e5e7eb; }

/* Lead name / primary text in lists */
.lead-name, .lead-row .name, .gs-name, .lead-info .name, td .name,
.lead-list-name, .pipeline-card .lead-name {
    font-size: 15px !important;
    font-weight: 600;
}
.lead-meta, .lead-row .meta, .gs-meta, .lead-sub, .muted-meta {
    font-size: 12.5px !important;
    color: #6b7280;
}

/* Status / priority pills */
.status-badge, .priority-badge, .badge, .pill, .tag-pill {
    font-size: 12px !important;
    padding: 4px 10px !important;
    font-weight: 600;
    border-radius: 4px;
}

/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-danger, button.btn-sm, .btn-sierra {
    font-size: 14px !important;
    padding: 8px 16px !important;
    font-weight: 600;
}
.btn-sm { font-size: 13px !important; padding: 6px 12px !important; }
.btn-lg { font-size: 16px !important; padding: 10px 20px !important; }

/* Form inputs */
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=search], input[type=date], select, textarea,
.form-control {
    font-size: 14px !important;
    padding: 9px 12px !important;
    line-height: 1.4;
}
label, .form-label { font-size: 13px !important; font-weight: 600; color: #374151; }

/* Modal headers / dialog titles */
.modal-header, .modal-title { font-size: 17px !important; font-weight: 700; }

/* Cards (dashboard tiles, stats) */
.card, .stat-card, .kpi-card { font-size: 14px; }
.stat-value, .kpi-value, .metric-value { font-size: 26px !important; font-weight: 700; }
.stat-label, .kpi-label, .metric-label { font-size: 12px !important; color: #6b7280; }

/* Top nav — keep it tight but bump readability slightly */
.sierra-topnav .nav-links a { font-size: 12.5px; }

/* Sidebar / filter buttons */
.filter-btn, .tab-btn, .pill-btn {
    font-size: 13px !important;
    padding: 7px 14px !important;
}

/* Toast notifications (so they're not tiny) */
.toast, .crm-toast { font-size: 14px !important; padding: 12px 18px !important; }


/* === SIERRA-MATCH SIZE BUMP (2026-05-01 v2) === */
html { font-size: 16px; }
body { font-size: 16px; }

.page-title, h1.page-title, .sierra-page h1 { font-size: 26px !important; }
h2 { font-size: 20px !important; }
h3 { font-size: 17px !important; }

table.data-table, table.lead-table, .table, table { font-size: 15px !important; }
table.data-table th, .table th, table th {
    font-size: 13px !important;
    padding: 14px 16px !important;
}
table.data-table td, .table td, table td {
    padding: 16px !important;
}

.lead-name, .lead-row .name, .gs-name, .lead-info .name, td .name,
.lead-list-name, .pipeline-card .lead-name {
    font-size: 16px !important;
}
.lead-meta, .lead-row .meta, .gs-meta, .lead-sub, .muted-meta {
    font-size: 13.5px !important;
}

.status-badge, .priority-badge, .badge, .pill, .tag-pill {
    font-size: 13px !important;
    padding: 5px 12px !important;
}

.btn, .btn-primary, .btn-secondary, .btn-danger, button.btn-sm, .btn-sierra {
    font-size: 15px !important;
    padding: 10px 18px !important;
}
.btn-sm { font-size: 14px !important; padding: 7px 14px !important; }
.btn-lg { font-size: 17px !important; padding: 12px 22px !important; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=search], input[type=date], select, textarea,
.form-control {
    font-size: 15px !important;
    padding: 11px 14px !important;
}
label, .form-label { font-size: 14px !important; }

.modal-header, .modal-title { font-size: 19px !important; }

.stat-value, .kpi-value, .metric-value { font-size: 30px !important; }
.stat-label, .kpi-label, .metric-label { font-size: 13px !important; }

.sierra-topnav .nav-links a { font-size: 13.5px !important; }

.filter-btn, .tab-btn, .pill-btn {
    font-size: 14px !important;
    padding: 9px 16px !important;
}

.toast, .crm-toast { font-size: 15px !important; padding: 14px 20px !important; }

/* tabs and section headers commonly seen in Sierra */
.tab, .nav-tabs a, .tab-link { font-size: 14px !important; }
.section-title, .panel-title, .card-title { font-size: 16px !important; font-weight: 700; }


/* === SIERRA-MATCH SIZE BUMP (2026-05-01 v2) === */
html { font-size: 16px; }
body { font-size: 16px; }

.page-title, h1.page-title, .sierra-page h1 { font-size: 26px !important; }
h2 { font-size: 20px !important; }
h3 { font-size: 17px !important; }

table.data-table, table.lead-table, .table, table { font-size: 15px !important; }
table.data-table th, .table th, table th {
    font-size: 13px !important;
    padding: 14px 16px !important;
}
table.data-table td, .table td, table td {
    padding: 16px !important;
}

.lead-name, .lead-row .name, .gs-name, .lead-info .name, td .name,
.lead-list-name, .pipeline-card .lead-name {
    font-size: 16px !important;
}
.lead-meta, .lead-row .meta, .gs-meta, .lead-sub, .muted-meta {
    font-size: 13.5px !important;
}

.status-badge, .priority-badge, .badge, .pill, .tag-pill {
    font-size: 13px !important;
    padding: 5px 12px !important;
}

.btn, .btn-primary, .btn-secondary, .btn-danger, button.btn-sm, .btn-sierra {
    font-size: 15px !important;
    padding: 10px 18px !important;
}
.btn-sm { font-size: 14px !important; padding: 7px 14px !important; }
.btn-lg { font-size: 17px !important; padding: 12px 22px !important; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=search], input[type=date], select, textarea,
.form-control {
    font-size: 15px !important;
    padding: 11px 14px !important;
}
label, .form-label { font-size: 14px !important; }

.modal-header, .modal-title { font-size: 19px !important; }

.stat-value, .kpi-value, .metric-value { font-size: 30px !important; }
.stat-label, .kpi-label, .metric-label { font-size: 13px !important; }

.sierra-topnav .nav-links a { font-size: 13.5px !important; }

.filter-btn, .tab-btn, .pill-btn {
    font-size: 14px !important;
    padding: 9px 16px !important;
}

.toast, .crm-toast { font-size: 15px !important; padding: 14px 20px !important; }

/* tabs and section headers commonly seen in Sierra */
.tab, .nav-tabs a, .tab-link { font-size: 14px !important; }
.section-title, .panel-title, .card-title { font-size: 16px !important; font-weight: 700; }


/* === SHRINK SEARCH BAR + TIGHTEN NAV (2026-05-01 v3) === */
.sierra-topnav .nav-search { width: 150px !important; margin-right: 10px !important; }
@media (max-width:1700px) { .sierra-topnav .nav-search { width: 130px !important; } }
@media (max-width:1500px) { .sierra-topnav .nav-search { width: 110px !important; } }
@media (max-width:1300px) { .sierra-topnav .nav-search { width: 90px !important; min-width: 80px !important; } }
.sierra-topnav .nav-search input { padding: 6px 6px !important; font-size: 12.5px !important; }
.sierra-topnav .nav-links a { font-size: 13px !important; padding: 0 8px !important; }
@media (max-width:1500px) { .sierra-topnav .nav-links a { font-size: 12px !important; padding: 0 6px !important; } }


/* === SHRINK SEARCH BAR + TIGHTEN NAV (2026-05-01 v3) === */
.sierra-topnav .nav-search { width: 150px !important; margin-right: 10px !important; }
@media (max-width:1700px) { .sierra-topnav .nav-search { width: 130px !important; } }
@media (max-width:1500px) { .sierra-topnav .nav-search { width: 110px !important; } }
@media (max-width:1300px) { .sierra-topnav .nav-search { width: 90px !important; min-width: 80px !important; } }
.sierra-topnav .nav-search input { padding: 6px 6px !important; font-size: 12.5px !important; }
.sierra-topnav .nav-links a { font-size: 13px !important; padding: 0 8px !important; }
@media (max-width:1500px) { .sierra-topnav .nav-links a { font-size: 12px !important; padding: 0 6px !important; } }

/* === SEAMLESS PAGE TRANSITIONS (2026-05-01 v5) ===
   Pre-paint themed background instantly so there's no white flash. */
html { background: #f5f5f5; }
html, body { background-color: #f5f5f5; }

.sierra-topnav { contain: layout style; }
.sierra-topnav .nav-links a i,
.sierra-topnav .nav-links a .fa,
.sierra-topnav .nav-links a [class*='fa-'] {
    display: inline-block;
    min-width: 14px;
    text-align: center;
}

.sierra-topnav .nav-links a {
    transition: background 120ms ease, color 120ms ease;
}

/* Subtle 100ms fade — short enough to feel instant, smooth enough to mask reflow */
.main-content, .content-area, main {
    animation: contentFadeIn 100ms ease-out both;
}
@keyframes contentFadeIn {
    from { opacity: 0.5; }
    to   { opacity: 1; }
}

.sierra-topnav { animation: none !important; opacity: 1 !important; transform: none !important; }
body { animation: none !important; }