/* ─── RESET & BASE ──────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #22252f;
    --bg-input: #14161e;
    --border: #2a2d3a;
    --text: #e4e4e7;
    --text-muted: #8b8d98;
    --accent: #ff6b00;
    --accent-hover: #ff8533;
    --blue: #4a9eff;
    --green: #22c55e;
    --red: #ef4444;
    --purple: #a855f7;
    --orange: #ff6b00;
    --sidebar-width: 240px;
    --radius: 10px;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ─── SIDEBAR ──────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}
.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }
.logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
}
.nav-links {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
}
.nav-links li { margin-bottom: 2px; }
.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-links a:hover { background: var(--bg-hover); color: var(--text); }
.nav-links li.active a { background: var(--accent); color: white; }
.nav-links svg { width: 18px; height: 18px; flex-shrink: 0; }
.badge {
    background: var(--red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}
.badge-blue { background: var(--blue); }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}
.logout-btn {
    color: var(--text-muted);
    font-size: 13px;
}
.logout-btn:hover { color: var(--red); }

/* ─── MOBILE TOGGLE ────────────────────────────────── */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text);
}
.mobile-toggle svg { width: 22px; height: 22px; }

/* ─── CONTENT ──────────────────────────────────────── */
.content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 700; }
.page-desc { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ─── STATS GRID ───────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: rgba(74,158,255,0.15); color: var(--blue); }
.stat-icon.orange { background: rgba(255,107,0,0.15); color: var(--orange); }
.stat-icon.green { background: rgba(34,197,94,0.15); color: var(--green); }
.stat-icon.purple { background: rgba(168,85,247,0.15); color: var(--purple); }
.stat-number { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── CARDS ────────────────────────────────────────── */
.card-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 18px 20px 0;
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }

/* ─── TODAY STATS ──────────────────────────────────── */
.today-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
.today-label { font-size: 13px; color: var(--text-muted); }
.today-value { font-size: 18px; font-weight: 600; }
.today-value.red { color: var(--red); }
.today-value.green { color: var(--green); }
.today-value.highlight { color: var(--accent); }

/* ─── QUEUE ────────────────────────────────────────── */
.queue-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.queue-count { color: var(--text-muted); font-size: 14px; }
.queue-list { display: flex; flex-direction: column; gap: 12px; }
.queue-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: border-color 0.2s;
}
.queue-card:hover { border-color: var(--accent); }
.queue-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.queue-prospect { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.queue-email { color: var(--text-muted); font-size: 13px; }
.queue-card-subject { font-size: 14px; margin-bottom: 8px; }
.queue-card-preview {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    white-space: pre-wrap;
}
.queue-card-actions { display: flex; gap: 8px; }

/* ─── TAGS ─────────────────────────────────────────── */
.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-muted);
}
.tag-blue { background: rgba(74,158,255,0.15); color: var(--blue); }
.tag-green { background: rgba(34,197,94,0.15); color: var(--green); }
.tag-orange { background: rgba(255,107,0,0.15); color: var(--orange); }
.tag-red { background: rgba(239,68,68,0.15); color: var(--red); }
.tag-gray { background: var(--bg-hover); color: var(--text-muted); }
.tag-score { background: rgba(168,85,247,0.15); color: var(--purple); }
.tag-new { background: var(--accent); color: white; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.7; } }

/* ─── TABLE ────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.data-table th {
    background: var(--bg-hover);
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 10px 14px;
    font-size: 13px;
    border-top: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--bg-hover); }
.email-cell { font-size: 12px; color: var(--text-muted); }
.date-cell { font-size: 12px; color: var(--text-muted); }
.link-small { font-size: 12px; }
.red { color: var(--red); }
.green { color: var(--green); }

/* ─── RESPONSES ────────────────────────────────────── */
.responses-list { display: flex; flex-direction: column; gap: 10px; }
.response-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.response-card:hover { border-color: var(--blue); }
.response-card.unread { border-left: 3px solid var(--accent); background: rgba(255,107,0,0.03); }
.response-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}
.response-from { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.response-date { font-size: 12px; color: var(--text-muted); }
.response-email { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.response-subject { font-size: 14px; margin-bottom: 8px; }
.response-body {
    font-size: 13px;
    color: var(--text-muted);
    white-space: pre-wrap;
    line-height: 1.5;
}

/* ─── FILTERS ──────────────────────────────────────── */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filters-bar select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}
.leads-count { color: var(--text-muted); font-size: 13px; margin-left: auto; }

/* ─── PAGINATION ───────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* ─── BUTTONS ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn:hover { background: var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--green); color: white; border-color: var(--green); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── FORMS ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}
input[type="text"], input[type="password"], input[type="email"],
textarea, select, .input-full {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}
textarea { resize: vertical; line-height: 1.6; }

/* ─── MODAL ────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ─── DETAIL / ANALYSIS ────────────────────────────── */
.detail-info {
    display: grid;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg);
    border-radius: 8px;
}
.analysis-section {
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg);
    border-radius: 8px;
}
.analysis-section h3 { font-size: 14px; margin-bottom: 12px; color: var(--accent); }
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.analysis-item { font-size: 13px; }
.analysis-item strong { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; margin-bottom: 4px; }
.analysis-item.full { grid-column: 1 / -1; }
.score-big { font-size: 24px; font-weight: 700; color: var(--accent); }
.email-preview-section { margin-top: 12px; }
.email-preview-section h3 { font-size: 14px; margin-bottom: 12px; }
.email-field { margin-bottom: 12px; }
.email-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }

/* ─── SETTINGS ─────────────────────────────────────── */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.actions-list { display: flex; flex-direction: column; gap: 8px; }
.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.action-item:last-child { border-bottom: none; }
.action-info { flex: 1; }
.action-info strong { font-size: 13px; display: block; margin-bottom: 2px; }
.action-info p { font-size: 12px; color: var(--text-muted); margin: 0; }
.action-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 12px;
}
.action-status.pending { background: rgba(74,158,255,0.1); color: var(--blue); }
.action-status.success { background: rgba(34,197,94,0.1); color: var(--green); }
.action-status.error { background: rgba(239,68,68,0.1); color: var(--red); }
.help-text { font-size: 12px; color: var(--text-muted); }
.help-text code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-item { display: flex; justify-content: space-between; font-size: 13px; }
.info-label { color: var(--text-muted); }

/* ─── LOADING / EMPTY ──────────────────────────────── */
.loading { text-align: center; color: var(--text-muted); padding: 40px; }
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ─── ALERT ────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.1); color: var(--red); }

/* ─── LOGIN ────────────────────────────────────────── */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
}
.login-logo {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 4px;
}
.login-logo span { color: var(--accent); }
.login-sub {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 28px;
}

/* ─── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .card-row { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .analysis-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .mobile-toggle { display: block; }
    .content {
        margin-left: 0;
        padding: 20px;
        padding-top: 60px;
    }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .queue-card-header { flex-direction: column; }
    .queue-card-actions { flex-wrap: wrap; }
    .actions-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .modal { margin: 10px; max-height: 95vh; }
    .modal-overlay { padding: 10px; align-items: flex-start; }
    .page-header h1 { font-size: 20px; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .leads-count { margin-left: 0; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 14px; }
    .stat-number { font-size: 22px; }
}
