:root {
    --brand-primary: #1B2A57;
    --brand-primary-dark: #131e3f;
    --brand-primary-light: #2a3f7a;
    --brand-secondary: #2DB6A8;
    --brand-secondary-dark: #239489;
    --brand-secondary-light: #4ec9bc;
    --brand-accent: #6B7280;
    --brand-bg: #F7F8FB;
    --brand-surface: #FFFFFF;
    --brand-border: #E5E7EB;
    --brand-text: #111827;
    --brand-text-muted: #6B7280;
    --brand-success: #10B981;
    --brand-warning: #F59E0B;
    --brand-danger: #EF4444;
    --brand-info: #3B82F6;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.06);
    --shadow-lg: 0 8px 24px rgba(17, 24, 39, 0.08);
    --transition: all 0.18s ease;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--brand-text);
    background: var(--brand-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--brand-secondary);
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--brand-primary);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
    height: 36px;
    width: auto;
}

.sidebar-brand-text {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 18px;
}

.sidebar-section-title {
    padding: 0 12px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--brand-secondary);
    color: #fff;
    font-weight: 500;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--brand-surface);
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--brand-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text-muted);
    background: transparent;
    border: 1px solid var(--brand-border);
    cursor: pointer;
    transition: var(--transition);
}

.topbar-icon-btn:hover {
    background: var(--brand-bg);
    color: var(--brand-primary);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 18px;
    border-left: 1px solid var(--brand-border);
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.topbar-user-info {
    line-height: 1.2;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-text);
}

.topbar-user-role {
    font-size: 11px;
    color: var(--brand-text-muted);
}

.content {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.page-header-subtitle {
    font-size: 13px;
    color: var(--brand-text-muted);
    margin: 0;
}

.page-header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--brand-secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--brand-secondary-dark);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border-color: var(--brand-border);
    color: var(--brand-text);
}

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

.btn-danger {
    background: var(--brand-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #c33333;
    color: #fff;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 7px;
    width: 32px;
    height: 32px;
    justify-content: center;
}

.card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-body.flush {
    padding: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(27, 42, 87, 0.1); color: var(--brand-primary); }
.stat-icon.secondary { background: rgba(45, 182, 168, 0.12); color: var(--brand-secondary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--brand-success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--brand-warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--brand-danger); }
.stat-icon.info { background: rgba(59, 130, 246, 0.1); color: var(--brand-info); }

.stat-content {
    flex: 1;
}

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

.stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--brand-text);
    line-height: 1.2;
}

.stat-meta {
    font-size: 11px;
    color: var(--brand-text-muted);
    margin-top: 4px;
}

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

table.data-table thead th {
    text-align: left;
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--brand-text-muted);
    background: #FAFBFD;
    border-bottom: 1px solid var(--brand-border);
}

table.data-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--brand-border);
    font-size: 13px;
    vertical-align: middle;
}

table.data-table tbody tr:hover {
    background: var(--brand-bg);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--brand-success); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--brand-warning); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--brand-danger); }
.badge-info { background: rgba(59, 130, 246, 0.12); color: var(--brand-info); }
.badge-neutral { background: rgba(107, 114, 128, 0.12); color: var(--brand-accent); }
.badge-secondary { background: rgba(45, 182, 168, 0.12); color: var(--brand-secondary); }
.badge-primary { background: rgba(27, 42, 87, 0.1); color: var(--brand-primary); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

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

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

.form-label .required {
    color: var(--brand-danger);
}

.form-control,
.form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 13px;
    color: var(--brand-text);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px rgba(45, 182, 168, 0.12);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    font-size: 11px;
    color: var(--brand-text-muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--brand-border);
    margin-top: 24px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}

.alert i {
    font-size: 14px;
    margin-top: 2px;
}

.alert-success { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.alert-info { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.alert-danger { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state i {
    font-size: 40px;
    color: var(--brand-border);
    margin-bottom: 12px;
}

.empty-state-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--brand-text-muted);
    margin-bottom: 16px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-light) 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 36px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.auth-brand img {
    height: 56px;
    width: auto;
    margin-bottom: 10px;
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin: 0 0 6px 0;
}

.auth-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--brand-text-muted);
    margin: 0 0 24px 0;
}

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

.mono {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12px;
}

.code-block {
    background: #0F172A;
    color: #E2E8F0;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--brand-border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.tab:hover {
    color: var(--brand-primary);
}

.tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-secondary);
}

.row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.col {
    flex: 1;
    min-width: 0;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }

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

.health-dot.up { background: var(--brand-success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.health-dot.down { background: var(--brand-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
.health-dot.warn { background: var(--brand-warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}
