* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Login page ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 360px;
}
.login-box h1 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* ---- App shell ---- */
.app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 230px;
    background: #1f2937;
    color: #e5e7eb;
    flex-shrink: 0;
}
.sidebar .brand {
    padding: 18px 16px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid #374151;
}
.sidebar nav a {
    display: block;
    padding: 12px 16px;
    color: #d1d5db;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: #111827;
    color: #fff;
    border-left-color: #2563eb;
    text-decoration: none;
}
.sidebar nav .section-label {
    padding: 14px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #9ca3af;
}
.main {
    flex: 1;
    min-width: 0;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
}
.topbar .user {
    font-size: 14px;
}
.content {
    padding: 24px;
}

/* ---- Cards / tables ---- */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-cards .card { margin-bottom: 0; text-align: center; }
.stat-cards .num { font-size: 28px; font-weight: 700; color: #1f2937; }
.stat-cards .label { color: #6b7280; font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; }
th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #fafafa; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #374151; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=url], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
textarea { min-height: 80px; }
.form-row { display: flex; gap: 16px; }
.form-row > .form-group { flex: 1; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

.perm-table th, .perm-table td { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
