/* ============================================
   TERGOMEDIA CRM - COMPLETE STYLES
   Matching accounting.tergomedia.com exactly
   ============================================ */

:root {
    --black: #151515;
    --bg: #111111;
    --card: #1a1a1a;
    --card-border: #2a2a2a;
    --card-hover: #222222;
    --yellow: #f9ca00;
    --yellow-hover: #e5b800;
    --yellow-dim: rgba(249, 202, 0, 0.15);
    --yellow-dim2: rgba(249, 202, 0, 0.05);
    --yellow-border: rgba(249, 202, 0, 0.25);
    --white: #ffffff;
    --gray-100: #f0f0f0;
    --gray-200: #cccccc;
    --gray-300: #aaaaaa;
    --gray-400: #999999;
    --gray-500: #666666;
    --gray-600: #444444;
    --gray-700: #333333;
    --gray-800: #222222;
    --gray-900: #1a1a1a;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --purple: #8b5cf6;
    --purple-bg: rgba(139, 92, 246, 0.12);
    --orange: #f59e0b;
    --orange-bg: rgba(245, 158, 11, 0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--white);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--yellow); text-decoration: none; }
a:hover { color: var(--yellow-hover); }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gray-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* Modal scrollbar — yellow thumb matching accounting app */
.modal::-webkit-scrollbar { width: 8px; }
.modal::-webkit-scrollbar-track { background: var(--card); }
.modal::-webkit-scrollbar-thumb { background: var(--yellow); border-radius: 4px; }
.modal::-webkit-scrollbar-thumb:hover { background: var(--yellow-hover); }

/* ============================================
   NAVIGATION - matches accounting app exactly
   Single row: logo, links, +New, user
   ============================================ */

.nav {
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: var(--card-border); /* #2a2a2a — matches accounting app */
    border-bottom: 1px solid var(--yellow-border); /* yellow-tinted border */
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px;
}

.nav-logo {
    height: 36px;
    margin-right: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex: 1;
    align-items: center;
}

.nav-link {
    padding: 6px 16px;
    font-size: 14px;
    color: var(--gray-300);
    border-radius: 6px;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.nav-link:hover { color: var(--white); background: var(--gray-800); }
.nav-link.active {
    background: var(--yellow);
    color: var(--black);
    font-weight: 600;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gray-700);
    color: var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}
.nav-avatar:hover { background: var(--gray-600); }

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--gray-700);
    border-radius: 8px;
    color: var(--gray-300);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.nav-user-btn:hover { border-color: var(--gray-500); color: var(--white); }
.nav-user-btn .user-icon { font-size: 16px; }

/* Mobile nav tabs (below header, matching accounting app) */
.mobile-nav {
    display: none;
    background: var(--card-border); /* #2a2a2a — same as nav */
    border-top: 1px solid var(--gray-700);
    padding: 8px;
}
.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0;
    color: var(--gray-400);
    font-size: 18px;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
}
.mobile-nav-item span { font-size: 10px; font-weight: 500; }
.mobile-nav-item.active { 
    background: var(--yellow); 
    color: var(--black);
}
.mobile-nav-item.create-btn {
    background: var(--green);
    color: white;
}
.mobile-nav-item.create-btn span { font-weight: 700; }

@media (max-width: 768px) {
    .nav { height: auto; flex-wrap: wrap; padding: 12px 16px; }
    .nav-links { display: none; }
    .nav-right { display: none; }
    .mobile-nav { display: block; }
    .main { padding-bottom: 16px; }
}

/* ============================================
   DROPDOWNS
   ============================================ */

.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    background: var(--card-border); /* #2a2a2a — matching accounting app */
    border: 1px solid var(--gray-600);
    border-radius: var(--radius-sm);
    min-width: 160px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    z-index: 200;
    overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--gray-200);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.dropdown-item:hover { background: rgba(0,0,0,0.3); color: var(--white); }
.dropdown-header {
    padding: 10px 16px 6px;
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dropdown-divider { border-top: 1px solid var(--card-border); margin: 4px 0; }

/* ============================================
   LAYOUT
   ============================================ */

.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px;
}

/* Standalone cards (direct children of main) get bottom margin */
.main > .card { margin-bottom: 24px; }
.main > .card:last-child { margin-bottom: 0; }

