:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --primary-dark: #1e293b;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --card-bg: #ffffff;
    --body-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    margin: 0;
    color: #1e293b;
}

/* ============================================
   AUTH - Enterprise Login
   ============================================ */
.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #09090b;
    position: relative;
    overflow: hidden;
    padding: 24px;
}

/* Background effects */
.auth__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.auth__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 100%);
}

.auth__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}

.auth__glow--1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.15), transparent 70%);
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
}

.auth__glow--2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6,182,212,0.1), transparent 70%);
    bottom: -100px;
    right: -100px;
}

/* Container */
.auth__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

/* Logo */
.auth__logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth__logo-mark {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.1),
        0 8px 24px -4px rgba(59,130,246,0.3);
}

.auth__logo-name {
    font-size: 22px;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -0.5px;
}

/* Card */
.auth__card {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 36px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 20px 50px -12px rgba(0,0,0,0.5);
}

.auth__header {
    margin-bottom: 28px;
}

.auth__title {
    font-size: 20px;
    font-weight: 600;
    color: #fafafa;
    margin: 0 0 6px 0;
    letter-spacing: -0.3px;
}

.auth__subtitle {
    font-size: 14px;
    color: #71717a;
    margin: 0;
    font-weight: 400;
}

/* Form */
.auth__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth__label {
    font-size: 13px;
    font-weight: 500;
    color: #a1a1aa;
    letter-spacing: 0;
}

.auth__input {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fafafa;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s ease;
}

.auth__input::placeholder {
    color: #52525b;
}

.auth__input:hover {
    border-color: rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
}

.auth__input:focus {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.06);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Input group (password) */
.auth__input-group {
    position: relative;
}

.auth__input-group .auth__input {
    padding-right: 44px;
}

.auth__pw-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #52525b;
    cursor: pointer;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color 0.15s;
}

.auth__pw-toggle:hover {
    color: #a1a1aa;
}

/* Error */
.auth__error {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 450;
    line-height: 1.4;
}

.auth__error svg {
    flex-shrink: 0;
    color: #f87171;
}

.auth__error--show {
    display: flex;
    animation: authFadeIn 0.25s ease;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Submit button */
.auth__submit {
    position: relative;
    width: 100%;
    padding: 12px 20px;
    background: #fafafa;
    color: #09090b;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.auth__submit:hover {
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(255,255,255,0.1);
}

.auth__submit:active {
    transform: scale(0.985);
}

.auth__submit:disabled {
    cursor: not-allowed;
}

.auth__submit-loader {
    display: none;
    animation: authSpin 0.8s linear infinite;
}

.auth__submit--loading .auth__submit-text { opacity: 0; }
.auth__submit--loading .auth__submit-loader {
    display: flex;
    position: absolute;
}
.auth__submit--loading {
    background: #d4d4d8;
    pointer-events: none;
}

.auth__submit--success {
    background: #10b981 !important;
    color: white !important;
    pointer-events: none;
}

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

/* Divider */
.auth__divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 24px 0 20px;
}

/* Footer text */
.auth__footer-text {
    text-align: center;
    font-size: 13px;
    color: #52525b;
    margin: 0;
    line-height: 1.5;
}

.auth__footer-text strong {
    color: #a1a1aa;
    font-weight: 500;
}

/* Bottom bar */
.auth__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 4px;
}

.auth__secured {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #3f3f46;
    font-weight: 450;
}

.auth__secured svg {
    color: #22c55e;
}

.auth__copy {
    font-size: 12px;
    color: #3f3f46;
    font-weight: 400;
}

/* Mobile */
@media (max-width: 480px) {
    .auth { padding: 20px 16px; }
    .auth__card { padding: 28px 24px; }
    .auth__container { gap: 24px; }
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus { border-color: var(--primary-light); }

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    justify-content: center;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-sm { padding: 8px 16px; font-size: 13px; }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: #475569;
}
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary-light); }

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

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 24px 20px;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-nav { padding: 16px 0; }

.nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--accent);
}

.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

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

.topbar {
    background: white;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar h2 { font-size: 20px; font-weight: 700; color: #1e293b; margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.page-content { padding: 32px; }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.stat-card .stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

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

.stat-card .stat-label { font-size: 13px; color: #64748b; font-weight: 500; }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: #1e293b; line-height: 1.1; }
.stat-card .stat-change { font-size: 12px; margin-top: 6px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* Cards */
.card {
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.card-body { padding: 24px; }

/* Tables */
.table-responsive { overflow-x: auto; }

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

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}

tr:hover td { background: #f8fafc; }

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-up { background: #dcfce7; color: #166534; }
.status-down { background: #fee2e2; color: #991b1b; }
.status-degraded { background: #fef3c7; color: #92400e; }
.status-unknown { background: #f1f5f9; color: #475569; }

.severity-critical { background: #fee2e2; color: #991b1b; }
.severity-high { background: #ffedd5; color: #9a3412; }
.severity-medium { background: #fef3c7; color: #92400e; }
.severity-low { background: #dcfce7; color: #166534; }
.severity-info { background: #dbeafe; color: #1e40af; }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-green { background: #10b981; }
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-gray { background: #94a3b8; }

/* Charts */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-container.small { height: 200px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

/* Alerts */
.alert-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.alert-item.critical { border-left-color: var(--danger); background: #fef2f2; }
.alert-item.high { border-left-color: #ea580c; background: #fff7ed; }
.alert-item.medium { border-left-color: var(--warning); background: #fffbeb; }
.alert-item.low { border-left-color: var(--success); background: #f0fdf4; }
.alert-item.info { border-left-color: var(--primary-light); background: #eff6ff; }

.alert-item .alert-title { font-weight: 600; font-size: 14px; }
.alert-item .alert-time { font-size: 12px; color: #94a3b8; }
.alert-item .alert-msg { font-size: 13px; color: #475569; margin-top: 4px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s;
}

/* NIST Radar container */
.nist-functions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.nist-function-card {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.nist-function-card .score {
    font-size: 36px;
    font-weight: 800;
    margin: 8px 0;
}

.nist-function-card .label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .nist-functions { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .nist-functions { grid-template-columns: 1fr 1fr; }
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

select.form-control {
    appearance: auto;
}

.uptime-bar {
    display: flex;
    gap: 2px;
    height: 32px;
    align-items: stretch;
}

.uptime-bar .tick {
    flex: 1;
    border-radius: 3px;
    min-width: 3px;
}

.tick-up { background: var(--success); }
.tick-down { background: var(--danger); }
.tick-degraded { background: var(--warning); }
.tick-unknown { background: #e2e8f0; }
