@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --brand: #4f46e5;
    --brand2: #7c3aed;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --accent: #10b981;
    --accent-light: #ecfdf5;
    --ink: #0b1220;
    --ink-soft: #5b6478;
    --muted: #9aa3b8;
    --border: #e7e9f2;
    --card: #ffffff;
    --bg: #f5f6fb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 11px;
    --shadow-sm: 0 1px 2px rgba(16,24,64,0.04), 0 1px 4px rgba(16,24,64,0.05);
    --shadow-md: 0 6px 20px rgba(16,24,64,0.07), 0 2px 6px rgba(16,24,64,0.04);
    --shadow-lg: 0 24px 60px rgba(30,27,90,0.14), 0 6px 16px rgba(30,27,90,0.06);
    --grad-brand: linear-gradient(135deg, var(--brand) 0%, var(--brand2) 100%);
    --grad-accent: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
h1, h2, h3, .brand, .section-title, .profile-name, .logo-title, .info-side h1 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}
a { color: inherit; }

/* ---------- Login card (used by index.php) ---------- */
.center-page { display: flex; justify-content: center; align-items: center; padding: 20px; }
.card { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 32px; text-align: center; }
.logo-title { font-size: 26px; font-weight: 800; color: var(--ink); margin-bottom: 6px; letter-spacing: -0.02em; }
.subtitle { font-size: 14px; color: var(--ink-soft); margin-bottom: 24px; }
.telegram-btn-wrapper { background: var(--accent-light); border: 1px solid #bbf7d0; border-radius: var(--radius-md); padding: 20px; margin-top: 10px; }
.telegram-btn-wrapper p { font-size: 13px; color: #166534; margin-bottom: 15px; line-height: 1.5; }
.widget-area { display: flex; justify-content: center; }

/* ---------- Top navigation ---------- */
.topbar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0 28px;
    height: 60px;
    display: flex;
    justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
    gap: 12px;
}
.topbar .brand {
    font-weight: 800; font-size: 18.5px; text-decoration: none; letter-spacing: -0.02em;
    background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.topbar .brand-logo {
    width: 28px; height: 28px; object-fit: contain; border-radius: 8px; flex-shrink: 0;
}

/* Oddiy nav (bosh sahifaga qaytish kabi sahifalar uchun) */
.topbar .nav { display: flex; flex-wrap: nowrap; gap: 2px; align-items: center; flex-shrink: 0; }
.topbar .nav a { padding: 7px 12px; border-radius: 10px; color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 600; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.topbar .nav a:hover { background: var(--brand-light); color: var(--brand-dark); }
.topbar .nav a.danger { color: var(--danger); }
.topbar .nav a.danger:hover { background: var(--danger-light); }

/* Hamburger tugma */
.ham-btn {
    width: 40px; height: 40px; border-radius: 10px;
    background: transparent; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; transition: background 0.15s; flex-shrink: 0;
}
.ham-btn:hover { background: var(--brand-light); }
.ham-btn span {
    display: block; width: 20px; height: 2px;
    background: var(--ink-soft); border-radius: 2px;
    transition: all 0.25s ease; transform-origin: center;
}
.ham-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--brand); }
.ham-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.ham-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--brand); }

/* Dropdown menyu */
.ham-dropdown {
    position: absolute; top: calc(100% + 8px); right: 28px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(30,27,90,0.13), 0 2px 8px rgba(30,27,90,0.07);
    width: 224px;
    overflow: hidden;
    opacity: 0; transform: translateY(-6px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 100;
}
.ham-dropdown.open {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: all;
}
.ham-dd-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
}
.ham-dd-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.ham-dd-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.ham-dd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px;
    font-size: 13.5px; font-weight: 600;
    color: var(--ink); text-decoration: none;
    transition: background 0.12s;
    border: none; background: transparent; width: 100%; text-align: left; cursor: pointer;
}
.ham-dd-item .dd-icon { font-size: 17px; color: var(--ink-soft); }
.ham-dd-item:hover { background: var(--bg); }
.ham-dd-item.admin { color: var(--brand); }
.ham-dd-item.admin .dd-icon { color: var(--brand); }
.ham-dd-item.admin:hover { background: var(--brand-light); }
.ham-dd-item.danger { color: var(--danger); }
.ham-dd-item.danger .dd-icon { color: var(--danger); }
.ham-dd-item.danger:hover { background: var(--danger-light); }
.ham-dd-sep { height: 1px; background: var(--border); margin: 4px 0; }