/* Remove bottom margin from last grid/row in main */
.main > .stats-row:last-child,
.main > .grid-2:last-child,
.main > .detail-grid:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
    .main { padding: 16px; }
}

/* ============================================
   BUTTONS - matching accounting app
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--yellow);
    color: var(--black);
}
.btn-primary:hover { background: var(--yellow-hover); color: var(--black); }

.btn-secondary {
    background: var(--gray-800);
    color: var(--gray-200);
    border: 1px solid var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-700); color: var(--white); }

.btn-outline {
    background: transparent;
    color: var(--gray-300);
    border: 1px solid var(--gray-600);
}
.btn-outline:hover { border-color: var(--gray-400); color: var(--white); }

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

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--card);
    border: 1px solid rgba(249, 202, 0, 0.1); /* subtle yellow border like accounting */
    border-radius: 12px; /* rounded-xl */
    padding: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ============================================
   TABLES - matching accounting app
   Yellow headers, gold border, clean rows
   ============================================ */

.table-wrap {
    border: 1px solid var(--yellow-border);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--yellow);
    background: rgba(249, 202, 0, 0.06);
    border-bottom: 1px solid var(--yellow-border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--gray-200);
    border-bottom: 1px solid var(--card-border);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover {
    background: var(--card-hover);
}

tbody tr.clickable { cursor: pointer; }

/* ============================================
   FORMS
   ============================================ */

.form-input, .form-select {
    width: 100%;
    padding: 9px 14px;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--yellow);
}
.form-input::placeholder { color: var(--gray-500); }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

textarea.form-input { resize: vertical; min-height: 60px; }

.form-label {
    display: block;
    font-size: 11px;
    color: var(--yellow);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group { margin-bottom: 14px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-300);
    margin: 16px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

/* ============================================
   TOOLBAR - search + filter + buttons on ONE ROW
   ============================================ */

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar .form-input,
.toolbar .form-select {
    width: auto;
    min-width: 0;
}

.toolbar .search-input {
    flex: 1;
    max-width: 300px;
    min-width: 160px;
}

.toolbar .form-select {
    width: 150px;
    flex-shrink: 0;
}

.toolbar-spacer {
    flex: 1;
}

@media (max-width: 640px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .search-input { max-width: 100%; }
    .toolbar .form-select { width: 100%; }
    .toolbar-spacer { display: none; }
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--white);
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 640px) {
    .page-header { flex-direction: column; }
    .page-title { font-size: 22px; }
}

/* ============================================
   STATS ROW
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: rgba(42, 42, 42, 0.5); /* bg-tg-gray/50 matching accounting */
    border: 1px solid rgba(249, 202, 0, 0.1); /* border-tg-yellow/10 */
    border-radius: 12px; /* rounded-xl */
    padding: 20px;
}
.stat-card.yellow { border-color: var(--yellow-border); }
.stat-card.green { border-color: rgba(34, 197, 94, 0.25); }
.stat-card.red { border-color: rgba(239, 68, 68, 0.25); }
.stat-card.clickable { cursor: pointer; transition: var(--transition); }
.stat-card.clickable:hover { border-color: var(--yellow); background: rgba(42, 42, 42, 0.8); }

.stat-label { font-size: 12px; color: var(--gray-400); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; }

@media (max-width: 640px) {
    .stats-row { grid-template-columns: 1fr; } /* Stack on mobile like accounting */
    .stat-value { font-size: 24px; }
}

/* ============================================
   BADGES - matching accounting app style
   ============================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-active { background: var(--green-bg); color: var(--green); }
.badge-prospect { background: var(--yellow-dim); color: var(--yellow); }
.badge-inactive { background: var(--gray-800); color: var(--gray-400); }
.badge-archived { background: var(--red-bg); color: var(--red); }

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    padding-top: 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; }

.modal {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Modal input styling — matching accounting app */
.modal .form-input,
.modal .form-select,
.modal textarea.form-input {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--gray-600);
}
.modal .form-input:focus,
.modal .form-select:focus,
.modal textarea.form-input:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(249, 202, 0, 0.1);
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0.5rem;
        padding-top: 1rem;
    }
    .modal {
        max-height: calc(100vh - 2rem);
    }
    .modal .form-input,
    .modal .form-select,
    .modal textarea.form-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
    .modal .form-row {
        grid-template-columns: 1fr;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--yellow-border); /* yellow-tinted border like accounting */
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 1;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title { font-size: 18px; font-weight: 700; color: var(--yellow); }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--gray-300);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: rgba(249, 202, 0, 0.1); color: var(--yellow); }

