@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-deep: #0a0e17;
    --bg-base: #0d1219;
    --bg-surface: #151c28;
    --bg-surface-hover: #1a2332;
    --bg-elevated: #1e2a3a;
    --border: #1e2d3d;
    --border-light: #253446;
    --text-primary: #e2e8f0;
    --text-secondary: #8899aa;
    --text-muted: #5a6a7a;
    --accent: #00d4aa;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --accent-dim: #00a885;
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.15);
    --orange: #f59e0b;
    --orange-glow: rgba(245, 158, 11, 0.15);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.12);
    --green: #10b981;
    --purple: #8b5cf6;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.3), 0 12px 24px rgba(0,0,0,0.2);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

::selection {
    background: var(--accent);
    color: var(--bg-deep);
}

.navbar {
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-brand a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-brand .logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.nav-brand .brand-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

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

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--blue));
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    text-align: left;
    padding: 0.65rem 0.75rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

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

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

tbody td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--bg-surface-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-approved {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-high_alert, .badge-RecommendedAction\.HIGH_ALERT {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.badge-alert, .badge-RecommendedAction\.ALERT {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-watch, .badge-RecommendedAction\.WATCH {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-ignore, .badge-RecommendedAction\.IGNORE {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
}

.score {
    font-weight: 800;
    font-size: 1.1rem;
    font-family: 'JetBrains Mono', monospace;
}

.score-high {
    color: #f87171;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.score-medium {
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.score-low {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: var(--bg-deep);
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

.reasons-list {
    list-style: none;
    padding: 0;
}

.reasons-list li {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: background var(--transition);
}

.reasons-list li:hover {
    background: var(--bg-elevated);
}

.reasons-list li:last-child {
    border-bottom: none;
}

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

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.meta-item .value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.actions-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.section {
    margin-bottom: 2rem;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #60a5fa;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

input[type="text"],
input[type="search"],
input[type="number"],
select,
textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

label {
    color: var(--text-secondary);
}

#run-all-status {
    border-radius: var(--radius) !important;
    font-family: 'Inter', sans-serif;
    border: 1px solid var(--border);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-header h1 {
    margin-bottom: 0;
}

.run-all-btn {
    font-size: 0.95rem !important;
    padding: 0.55rem 1.5rem !important;
    background: linear-gradient(135deg, var(--accent), #00c49a) !important;
    color: var(--bg-deep) !important;
    box-shadow: 0 2px 12px rgba(0, 212, 170, 0.3);
    border: none;
}

.run-all-btn:hover {
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.45) !important;
    transform: translateY(-1px);
}

.auto-refresh-bar {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-refresh-bar a {
    color: var(--accent);
    font-weight: 500;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    .nav-links { flex-wrap: wrap; gap: 0.25rem; }
    .container { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.user-badge {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.75rem 0 0.25rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-form input {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dim));
    color: var(--bg-deep);
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}
