:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #eef4ff;
    --sidebar: #0d1b2a;
    --sidebar-alt: #15293d;
    --primary: #007cba;
    --primary-soft: #dfeffc;
    --green: #7ac14e;
    --green-soft: #eaf9db;
    --text: #122234;
    --muted: #67768a;
    --line: #e9eef5;
    --warning: #ffb703;
    --danger: #e85d75;
    --shadow: 0 18px 40px rgba(19, 37, 58, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Roboto', sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app-shell {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(180deg, #eef3fb 0%, #f7f9fc 100%);
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #0b1724 100%);
    color: white;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #38a7db);
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(0,124,186,0.4);
}

.brand-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.08em; }
.brand-subtitle { font-size: 0.72rem; opacity: 0.75; }

.nav-menu { display: flex; flex-direction: column; gap: 10px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.82);
    transition: 0.2s ease;
}
.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-card {
    margin-top: auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 16px 14px;
}

.small-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.6); }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-pill.success { background: rgba(122, 193, 78, 0.18); color: #c9ef9d; }
.mini-meta { margin-top: 12px; font-size: 0.78rem; color: rgba(255,255,255,0.76); }

.main-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 22px 30px 18px;
    background: rgba(255,255,255,0.4);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    gap: 16px;
}
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.68rem; }
.topbar h1 { margin: 6px 0 0; font-size: 2rem; }
.toolbar-actions { display: flex; align-items: center; gap: 14px; }
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface);
    padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
    min-width: 220px;
}
.search-box input { border: none; outline: none; background: transparent; width: 100%; }
.primary-button, .ghost-button {
    border: none; border-radius: 12px; cursor: pointer; padding: 11px 16px; font-weight: 600;
}
.primary-button { background: linear-gradient(135deg, var(--primary), #1f9ad9); color: white; box-shadow: 0 10px 24px rgba(0,124,186,0.22); }
.ghost-button { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.user-pill { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.user-pill strong { display: block; }
.user-pill small { color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--primary); font-weight: 700; }

.content-area { padding: 30px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-header h2 { margin: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 18px; }
.kpi-card, .panel-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.kpi-card { padding: 18px 20px; }
.kpi-label { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; }
.kpi-value { margin-top: 12px; font-size: 1.8rem; font-weight: 700; }
.kpi-trend {
    display: inline-flex; margin-top: 10px; padding: 6px 9px; border-radius: 999px;
    color: var(--green); background: var(--green-soft); font-size: 0.82rem; font-weight: 700;
}

.stats-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; margin-top: 24px; }
.panel-card { padding: 20px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-header h3 { margin: 0; }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { background: #f7f9fc; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.row-badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-weight: 600; font-size: 0.75rem; }
.row-badge.success { background: var(--green-soft); color: #3f7c1d; }
.row-badge.warning { background: #fff3d9; color: #9f6b00; }
.row-badge.alert { background: #ffe1e7; color: #b12d4a; }

.list-vertical { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.list-vertical li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.small-number { font-weight: 700; }

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(0,124,186,0.17), transparent 30%), #edf3ff;
}

.login-backdrop {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(13,27,42,0.82), rgba(22,74,115,0.70));
    filter: blur(0.5px);
}

.login-card {
    position: relative; z-index: 1;
    width: min(440px, calc(100% - 32px));
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 24px;
    box-shadow: 0 28px 60px rgba(0,0,0,0.18);
    padding: 28px 26px;
    backdrop-filter: blur(16px);
}

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand .brand-mark { width: 52px; height: 52px; }
.login-form { display: grid; gap: 16px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group label { font-weight: 500; }
.field-group input {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: white;
    outline: none;
}
.password-box { position: relative; }
.password-box input { width: 100%; padding-right: 80px; }
.toggle-password {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--primary); font-weight: 700; cursor: pointer;
}
.full-width { width: 100%; }
.form-row { display: flex; justify-content: space-between; align-items: center; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.alert {
    border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-weight: 500;
}
.alert.danger { background: #fff0f3; border: 1px solid #f8c4d1; color: #9d2347; }
.login-footer { margin-top: 20px; text-align: center; color: var(--muted); }

@media (max-width: 980px) {
    .sidebar { width: 80px; padding: 16px 10px; }
    .brand-title, .brand-subtitle, .nav-item span, .nav-item { font-size: 0.75rem; }
    .nav-item { justify-content: center; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; padding: 15px; }
    .nav-menu { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .main-panel { min-height: calc(100vh - 200px); }
    .topbar { flex-direction: column; align-items: flex-start; }
    .toolbar-actions { width: 100%; flex-wrap: wrap; }
    .search-box { flex: 1; min-width: 0; }
    .content-area { padding: 18px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
}
