:root {
    --primary: #021DA3;
    --primary-dark: #01167e;
    --primary-light: #3b5bdb;
    --accent: #00b4d8;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1a1a1a;
    --text-muted: #6c757d;
    --border: #e0e0e0;
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 36px rgba(0,0,0,0.35);
}

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

body {
    font-family: 'Segoe UI', system-ui, Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── Navbar ─── */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-brand .shield-icon {
    font-size: 26px;
    line-height: 1;
}
.navbar-brand .brand-sub {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.navbar-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    list-style: none;
}
.navbar-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}
.navbar-nav a:hover { background: rgba(255,255,255,0.15); }
.navbar-nav a.active { background: rgba(255,255,255,0.2); }

/* ─── Footer ─── */
.footer {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 20px 24px;
    font-size: 13px;
    margin-top: auto;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer .footer-brand { font-weight: 600; color: white; }

/* ─── Container ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.container-fluid { padding: 24px; }

/* ─── Cards ─── */
.card {
    background: var(--card);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s;
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2,29,163,0.1);
}
select.form-control { cursor: pointer; }

/* ─── Buttons ─── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s, filter 0.2s;
}
.btn:hover { filter: brightness(0.92); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-warning { background: var(--warning); color: #333; }
.btn-secondary { background: #6c757d; color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; text-align: center; }

/* ─── Tables ─── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    text-align: left;
    padding: 12px 14px;
    background: #f8f9fa;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.table tr:hover { background: #f8f9fa; }

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-warning { background: #fff3cd; color: #856404; }

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* ─── Auth pages with security background ─── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(2,29,163,0.92) 0%, rgba(1,22,126,0.88) 50%, rgba(1,13,77,0.92) 100%),
        url('/static/img/security-bg.svg');
    background-size: cover;
    background-position: center;
    padding: 20px;
}
.auth-card {
    background: rgba(255,255,255,0.98);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
}
.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}
.auth-logo .logo-icon {
    font-size: 48px;
    margin-bottom: 8px;
}
.auth-logo h1 {
    color: var(--primary);
    font-size: 26px;
    font-weight: 700;
}
.auth-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}
.auth-footer strong { color: var(--primary); }

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Server detail ─── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}
.detail-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}
.detail-item .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-item .value {
    font-size: 15px;
    font-weight: 500;
    margin-top: 2px;
    word-break: break-all;
}

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 20px; color: var(--primary); }

/* ─── Misc ─── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.cursor-pointer { cursor: pointer; }
.mono { font-family: 'Courier New', monospace; }
.copy-btn {
    background: none; border: none; cursor: pointer;
    font-size: 16px; padding: 2px 6px; border-radius: 4px;
}
.copy-btn:hover { background: #e8e8e8; }
.break-all { word-break: break-all; }

/* ─── Page wrapper with footer at bottom ─── */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.page-content { flex: 1; }

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}
.tabs a {
    padding: 12px 24px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

@media (max-width: 768px) {
    .navbar { padding: 0 12px; height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
    .navbar-nav a { padding: 6px 8px; font-size: 13px; }
    .container { padding: 12px; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px; }
    .auth-card { padding: 28px; }
    .tabs a { padding: 10px 14px; font-size: 13px; }
}
