/* ==========================================================================
   No More Wholesale Pipeline — Styled to match No More Cafe Dashboard
   Dark mode, Cormorant Garamond + Raleway, gold/cream/brown palette
   ========================================================================== */

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

:root {
    --cream: #F8F7F4;
    --brown: #5F300D;
    --gold: #D6BB88;
    --gold-dim: rgba(214,187,136,0.35);
    --black: #0A0A09;
    --card: #131311;
    --card-hover: #191916;
    --border: #1F1F1C;
    --border-light: #2A2A26;
    --green: #6FCF7C;
    --red: #E57373;
    --amber: #E8C468;
    --muted: #6B6B65;
    --text: #C8C8C2;
    --teal: #7FAFA0;
    --purple: #B07CC3;
    --tan: #C3907F;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Raleway', -apple-system, sans-serif;
    --radius: 6px;
    --radius-lg: 10px;
}

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

html {
    font-size: 12.5px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: var(--black);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

/* ==========================================================================
   Layout: Sidebar + Content
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 3px;
    margin-bottom: 2px;
}

.sidebar-brand span {
    font-family: var(--font-body);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
}

.sidebar-nav {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.sidebar-nav li a:hover {
    color: var(--text);
    background: var(--card-hover);
}

.sidebar-nav li.active a {
    color: var(--gold);
    background: rgba(214,187,136,0.06);
    border-right: 2px solid var(--gold);
}

.sidebar-nav li a svg {
    opacity: 0.5;
    flex-shrink: 0;
}

.sidebar-nav li.active a svg,
.sidebar-nav li a:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.sending-from .label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 4px;
}

.sending-from .email {
    font-size: 10px;
    color: var(--gold-dim);
    word-break: break-all;
}

.content {
    margin-left: 220px;
    padding: 28px 32px;
    max-width: 1200px;
}

/* ==========================================================================
   Page Header
   ========================================================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--cream);
    letter-spacing: 1px;
}

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

.last-updated {
    font-size: 10px;
    color: var(--muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--card-hover);
    border-color: var(--muted);
}

.btn-primary {
    background: var(--gold);
    color: var(--black);
    border-color: var(--gold);
}

.btn-primary:hover {
    background: #c4a974;
    border-color: #c4a974;
}

.btn-outline {
    background: transparent;
}

.btn-sm { padding: 5px 12px; font-size: 10px; }
.btn-xs { padding: 3px 8px; font-size: 9.5px; }

/* ==========================================================================
   Pipeline Funnel
   ========================================================================== */

.pipeline-funnel {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 20px 0;
    margin-bottom: 24px;
    overflow-x: auto;
}

.funnel-stage {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    min-width: 90px;
}

.funnel-stage:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.funnel-stage.highlight {
    border-color: var(--gold-dim);
    background: rgba(214,187,136,0.04);
}

.stage-count {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--cream);
    line-height: 1.1;
}

.stage-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-top: 4px;
}

.funnel-arrow {
    color: var(--border-light);
    font-size: 16px;
    flex-shrink: 0;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--cream);
    line-height: 1.1;
}

.stat-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-top: 4px;
}

.stat-sub {
    font-size: 9px;
    color: var(--muted);
    margin-top: 2px;
}

/* ==========================================================================
   Section Cards (Dashboard grid)
   ========================================================================== */

.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.section-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.section-card h3 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--gold);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Email stats rows */
.email-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.email-stat-row:last-child { border-bottom: none; }

.email-stat-row span:first-child { color: var(--muted); }

.email-stat-val {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--cream);
}

/* Activity feed */
.activity-feed {
    max-height: 320px;
    overflow-y: auto;
}

.activity-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

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

.activity-action {
    font-weight: 600;
    color: var(--cream);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.activity-detail {
    color: var(--text);
    font-size: 11px;
}

.activity-detail-sub {
    color: var(--muted);
    font-size: 10px;
    margin-top: 1px;
}

.activity-time {
    color: var(--muted);
    font-size: 9.5px;
    margin-top: 2px;
}

.activity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    margin-top: 6px;
}

