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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
    color: #1a1d29;
}

/* Split layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.left-panel {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, #fff 0%, #f0f2f5 100%);
    border-right: 1px solid #e2e4e8;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.brand {
    cursor: pointer;
    padding: 16px;
    border-radius: 12px;
    transition: background 0.2s;
}

.brand:hover {
    background: rgba(102, 126, 234, 0.1);
}

.brand-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 8px;
}

.brand-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #1a1d29;
    margin-bottom: 4px;
}

.brand-subtitle {
    font-size: 0.85em;
    color: #5a5f73;
}

.brand-description {
    font-size: 0.8em;
    color: #6b6f7f;
    margin-top: 8px;
    line-height: 1.35;
}

.how-it-works {
    margin-top: 16px;
    padding: 12px;
    background: #e8eaef;
    border-radius: 8px;
}

.how-it-works summary {
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #4a4f63;
}

.how-it-works-steps {
    margin-top: 10px;
    padding-left: 20px;
    font-size: 0.8em;
    color: #5a5f73;
    line-height: 1.6;
}

.how-it-works-steps li {
    margin-bottom: 6px;
}

.graph-storage-left {
    margin-top: 16px;
    padding: 12px;
    background: #e8eaef;
    border-radius: 8px;
}

.graph-storage-left summary {
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #4a4f63;
}

.graph-storage-content {
    margin-top: 10px;
    font-size: 0.8em;
    color: #5a5f73;
    line-height: 1.5;
}

.graph-storage-content h4 {
    font-size: 0.95em;
    margin: 10px 0 4px;
    color: #4a4f63;
}

.graph-storage-content ul {
    margin: 0 0 8px;
    padding-left: 18px;
}

.graph-storage-content li {
    margin-bottom: 6px;
}

.graph-storage-content code {
    font-size: 0.9em;
    background: rgba(0,0,0,0.06);
    padding: 1px 4px;
    border-radius: 3px;
}

.graph-storage-sub {
    margin-top: 8px;
    font-size: 0.95em;
    color: #4a4f63;
}

.graph-storage-note {
    margin-top: 10px;
    font-style: italic;
    font-size: 0.95em;
}

.graph-storage-future {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.graph-storage-future h4 {
    margin-top: 0;
}

.graph-storage-future p {
    margin-bottom: 0;
}

.right-panel {
    flex: 1;
    overflow: auto;
    background: #fff;
    padding: 32px;
}

.empty-view {
    max-width: 560px;
    margin: 80px auto;
    text-align: center;
    color: #5a5f73;
    font-size: 1.05em;
}

.empty-view strong {
    color: #667eea;
}

.onboarding-view .step {
    max-width: 640px;
}

.scan-view {
    max-width: 100%;
}

.scan-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.scan-view-header h2 {
    color: #1a1d29;
    font-size: 1.5em;
}

.link {
    color: #667eea;
    text-decoration: underline;
}

.smtp-status {
    margin-top: 24px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
}

.smtp-status.success {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid #4caf50;
}

.smtp-status.error {
    background: rgba(244, 67, 54, 0.2);
    color: #ff8a80;
    border: 1px solid #f44336;
}

.smtp-status-success,
.smtp-status-error {
    display: inline-block;
}

.smtp-status-muted {
    color: #888;
    font-size: 0.9em;
}

.step {
    padding: 30px;
}

.step h2 {
    color: #1a1d29;
    margin-bottom: 10px;
    font-size: 1.8em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.step-description {
    color: #5a5f73;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.5;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a4f63;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0d4dc;
    border-radius: 6px;
    font-size: 1em;
    background: #fff;
    color: #1a1d29;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group .form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.875rem;
    color: #6b7280;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

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

.checkbox-group {
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f2f5;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #1a1d29;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
}

#domainsList, #mailboxesList {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #e2e4e8;
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.domain-item, .mailbox-item {
    padding: 12px;
    margin: 8px 0;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e2e4e8;
    transition: all 0.3s;
}

.domain-item:hover, .mailbox-item:hover {
    background: #f5f6fa;
    border-color: #667eea;
}

.domain-item label, .mailbox-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.domain-item input[type="checkbox"], .mailbox-item input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

.domain-name, .mailbox-name {
    font-weight: 600;
    color: #1a1d29;
}

.domain-details, .mailbox-details {
    font-size: 0.9em;
    color: #5a5f73;
    margin-top: 5px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.1em;
}

/* Mailbox table (scan view) */
.mailbox-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e4e8;
}

