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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: #1f2937;
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    display: block;
}

.stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab:hover {
    color: #374151;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.table tr:hover {
    background-color: #f9fafb;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-live {
    background: #dcfce7;
    color: #166534;
}

.status-review {
    background: #fef3c7;
    color: #92400e;
}

.status-pending {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-approved {
    background: #dbeafe;
    color: #1e40af;
}

.status-rejected {
    background: #fee2e2;
    color: #dc2626;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    padding: 2rem;
    width: 90%;
    max-width: 700px;      /* ← Increased from 500px */
    max-height: 90vh;      /* ← Add this line */
    overflow-y: auto;      /* ← Add this line */
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.hidden {
    display: none;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
}

.text-center {
    text-align: center;
}

.login-form {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.search-box {
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.revenue-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.revenue-input input {
    flex: 1;
}

.search-box {
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

/* ========================================
   EMAIL MANAGEMENT STYLES
   ======================================== */

/* Email management actions in header */
.email-management-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Email stats grid */
.email-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.email-stat-card {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
}

.email-stat-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e0;
}

.email-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    display: block;
    margin-bottom: 0.5rem;
}

.email-stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Email filters */
.email-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: end;
}

.email-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.email-filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.email-filter-group .form-input {
    font-size: 0.875rem;
}

/* Email logs container */
.email-logs-container {
    position: relative;
    min-height: 400px;
}

.email-logs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
}

/* Email status badges */
.email-status-sent {
    background: #dcfce7;
    color: #166534;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.email-status-pending {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.email-status-failed {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* Email type badges */
.email-type-badge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.email-type-admin {
    background: #f3e8ff;
    color: #7c3aed;
}

.email-type-welcome {
    background: #ecfdf5;
    color: #059669;
}

.email-type-revenue {
    background: #fff7ed;
    color: #ea580c;
}

/* Retry count indicator */
.retry-count {
    font-weight: 600;
    color: #dc2626;
}

.retry-count.zero {
    color: #6b7280;
    font-weight: normal;
}

/* Test email preview */
.test-email-preview {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.test-email-preview p {
    margin: 0 0 0.5rem 0;
}

.test-email-preview #previewContent {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Email details modal content */
.email-details-section {
    margin-bottom: 1.5rem;
}

.email-details-section h4 {
    margin-bottom: 0.75rem;
    color: #374151;
    font-weight: 600;
}

.email-details-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.email-details-label {
    font-weight: 500;
    color: #6b7280;
}

.email-details-value {
    color: #1f2937;
}

.email-content-preview {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    white-space: pre-wrap;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .email-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .email-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .email-filter-group {
        min-width: auto;
    }
    
    .email-management-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

/* Add to styles.css - Security-focused styling */

/* Secure bank information section */
.secure-bank-section {
    position: relative;
}

.secure-bank-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border-radius: 6px 6px 0 0;
}

/* Decrypted information styling */
.decrypted-bank-info {
    background: linear-gradient(135deg, #fefcbf 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
    position: relative;
    overflow: hidden;
}

.decrypted-bank-info::after {
    content: 'SENSITIVE DATA';
    position: absolute;
    top: -25px;
    right: -60px;
    background: #dc2626;
    color: white;
    padding: 5px 80px;
    font-size: 0.75rem;
    font-weight: bold;
    transform: rotate(45deg);
    letter-spacing: 1px;
}

/* Security warning styling */
.security-warning {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Purpose selection styling */
.purpose-select {
    border: 2px solid #f59e0b !important;
    background: #fffbeb;
}

.purpose-select:focus {
    border-color: #d97706 !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1) !important;
}

/* Decrypt button styling */
.btn-decrypt {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-decrypt:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-decrypt:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Auto-hide timer styling */
.auto-hide-timer {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Copy button animation */
.btn-copy {
    transition: all 0.2s;
}

.btn-copy:active {
    transform: scale(0.95);
}

/* Modal content adjustments for security section */
.modal-content-large {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Security badge for sensitive data */
.sensitive-badge {
    background: #dc2626;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Audit trail styling */
.audit-entry {
    background: #f8f9fa;
    border-left: 4px solid #6b7280;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.audit-entry.recent {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .secure-bank-section {
        margin: 1rem -1rem;
        padding: 1rem;
        border-radius: 0;
    }
    
    .decrypted-bank-info {
        margin: 1rem -1rem;
        border-radius: 0;
    }
    
    .modal-content-large {
        width: 95%;
        margin: 2.5%;
        max-height: 95vh;
    }
}