* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f6fa;
    color: #1f2937;
}

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

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

.mobile-topbar {
    display: none;
}

.sidebar {
    width: 250px;
    background: #111827;
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}

.brand {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar nav a {
    padding: 12px;
    border-radius: 10px;
    color: #e5e7eb;
}

.sidebar nav a:hover {
    background: #1f2937;
}

.content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.btn {
    display: inline-block;
    border: 0;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    background: #111827;
    color: white;
    font-size: 14px;
}

.btn.secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn.danger {
    background: #dc2626;
}

.btn.success {
    background: #16a34a;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    margin-top: 6px;
}

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

label small {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-weight: 400;
    line-height: 1.4;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f9fafb;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.permission-item {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid #e5e7eb;
    padding: 12px;
    border-radius: 10px;
    background: #f9fafb;
    font-weight: 500;
}

.permission-item input {
    width: auto;
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 10px;
    font-size: 12px;
    background: #e5e7eb;
}

.badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.badge.active {
    background: #dcfce7;
    color: #166534;
}

.badge.passive {
    background: #fee2e2;
    color: #991b1b;
}

.menu-toggle {
    border: 0;
    background: #111827;
    color: white;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 18px;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 900px) {
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .app {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        transition: 0.25s ease;
        box-shadow: 0 20px 50px rgba(15, 23, 42, 0.30);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 45;
    }

    .content {
        padding: 16px;
    }

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

    .card {
        padding: 16px;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        text-align: center;
    }
}