.activity-dot-imported { background: var(--teal); }
.activity-dot-stage_change { background: var(--amber); }
.activity-dot-enrolled { background: var(--purple); }
.activity-dot-email_sent { background: var(--gold); }
.activity-dot-replied { background: var(--green); }
.activity-dot-bounced { background: var(--red); }

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state, .empty-state-sm {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    padding: 24px;
}

.empty-state-sm { padding: 12px; font-size: 10px; }

.empty-state-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
}

.empty-state-card h3 {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--cream);
    margin-bottom: 8px;
}

.empty-state-card p {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 16px;
}

/* ==========================================================================
   Data Table (Contacts)
   ========================================================================== */

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table thead {
    background: rgba(214,187,136,0.04);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

.data-table th.sortable {
    cursor: pointer;
}

.data-table th.sortable:hover {
    color: var(--gold);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

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

.th-check { width: 36px; }

.contact-name {
    color: var(--cream);
    font-weight: 500;
    cursor: pointer;
}

.contact-name:hover {
    color: var(--gold);
    text-decoration: underline;
}

.title-cell {
    color: var(--muted);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-cell {
    color: var(--muted);
    font-size: 10px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 8.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

.tag-primary { background: rgba(107,207,124,0.12); color: var(--green); }
.tag-secondary { background: rgba(232,196,104,0.12); color: var(--amber); }
.tag-off { background: rgba(107,107,101,0.15); color: var(--muted); }

/* Stage badges */
.stage-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stage-new { background: rgba(200,200,194,0.1); color: var(--text); }
.stage-queued { background: rgba(127,175,160,0.12); color: var(--teal); }
.stage-contacted { background: rgba(214,187,136,0.12); color: var(--gold); }
.stage-replied { background: rgba(176,124,195,0.12); color: var(--purple); }
.stage-interested { background: rgba(107,207,124,0.12); color: var(--green); }
.stage-meeting { background: rgba(232,196,104,0.12); color: var(--amber); }
.stage-closed_won { background: rgba(107,207,124,0.2); color: var(--green); }
.stage-closed_lost { background: rgba(229,115,115,0.12); color: var(--red); }
.stage-unsubscribed { background: rgba(107,107,101,0.15); color: var(--muted); }
.stage-draft { background: rgba(200,200,194,0.1); color: var(--text); }
.stage-active { background: rgba(107,207,124,0.12); color: var(--green); }
.stage-paused { background: rgba(232,196,104,0.12); color: var(--amber); }
.stage-completed { background: rgba(214,187,136,0.12); color: var(--gold); }
.stage-scheduled { background: rgba(127,175,160,0.12); color: var(--teal); }
.stage-sent { background: rgba(214,187,136,0.12); color: var(--gold); }
.stage-delivered { background: rgba(214,187,136,0.15); color: var(--gold); }
.stage-opened { background: rgba(176,124,195,0.12); color: var(--purple); }
.stage-bounced { background: rgba(229,115,115,0.12); color: var(--red); }
.stage-failed { background: rgba(229,115,115,0.12); color: var(--red); }
.stage-sending { background: rgba(232,196,104,0.12); color: var(--amber); }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 0;
}

.page-info {
    font-size: 10px;
    color: var(--muted);
}

/* ==========================================================================
   Bulk Actions
   ========================================================================== */

.bulk-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: rgba(214,187,136,0.06);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
}

.bulk-label {
    font-size: 10px;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

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

.form-group label {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-input, .search-input, .filter-select, .stage-select, .notes-field {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text);
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus, .search-input:focus, .filter-select:focus, .notes-field:focus {
    border-color: var(--gold-dim);
}

.search-input {
    width: 220px;
}

.filter-select {
    width: auto;
    min-width: 120px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B6B65' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.stage-select {
    width: auto;
    padding: 4px 8px;
    font-size: 10px;
}

.notes-field {
    resize: vertical;
    min-height: 60px;
}

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

input[type="checkbox"] {
    accent-color: var(--gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    z-index: 1000;
    overflow-y: auto;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 560px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.modal-wide {
    width: 720px;
}

.modal-compose {
    width: 95vw;
    max-width: 1100px;
}

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

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--cream);
}

.btn-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
}

.btn-close:hover { color: var(--text); }
.btn-close-sm { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.btn-close-sm:hover { color: var(--red); }

.modal-body {
    padding: 24px;
}

/* ==========================================================================
   Contact Detail Modal
   ========================================================================== */

.contact-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h4 {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gold);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 11px;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--muted); }
.detail-row a { color: var(--gold); text-decoration: none; margin-right: 8px; }
.detail-row a:hover { text-decoration: underline; }

.email-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.email-subject { flex: 1; color: var(--text); }
.email-date { color: var(--muted); font-size: 10px; }

.activity-item-sm {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    color: var(--muted);
}

/* Dossier styles */
.dossier-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.dossier-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dossier-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}

.dossier-block {
    margin-bottom: 12px;
    padding: 10px;
    background: var(--black);
    border-radius: var(--radius);
    border-left: 2px solid var(--teal);
}

.dossier-block strong {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--teal);
    margin-bottom: 6px;
}

