* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f4f6f8;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

/* ── Auth (login) page ─────────────────────────────────── */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f4f6f8;
}

.auth .box {
    width: min(420px, calc(100% - 32px));
}

/* ── App shell: sidebar + content ─────────────────────── */

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

/* Sidebar */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #d9dee7;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.sidebar-brand .brand-text {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    color: #6b7280;
    font-weight: 400;
}

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

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    padding: 0 8px;
    margin-bottom: 6px;
    margin-top: 18px;
}

.nav-section-label:first-child {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 4px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-item:hover svg {
    opacity: 1;
}

.nav-item.active {
    background: #e5e7eb;
    color: #111827;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-item.danger {
    color: #b91c1c;
}

.nav-item.danger:hover {
    background: #fee2e2;
    color: #991b1b;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

/* Main content area */
.content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid #d9dee7;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    color: #111827;
}

.topbar-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

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

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.main-inner {
    padding: 32px;
    flex: 1;
}

/* ── Cards / boxes ─────────────────────────────────────── */

h1, h2, h3, p { margin: 0; }

h2 {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

p {
    margin-top: 6px;
    color: #6b7280;
    line-height: 1.5;
}

a {
    color: #2563eb;
    text-decoration: none;
}

.box {
    width: 100%;
    margin-bottom: 20px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 4px;
    box-shadow: none;
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.page-grid.single {
    grid-template-columns: 1fr;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #d9dee7;
    border-radius: 4px;
    padding: 20px 24px;
    box-shadow: none;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.stat-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e5e7eb;
    color: #374151;
}

/* ── Forms ─────────────────────────────────────────────── */

label {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

input[type="text"],
input[type="password"],
input[type="url"],
input:not([type="checkbox"]):not([type="submit"]) {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-weight: 400;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.check input[type="checkbox"] {
    width: 17px;
    min-height: 17px;
    accent-color: #2563eb;
    cursor: pointer;
}

button[type="submit"], .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    transition: opacity 0.15s, transform 0.1s;
    box-shadow: none;
}

button[type="submit"]:hover, .btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ── Notices / alerts ──────────────────────────────────── */

.notice, .alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
}

.notice {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.alert {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ── Code blocks ───────────────────────────────────────── */

code {
    display: inline-block;
    max-width: 100%;
    padding: 9px 12px;
    overflow-wrap: anywhere;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    font-family: Consolas, Monaco, monospace;
    font-size: 12.5px;
    color: #1d4ed8;
    line-height: 1.5;
}

/* ── Sidebar toggle (mobile) ───────────────────────────── */

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #4b5563;
    box-shadow: none;
    min-height: unset;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.5);
    }

    .content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .topbar {
        padding: 14px 20px;
    }

    .main-inner {
        padding: 20px;
    }

    .page-grid {
        grid-template-columns: 1fr;
    }
}
