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

:root {
    --black: #0a0a0a;
    --white: #fafafa;
    --accent: #c8ff00;
    --accent-dim: #a3cc00;
    --gray-100: #f0f0f0;
    --gray-200: #e0e0e0;
    --gray-500: #6b6b6b;
    --gray-700: #2a2a2a;
    --gray-800: #1a1a1a;
    --gray-900: #111111;
    --danger: #ff4444;
    --success: #00cc88;
    --warning: #ffaa00;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--black);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
}

.hidden { display: none !important; }

/* ============ AUTH ============ */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 16px;
    padding: 48px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.auth-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-logo span { color: var(--accent); }

.auth-sub {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 32px;
}

/* ============ INPUTS ============ */
.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--gray-900);
    border: 1px solid var(--gray-700);
    border-radius: 8px;
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--gray-500); }

.input + .input { margin-top: 12px; }

.textarea {
    min-height: 80px;
    resize: vertical;
}

.textarea-lg { min-height: 160px; }

select.input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-700);
}

.btn-ghost:hover { border-color: var(--gray-500); color: var(--white); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(255, 68, 68, 0.1); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-full { width: 100%; margin-top: 16px; }

.btn-icon {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 4px;
}

.btn-icon:hover { color: var(--white); }

/* ============ APP LAYOUT ============ */
.app {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 240px;
    background: var(--gray-900);
    border-right: 1px solid var(--gray-700);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
}

.sidebar-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: 16px;
}

.sidebar-logo span { color: var(--accent); }

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--gray-800);
    color: var(--white);
}

.nav-link.active {
    background: rgba(200, 255, 0, 0.08);
    color: var(--accent);
}

.nav-link-dim { font-size: 13px; }

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--gray-700);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-badge {
    font-size: 13px;
    color: var(--gray-500);
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 40px;
    max-width: 1100px;
}

/* ============ PAGE ============ */
.page-header {
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-sub {
    width: 100%;
    color: var(--gray-500);
    font-size: 14px;
    order: 2;
    margin-top: -8px;
}

.page-header .btn,
.page-header .header-actions {
    margin-left: auto;
}

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

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 24px;
}

.stat-card.accent {
    border-color: rgba(200, 255, 0, 0.2);
    background: linear-gradient(135deg, #141400, #1a1a0a);
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card.accent .stat-value { color: var(--accent); }

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ QUICK ACTIONS ============ */
.quick-actions h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.action-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.action-icon {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}

.action-card h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.action-card p {
    font-size: 13px;
    color: var(--gray-500);
}

/* ============ FORMS ============ */
.form-container {
    margin-bottom: 24px;
}

.form-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 24px;
}

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

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* ============ CARD LIST ============ */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-item {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.2s;
}

.card-item:hover { border-color: var(--gray-500); }

.card-item-content {
    flex: 1;
    min-width: 0;
}

.card-item-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.card-item-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.card-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============ TABLE ============ */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-700);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td { background: var(--gray-900); }

/* ============ STATUS BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new { background: rgba(200, 255, 0, 0.1); color: var(--accent); }
.badge-contacted { background: rgba(0, 204, 136, 0.1); color: var(--success); }
.badge-draft { background: rgba(107, 107, 107, 0.2); color: var(--gray-500); }
.badge-sent { background: rgba(0, 136, 255, 0.1); color: #0088ff; }
.badge-opened { background: rgba(255, 170, 0, 0.1); color: var(--warning); }
.badge-replied { background: rgba(200, 255, 0, 0.15); color: var(--accent); }
.badge-active { background: rgba(0, 204, 136, 0.1); color: var(--success); }

/* ============ EMAIL LIST ============ */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-item {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.email-item:hover {
    border-color: var(--gray-500);
}

.email-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.email-item-subject {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}

.email-item-preview {
    font-size: 13px;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-item-to {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

/* ============ CHECKBOX LIST ============ */
.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--gray-700);
    border-radius: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.checkbox-item:hover { background: var(--gray-900); }
.checkbox-item:last-child { border-bottom: none; }

.checkbox-item input { accent-color: var(--accent); }

.checkbox-item-label {
    font-size: 14px;
}

.checkbox-item-sub {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-meta {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-700);
}

.modal-body {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    margin-bottom: 24px;
    color: var(--gray-200);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--gray-500);
}

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

.empty-state p {
    font-size: 14px;
    max-width: 360px;
    margin: 0 auto;
}

/* ============ LOADING ============ */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
    font-size: 14px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-700);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    animation: slideUp 0.3s ease;
}

.toast-success { border-color: var(--success); color: var(--success); }
.toast-error { border-color: var(--danger); color: var(--danger); }

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        padding: 12px;
        overflow-x: auto;
    }

    .sidebar-logo { display: none; }

    .nav-links {
        flex-direction: row;
        gap: 4px;
    }

    .sidebar-footer { display: none; }

    .main-content {
        margin-left: 0;
        padding: 24px;
    }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .action-cards { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
