* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6f8;
    color: #1f2430;
}

.nav {
    background: #1f2430;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: 1.2rem; align-items: center; }
.nav-links a {
    color: #cbd3e1;
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}
.nav-links a:hover { background: #2e3340; color: #fff; }
.nav-links a.active { background: #4c6ef5; color: #fff; }
.nav-user { color: #9aa5b8; margin-left: 1rem; }
.nav-links .logout { color: #ff8787; }

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 { font-size: 1.6rem; margin-bottom: 1.2rem; }

.alert {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.alert.error { background: #ffe3e3; color: #c92a2a; border: 1px solid #ffa8a8; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card summary { cursor: pointer; font-weight: 600; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-top: 1rem;
}
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: #495057; }
.form-grid input, .form-grid button { margin-top: 0.25rem; }

input[type="text"], input[type="password"], input[type="file"], select {
    padding: 0.55rem 0.7rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fff;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
    outline: none;
    border-color: #4c6ef5;
}

button {
    background: #4c6ef5;
    color: #fff;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
button:hover { background: #3b5bdb; }
button.danger { background: #e03131; }
button.danger:hover { background: #c92a2a; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.table th, .table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #edf0f5;
    font-size: 0.9rem;
    vertical-align: middle;
}
.table th { background: #f1f3f8; color: #495057; font-weight: 600; }
.table tbody tr:hover { background: #f8f9fc; }
.table .empty { text-align: center; color: #adb5bd; padding: 2rem; }

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

code {
    background: #eef1f7;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

details.inline { display: inline-block; margin-right: 0.5rem; }
details.inline summary { cursor: pointer; color: #4c6ef5; }
.form-inline { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.form-inline input { font-size: 0.85rem; padding: 0.4rem; }
.inline-form { display: inline; }

.filter-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 1rem;
}
.btn-link {
    color: #4c6ef5;
    text-decoration: none;
    padding: 0.55rem 0.8rem;
    border: 1px solid #4c6ef5;
    border-radius: 6px;
    font-size: 0.9rem;
}

.row-ok { background: #f4fbf5; }
.row-no { background: #fff8e6; }
.row-err { background: #fff0f0; }
.err { color: #c92a2a; font-size: 0.8rem; }

.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}
.login-form {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 340px;
}
.login-form h1 { text-align: center; margin-top: 0; }
.login-form label {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #495057;
}
.login-form input { margin-top: 0.3rem; }
.login-form button { width: 100%; padding: 0.7rem; }

.alert.ok { background: #e6fcf5; color: #087f5b; border: 1px solid #63e6be; }
.muted { color: #868e96; font-size: 0.85rem; }
.ok { color: #087f5b; font-weight: 600; }
.off { color: #c92a2a; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
}
.badge.super_admin { background: #d0bfff; color: #5f3dc4; }
.badge.admin { background: #a5d8ff; color: #1864ab; }

code.key {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78em;
    word-break: break-all;
    background: #f1f3f8;
    color: #364fc7;
}

pre.code {
    background: #1f2430;
    color: #e9ecef;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
}

h2 { font-size: 1.15rem; margin-top: 0.5rem; margin-bottom: 0.6rem; }