.modal-body { padding: 24px; }

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }

/* ============================================
   LOADING
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-700);
    border-top-color: var(--yellow);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}
.empty-state-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-state-text { font-size: 14px; color: var(--gray-400); }

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    padding: 10px 18px;
    font-size: 13px;
    color: var(--gray-400);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: var(--transition);
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

/* ============================================
   DETAIL GRID
   ============================================ */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .detail-grid, .grid-2 { grid-template-columns: 1fr; }
}

/* ============================================
   INFO GRID (detail pages)
   ============================================ */

.info-grid { display: flex; flex-direction: column; gap: 0; }
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--card-border);
    gap: 16px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--gray-400); font-size: 13px; min-width: 120px; flex-shrink: 0; }
.info-value { color: var(--white); font-size: 13px; text-align: right; word-break: break-word; }

/* ============================================
   TIMELINE
   ============================================ */

.timeline { list-style: none; padding: 0; }
.timeline-item {
    position: relative;
    padding: 8px 0 8px 20px;
    border-left: 2px solid var(--card-border);
    margin-left: 6px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-500);
}
.timeline-item.note::before { background: var(--blue); }
.timeline-item.call::before { background: var(--green); }
.timeline-item.email::before { background: var(--orange); }
.timeline-item.meeting::before { background: var(--purple); }
.timeline-item.contact_created::before, .timeline-item.company_created::before { background: var(--yellow); }
.timeline-item.contact_merged::before, .timeline-item.company_merged::before { background: var(--red); }
.timeline-item.link_created::before { background: var(--green); }
.timeline-title { font-size: 13px; color: var(--white); }
.timeline-desc { font-size: 12px; color: var(--gray-300); margin-top: 4px; white-space: pre-wrap; }
.timeline-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* ============================================
   SEARCH RESULTS (link modals)
   ============================================ */

.search-results {
    max-height: 240px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
}
.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--card-hover); }

/* ============================================
   DUPLICATE DETECTION
   ============================================ */

.dup-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

/* ============================================
   PIPELINE / KANBAN
   ============================================ */

.pipeline {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
}
.pipeline-stage {
    min-width: 260px;
    max-width: 300px;
    flex-shrink: 0;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 12px;
}
.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}
.stage-name { font-weight: 600; font-size: 13px; }
.stage-count { font-size: 12px; color: var(--gray-400); background: var(--gray-800); padding: 2px 8px; border-radius: 10px; }
.stage-deals { display: flex; flex-direction: column; gap: 8px; }
.deal-card {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: grab;
    transition: var(--transition);
}
.deal-card:hover { border-color: var(--gray-600); }
.deal-title { font-size: 13px; font-weight: 500; }
.deal-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.deal-value { font-size: 12px; color: var(--yellow); margin-top: 4px; font-family: monospace; }

/* ============================================
   IMPORT
   ============================================ */

.drop-zone {
    border: 2px dashed var(--gray-600);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--yellow);
    background: var(--yellow-dim2);
}
.drop-zone-text { color: var(--gray-400); font-size: 14px; }

.import-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--gray-300);
    border-bottom: 1px solid var(--card-border);
}
.import-result-row.error { background: var(--red-bg); }
.import-result-row.skip { background: var(--yellow-dim2); }

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ============================================
   LOGIN
   ============================================ */

.login-bg {
    min-height: calc(100vh - 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image:
        linear-gradient(rgba(249,202,0,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(249,202,0,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}
.login-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-top: 3px solid var(--yellow);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

/* ============================================
   TAGS
   ============================================ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.tag .tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 13px;
    line-height: 1;
    margin-left: 2px;
}
.tag .tag-remove:hover { opacity: 1; }
.tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ============================================
   MERGE FIELD PICKER
   ============================================ */

.merge-grid {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    gap: 0;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.merge-grid .merge-header {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--yellow);
    background: rgba(249, 202, 0, 0.06);
    border-bottom: 1px solid var(--card-border);
}
.merge-grid .merge-field-label {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--gray-400);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    background: var(--gray-900);
}
.merge-grid .merge-cell {
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: background 0.15s;
}
.merge-cell:hover { background: var(--card-hover); }
.merge-cell.selected {
    background: var(--yellow-dim);
    outline: 2px solid var(--yellow);
    outline-offset: -2px;
}

/* Deal card tags */
.deal-tags { margin-top: 6px; }
.deal-tags .tags-wrap { gap: 3px; }
.deal-tags .tag { font-size: 10px; padding: 1px 6px; }

/* Contact action buttons row */
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ============================================
   UTILITIES
   ============================================ */

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--white); }

.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-gray { color: var(--gray-400); }
.text-red { color: var(--red); }
.text-mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 12px; }