.mailbox-table th,
.mailbox-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e4e8;
}

.mailbox-table th {
    background: #f5f6fa;
    color: #5a5f73;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mailbox-table tbody tr:hover {
    background: #f8f9fb;
}

.mailbox-table .col-mailbox { font-weight: 600; color: #1a1d29; }
.mailbox-table .col-status { white-space: normal; max-width: 280px; }
.mailbox-table .col-status .status-error-detail { font-size: 0.85em; color: #c62828; margin-top: 4px; word-break: break-word; }
.mailbox-table .col-message {
    font-size: 0.9em;
    color: #5a5f73;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* When send disabled: Message column is the main status — give it space and full text */
.mailbox-table.send-disabled-layout .col-message {
    max-width: none;
    min-width: 200px;
    width: 20%;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    vertical-align: top;
    padding-top: 12px;
    padding-bottom: 12px;
}

.mailbox-table .progress-cell {
    min-width: 180px;
}

.mailbox-table .progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Track: always visible block container */
.mailbox-table .progress-bar-track {
    display: block;
    width: 120px;
    height: 14px;
    background: #e8eaef;
    border: 1px solid #d0d4dc;
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Fill: block so width % works; min 2px when any progress */
.mailbox-table .progress-bar-fill {
    display: block;
    height: 100%;
    min-height: 14px;
    min-width: 2px;
    background: linear-gradient(90deg, #818cf8, #a78bfa);
    border-radius: 6px;
    transition: width 0.25s ease;
}

.mailbox-table .progress-label {
    font-size: 0.85em;
    color: #5a5f73;
    white-space: nowrap;
}

.mailbox-table .progress-pct {
    font-size: 0.85em;
    font-weight: 600;
    color: #4a4f63;
}

.mailbox-table .progress-mailbox-total {
    font-size: 0.75em;
    color: #8b8f9a;
    margin-top: 2px;
}

.mailbox-table .col-posture {
    white-space: nowrap;
}

.mailbox-table .posture-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
}

.mailbox-table .posture-badge.posture-ok {
    background: rgba(76, 175, 80, 0.25);
    color: #81c784;
    border: 1px solid #4caf50;
}

.mailbox-table .posture-badge.posture-low {
    background: rgba(158, 158, 158, 0.2);
    color: #5a5f73;
    border: 1px solid #757575;
}

.mailbox-table .posture-badge.posture-medium {
    background: rgba(255, 152, 0, 0.25);
    color: #ffb74d;
    border: 1px solid #ff9800;
}

.mailbox-table .posture-badge.posture-high {
    background: rgba(244, 67, 54, 0.25);
    color: #ff8a80;
    border: 1px solid #f44336;
}

.mailbox-table .posture-badge.posture-critical {
    background: rgba(183, 28, 28, 0.3);
    color: #ef5350;
    border: 1px solid #b71c1c;
}

.mailbox-table .col-threats {
    max-width: 320px;
    font-size: 0.85em;
}

/* When send is disabled, use space for threats: full descriptions and wider column */
.mailbox-table.send-disabled-layout .col-threats {
    max-width: none;
    min-width: 420px;
    width: 32%;
    font-size: 0.9em;
}

.mailbox-table.send-disabled-layout .col-sent,
.mailbox-table.send-disabled-layout .col-failed {
    display: none;
}

.mailbox-table.send-disabled-layout .col-graph-summary {
    min-width: 200px;
}

.mailbox-table .col-graph-summary-head {
    white-space: nowrap;
    color: #5a5f73;
}

.mailbox-table .col-graph-summary {
    font-size: 0.85em;
    color: #4a4f63;
    min-width: 200px;
    vertical-align: top;
    padding-top: 12px;
    padding-bottom: 12px;
}

.mailbox-table .graph-summary-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f8f9fb;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    padding: 10px 12px;
}

.mailbox-table .graph-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.mailbox-table .graph-summary-label {
    color: #5a5f73;
    font-size: 0.9em;
    flex-shrink: 0;
}

.mailbox-table .graph-summary-value {
    color: #1a1d29;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

.mailbox-table .graph-summary-row.graph-summary-time .graph-summary-value {
    font-size: 0.8em;
    font-weight: normal;
    color: #5a5f73;
}

.mailbox-table .graph-summary-none {
    color: #8b8fa3;
    font-style: italic;
}

/* Security summary (replaces raw graph counts when available) */
.mailbox-table .security-summary-block {
    padding: 4px 0;
    max-width: 420px;
}

.mailbox-table .security-summary-block .security-summary-verdict-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.mailbox-table .security-summary-block .security-verdict-badge {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 6px;
}

.mailbox-table .security-summary-block .security-verdict-badge-attention {
    background: rgba(220, 53, 69, 0.18);
    color: #b02a37;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.mailbox-table .security-summary-block .security-verdict-badge-review {
    background: rgba(253, 126, 20, 0.15);
    color: #c45c0a;
    border: 1px solid rgba(253, 126, 20, 0.35);
}

.mailbox-table .security-summary-block .security-verdict-badge-ok {
    background: rgba(40, 167, 69, 0.12);
    color: #1e7e34;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.mailbox-table .security-summary-block .security-severity-inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.mailbox-table .security-summary-block .security-summary-at-glance {
    font-size: 0.88em;
    color: #374151;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.mailbox-table .security-summary-block .security-key-findings {
    margin: 0 0 8px 0;
    padding-left: 18px;
    font-size: 0.85em;
    color: #4b5563;
    line-height: 1.45;
}

.mailbox-table .security-summary-block .security-key-findings li {
    margin-bottom: 2px;
}

.mailbox-table .security-summary-block .security-summary-heading {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5a5f73;
    margin-bottom: 6px;
}

.mailbox-table .security-summary-block .security-summary-line {
    font-size: 0.9em;
    color: #1a1d29;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e4e8;
    line-height: 1.35;
}

.mailbox-table .security-summary-block .security-severity-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.mailbox-table .security-summary-block .security-severity-pill {
    font-size: 0.8em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

.mailbox-table .security-summary-block .security-severity-high {
    background: rgba(220, 53, 69, 0.15);
    color: #b02a37;
}

.mailbox-table .security-summary-block .security-severity-med {
    background: rgba(253, 126, 20, 0.15);
    color: #c45c0a;
}

.mailbox-table .security-summary-block .security-severity-low {
    background: rgba(108, 117, 125, 0.15);
    color: #5a5f73;
}

.mailbox-table .security-summary-block .security-severity-sublabel {
    font-size: 0.75em;
    color: #6b7280;
    font-weight: 400;
    margin-left: 4px;
}

.mailbox-table .threats-summary-sublabel {
    font-size: 0.8em;
    color: #6b7280;
    font-weight: 400;
}

.mailbox-table .security-summary-block .security-high-callout {
    font-size: 0.85em;
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid #dc3545;
    margin-bottom: 8px;
    font-weight: 500;
}

.mailbox-table .security-summary-block .security-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    font-size: 0.85em;
    color: #5a5f73;
    margin-bottom: 8px;
}

.mailbox-table .security-summary-block .security-metric {
    white-space: nowrap;
}

.mailbox-table .security-summary-block .security-metric strong {
    color: #1a1d29;
}

.mailbox-table .security-summary-block .security-summary-details {
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.mailbox-table .security-summary-block .security-summary-details summary {
    cursor: pointer;
    color: #3498db;
    font-weight: 500;
}

.mailbox-table .security-summary-block .security-summary-details summary:hover {
    text-decoration: underline;
}

.mailbox-table .security-summary-block .security-summary-bullets {
    margin: 6px 0 0 0;
    padding-left: 18px;
    color: #5a5f73;
    line-height: 1.5;
}

.mailbox-table .security-summary-block .security-summary-bullets li {
    margin-bottom: 2px;
}

.mailbox-table .security-summary-block .anomaly-bullet-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #3498db;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}

.mailbox-table .security-summary-block .anomaly-bullet-btn:hover {
    text-decoration: underline;
}

.mailbox-table .security-summary-block .security-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mailbox-table .security-summary-block .btn-investigate {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
}

.mailbox-table .security-summary-block .btn-investigate:hover {
    background: #2980b9;
}

.mailbox-table .security-summary-block .graph-view-btn-secondary {
    background: transparent;
    color: #3498db;
    border: 1px solid #3498db;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.88em;
    cursor: pointer;
}

.mailbox-table .security-summary-block .graph-view-btn-secondary:hover {
    background: rgba(52, 152, 219, 0.08);
}

.mailbox-table .security-summary-block .security-severity-breakdown {
    font-size: 0.85em;
    font-weight: normal;
    color: #5a5f73;
}

.mailbox-table .threats-combined-note {
    font-size: 0.75em;
    color: #6b6f7f;
    margin-bottom: 4px;
}

.mailbox-table .threats-summary {
    font-size: 0.9em;
    color: #5a5f73;
    margin-bottom: 6px;
}

.mailbox-table .threats-section-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #4a5568;
    margin-top: 8px;
    margin-bottom: 2px;
}

.mailbox-table .threats-section-label:first-of-type {
    margin-top: 4px;
}

.mailbox-table .threats-none {
    color: #8b8fa3;
    font-style: italic;
}

.mailbox-table .threats-list {
    margin: 0;
    padding-left: 18px;
    color: #1a1d29;
}

.mailbox-table .threats-list li {
    margin-bottom: 4px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.mailbox-table .threat-item {
    display: block;
    flex: 1;
    min-width: 0;
}

.mailbox-table .threat-type {
    display: inline-block;
    margin-right: 6px;
}

.mailbox-table .threat-desc {
    white-space: normal;
    word-wrap: break-word;
    display: block;
    margin-top: 2px;
    line-height: 1.4;
    color: #4a4f63;
}

/* Full threat list: complete descriptions, more readable when send disabled */
.mailbox-table .threats-list-full li {
    display: block;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: #f8f9fb;
    border-left: 3px solid currentColor;
}

.mailbox-table .threats-list-full .threat-severity-dot {
    display: none;
}

.mailbox-table .threats-list-full .threat-item {
    display: block;
}

.mailbox-table .threats-list-full .threat-type {
    display: block;
    margin-bottom: 4px;
    font-size: 0.95em;
}

.mailbox-table .threats-list-full .threat-desc {
    margin-top: 4px;
    font-size: 0.9em;
    line-height: 1.45;
    color: #1a1d29;
}

.mailbox-table .threats-list-full .threat-count {
    margin-left: 6px;
    font-weight: normal;
}

.mailbox-table .threat-severity-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 6px;
}

.mailbox-table .threat-severity-critical .threat-severity-dot { background: #b71c1c; }
.mailbox-table .threat-severity-high .threat-severity-dot { background: #f44336; }
.mailbox-table .threat-severity-medium .threat-severity-dot { background: #ff9800; }
.mailbox-table .threat-severity-low .threat-severity-dot { background: #757575; }

.mailbox-table .threat-severity-critical { border-left: 3px solid #b71c1c; padding-left: 6px; }
.mailbox-table .threat-severity-high { border-left: 3px solid #f44336; padding-left: 6px; }
.mailbox-table .threat-severity-medium { border-left: 3px solid #ff9800; padding-left: 6px; }
.mailbox-table .threat-severity-low { border-left: 3px solid #8b8fa3; padding-left: 6px; }

/* Severity color on anomaly name (both compact and full list) */
.mailbox-table .threat-severity-critical .threat-type { color: #b71c1c; }
.mailbox-table .threat-severity-high .threat-type { color: #b71c1c; }
.mailbox-table .threat-severity-medium .threat-type { color: #e65100; }
.mailbox-table .threat-severity-low .threat-type { color: #5c5f6f; }

/* Full list: keep left border severity-colored (override currentColor) */
.mailbox-table .threats-list-full li.threat-severity-critical { border-left-color: #b71c1c; }
.mailbox-table .threats-list-full li.threat-severity-high { border-left-color: #f44336; }
.mailbox-table .threats-list-full li.threat-severity-medium { border-left-color: #ff9800; }
.mailbox-table .threats-list-full li.threat-severity-low { border-left-color: #8b8fa3; }

.mailbox-table .threat-count {
    color: var(--muted, #888);
    font-size: 0.9em;
    font-weight: normal;
}

.mailbox-table .threat-view-graph {
    font-size: 0.85em;
    margin-left: 8px;
    white-space: nowrap;
}
.mailbox-table .threat-view-graph:focus {
    outline: 1px dotted currentColor;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    display: none;
}

.error-message.show {
    display: block;
}

.status-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #4caf50;
}

.status-message p {
    margin-bottom: 10px;
}

.status-message p:last-child {
    margin-bottom: 0;
}

.status-summary {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    border: 1px solid #e2e4e8;
}

.status-summary-item {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 0.9em;
    color: #5a5f73;
    margin-bottom: 5px;
}

.status-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #1a1d29;
}

.status-value.success {
    color: #4caf50;
}

.status-value.error {
    color: #f44336;
}

.status-value.muted {
    color: #5a5f73;
    font-size: 0.95em;
}

.status-summary-send-disabled .status-value.muted {
    font-weight: normal;
}

.status-details {
    background: #fff;
    border: 1px solid #e2e4e8;
    border-radius: 6px;
    padding: 15px;
}

.status-details h3 {
    margin-bottom: 15px;
    color: #1a1d29;
}

.mailbox-status {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border-left: 4px solid #ccc;
}

.mailbox-status.in-progress {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.mailbox-status.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.mailbox-status.error {
    background: #ffebee;
    border-left-color: #f44336;
}

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

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.mailbox-status.in-progress .status-badge {
    background: #ffc107;
    color: #000;
}

.mailbox-status.success .status-badge {
    background: #4caf50;
    color: white;
}

.mailbox-status.error .status-badge {
    background: #f44336;
    color: white;
}

.mailbox-status-details {
    font-size: 0.9em;
    color: #666;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.mailbox-status-details .error-message {
    grid-column: 1 / -1;
    color: #f44336;
    font-weight: 500;
    margin-top: 5px;
}

.progress-container {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
    min-width: 45px;
    text-align: right;
}

.mailbox-status-details .status-message-text {
    grid-column: 1 / -1;
    color: #666;
    font-style: italic;
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    font-size: 0.9em;
}

.mailbox-status.in-progress .status-message-text {
    color: #ff9800;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

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

.btn-danger {
    background: #f44336;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s, opacity 0.3s;
}

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
}

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

.btn-danger-secondary {
    background: transparent;
    color: #c62828;
    border: 1px solid #e57373;
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-danger-secondary:hover:not(:disabled) {
    background: #ffebee;
    color: #b71c1c;
}
.btn-danger-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Scrollbar styling */
#domainsList::-webkit-scrollbar,
#mailboxesList::-webkit-scrollbar {
    width: 8px;
}

#domainsList::-webkit-scrollbar-track,
#mailboxesList::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 4px;
}

#domainsList::-webkit-scrollbar-thumb,
#mailboxesList::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

#domainsList::-webkit-scrollbar-thumb:hover,
#mailboxesList::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Investigation modal: message-first drill-down */
.investigation-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.investigation-modal.is-open {
    display: flex;
}

.investigation-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.investigation-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e4e8;
    max-width: 92vw;
    width: 900px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.investigation-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e4e8;
}

.investigation-title-wrap { flex: 1; min-width: 0; }

.investigation-modal-header h2 {
    font-size: 1.2em;
    color: #1a1d29;
    margin: 0 0 2px 0;
}

.investigation-modal-subtitle {
    font-size: 0.88em;
    color: #5a5f73;
    margin: 0;
}

.investigation-modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    color: #5a5f73;
    cursor: pointer;
    padding: 0 4px;
}

.investigation-modal-close:hover { color: #1a1d29; }

.investigation-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid #e2e4e8;
    background: #f8f9fb;
}

.investigation-tab {
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 0.95em;
    color: #5a5f73;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.investigation-tab:hover { color: #1a1d29; }

.investigation-tab.is-active {
    color: #3498db;
    font-weight: 600;
    border-bottom-color: #3498db;
}

.investigation-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.investigation-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 16px 20px;
}

.investigation-panel.is-active {
    display: flex;
}

.investigation-context-line {
    font-size: 0.88em;
    color: #4a5568;
    margin: 0 0 10px 0;
    padding: 8px 10px;
    background: #e8f4fc;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.investigation-context-line[style*="display: none"] { display: none !important; }

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

.investigation-filter-label {
    font-size: 0.9em;
    color: #4a5568;
}

.investigation-threat-filter {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9em;
    min-width: 160px;
}

.investigation-search {
    flex: 1;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95em;
}

.investigation-search:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.investigation-count {
    font-size: 0.9em;
    color: #5a5f73;
}

.investigation-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
}

.investigation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.investigation-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f1f3f5;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e2e4e8;
}

.investigation-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.investigation-table tbody tr {
    cursor: pointer;
}

.investigation-table tbody tr:hover {
    background: #f8f9fb;
}

.investigation-table tbody tr.investigation-row-selected {
    background: #e8f4fc;
}

.investigation-table .col-message { max-width: 360px; min-width: 120px; }
.investigation-table .col-message .investigation-msg-subject { display: block; font-weight: 500; color: #111; word-break: break-word; }
.investigation-table .col-message .investigation-msg-meta { display: block; font-size: 0.85em; color: #6b7280; margin-top: 2px; }
.investigation-table .col-threat { width: 140px; }
.investigation-table .col-cause { max-width: 320px; min-width: 100px; word-break: break-word; font-size: 0.9em; color: #374151; }
.investigation-table th.col-cause { white-space: nowrap; }
.investigation-cause-value { display: inline-block; max-width: 100%; }

.investigation-threat-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(220, 53, 69, 0.12);
    color: #b02a37;
    margin-right: 4px;
    margin-bottom: 2px;
}

.investigation-message-detail {
    margin-top: 12px;
    padding: 12px;
    background: #f1f3f5;
    border-radius: 8px;
    font-size: 0.88em;
    color: #374151;
    border-left: 4px solid #3498db;
}

.investigation-message-detail[aria-hidden="true"] {
    display: none;
}

.investigation-threat-details {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
}
.investigation-threat-detail-list {
    margin: 6px 0 0;
    padding-left: 20px;
    list-style: disc;
}
.investigation-threat-detail-type {
    font-weight: 600;
    color: #b02a37;
}
.investigation-threat-detail-value {
    color: #374151;
}
.investigation-threat-urls {
    margin: 4px 0 0 8px;
    padding-left: 16px;
    list-style: circle;
}
.investigation-high-risk-url {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9em;
    padding: 2px 6px;
    background: rgba(220, 53, 69, 0.15);
    color: #b02a37;
    border-radius: 4px;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.investigation-detail-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}
.investigation-detail-actions .btn {
    margin-right: 8px;
    margin-bottom: 4px;
}

.investigation-graph-intro {
    margin: 0 0 12px 0;
    color: #5a5f73;
    font-size: 0.95em;
}

/* Graph modal: hidden by default, shown when .is-open (no wrapper - matches Feb23) */
.graph-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.graph-modal.is-open {
    display: flex;
}

.graph-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.graph-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e4e8;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.graph-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e4e8;
}

.graph-modal-title-wrap {
    flex: 1;
    min-width: 0;
}

.graph-modal-header h2 {
    font-size: 1.15em;
    color: #1a1d29;
    margin: 0 0 4px 0;
}

.graph-context-summary {
    font-size: 0.9em;
    color: #4a5568;
    margin: 0 0 12px 0;
    padding: 8px 10px;
    background: #e8f4fc;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.graph-context-summary:empty {
    display: none;
}

.graph-oneliner {
    font-size: 0.9em;
    color: #374151;
    margin: 0 0 0.5em 0;
    line-height: 1.4;
}

.graph-oneliner:empty {
    display: none;
}

.graph-modal-subtitle {
    font-size: 0.9em;
    color: #5a5f73;
    margin: 0;
    line-height: 1.4;
}

.graph-modal-close {
    background: none;
    border: none;
    color: #5a5f73;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.graph-modal-close:hover {
    color: #1a1d29;
    background: #f0f2f5;
}

.graph-modal-body {
    padding: 16px 20px 20px;
    overflow: auto;
}

.graph-structure-explainer {
    margin-bottom: 12px;
}

.graph-structure-details {
    font-size: 0.9em;
    background: #f0f2f5;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    padding: 10px 14px;
}

.graph-structure-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #1a1d29;
}

.graph-structure-content {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e4e8;
    color: #4a4f63;
    line-height: 1.55;
}

.graph-structure-content p {
    margin-bottom: 8px;
}

.graph-structure-content ul {
    margin: 8px 0 12px 20px;
}

.graph-structure-content li {
    margin-bottom: 6px;
}

.graph-structure-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0;
    padding: 12px 16px;
    background: #fff;
    border: 1px dashed #c0c4cc;
    border-radius: 8px;
    font-size: 0.85em;
}

.graph-diagram-node {
    padding: 6px 10px;
    background: #e8f0fe;
    color: #1a1d29;
    border-radius: 6px;
    font-weight: 500;
}

.graph-diagram-edge {
    color: #667eea;
    font-weight: 600;
}

.graph-structure-note {
    font-size: 0.9em;
    color: #5a5f73;
    margin-top: 8px;
    margin-bottom: 0;
}

.graph-modal-legend {
    font-size: 0.9em;
    color: #4a4f63;
    font-weight: 500;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: #eef0f7;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.graph-legend-internal { color: #3498db; font-weight: 600; }
.graph-legend-external { color: #e74c3c; font-weight: 600; }

.graph-layout {
    display: flex;
    gap: 20px;
    min-height: 0;
}

.graph-canvas-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 400px;
    background: #f5f6fa;
    border-radius: 8px;
    overflow: hidden;
}

.graph-node-details {
    width: 280px;
    min-width: 240px;
    max-height: 480px;
    overflow-y: auto;
    background: #f8f9fb;
    border-radius: 8px;
    border: 1px solid #e2e4e8;
    padding: 14px;
}

.graph-node-details-placeholder {
    font-size: 0.9em;
    color: #6b6f7f;
    margin: 0;
}

.graph-node-details-content {
    font-size: 0.88em;
    color: #1a1d29;
}

.graph-node-details-content[aria-hidden="true"] {
    display: none;
}

.graph-node-details-content .detail-email {
    word-break: break-all;
    font-weight: 500;
    margin-bottom: 10px;
}

.graph-node-details-content .detail-context {
    font-size: 0.85em;
    color: #4a5568;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: #e8f4fc;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.graph-node-details-content .detail-type {
    color: #5a5f73;
    margin-bottom: 8px;
}

.graph-node-details-content .detail-stats {
    color: #4a4f63;
    margin-bottom: 12px;
}

.graph-node-details-content .detail-times {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #5a5f73;
}

.graph-node-details-content .detail-time {
    word-break: break-all;
}

.graph-node-details-content .detail-exchange {
    font-size: 0.85em;
    color: #5a5f73;
    margin-bottom: 12px;
}

.graph-node-details-content .detail-section {
    margin-top: 12px;
}

.graph-node-details-content .detail-section-title {
    font-weight: 600;
    color: #5a5f73;
    margin-bottom: 6px;
}

.graph-node-details-content .detail-connection-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.graph-node-details-content .detail-connection-list li {
    padding: 4px 0;
    border-bottom: 1px solid #e2e4e8;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.graph-node-details-content .detail-connection-list li:last-child {
    border-bottom: none;
}

.graph-node-details-content .detail-connection-addr {
    word-break: break-all;
    flex: 1;
}

.graph-node-details-content .detail-connection-msgs {
    color: #667eea;
    flex-shrink: 0;
}

.graph-reset-view {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    padding: 6px 12px;
    font-size: 0.8em;
    background: #fff;
    border: 1px solid #e2e4e8;
    border-radius: 6px;
    color: #5a5f73;
    cursor: pointer;
}

.graph-reset-view:hover {
    background: #f0f2f5;
    color: #1a1d29;
}

.graph-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.graph-node-details-content .detail-show-more {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.9em;
    color: #667eea;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.graph-node-details-content .detail-show-more:hover {
    text-decoration: underline;
}

.graph-node-details-content .detail-edge-loading,
.graph-node-details-content .detail-edge-empty {
    color: #6b6f7f;
    font-size: 0.9em;
    margin-top: 8px;
}

.graph-node-details-content .detail-edge-message-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.graph-node-details-content .detail-edge-msg {
    padding: 8px 0;
    border-bottom: 1px solid #e2e4e8;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.graph-node-details-content .detail-edge-msg:last-child {
    border-bottom: none;
}

.graph-node-details-content .detail-edge-subject {
    font-weight: 500;
    word-break: break-word;
}

.graph-node-details-content .detail-edge-date {
    font-size: 0.85em;
    color: #5a5f73;
}

.graph-node-details-content .detail-edge-mid {
    font-size: 0.8em;
    color: #6b6f7f;
    word-break: break-all;
}

.graph-view-btn {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.85em;
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
}

.graph-view-btn:hover {
    text-decoration: underline;
}

.graph-tooltip {
    position: absolute;
    pointer-events: none;
    background: #fff;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.85em;
    color: #1a1d29;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 10;
    visibility: hidden;
    white-space: pre-wrap;
    word-break: break-all;
}

.graph-tooltip[aria-hidden="false"] {
    visibility: visible;
}

.graph-tooltip .graph-tooltip-type {
    color: #5a5f73;
    font-size: 0.9em;
}

.graph-tooltip .graph-tooltip-stats {
    margin-top: 4px;
    color: #4a4f63;
}

/* Anomaly breakdown explanation modal (click a bullet to see what it means) */
.anomaly-explanation-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.anomaly-explanation-modal.is-open {
    display: flex;
}

.anomaly-explanation-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.anomaly-explanation-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e4e8;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.anomaly-explanation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e4e8;
}

.anomaly-explanation-header h2 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #1a1d29;
}

.anomaly-explanation-close {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    color: #6b6f7f;
    cursor: pointer;
    padding: 0 4px;
}

.anomaly-explanation-close:hover {
    color: #1a1d29;
}

.anomaly-explanation-body {
    padding: 16px 18px;
}

.anomaly-explanation-body p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.5;
    color: #4a4f63;
}

/* Toast for Destroy data success / feedback */
.feedback-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    transition: opacity 0.3s ease;
}
.feedback-toast.toast-success {
    background: #0d7d4d;
    color: #fff;
}
.feedback-toast.toast-error {
    background: #b91c1c;
    color: #fff;
}
