:root {
    --bg-primary: #030712;
    --bg-secondary: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon { font-size: 1.5rem; }
.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    background: var(--gradient-primary);
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.upgrade-btn svg { width: 16px; height: 16px; }

.main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.page { display: none; animation: fadeIn 0.2s ease; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.time-range {
    display: flex;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 0.25rem;
}

.time-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.time-btn:hover { color: var(--text-primary); }
.time-btn.active {
    background: var(--accent-blue);
    color: white;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-green);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.pro-badge {
    padding: 0.5rem 1rem;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

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

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-badge {
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-link {
    font-size: 0.85rem;
    color: var(--accent-blue);
    text-decoration: none;
}

.card-link:hover { text-decoration: underline; }

.chart-container { height: 300px; }
.chart-container-sm { height: 250px; }

.mini-table {
    display: flex;
    flex-direction: column;
}

.mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.mini-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.75rem;
}

.mini-domain {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-cyan);
}

.mini-count {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.table-container { overflow-x: auto; }

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }

tr:hover td { background: rgba(59, 130, 246, 0.05); }

.table-domain {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

.table-count {
    font-family: var(--font-mono);
    font-weight: 600;
}

.table-asn {
    font-family: var(--font-mono);
    color: var(--accent-purple);
}

.search-container { margin-bottom: 2rem; }

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.email-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.email-detail {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-header {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.email-subject {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.email-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.email-meta-item { font-size: 0.85rem; }
.email-meta-label { color: var(--text-muted); margin-bottom: 0.25rem; }
.email-meta-value {
    font-family: var(--font-mono);
    word-break: break-all;
}

.email-body {
    flex: 1;
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    overflow-y: auto;
    background: var(--bg-primary);
}

.email-urls {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.email-urls h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.url-item {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-yellow);
    margin-bottom: 0.5rem;
    word-break: break-all;
}

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

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .stats-row { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 1rem; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.live-ticker {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.ticker-label {
    padding: 0.75rem 1rem;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: tickerPulse 2s infinite;
}

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

.ticker-content {
    flex: 1;
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
}

.ticker-item {
    display: inline-block;
    padding-right: 3rem;
    animation: tickerScroll 20s linear infinite;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.stat-value-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value-row span:first-child {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.delta-chip {
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.delta-chip.up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.delta-chip.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.delta-chip.neutral {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.sparkline {
    margin-top: 0.5rem;
    opacity: 0.8;
}

.stats-row.secondary {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 2rem;
}

.stat-card.mini {
    padding: 1rem 1.25rem;
}

.stat-card.mini .stat-icon {
    width: 40px;
    height: 40px;
}

.stat-card.mini .stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card.mini .stat-value {
    font-size: 1.5rem;
}

.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.15); color: #f97316; }

.vertical-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.vertical-badge.phish { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.vertical-badge.malware { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.vertical-badge.scam { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.vertical-badge.pharma { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.vertical-badge.crypto { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.vertical-badge.bec { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.vertical-badge.shipping { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }

.email-modal-3pane {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.email-detail-3pane {
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.email-detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-detail-body {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    flex: 1;
    overflow: hidden;
}

.email-pane {
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.email-pane:last-child {
    border-right: none;
}

.email-pane-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.email-field {
    margin-bottom: 1rem;
}

.email-field-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.email-field-value {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    word-break: break-all;
}

.email-body-content {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    height: calc(100% - 3rem);
    overflow-y: auto;
}

.url-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.url-list-item {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-yellow);
    word-break: break-all;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.8rem;
}

.attachment-icon {
    color: var(--accent-purple);
}

@media (max-width: 1000px) {
    .email-detail-body {
        grid-template-columns: 1fr;
    }
    .email-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

.app-footer {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.footer-logo { font-size: 1.1rem; }

.footer-name {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.footer-tag {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.footer-nav {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}

.footer-nav a:hover {
    color: var(--accent-blue);
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.footer-sep {
    color: var(--border-color);
}

.legal-card {
    padding: 0;
}

.legal-body {
    padding: 2rem 2.5rem;
    max-width: 880px;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 0.92rem;
}

.legal-body h2 {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

.legal-body h2:first-child {
    margin-top: 0;
}

.legal-body p {
    margin-bottom: 0.85rem;
}

.legal-body ul {
    margin: 0.5rem 0 0.85rem 1.2rem;
    padding-left: 0.8rem;
}

.legal-body li {
    margin-bottom: 0.4rem;
}

.legal-body code {
    background: var(--bg-tertiary, var(--bg-card));
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.legal-body strong {
    color: var(--text-primary);
}