/* ── Rich Text Editor ── */
.rte-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: var(--gray-800); border: 1px solid var(--card-border); border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.rte-btn { background: none; border: none; color: var(--gray-400); cursor: pointer; padding: 4px 7px; border-radius: 4px; font-size: 13px; line-height: 1; }
.rte-btn:hover { background: var(--gray-700); color: var(--yellow); }
.rte-select { background: var(--gray-900); color: var(--gray-400); border: 1px solid var(--card-border); border-radius: 4px; padding: 2px 4px; font-size: 12px; cursor: pointer; }
.rte-sep { width: 1px; height: 18px; background: var(--card-border); margin: 0 4px; }
.rte-color { width: 24px; height: 24px; border: none; cursor: pointer; background: none; padding: 0; }
.rte-body { background: var(--gray-900); border: 1px solid var(--card-border); border-top: none; border-radius: 0 0 8px 8px; padding: 12px 14px; color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.6; outline: none; overflow-y: auto; max-height: 400px; }
.rte-body:empty:not(:focus)::before { content: attr(data-placeholder); color: var(--gray-500); pointer-events: none; }
.rte-body a { color: var(--yellow); }
.rte-body h2 { font-size: 18px; font-weight: 600; margin: 8px 0 4px; }
.rte-body h3 { font-size: 15px; font-weight: 600; margin: 6px 0 4px; }
.rte-body ul, .rte-body ol { padding-left: 20px; margin: 4px 0; }
.email-sig { border-top: 1px solid var(--card-border); padding-top: 8px; margin-top: 12px; color: var(--gray-400); font-size: 13px; }

/* ── Dashboard stat sub-text ── */
.stat-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
/* ============================================
   DASHBOARD CHARTS
   ============================================ */

.chart-container {
    padding: 12px 0;
    min-height: 80px;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    justify-content: center;
    padding: 8px 12px 0;
    min-height: 160px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
}

.bar-value {
    font-size: 11px;
    color: var(--gray-400);
    margin-bottom: 4px;
    font-weight: 600;
}

.bar {
    width: 100%;
    min-width: 24px;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
}

.bar-label {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Donut Chart */
.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-300);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Horizontal Bars */
.h-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 4px;
}

.h-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.h-bar-label {
    font-size: 12px;
    color: var(--gray-300);
    min-width: 100px;
    white-space: nowrap;
    text-transform: capitalize;
}

.h-bar-track {
    flex: 1;
    height: 18px;
    background: var(--gray-800);
    border-radius: 4px;
    overflow: hidden;
}

.h-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.h-bar-value {
    font-size: 12px;
    color: var(--gray-400);
    min-width: 40px;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .bar-chart {
        gap: 4px;
    }
    .h-bar-label {
        min-width: 70px;
        font-size: 11px;
    }
}
/* ── Notification System ── */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--red, #ef4444);
    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;
    line-height: 1;
}

.nav-bell-btn:hover { background: rgba(255,255,255,0.08) !important; }

.notif-item:hover { background: rgba(249,202,0,0.08) !important; }

.notif-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-300);
    transition: var(--transition);
}

.notif-toggle:hover { border-color: var(--yellow); }

.notif-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--yellow);
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-bell-btn { padding: 6px !important; }
    #notification-panel { min-width: 300px !important; right: -40px !important; }
}

/* ── Bulk Selection ── */
.bulk-cb {
    width: 16px;
    height: 16px;
    accent-color: var(--yellow);
    cursor: pointer;
}

.bulk-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark-surface, #1a1a2e);
    border-top: 2px solid var(--yellow);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    gap: 12px;
}

@media (max-width: 768px) {
    .bulk-bar {
        flex-direction: column;
        padding: 12px 16px;
        gap: 10px;
    }
    .bulk-bar > div { width: 100%; justify-content: center; }
}