/* Mobile-first responsive admin panel */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f5f5;
    --card-bg: #fff;
    --text: #1a1a1a;
    --muted: #666;
    --border: #e0e0e0;
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --danger: #e74c3c;
    --success: #27ae60;
    --nav-height: 56px;
    --radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-height) + 16px);
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    padding-bottom: 0;
}

.login-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
}

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.field input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    /* prevent iOS zoom */
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 18px; flex: 1; }
.back-link {
    font-size: 22px;
    text-decoration: none;
    color: var(--primary);
    margin-right: 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Content */
.content { padding: 12px 16px; max-width: 600px; margin: 0 auto; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h2 { font-size: 16px; margin-bottom: 12px; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:active { background: #f0f0f0; }

/* Stat cards grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.stat-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Detail list */
.detail-list { display: flex; flex-direction: column; gap: 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.detail-label { font-size: 13px; color: var(--muted); }
.detail-value { font-size: 14px; font-weight: 500; text-align: right; word-break: break-all; }

/* User row in list */
.user-row { display: flex; justify-content: space-between; align-items: center; }
.user-name { font-weight: 600; font-size: 15px; }
.user-email { font-size: 13px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-admin { background: #e8d5f5; color: #6c2d91; }
.badge-angel { background: #fce4ec; color: #c62828; }
.badge-gold { background: #fff3e0; color: #e65100; }
.badge-silver { background: #e8eaf6; color: #283593; }
.badge-user { background: #eee; color: #666; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    transition: background 0.15s;
}
.btn:active { background: #eee; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; min-height: 36px; }
.btn-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Level buttons */
.level-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.level-buttons .btn { flex: 1; min-width: 60px; padding: 8px 6px; font-size: 13px; }

/* Action groups */
.action-group { margin-bottom: 16px; }
.action-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }

/* Session card */
.session-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
}

/* Search */
.search-form { display: flex; gap: 8px; }
.search-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
}

/* Filter */
.filter-bar { display: flex; gap: 8px; }
.select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--card-bg);
    min-height: 44px;
}

/* Load more */
.load-more { margin-top: 8px; }

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 20;
}
.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
}
.nav-item.active { color: var(--primary); font-weight: 600; }

/* Text helpers */
.error-text { color: var(--danger); font-size: 14px; margin-top: 8px; }
.success-text { color: var(--success); font-size: 14px; margin-top: 8px; }
.muted { color: var(--muted); }
.mono { font-family: "SF Mono", "Consolas", monospace; font-size: 13px; }

/* SQL sections */
.sql-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.sql-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }

/* Responsive: wider screens get a bit more room */
@media (min-width: 768px) {
    .content { max-width: 700px; }
    .card-grid { grid-template-columns: repeat(3, 1fr); }
}