.dossier-block p {
    font-size: 11px;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
}

.draft-reply {
    background: rgba(214,187,136,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 6px;
}

.draft-reply pre {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text);
    white-space: pre-wrap;
    margin: 8px 0 0;
    line-height: 1.5;
}

/* ==========================================================================
   Sequences Page
   ========================================================================== */

.sequences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.sequence-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.sequence-card:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.seq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.seq-header h4 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--cream);
}

.seq-desc {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 12px;
}

.seq-stats {
    display: flex;
    gap: 16px;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.seq-actions {
    display: flex;
    gap: 8px;
}

/* Step editor */
.step-editor {
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}

.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.step-num {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
}

.step-delay {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--muted);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    padding: 6px 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar-btn {
    padding: 3px 10px;
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
}

.toolbar-btn:hover {
    background: var(--card-hover);
    border-color: var(--border);
}

.toolbar-btn.var-btn {
    color: var(--gold);
    font-size: 9px;
    letter-spacing: 0.3px;
}

.toolbar-sep {
    color: var(--border-light);
    font-size: 14px;
    margin: 0 2px;
}

/* Compose + Preview split */
.compose-preview-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.compose-side label {
    display: block;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.preview-side {
    display: flex;
    flex-direction: column;
}

.preview-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.preview-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--teal);
}

.preview-contact-select {
    font-family: var(--font-body);
    font-size: 9px;
    color: var(--text);
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    max-width: 200px;
}

.preview-email {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px;
    min-height: 220px;
    overflow-y: auto;
    max-height: 400px;
}

.preview-from {
    font-size: 11px;
    color: #333;
    font-weight: 600;
    margin-bottom: 2px;
}

.preview-to {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}

.preview-subj {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    min-height: 18px;
}

.preview-body-render {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.preview-body-render a {
    color: #1a73e8;
}

@media (max-width: 600px) {
    .compose-preview-split {
        grid-template-columns: 1fr;
    }
}

/* Rich text editor — Gmail-like compose */
.step-body-rich {
    width: 100%;
    min-height: 180px;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.6;
    color: var(--cream);
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    outline: none;
    overflow-y: auto;
    max-height: 400px;
}

.step-body-rich:focus {
    border-color: var(--gold-dim);
}

.step-body-rich:empty:before {
    content: attr(data-placeholder);
    color: var(--muted);
    pointer-events: none;
    white-space: pre-line;
}

.step-body-rich a {
    color: var(--gold);
    text-decoration: underline;
}

.step-body-rich b, .step-body-rich strong {
    color: var(--cream);
}

.step-delay-input {
    width: 48px;
    padding: 3px 6px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 3px;
    text-align: center;
}

/* Step preview in detail view */
.steps-preview {
    margin-bottom: 20px;
}

.step-preview {
    background: var(--black);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.step-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.step-delay-badge {
    font-size: 9px;
    color: var(--muted);
    background: rgba(200,200,194,0.06);
    padding: 2px 8px;
    border-radius: 3px;
}

.step-preview-subject {
    font-weight: 600;
    color: var(--cream);
    font-size: 12px;
    margin-bottom: 6px;
}

.step-preview-body {
    color: var(--muted);
    font-size: 10.5px;
    white-space: pre-wrap;
}

.step-connector {
    width: 2px;
    height: 16px;
    background: var(--border);
    margin-left: 20px;
}

/* Enrollment list */
.enroll-info {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 16px;
}

.enroll-info strong { color: var(--gold); }

.enroll-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.enroll-count-label {
    font-size: 10px;
    color: var(--gold);
    margin-left: auto;
}

.enroll-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.enroll-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.1s;
}

.enroll-item:hover { background: var(--card-hover); }
.enroll-item:last-child { border-bottom: none; }
.enroll-title { color: var(--muted); flex: 1; }
.enroll-company { color: var(--muted); font-size: 10px; }

.enrollments-list {
    max-height: 300px;
    overflow-y: auto;
}

.enrollment-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.enrollment-row span:first-child { flex: 1; }

.seq-detail-info {
    margin-bottom: 20px;
}

.seq-detail-info p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 8px;
}