.container { max-width: 1040px; margin: 30px auto; padding: 0 20px; }

/* ---------- Stat cards ---------- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-box {
    background: var(--card); border-radius: var(--radius-lg); padding: 24px 18px; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.stat-box::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-brand);
}
.stat-box .num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.stat-box .label { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; font-weight: 600; }

.section-title { font-size: 18px; font-weight: 800; margin: 28px 0 14px; color: var(--ink); letter-spacing: -0.01em; }

/* ---------- Buttons ---------- */
.mock-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--grad-brand);
    color: #fff; padding: 15px 24px; border-radius: var(--radius-md);
    text-decoration: none; font-weight: 700; font-size: 14px; margin: 0 10px 10px 0;
    box-shadow: 0 10px 24px rgba(79,70,229,0.28);
    transition: transform 0.15s, box-shadow 0.15s;
}
.mock-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(79,70,229,0.34); }

.btn {
    display: inline-block; background: var(--brand); color: #fff; border: none;
    padding: 12px 22px; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
    font-size: 14px; text-decoration: none; transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(79,70,229,0.18);
}
.btn:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: #f8f9ff; border-color: var(--brand); color: var(--brand-dark); }
.btn.danger { background: var(--danger); box-shadow: 0 4px 12px rgba(239,68,68,0.2); }
.btn.danger:hover { background: #dc2626; }

/* ---------- Number grid ---------- */
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.number-item {
    background: var(--card); border-radius: var(--radius-md); padding: 15px 8px;
    text-align: center; text-decoration: none; color: var(--ink);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.number-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.number-item .n { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 800; }
.number-item .pct { font-size: 11px; color: var(--ink-soft); margin-top: 4px; font-weight: 700; }
.number-item.mastered { border-color: var(--accent); background: var(--accent-light); }
.number-item.mastered .n { color: #059669; }
.number-item.empty { opacity: 0.4; pointer-events: none; }
.number-item.group-tile { grid-column: span 2; background: linear-gradient(135deg, #f5f3ff, #eef2ff); border-color: #ddd6fe; }
.number-item.group-tile .n { font-size: 15px; color: var(--brand2); }
.number-item.locked { opacity: 0.55; }
.number-item.locked .pct { color: var(--brand-dark); font-weight: 800; }

/* ---------- Question grid ---------- */
.q-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.q-btn {
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; text-decoration: none;
    transition: transform 0.13s, box-shadow 0.13s;
    flex-shrink: 0;
}
.q-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.q-btn.ok { background: transparent; border: 2px solid var(--accent); color: #059669; }
.q-btn.ok:hover { background: #ecfdf5; }
.q-btn.no { background: transparent; border: 2px solid var(--danger); color: #dc2626; }
.q-btn.no:hover { background: #fef2f2; }

/* ---------- Question cards ---------- */
.q-card { background: var(--card); border-radius: var(--radius-xl); padding: 28px; box-shadow: var(--shadow-md); border: 1px solid var(--border); margin-bottom: 20px; }
.q-card img.q-img { max-width: 100%; border-radius: var(--radius-md); margin: 14px 0; display: block; }
.q-text { font-size: 16.5px; font-weight: 700; line-height: 1.6; margin-bottom: 16px; color: var(--ink); }
.q-base { background: var(--brand-light); border-radius: var(--radius-md); padding: 18px; margin-bottom: 16px; font-size: 14px; color: #3730a3; border: 1px solid #e0e7ff; line-height: 1.6; font-weight: 500; }
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
    text-align: left; padding: 14px 18px; border-radius: var(--radius-md);
    border: 2px solid var(--border); background: #fff; cursor: pointer; font-size: 14.5px; font-weight: 500;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.option-btn:hover { border-color: var(--brand); background: var(--brand-light); transform: translateX(2px); }
.option-btn.correct { border-color: var(--accent); background: var(--accent-light); font-weight: 700; }
.option-btn.wrong { border-color: var(--danger); background: var(--danger-light); }
.option-btn.selected { border-color: var(--brand); background: var(--brand-light); font-weight: 700; }
.mock-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.mock-progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.mock-progress-bar-fill { height: 100%; background: var(--grad-brand); border-radius: 999px; transition: width .25s; }
.mock-nav { display: flex; gap: 10px; margin-top: 6px; }
.mock-nav .btn { flex: 1; }
.lb-row { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius-md); padding: 14px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 8px; transition: transform 0.12s, box-shadow 0.12s; }
.lb-row:hover { transform: translateX(2px); box-shadow: var(--shadow-md); }
.lb-row.top3 { background: linear-gradient(135deg, #fffbeb, #fff); border-color: #fde68a; }
.lb-rank { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; color: var(--brand); width: 34px; font-size: 15px; }
.lb-name { flex: 1; font-weight: 700; font-size: 14px; }
.lb-pct { font-weight: 800; color: #059669; font-size: 15px; }
.lb-pref { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.lb-tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.lb-tab { flex-shrink: 0; padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #fff; color: var(--ink-soft); border: 1px solid var(--border); text-decoration: none; }
.lb-tab.active { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.test-code-display { font-size: 32px; font-weight: 800; letter-spacing: 6px; color: var(--brand); text-align: center; }
.stat-hero { display: flex; align-items: center; gap: 28px; background: var(--card); border-radius: var(--radius-xl); padding: 24px 28px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.progress-ring { width: 120px; height: 120px; }
.progress-ring circle { transition: stroke-dashoffset 0.6s ease; }
.ring-center { position: absolute; top: 0; left: 0; width: 120px; height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-pct { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800; color: var(--brand); }
.ring-label { font-size: 10.5px; color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.stat-hero-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.stat-hero-row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.stat-hero-row:last-child { border-bottom: none; padding-bottom: 0; }
.stat-hero-row span { color: var(--ink-soft); font-weight: 600; }
.stat-hero-row b { font-weight: 800; font-size: 14.5px; }
.number-bars { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.nb-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.nb-fill { width: 100%; border-radius: 3px 3px 0 0; min-height: 4px; transition: height 0.3s; }
@media (max-width: 560px) {
    .stat-hero { justify-content: center; text-align: center; }
    .stat-hero-side { min-width: 100%; }
}
.feedback { margin-top: 16px; font-weight: 700; font-size: 14.5px; }
.feedback.ok { color: #166534; }
.feedback.no { color: #991b1b; }
.solution-block { margin-top: 16px; font-size: 13px; color: var(--ink-soft); }
.rank-card { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 20px; transition: transform 0.12s, box-shadow 0.12s; }
.rank-card:hover { transform: translateX(2px); box-shadow: var(--shadow-md); }
.rank-icon { font-size: 26px; }
.rank-info { flex: 1; }
.rank-num { font-size: 18px; font-weight: 800; color: var(--brand); }
.rank-label { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.rank-arrow { font-size: 18px; color: var(--ink-soft); }
.upgrade-note { background: var(--brand-light); border: 1px solid #e0e7ff; border-radius: var(--radius-md); padding: 14px 16px; font-size: 13px; color: #3730a3; line-height: 1.55; }
.upgrade-note a { color: var(--brand-dark); font-weight: 700; text-decoration: underline; }
.sol-text { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; font-size: 14.5px; line-height: 1.65; color: var(--ink); margin-top: 8px; }
.upgrade-card { background: var(--card); border-radius: var(--radius-xl); padding: 34px; box-shadow: var(--shadow-md); border: 1px solid var(--border); text-align: center; }
.upgrade-card .icon { font-size: 40px; margin-bottom: 10px; }
.upgrade-card h2 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.upgrade-card p { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 18px; line-height: 1.6; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card { background: var(--card); border-radius: var(--radius-xl); padding: 26px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.plan-card.pro { border-color: var(--brand); background: linear-gradient(180deg, #f5f3ff, #ffffff); }
.plan-name { font-size: 17px; font-weight: 800; }
.plan-price { font-size: 24px; font-weight: 800; color: var(--brand); margin: 8px 0 16px; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }
.plan-features li::before { content: '✓ '; color: var(--accent); font-weight: 800; }
.plan-current { margin-top: 16px; font-size: 12px; font-weight: 700; color: #166534; background: var(--accent-light); border-radius: 999px; padding: 6px 12px; display: inline-block; }

/* ---------- Forms ---------- */
.form-box { background: var(--card); border-radius: var(--radius-xl); padding: 28px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--ink-soft); }
.form-group input[type=text], .form-group textarea, .form-group select, .form-group input[type=file] {
    width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s; background: #fbfbfe;
}
.form-group input[type=text]:focus, .form-group textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-group textarea { resize: vertical; min-height: 66px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hint code { background: var(--brand-light); color: var(--brand-dark); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-row label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 5px; }

.progress-bar-outer { background: var(--border); border-radius: 999px; height: 10px; overflow: hidden; margin-top: 8px; }
.progress-bar-inner { background: var(--grad-accent); height: 100%; }

/* ---------- User rows / avatars ---------- */
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.user-row { background: var(--card); border-radius: var(--radius-md); padding: 13px 18px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 8px; transition: box-shadow 0.15s; }
.user-row:hover { box-shadow: var(--shadow-md); }
.user-row .u-name { font-weight: 700; font-size: 14px; }
.user-row .u-id { font-size: 12px; color: var(--muted); margin-top: 1px; }
.user-row .u-info { flex: 1; }

/* ---------- Profile page ---------- */
.profile-header {
    background: var(--grad-brand);
    border-radius: var(--radius-xl);
    padding: 34px 30px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 22px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.profile-header::after {
    content: ''; position: absolute; top: -60px; right: -60px; width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%); border-radius: 50%;
}
.profile-avatar-lg {
    width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255,255,255,0.7); flex-shrink: 0; background: rgba(255,255,255,0.2);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); position: relative; z-index: 1;
}
.profile-avatar-lg.placeholder { display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: #fff; }
.profile-name { font-size: 23px; font-weight: 800; letter-spacing: -0.01em; position: relative; z-index: 1; }
.profile-username { font-size: 13.5px; opacity: 0.85; margin-top: 2px; position: relative; z-index: 1; }
.profile-meta { font-size: 12.5px; opacity: 0.85; margin-top: 9px; display: flex; gap: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.profile-role-badge {
    display: inline-block; margin-top: 11px; background: rgba(255,255,255,0.22);
    padding: 6px 15px; border-radius: 999px; font-size: 12px; font-weight: 700; position: relative; z-index: 1;
}

.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.profile-stat { background: var(--card); border-radius: var(--radius-md); padding: 18px; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.profile-stat .num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800; color: var(--brand); }
.profile-stat .label { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; font-weight: 600; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.perm-pill { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; font-weight: 600; }
.perm-pill .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.perm-pill.on .dot { background: var(--accent); }
.perm-pill.off .dot { background: #cbd5e1; }
.perm-pill.off { color: var(--muted); }

/* ---------- Quick links ---------- */
.quick-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 26px; }
.quick-link {
    background: var(--card); border-radius: var(--radius-md); padding: 16px 12px; text-align: center;
    text-decoration: none; color: var(--ink); font-weight: 700; font-size: 13px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    position: relative; line-height: 1.4;
}
.quick-link:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.qlink-badge {
    position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px;
    background: var(--danger); color: #fff; border-radius: 999px; border: 2px solid var(--card);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 800; line-height: 1;
    box-shadow: 0 2px 6px rgba(239,68,68,0.35);
}

/* ---------- Chart box ---------- */
.chart-box { background: var(--card); border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 26px; }

@media (max-width: 860px) {
    .quick-links { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
    .container { padding: 0 14px; margin: 20px auto; }
    .topbar { padding: 0 14px; height: 54px; }
    .topbar .nav a { padding: 6px 8px; font-size: 12px; }
    .topbar .brand { font-size: 16px; }
    .quick-links { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .quick-link { padding: 14px 10px; font-size: 12.5px; }
    .card { padding: 26px 20px; }
    .q-card, .form-box { padding: 20px; border-radius: var(--radius-lg); }
    .number-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
    .number-item { padding: 11px 6px; }
    .number-item .n { font-size: 15px; }
    .mock-btn { width: 100%; justify-content: center; margin: 0 0 10px 0; }
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-box { padding: 15px 8px; }
    .stat-box .num { font-size: 21px; }
    .stat-box .label { font-size: 10px; }
    .section-title { font-size: 16px; }
    .profile-header { padding: 24px 20px; flex-direction: column; text-align: center; justify-content: center; }
    .profile-meta { justify-content: center; }
}

.formula-preview { background: var(--brand-light); border: 1.5px dashed #c7d2fe; border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 8px; font-size: 14px; min-height: 22px; color: var(--ink); }

/* ---------- Admin settings / cards ---------- */
.admin-card { background: var(--card); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 16px; }
.admin-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.admin-card-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.admin-card-name { font-weight: 700; font-size: 15px; }
.perm-check-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.perm-check { display: flex; align-items: center; gap: 7px; background: #f8f9ff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.perm-check input { accent-color: var(--brand); width: 15px; height: 15px; }
.saved-banner { background: var(--accent-light); color: #166534; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 700; font-size: 13.5px; margin-bottom: 16px; }

/* ---------- Analytics ---------- */
.analytics-card { background: var(--card); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 18px; }
.analytics-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.analytics-row:last-child { border-bottom: none; }
.analytics-row .rate { font-weight: 800; color: var(--danger); }
.analytics-row .n-badge { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; padding: 3px 9px; border-radius: 8px; font-size: 12px; margin-right: 8px; }

/* ---------- Discussion ---------- */
.comment-form { display: flex; gap: 10px; margin-bottom: 22px; }
.comment-form textarea { flex: 1; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; resize: vertical; min-height: 50px; background: #fbfbfe; }
.comment-form textarea:focus { outline: none; border-color: var(--brand); background: #fff; }
.comment-item { background: var(--card); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 10px; }
.comment-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.comment-author { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.comment-time { font-size: 11.5px; color: var(--muted); }
.comment-text { font-size: 14px; color: var(--ink-soft); line-height: 1.6; white-space: pre-wrap; }
.comment-delete { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; margin-top: 8px; }
.comment-delete:hover { color: var(--danger); }

/* ---------- Per-question comments & reports ---------- */
.qc-block { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 16px; }
.report-summary {
    cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-soft);
    list-style: none; user-select: none; padding: 4px 0;
}
.report-summary::-webkit-details-marker { display: none; }
.report-summary:hover { color: var(--brand-dark); }
details[open] .report-summary { color: var(--brand-dark); margin-bottom: 12px; }
.report-note { background: var(--accent-light); border: 1px solid #d1fae5; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px; color: #047857; font-weight: 600; margin-bottom: 12px; }
.badge-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 800; margin-left: 6px; }
