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

:root {
    --primary: #0D2137;
    --accent: #F0A500;
    --bg: #F1F5F9;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-muted: #64748B;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #2563EB;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

.sidebar {
    width: 240px;
    background: var(--primary);
    color: white;
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    padding: 8px 0;
}

.nav-menu li a {
    display: block;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    color: white;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--accent);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    max-width: calc(100vw - 240px);
}

/* Typography */
h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 16px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

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

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.stat-card.warning { border-left: 4px solid var(--warning); }

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead th {
    background: #F8FAFC;
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 13px;
}

.data-table tbody tr:hover { background: #F8FAFC; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #E2E8F0;
    color: #475569;
}

.badge-success { background: #DCFCE7; color: var(--success); }
.badge-warning { background: #FEF3C7; color: var(--warning); }
.badge-danger { background: #FEE2E2; color: var(--danger); }
.badge-info { background: #DBEAFE; color: var(--info); }

/* Forms */
.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--primary);
    color: white;
}

.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--info); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Code */
code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: #F1F5F9;
    padding: 1px 4px;
    border-radius: 3px;
}

.log-detail {
    max-width: 300px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.test-result {
    margin-top: 8px;
    padding: 8px 12px;
    background: #DCFCE7;
    border-radius: 6px;
    font-size: 13px;
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-card h1 {
    font-size: 22px;
    margin-bottom: 4px;
    color: var(--primary);
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
    margin-top: 8px;
}

.alert-error {
    background: #FEE2E2;
    color: var(--danger);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.sidebar-user {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-link {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    color: white;
}

.sidebar-logout {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.sidebar-logout:hover {
    text-decoration: underline;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.nav-badge-warning {
    display: inline-block;
    background: var(--warning);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}
