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

body {
    min-height: 100vh;
    background: #0f172a;
    color: #e5e7eb;
    font-family: Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    background: #020617;
    border-right: 1px solid #1e293b;
    padding: 24px;
}

.admin-logo {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 34px;
}

.admin-sidebar nav {
    display: grid;
    gap: 10px;
}

.admin-sidebar a {
    padding: 12px 14px;
    border-radius: 12px;
    color: #cbd5e1;
    font-weight: 700;
}

.admin-sidebar a:hover {
    background: #1e293b;
    color: #fff;
}

.admin-logout {
    margin-top: 20px;
    color: #fca5a5 !important;
}

.admin-main {
    margin-left: 240px;
    padding: 36px;
}

.admin-main h1 {
    font-size: 38px;
    margin-bottom: 8px;
}

.admin-subtitle {
    color: #94a3b8;
    margin-bottom: 28px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.admin-stat,
.admin-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 18px;
    padding: 22px;
}

.admin-stat span {
    display: block;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 10px;
}

.admin-stat strong {
    font-size: 34px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.admin-card h2 {
    margin-bottom: 16px;
}

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

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid #1f2937;
    text-align: left;
    font-size: 14px;
}

th {
    color: #94a3b8;
    font-weight: 800;
}

td {
    color: #e5e7eb;
}

.admin-search {
    display: flex;
    gap: 12px;
    margin: 22px 0;
}

.admin-search input,
.admin-login-card input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #020617;
    color: #e5e7eb;
}

button,
.admin-search button,
.admin-login-card button {
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

button.danger {
    background: #991b1b;
}

button.danger:hover {
    background: #7f1d1d;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.badge.green {
    background: #064e3b;
    color: #a7f3d0;
}

.badge.yellow {
    background: #713f12;
    color: #fde68a;
}

.badge.red {
    background: #7f1d1d;
    color: #fecaca;
}

.badge.gray {
    background: #334155;
    color: #cbd5e1;
}

.admin-success,
.admin-error {
    padding: 14px 16px;
    border-radius: 14px;
    margin: 18px 0;
    font-weight: 800;
}

.admin-success {
    background: #064e3b;
    color: #a7f3d0;
}

.admin-error {
    background: #7f1d1d;
    color: #fecaca;
}

.admin-login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 22px;
    padding: 30px;
}

.admin-login-card h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

.admin-login-card p {
    color: #94a3b8;
    margin-bottom: 22px;
}

.admin-login-card form {
    display: grid;
    gap: 12px;
}

.admin-login-card label {
    color: #cbd5e1;
    font-weight: 800;
}

@media (max-width: 900px) {
    /* Sidebar hidden by default on mobile, opens as off-canvas */
    .admin-sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        background: #020617;
        padding: 18px;
        transform: translateX(-100%);
        transition: transform 240ms ease-in-out;
        z-index: 1100;
    }

    .admin-sidebar.open {
        display: block;
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        position: fixed;
        left: 12px;
        top: 12px;
        z-index: 1200;
        background: #111827;
        color: #e5e7eb;
        border: 1px solid #1f2937;
        padding: 10px 12px;
        border-radius: 10px;
        font-size: 20px;
        cursor: pointer;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 1050;
        transition: opacity 200ms ease-in-out;
    }

    .mobile-overlay.active { display: block; }

    .admin-logo {
        font-size: 18px;
        margin-bottom: 0;
    }

    .admin-sidebar nav {
        display: block;
        gap: 8px;
        overflow: visible;
        margin-top: 14px;
    }

    .admin-main {
        margin-left: 0;
        padding: 20px;
        padding-top: 64px; /* leave space for mobile menu button */
    }

    .admin-stats,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    /* Show two stat columns on medium mobile to avoid tiny cards */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .admin-search {
        flex-direction: column;
        gap: 10px;
    }

    .admin-search input {
        width: 100%;
    }

    .admin-actions {
        gap: 10px;
    }

    .admin-card,
    .admin-stat {
        padding: 16px;
        border-radius: 14px;
    }

    .admin-main h1 {
        font-size: 28px;
    }

    .admin-stat strong {
        font-size: 28px;
    }

    .admin-login-card {
        padding: 22px;
        max-width: 380px;
    }
}

@media (max-width: 600px) {
    /* further tighten spacing for small phones */
    .admin-sidebar nav a {
        padding: 8px 10px;
        font-size: 13px;
    }

    .admin-logo {
        font-size: 16px;
    }

    .admin-main {
        padding: 16px;
    }

    /* ensure content isn't hidden under the fixed toggle */
    .admin-main { padding-top: 64px; }

    .admin-main h1 {
        font-size: 22px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    button,
    .admin-search button,
    .admin-login-card button {
        width: 100%;
        padding: 12px;
    }

    .admin-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-stats {
        gap: 10px;
    }

    .admin-card,
    .admin-stat {
        padding: 12px;
        border-radius: 12px;
    }

    .admin-login-body {
        padding: 16px;
    }

    .admin-login-card {
        width: 100%;
        margin: 0 12px;
    }

    /* Make tables easier to scan on narrow screens: keep horizontal scroll but reduce padding */
    table { font-size: 13px; }
    th, td { padding: 8px 6px; }
}

/* Hide mobile toggle on very large screens just in case */
@media (min-width: 901px) {
    .mobile-menu-toggle, .mobile-overlay { display: none !important; }
    .admin-sidebar { display: block !important; position: fixed; transform: none; }
}