/* ==========================================================================
   Inbox Page
   ========================================================================== */

.inbox-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.inbox-list-container {
    min-width: 0;
}

.inbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: all 0.2s;
}

.email-item:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.email-to {
    font-weight: 500;
    color: var(--cream);
    font-size: 12px;
}

.email-item-subject {
    font-size: 11px;
    color: var(--text);
    margin-bottom: 6px;
}

.email-item-meta {
    display: flex;
    gap: 16px;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 8px;
}

.email-item-actions {
    display: flex;
    gap: 6px;
}

.activity-sidebar {
    position: sticky;
    top: 28px;
}

.activity-sidebar h3 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--gold);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.activity-feed-full {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.activity-feed-full .activity-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-content {
    min-width: 0;
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ==========================================================================
   Settings Page
   ========================================================================== */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.settings-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-section h3 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--gold);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.settings-desc {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 12px;
}

.inline-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.small-input {
    width: 70px !important;
    text-align: center;
}

.warmup-grid, .day-weights-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.warmup-grid div, .day-weights-grid div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.warmup-label, .day-weights-grid span {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sig-preview-box {
    margin-top: 16px;
    padding: 12px;
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.save-status {
    font-size: 10px;
    color: var(--green);
}

.dupe-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.dupe-company {
    color: var(--cream);
    font-weight: 500;
}

.dupe-count {
    color: var(--amber);
    font-size: 9px;
    margin-left: 6px;
}

.dupe-names {
    color: var(--muted);
    font-size: 10px;
    margin-top: 2px;
}

/* ==========================================================================
   Kanban Board
   ========================================================================== */

.kanban-board {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: calc(100vh - 140px);
}

.kanban-column {
    flex: 1;
    min-width: 160px;
    max-width: 220px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.kanban-column.highlight {
    border-color: var(--gold-dim);
}

.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.kanban-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

.kanban-count {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--cream);
}

.kanban-cards {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

.kanban-cards.drag-over {
    background: rgba(214,187,136,0.04);
    outline: 2px dashed var(--gold-dim);
    outline-offset: -4px;
}

.kanban-card {
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.kanban-card:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.kanban-card[draggable="true"] {
    cursor: grab;
}

.kcard-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--cream);
    margin-bottom: 2px;
}

.kcard-title {
    font-size: 9px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kcard-company {
    font-size: 10px;
    color: var(--text);
    margin-top: 4px;
}

.kcard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.kcard-score {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--gold);
}

.kanban-empty {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    padding: 20px 8px;
}

.kanban-more {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    padding: 8px;
}

/* Smart Suggestions */
.suggestions-bar {
    background: rgba(214,187,136,0.06);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.suggestions-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold);
    margin-bottom: 8px;
}

.suggestion-item {
    display: block;
    font-size: 11px;
    color: var(--text);
    padding: 4px 0;
}

.suggestion-item b {
    color: var(--cream);
}

/* ==========================================================================
   Contact Timeline
   ========================================================================== */

.timeline {
    position: relative;
    padding-left: 20px;
}

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

.timeline-item {
    position: relative;
    padding: 8px 0 8px 16px;
    font-size: 11px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    border: 2px solid var(--card);
}

.timeline-item.tl-imported::before { background: var(--teal); }
.timeline-item.tl-enrolled::before { background: var(--purple); }
.timeline-item.tl-email_sent::before { background: var(--gold); }
.timeline-item.tl-email_opened::before { background: var(--amber); }
.timeline-item.tl-replied::before { background: var(--green); }
.timeline-item.tl-bounced::before { background: var(--red); }
.timeline-item.tl-stage_change::before { background: var(--teal); }
.timeline-item.tl-research_complete::before { background: var(--purple); }

.tl-action {
    font-weight: 600;
    color: var(--cream);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-detail {
    color: var(--text);
    margin-top: 2px;
}

.tl-time {
    color: var(--muted);
    font-size: 9px;
    margin-top: 2px;
}

/* ==========================================================================
   Verification Badges
   ========================================================================== */

.v-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 4px;
    vertical-align: middle;
}

.v-valid { background: rgba(107,207,124,0.15); color: var(--green); }
.v-invalid { background: rgba(229,115,115,0.15); color: var(--red); }
.v-risky { background: rgba(232,196,104,0.15); color: var(--amber); }
.v-unknown { background: rgba(107,107,101,0.15); color: var(--muted); }
.v-unverified { background: rgba(107,107,101,0.1); color: var(--muted); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
    .section-grid { grid-template-columns: 1fr; }
    .inbox-layout { grid-template-columns: 1fr; }
    .activity-sidebar { position: static; }
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .contact-detail-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Mobile: hamburger menu, collapsible sidebar, full-width content
   ========================================================================== */

.mobile-menu-btn {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* Hamburger button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 200;
        width: 40px;
        height: 40px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        color: var(--gold);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    /* Dark overlay behind sidebar */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar: hidden off-screen, slides in */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 240px;
    }

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

    /* Content takes full width */
    .content {
        margin-left: 0;
        padding: 60px 16px 24px;
        width: 100%;
        overflow-x: hidden;
    }

    /* Page headers */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h2 {
        font-size: 20px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Stats grid: 2 columns on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Tables: horizontal scroll */
    .table-container,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Cards */
    .stat-card {
        padding: 14px;
    }

    /* Modals: full screen on mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        margin: 5vh auto;
    }

    /* Pipeline kanban: horizontal scroll */
    .kanban-board {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }

    .kanban-column {
        min-width: 260px;
        flex-shrink: 0;
    }

    /* Inbox layout: stack */
    .inbox-layout {
        grid-template-columns: 1fr;
    }

    /* Filter selects: full width */
    .filter-select {
        width: 100%;
    }

    /* Buttons: bigger touch targets */
    .btn {
        min-height: 38px;
        padding: 8px 14px;
    }

    .btn-xs {
        min-height: 32px;
        padding: 6px 10px;
    }

    /* Compose/preview split: stack */
    .compose-preview-split {
        grid-template-columns: 1fr;
    }

    /* Contact detail grid */
    .contact-detail-grid {
        grid-template-columns: 1fr;
    }

    /* Sending health row */
    .sending-health {
        flex-direction: column;
        gap: 8px;
    }

    /* Funnel: stack vertically */
    .funnel-steps {
        flex-direction: column;
    }

    .funnel-step {
        min-width: auto;
    }

    /* Settings: single column, prevent overflow */
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-section {
        padding: 16px;
        overflow: hidden;
    }

    .settings-section .form-input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .inline-inputs {
        flex-wrap: wrap;
    }

    .warmup-grid,
    .day-weights-grid {
        flex-wrap: wrap;
    }

    .warmup-grid > div,
    .day-weights-grid > div {
        flex: 1 1 45%;
        min-width: 0;
    }

    .sig-preview-box {
        overflow-x: auto;
    }

    /* Save button row */
    .page-header .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .header-actions .btn {
        width: 100%;
    }
}
