:root {
    --admin-sidebar: #16213e;
    --admin-accent: #0f3460;
    --admin-highlight: #e94560;
    --admin-bg: #f5f6fa;
    --admin-text: #333;
    --admin-border: #dde1e7;
}

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
}

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

.admin-sidebar {
    width: 240px;
    background: var(--admin-sidebar);
    color: #fff;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-brand {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.admin-sidebar nav { display: flex; flex-direction: column; }

.admin-sidebar a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.admin-sidebar a:hover { background: var(--admin-accent); }

.admin-sidebar hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.admin-sidebar .current-user {
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.25rem;
}

.current-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.current-user-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
}

.current-user-email {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.95);
    word-break: break-all;
    line-height: 1.35;
}

.current-user-role {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
}

.logout-form { padding: 0 1.25rem; margin-top: 0.5rem; }

.logout-form button {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
}

.logout-form button:hover { border-color: var(--admin-highlight); color: var(--admin-highlight); }

.admin-main {
    margin-left: 240px;
    flex: 1;
    padding: 2rem 2.5rem;
}

.page-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.card {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--admin-highlight);
}

.stat-card .label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--admin-highlight);
    color: #fff;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: #fff;
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
    font-size: 0.9rem;
}

th {
    background: #f8f9fb;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
}

tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-secondary { background: #e9ecef; color: #666; }

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-highlight);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
}

textarea.form-control { min-height: 120px; resize: vertical; }

textarea.form-control.content-editor { min-height: 320px; font-family: "Consolas", monospace; font-size: 0.85rem; }

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check input { width: auto; }

.text-danger { color: #dc3545; font-size: 0.8rem; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--admin-border);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tag-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-sidebar);
}

.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-lead {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-alt {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

.login-alt a {
    color: #555;
}

.login-alt a:hover {
    color: #222;
}

.inline-form { display: inline; }

@media (max-width: 768px) {
    .admin-sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .admin-main { margin-left: 0; padding: 1rem; }
    .admin-shell { flex-direction: column; }
}
