:root {
    --sidebar-w: 220px;
    --sidebar-bg: #1a1f2e;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(30,144,255,0.15);
    --sidebar-active-border: #1e90ff;
    --nav-text: #b0bcd4;
    --nav-text-active: #ffffff;
    --nav-divider: #8896a8;
    --top-bar-h: 50px;
    --content-bg: #f0f3f8;
    --accent: #1e90ff;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: 'Segoe UI', Arial, sans-serif; }

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

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

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

.sidebar-logo {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px; color: white;
    flex-shrink: 0;
}

.sidebar-title { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-sub { color: var(--nav-divider); font-size: 11px; }

.nav-divider {
    padding: 14px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #5c6b82;
    text-transform: uppercase;
}

.nav-section { padding: 2px 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--nav-text-active);
    text-decoration: none;
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--nav-text-active);
    border-left: 3px solid var(--sidebar-active-border);
    padding-left: 7px;
}

.nav-icon {
    font-size: 15px;
    color: #6e8099;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { color: var(--accent); }

.sidebar-footer {
    margin-top: auto;
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.btn-logout:hover { background: var(--sidebar-hover); color: white; }

/* ─── Content ───────────────────────────────────────────── */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-bar {
    height: var(--top-bar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.top-bar-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a2433;
}

.main-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--content-bg);
}

/* ─── Card ──────────────────────────────────────────────── */
.page-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.page-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a2433;
    margin: 0 0 16px;
}

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

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 44px;
    width: 360px;
    box-shadow: 0 8px 40px rgba(0,0,0,.25);
}

.login-logo {
    width: 52px; height: 52px;
    background: var(--accent);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 20px; color: white;
    margin: 0 auto 20px;
}

.login-card h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #1a2433;
    margin: 0 0 6px;
}

.login-card p {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    margin: 0 0 28px;
}

.login-field { margin-bottom: 14px; }

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1a2433;
    outline: none;
    transition: border-color .15s;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
    width: 100%;
    padding: 10px;
    margin-top: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.login-btn:hover { opacity: .88; }

/* ─── Dashboard cards ───────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 4px solid transparent;
}

.dash-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    transform: translateY(-2px);
    text-decoration: none;
    border-left-color: var(--accent);
}

.dash-card-icon { font-size: 26px; }
.dash-card-label { font-size: 12px; color: #6b7280; }
.dash-card-title { font-size: 15px; font-weight: 700; color: #1a2433; }
