/* Orivex / Orivex — shared dashboard shell */
:root {
    --ink: #0f172a;
    --ink-soft: #1e293b;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --field: #f8fafc;
    --surface: #ffffff;
    --page: #f1f5f9;
    --brand: #92400e;
    --brand-hover: #a16207;
    --brand-dark: #78350f;
    --brand-soft: rgba(146, 64, 14, 0.1);
    --brand-ring: rgba(146, 64, 14, 0.18);
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --success: #059669;
    --success-soft: #ecfdf5;
    --info: #2563eb;
    --info-soft: #eff6ff;
    --sidebar-w: 272px;
    --topbar-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font);
    background: var(--page);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* Normal thin scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.material-symbols-rounded {
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
    font-size: 22px;
    line-height: 1;
    user-select: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* ─── Shell ─── */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
    height: 100dvh;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    min-height: 0;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 76px;
    height: auto;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    min-width: 0;
}

/* Logo image already includes the wordmark — no extra title/role next to it */
.sidebar-brand img {
    height: 52px;
    width: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: fit-content;
    flex-shrink: 0;
    white-space: nowrap;
}

.role-badge.admin {
    background: var(--brand-soft);
    color: var(--brand);
}

.role-badge.student {
    background: var(--info-soft);
    color: var(--info);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section {
    margin: 12px 10px 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    letter-spacing: -0.01em;
}

.nav-item .material-symbols-rounded {
    font-size: 22px;
    opacity: 1;
    color: #475569;
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.nav-item:hover {
    background: var(--field);
    color: var(--ink);
}

.nav-item:hover .material-symbols-rounded {
    color: var(--ink-soft);
}

.nav-item.is-active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
}

.nav-item.is-active .material-symbols-rounded {
    color: var(--brand);
    font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.nav-item .nav-count {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--line);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-item.is-active .nav-count {
    background: rgba(146, 64, 14, 0.18);
    color: var(--brand);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: var(--field);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-hover), var(--brand-dark));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    min-width: 0;
    flex: 1;
}

.user-meta strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta span {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

/* Main */
.main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--page);
}

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
}

.page-title h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.page-title p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search {
    position: relative;
    width: min(280px, 32vw);
}

.search .material-symbols-rounded {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    font-size: 18px;
    pointer-events: none;
}

.search input {
    width: 100%;
    height: 40px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--field);
    padding: 0 12px 0 38px;
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.search input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--field);
    border-color: var(--line-strong);
}

.icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--surface);
}

.content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 24px 32px;
}

.view {
    display: none;
    animation: fade-up 0.35s var(--ease) both;
}

.view.is-active {
    display: block;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── UI primitives ─── */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-pad {
    padding: 18px 20px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-head h2,
.card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.card-head p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.stat-card {
    padding: 18px 18px 14px;
    position: relative;
    overflow: hidden;
    transition:
        transform 0.2s var(--ease),
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(146, 64, 14, 0.08), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(15, 23, 42, 0.03), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -18px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--brand-soft);
    opacity: 0.55;
    transition: transform 0.35s var(--ease), opacity 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    border-color: rgba(146, 64, 14, 0.22);
}

.stat-card:hover::after {
    transform: scale(1.12);
    opacity: 0.75;
}

.stat-card.tone-blue::before {
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.1), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(15, 23, 42, 0.03), transparent 40%);
}

.stat-card.tone-blue::after {
    background: var(--info-soft);
}

.stat-card.tone-green::before {
    background:
        radial-gradient(circle at 100% 0%, rgba(5, 150, 105, 0.1), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(15, 23, 42, 0.03), transparent 40%);
}

.stat-card.tone-green::after {
    background: var(--success-soft);
}

.stat-card.tone-amber::before {
    background:
        radial-gradient(circle at 100% 0%, rgba(217, 119, 6, 0.12), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(15, 23, 42, 0.03), transparent 40%);
}

.stat-card.tone-amber::after {
    background: var(--warning-soft);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand);
    position: relative;
    z-index: 1;
    box-shadow: 0 6px 14px rgba(146, 64, 14, 0.12);
}

.stat-icon .material-symbols-rounded {
    font-size: 22px;
}

.stat-icon.blue {
    background: var(--info-soft);
    color: var(--info);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}

.stat-icon.amber {
    background: var(--warning-soft);
    color: var(--warning);
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.12);
}

.stat-icon.green {
    background: var(--success-soft);
    color: var(--success);
    box-shadow: 0 6px 14px rgba(5, 150, 105, 0.12);
}

.stat-trend {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--success);
    background: var(--success-soft);
    padding: 4px 9px;
    border-radius: 999px;
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.stat-trend .material-symbols-rounded {
    font-size: 14px;
}

.stat-trend.down {
    color: var(--danger);
    background: var(--danger-soft);
}

.stat-trend.neutral {
    color: var(--muted);
    background: var(--field);
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    position: relative;
    z-index: 1;
}

.stat-body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.stat-copy {
    min-width: 0;
}

.stat-hint {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted-2);
    line-height: 1.35;
}

/* Mini sparkline bars */
.stat-spark {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 36px;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.stat-spark span {
    width: 5px;
    border-radius: 999px 999px 2px 2px;
    background: linear-gradient(180deg, var(--brand-hover), var(--brand));
    opacity: 0.55;
    min-height: 6px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.stat-card:hover .stat-spark span {
    opacity: 0.9;
}

.stat-spark.blue span {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.stat-spark.green span {
    background: linear-gradient(180deg, #34d399, #059669);
}

.stat-spark.amber span {
    background: linear-gradient(180deg, #fbbf24, #d97706);
}

/* Progress strip under card */
.stat-foot {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stat-meter {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
    max-width: 120px;
}

.stat-meter > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand-hover));
    width: 0;
    transition: width 0.6s var(--ease);
}

.stat-card.tone-blue .stat-meter > i {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.stat-card.tone-green .stat-meter > i {
    background: linear-gradient(90deg, #059669, #34d399);
}

.stat-card.tone-amber .stat-meter > i {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.stat-foot-meta {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.stat-foot-meta strong {
    color: var(--ink);
    font-weight: 800;
}

/* Ring metric (optional) */
.stat-ring {
    --p: 72;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-ring > span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: var(--ink);
}

.stat-card.tone-blue .stat-ring {
    background: conic-gradient(#2563eb calc(var(--p) * 1%), var(--line) 0);
}

.stat-card.tone-green .stat-ring {
    background: conic-gradient(#059669 calc(var(--p) * 1%), var(--line) 0);
}

.stat-card.tone-amber .stat-ring {
    background: conic-gradient(#d97706 calc(var(--p) * 1%), var(--line) 0);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}

.btn .material-symbols-rounded {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(180deg, var(--brand-hover), var(--brand));
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(146, 64, 14, 0.22);
    -webkit-text-fill-color: #ffffff;
}

/* Icons/labels inside primary CTAs must stay white (never inherit brand orange) */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary .material-symbols-rounded,
.btn-primary span {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink-soft) !important;
    -webkit-text-fill-color: var(--ink-soft);
}

.btn-secondary,
.btn-secondary .material-symbols-rounded,
.btn-secondary span {
    color: var(--ink-soft) !important;
    -webkit-text-fill-color: var(--ink-soft);
}

.btn-secondary:hover {
    background: var(--field);
    border-color: var(--line-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
    height: 34px;
    padding: 0 10px;
}

.btn-ghost:hover {
    background: var(--field);
    color: var(--ink-soft);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.btn-sm {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-sm .material-symbols-rounded {
    font-size: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.badge-neutral {
    background: var(--field);
    color: var(--muted);
    border: 1px solid var(--line);
}

.badge-brand {
    background: var(--brand-soft);
    color: var(--brand);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
    white-space: nowrap;
}

table.data td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    vertical-align: middle;
}

table.data tr:last-child td {
    border-bottom: 0;
}

table.data tbody tr:hover td {
    background: #fafbfc;
}

.cell-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cell-main strong {
    font-weight: 700;
    color: var(--ink);
    font-size: 13.5px;
}

.cell-main span {
    font-size: 12px;
    color: var(--muted);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Lists / activity */
.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.list-item:first-child {
    padding-top: 0;
}

.list-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--field);
    color: var(--muted);
}

.list-body {
    flex: 1;
    min-width: 0;
}

.list-body strong {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
}

.list-body p {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.45;
}

.list-meta {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted-2);
    white-space: nowrap;
}

/* Progress */
.progress {
    height: 8px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand-hover));
}

.progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
}

.progress-row span:last-child {
    color: var(--muted);
}

.skill-block + .skill-block {
    margin-top: 14px;
}

/* Empty / empty-ish panels */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.select,
.input {
    height: 38px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 0 12px;
    font-size: 13px;
    color: var(--ink-soft);
    outline: none;
}

.select:focus,
.input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Exam cards (student) */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.exam-card {
    display: flex;
    flex-direction: column;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s var(--ease);
}

.exam-card:hover {
    border-color: rgba(146, 64, 14, 0.3);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.exam-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.exam-lang {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    background: linear-gradient(135deg, #a16207, #92400e);
}

.exam-lang.py {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.exam-lang.js {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.exam-lang.java {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.exam-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.exam-card .desc {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    flex: 1;
}

.exam-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.exam-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.exam-meta .material-symbols-rounded {
    font-size: 16px;
}

.exam-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* Score ring */
.score-ring {
    --p: 72;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-ring > span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--ink);
}

/* Welcome banner */
.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(120deg, rgba(146, 64, 14, 0.95), rgba(249, 115, 22, 0.88)),
        radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.18), transparent 40%);
    color: #fff;
    margin-bottom: 18px;
    box-shadow: 0 14px 32px rgba(146, 64, 14, 0.22);
    overflow: hidden;
    position: relative;
}

.welcome h2 {
    margin: 0 0 6px;
    font-size: clamp(1.15rem, 1.5vw, 1.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.welcome p {
    margin: 0;
    font-size: 13.5px;
    opacity: 0.9;
    max-width: 520px;
    line-height: 1.5;
}

.welcome .btn {
    background: #fff;
    color: var(--brand-dark) !important;
    -webkit-text-fill-color: var(--brand-dark);
    box-shadow: none;
    border: 0;
}

.welcome .btn,
.welcome .btn .material-symbols-rounded,
.welcome .btn span {
    color: var(--brand-dark) !important;
    -webkit-text-fill-color: var(--brand-dark);
}

.welcome .btn:hover {
    filter: none;
    background: #f0fdfa;
}

/* Split layout helpers */
.stack-gap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.two-col {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
}

.three-col {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 16px;
}

/* Chart placeholder bars */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    padding-top: 8px;
}

.bar-chart .bar {
    flex: 1;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, var(--brand-hover), var(--brand));
    opacity: 0.85;
    min-width: 0;
    position: relative;
}

.bar-chart .bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.bar-chart-wrap {
    padding-bottom: 18px;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 25;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-col,
    .three-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(280px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.25s var(--ease);
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .search {
        display: none;
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .welcome {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .content {
        padding: 16px 14px 28px;
    }

    .topbar {
        padding: 0 14px;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }

    .attempts-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .page-title p {
        display: none;
    }
}

/* ─── Modals, menus, toast (admin actions UI) ─── */
.ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
}

.ui-overlay.is-open {
    display: flex;
}

.ui-modal {
    width: min(520px, 100%);
    max-height: min(88vh, 720px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: fade-up 0.28s var(--ease) both;
}

.ui-modal.wide {
    width: min(640px, 100%);
}

.ui-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.ui-modal-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ui-modal-head p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.ui-modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ui-modal-close:hover {
    background: var(--field);
    color: var(--ink);
}

.ui-modal-body {
    padding: 16px 20px 8px;
}

.ui-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 20px 18px;
    border-top: 1px solid var(--line);
    position: sticky;
    bottom: 0;
    background: var(--surface);
}

.form-grid {
    display: grid;
    gap: 12px;
}

.form-grid.two {
    grid-template-columns: 1fr 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

.form-field .input,
.form-field .select,
.form-field textarea {
    font-weight: 500;
    width: 100%;
}

.form-field textarea {
    min-height: 96px;
    resize: vertical;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 10px 12px;
    color: var(--ink);
    outline: none;
    font: inherit;
    font-size: 13px;
}

.form-field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.detail-list {
    display: grid;
    gap: 10px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--field);
    font-size: 13px;
}

.detail-row span {
    color: var(--muted);
    font-weight: 600;
}

.detail-row strong {
    color: var(--ink);
    font-weight: 700;
    text-align: right;
}

/* Action menu */
.action-menu {
    position: fixed;
    z-index: 90;
    min-width: 180px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
}

.action-menu.is-open {
    display: block;
}

.action-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
}

.action-menu button:hover {
    background: var(--field);
}

.action-menu button.danger {
    color: var(--danger);
}

.action-menu button .material-symbols-rounded {
    font-size: 18px;
    color: var(--muted);
}

.action-menu button.danger .material-symbols-rounded {
    color: var(--danger);
}

.action-menu .menu-sep {
    height: 1px;
    background: var(--line);
    margin: 4px 6px;
}

/* Toast */
.ui-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s var(--ease);
    max-width: min(420px, calc(100vw - 32px));
}

.ui-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ui-toast .material-symbols-rounded {
    font-size: 18px;
    color: #d97706;
}

.ui-toast.success .material-symbols-rounded {
    color: #6ee7b7;
}

.row-actions {
    position: relative;
}

/* Topbar profile */
.profile-menu {
    position: relative;
}

.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 4px 10px 4px 4px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
    border-color: rgba(146, 64, 14, 0.35);
    background: var(--field);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-hover), var(--brand-dark));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
}

.profile-info strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-info span {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.profile-caret {
    font-size: 18px !important;
    color: var(--muted);
    transition: transform 0.15s ease;
}

.profile-menu.is-open .profile-caret {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

.profile-dropdown[hidden] {
    display: none !important;
}

.profile-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
}

.profile-dropdown button:hover {
    background: var(--field);
}

.profile-dropdown button.danger {
    color: var(--danger);
}

.profile-dropdown button .material-symbols-rounded {
    font-size: 18px;
    color: var(--muted);
}

.profile-dropdown button.danger .material-symbols-rounded {
    color: var(--danger);
}

.profile-dropdown .menu-sep {
    height: 1px;
    background: var(--line);
    margin: 4px 6px;
}

@media (max-width: 560px) {
    .profile-info {
        display: none;
    }

    .profile-trigger {
        padding: 4px;
        width: 42px;
        justify-content: center;
    }

    .profile-caret {
        display: none;
    }
}

/* ─── Student profile page (reference layout) ─── */
.profile-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1100px;
}

.profile-hero {
    overflow: hidden;
    padding: 0;
}

.profile-hero-banner {
    height: 120px;
    background:
        linear-gradient(115deg, rgba(249, 115, 22, 0.55) 0%, rgba(253, 186, 116, 0.45) 45%, rgba(254, 243, 199, 0.7) 100%),
        linear-gradient(180deg, #ffedd5, #fef3c7);
}

.profile-hero-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 0 22px 22px;
    margin-top: -40px;
    flex-wrap: wrap;
}

.profile-hero-main {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.profile-photo-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: linear-gradient(135deg, var(--brand-hover), var(--brand-dark));
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.profile-photo-edit {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--ink);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.profile-photo-edit .material-symbols-rounded {
    font-size: 16px;
}

.profile-photo-edit:hover {
    background: var(--brand);
}

.profile-hero-text {
    padding-bottom: 4px;
    min-width: 0;
}

.profile-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.profile-name-row h2 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.verified-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 11.5px;
    font-weight: 700;
}

.verified-pill .material-symbols-rounded {
    font-size: 15px;
}

.profile-joined {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.profile-joined .material-symbols-rounded {
    font-size: 16px;
    color: var(--muted-2);
}

.profile-joined .dot-sep {
    opacity: 0.5;
}

.profile-details-card .card-head {
    margin-bottom: 18px;
}

.profile-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 20px;
}

.profile-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.pf-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--field);
    border: 1px solid var(--line);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pf-icon .material-symbols-rounded {
    font-size: 18px;
}

.profile-field .pf-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.profile-field strong {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    word-break: break-word;
}

.mini-verified {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--success);
}

.mini-verified .material-symbols-rounded {
    font-size: 13px;
}

.form-field-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
}

.form-field-block .input,
.form-field-block .select {
    font-weight: 500;
}

.form-field-block .input[readonly] {
    opacity: 0.72;
    background: var(--field);
}

/* Pref toggles */
.profile-pref-card {
    padding: 14px 18px;
}

.profile-pref-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 18px;
}

.pref-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.pref-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pref-ui {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--line-strong);
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: background 0.15s ease;
}

.pref-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease;
}

.pref-toggle input:checked + .pref-ui {
    background: var(--brand);
}

.pref-toggle input:checked + .pref-ui::after {
    transform: translateX(18px);
}

.pref-toggle strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.pref-toggle small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
}

.pref-toggle.compact {
    align-items: center;
}

.pref-toggle.compact .pref-ui {
    margin-top: 0;
    width: 36px;
    height: 20px;
}

.pref-toggle.compact .pref-ui::after {
    width: 16px;
    height: 16px;
}

.pref-toggle.compact input:checked + .pref-ui::after {
    transform: translateX(16px);
}

/* 2FA banner */
.profile-security {
    overflow: hidden;
    border: 1px solid rgba(146, 64, 14, 0.15);
    background:
        linear-gradient(105deg, rgba(255, 237, 213, 0.9) 0%, rgba(254, 243, 199, 0.55) 50%, rgba(255, 247, 237, 0.95) 100%);
    box-shadow: var(--shadow-sm);
}

.profile-security-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    flex-wrap: wrap;
}

.sec-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(146, 64, 14, 0.15);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sec-icon .material-symbols-rounded {
    font-size: 26px;
}

.sec-copy {
    flex: 1;
    min-width: 200px;
}

.sec-copy h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
}

.sec-copy p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

@media (max-width: 980px) {
    .profile-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-pref-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .profile-hero-banner {
        height: 88px;
    }

    .profile-photo {
        width: 76px;
        height: 76px;
        font-size: 22px;
    }

    .profile-fields {
        grid-template-columns: 1fr;
    }

    .profile-hero-body {
        padding: 0 14px 16px;
    }

    .profile-edit-form .form-grid.two,
    .profile-edit-form [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ─── Student results: exam-wise mark-loss feedback ─── */
/* Attempts page */
.attempts-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.attempts-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.att-metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    min-width: 0;
}

.att-metric-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.att-metric-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.att-metric-sub {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attempts-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    gap: 16px;
    align-items: start;
}

.attempts-main-head {
    padding: 16px 18px 0;
    margin-bottom: 4px;
}

.attempts-summary {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 !important;
    overflow: hidden;
}

.att-block {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.att-block:last-child {
    border-bottom: 0;
}

.att-block-head {
    margin-bottom: 12px;
}

.att-block-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.att-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.att-actions .btn {
    width: 100%;
    justify-content: flex-start;
}

.att-empty {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.att-latest-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.att-latest-score {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 900;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid rgba(146, 64, 14, 0.15);
    font-variant-numeric: tabular-nums;
}

.att-latest-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.att-latest-meta strong {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.3;
}

.att-latest-meta span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.att-by-exam {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.att-exam-row-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.att-exam-row-top strong {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.att-exam-row-top span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}

.att-exam-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--field);
    border: 1px solid var(--line);
    overflow: hidden;
}

.att-exam-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-dark), var(--brand-hover));
    border-radius: 999px;
}

.att-exam-row-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}

/* Attempts table row UI */
.score-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    border: 1px solid transparent;
}

.score-chip.is-good {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(5, 150, 105, 0.18);
}

.score-chip.is-mid {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.18);
}

.score-chip.is-low {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.15);
}

.score-chip.is-muted {
    background: var(--field);
    color: var(--muted);
    border-color: var(--line);
}

.th-actions,
.att-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.att-details-btn {
    min-width: 88px;
}

table.data tbody tr.att-row:hover .att-details-btn {
    border-color: rgba(146, 64, 14, 0.35);
    color: var(--brand);
    background: var(--brand-soft);
}

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

.results-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) 1fr;
    gap: 16px;
    align-items: start;
}

.results-exam-nav {
    position: sticky;
    top: 0;
}

.results-exam-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.results-exam-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.results-exam-item:hover {
    background: var(--field);
}

.results-exam-item.is-active {
    background: var(--brand-soft);
    border-color: rgba(146, 64, 14, 0.28);
}

.results-exam-item .exam-score-pill {
    margin-left: auto;
    font-size: 12px;
    font-weight: 800;
    color: var(--brand);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 4px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.results-exam-item.is-active .exam-score-pill {
    border-color: rgba(146, 64, 14, 0.25);
}

.results-exam-item .meta {
    min-width: 0;
    flex: 1;
}

.results-exam-item .meta strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-exam-item .meta span {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 2px;
}

.results-summary-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.results-summary-top h2 {
    margin: 0 0 6px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.results-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.results-summary-meta li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--field);
    border: 1px solid var(--line);
    padding: 5px 10px;
    border-radius: 999px;
}

.results-summary-meta .material-symbols-rounded {
    font-size: 16px;
    color: var(--brand);
}

.results-score-big {
    text-align: right;
}

.results-score-big strong {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1;
}

.results-score-big span {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.loss-section {
    background: linear-gradient(180deg, #fef3c7 0%, #ffffff 48%);
    border: 1px solid rgba(146, 64, 14, 0.14);
    border-radius: var(--radius-lg);
    padding: 16px 16px 8px;
}

.loss-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 4px;
}

.loss-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(146, 64, 14, 0.2);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(146, 64, 14, 0.1);
}

.loss-section-icon .material-symbols-rounded {
    font-size: 22px;
}

.loss-section-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
}

.loss-section-head p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.loss-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
}

.loss-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 16px 14px;
    box-shadow: var(--shadow-sm);
}

.loss-card-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 5px 10px 5px 8px;
    border-radius: 999px;
    background: rgba(146, 64, 14, 0.08);
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
}

.loss-card-label .material-symbols-rounded {
    font-size: 16px;
}

.loss-q-id {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.loss-q-prompt {
    margin: 0 0 14px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--muted);
    font-weight: 500;
}

.loss-block {
    margin-bottom: 12px;
}

.loss-block:last-child {
    margin-bottom: 0;
}

.loss-block h4 {
    margin: 0 0 6px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--ink-soft);
}

.loss-block p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    font-weight: 500;
}

.loss-feedback {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loss-feedback li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--ink-soft);
}

.loss-feedback .fb-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.loss-feedback .fb-icon .material-symbols-rounded {
    font-size: 14px;
}

.loss-feedback .fb-icon.miss {
    background: var(--danger-soft);
    color: var(--danger);
}

.loss-feedback .fb-icon.tip {
    background: var(--field);
    color: var(--muted);
    border: 1px solid var(--line);
}

.loss-feedback .fb-icon.ok {
    background: var(--success-soft);
    color: var(--success);
}

.loss-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
}

.loss-empty .material-symbols-rounded {
    font-size: 36px;
    color: var(--success);
    display: block;
    margin: 0 auto 8px;
}

/* ── Leaderboard arena ── */
.lb-arena {
    position: relative;
    border-radius: 22px;
    padding: 20px 18px 18px;
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid rgba(146, 64, 14, 0.14);
    background:
        radial-gradient(900px 280px at 50% -10%, rgba(249, 115, 22, 0.16), transparent 60%),
        radial-gradient(420px 220px at 10% 80%, rgba(59, 130, 246, 0.08), transparent 55%),
        radial-gradient(420px 220px at 90% 70%, rgba(168, 85, 247, 0.07), transparent 55%),
        linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.lb-arena-glow {
    position: absolute;
    inset: auto 20% -40% 20%;
    height: 120px;
    background: radial-gradient(ellipse, rgba(249, 115, 22, 0.18), transparent 70%);
    pointer-events: none;
    filter: blur(8px);
}

.lb-arena-head {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    z-index: 1;
}

.lb-arena-title h2 {
    margin: 8px 0 4px;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.lb-arena-title p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    max-width: 36ch;
}

.lb-arena-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #78350f;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.18);
}

.lb-arena-badge .material-symbols-rounded {
    font-size: 16px;
}

.lb-arena-tools {
    margin: 0;
    gap: 8px;
    align-items: center;
}

.lb-podium {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 250px;
    margin-bottom: 12px;
}

.lb-podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: 18px 18px 14px 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: transform 0.25s var(--ease, ease), box-shadow 0.25s ease;
}

.lb-podium-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
}

.lb-podium-card.is-first {
    order: 2;
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow:
        0 0 0 1px rgba(249, 115, 22, 0.12),
        0 18px 40px rgba(249, 115, 22, 0.14);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.95), #fff 45%);
}

.lb-podium-card.is-second {
    order: 1;
}

.lb-podium-card.is-third {
    order: 3;
}

.lb-podium-card.is-you-card {
    outline: 2px solid rgba(249, 115, 22, 0.45);
    outline-offset: 2px;
}

.lb-podium-top {
    width: 100%;
    padding: 16px 12px 12px;
}

.lb-podium-card.is-first .lb-podium-top {
    padding-top: 20px;
}

.lb-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    color: #fff;
    margin-bottom: 10px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
    border: 3px solid #fff;
    position: relative;
}

.lb-podium-card.is-first .lb-avatar {
    width: 64px;
    height: 64px;
    font-size: 18px;
}

.lb-avatar .lb-crown {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.lb-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #fff;
    margin-bottom: 8px;
}

.lb-medal.gold {
    background: linear-gradient(135deg, #fbbf24, #92400e);
    box-shadow: 0 4px 12px rgba(146, 64, 14, 0.3);
}

.lb-medal.silver {
    background: linear-gradient(135deg, #cbd5e1, #64748b);
}

.lb-medal.bronze {
    background: linear-gradient(135deg, #d97706, #78350f);
}

.lb-podium-card strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 2px;
    line-height: 1.25;
}

.lb-podium-card.is-first strong {
    font-size: 15px;
}

.lb-podium-card span.meta {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.lb-podium-score {
    font-size: 26px;
    font-weight: 900;
    color: var(--brand, #92400e);
    letter-spacing: -0.03em;
    line-height: 1;
}

.lb-podium-card.is-first .lb-podium-score {
    font-size: 32px;
}

.lb-podium-bar {
    width: 72%;
    height: 6px;
    border-radius: 999px;
    background: var(--field, #f1f5f9);
    margin: 10px auto 0;
    overflow: hidden;
}

.lb-podium-bar > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b45309, #92400e);
}

.lb-plinth {
    width: 100%;
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-weight: 900;
    font-size: 28px;
    letter-spacing: -0.04em;
    color: rgba(15, 23, 42, 0.08);
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.lb-plinth.is-gold {
    height: 72px;
    background: linear-gradient(180deg, #fef3c7, #ffedd5);
    color: rgba(194, 65, 12, 0.18);
}

.lb-plinth.is-silver {
    height: 52px;
    background: linear-gradient(180deg, #f8fafc, #e2e8f0);
}

.lb-plinth.is-bronze {
    height: 40px;
    background: linear-gradient(180deg, #fef3c7, #fed7aa);
    color: rgba(154, 52, 18, 0.16);
}

.lb-you-strip {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(146, 64, 14, 0.35);
    background: rgba(255, 247, 237, 0.75);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft, #1e293b);
}

.lb-you-strip strong {
    color: var(--brand, #92400e);
    font-weight: 800;
}

.lb-you-strip .btn {
    flex-shrink: 0;
}

.lb-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.lb-kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
    min-height: 88px;
}

.lb-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--field);
    color: var(--brand);
}

.lb-kpi-rank .lb-kpi-icon {
    background: rgba(249, 115, 22, 0.12);
    color: #78350f;
}

.lb-kpi-score .lb-kpi-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.lb-kpi-field .lb-kpi-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.lb-kpi-value {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.1;
}

.lb-kpi-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft, #334155);
    margin-top: 2px;
}

.lb-kpi-hint {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 2px;
}

.lb-kpi-ring {
    margin-left: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e2e8f0 0);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.lb-kpi-ring > i {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
}

.lb-board-card {
    overflow: hidden;
}

.lb-table .lb-racer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-table .lb-racer-av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.lb-score-cell {
    min-width: 110px;
}

.lb-score-cell strong {
    display: block;
    margin-bottom: 4px;
}

.lb-score-track {
    height: 5px;
    border-radius: 999px;
    background: var(--field);
    overflow: hidden;
    max-width: 100px;
}

.lb-score-track > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b45309, #92400e);
}

.lb-table tr.is-you {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.03));
}

.lb-table tr.is-you td {
    font-weight: 600;
}

.lb-table tr.is-you td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}

.lb-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 13px;
    background: var(--field, #f8fafc);
    color: var(--ink);
}

.lb-rank.gold {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
}

.lb-rank.silver {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #475569;
}

.lb-rank.bronze {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    color: #9a3412;
}

.lb-you-pill {
    display: inline-flex;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--brand-soft, rgba(146, 64, 14, 0.1));
    color: var(--brand, #92400e);
    vertical-align: middle;
}

@media (max-width: 900px) {
    .attempts-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .attempts-layout {
        grid-template-columns: 1fr;
    }

    .attempts-summary {
        position: static;
    }

    .results-layout {
        grid-template-columns: 1fr;
    }

    .results-exam-nav {
        position: static;
    }

    .results-exam-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .results-exam-item {
        min-width: 200px;
        flex-shrink: 0;
    }

    .lb-podium {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .lb-podium-card.is-first,
    .lb-podium-card.is-second,
    .lb-podium-card.is-third {
        order: 0;
    }

    .lb-plinth {
        display: none;
    }

    .lb-kpi-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .form-grid.two {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Messages & support ── */
.msg-layout {
    display: grid;
    gap: 16px;
}

.msg-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.msg-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
}

.msg-stat span {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.msg-stat strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.msg-thread-list {
    display: flex;
    flex-direction: column;
}

.msg-thread-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background 0.12s ease;
}

.msg-thread-row:last-child {
    border-bottom: 0;
}

.msg-thread-row:hover {
    background: var(--field);
}

.msg-thread-row.is-unread {
    background: rgba(146, 64, 14, 0.04);
}

.msg-thread-row.is-unread:hover {
    background: rgba(146, 64, 14, 0.07);
}

.msg-thread-main {
    min-width: 0;
}

.msg-thread-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.msg-thread-top strong {
    font-size: 14px;
    font-weight: 750;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.msg-thread-meta {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.msg-thread-preview {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.msg-thread-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.msg-thread-time {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted-2);
    white-space: nowrap;
}

.msg-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
}

.msg-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.msg-empty .material-symbols-rounded {
    font-size: 36px;
    color: var(--muted-2);
    margin-bottom: 8px;
}

.msg-empty strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
    margin-bottom: 4px;
}

.msg-empty p {
    margin: 0 auto;
    max-width: 320px;
    font-size: 13px;
    line-height: 1.5;
}

.msg-chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(42vh, 360px);
    overflow-y: auto;
    padding: 4px 2px 8px;
}

.msg-bubble {
    max-width: min(92%, 420px);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--field);
}

.msg-bubble.is-admin {
    align-self: flex-start;
    border-color: rgba(146, 64, 14, 0.22);
    background: rgba(146, 64, 14, 0.06);
}

.msg-bubble.is-student {
    align-self: flex-end;
    background: #f1f5f9;
}

.msg-bubble-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.msg-bubble-head strong {
    font-size: 12px;
    font-weight: 750;
    color: var(--ink);
}

.msg-bubble-head span {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted-2);
}

.msg-bubble p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-thread-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.msg-compose-hint {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
}

.icon-btn .dot[hidden] {
    display: none;
}

.nav-count.is-alert {
    background: var(--danger);
    color: #fff;
}

@media (max-width: 900px) {
    .msg-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .msg-stats {
        grid-template-columns: 1fr;
    }
}

/* ── 2FA manager (profile) ── */
.tfa-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tfa-status-pill.is-on {
    background: var(--success-soft);
    color: var(--success);
}

.tfa-status-pill.is-off {
    background: var(--field);
    color: var(--muted);
}

.tfa-method-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--field);
    margin-bottom: 10px;
}

.tfa-method-card h4 {
    margin: 0 0 4px;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ink);
}

.tfa-method-card p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.45;
}

.tfa-qr-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
    margin: 10px 0 12px;
}

.tfa-qr-wrap img {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
}

.tfa-secret-box {
    flex: 1;
    min-width: 160px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed var(--line-strong);
    background: var(--surface);
    word-break: break-all;
    color: var(--ink);
}

.tfa-demo-mail {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(146, 64, 14, 0.45);
    background: rgba(146, 64, 14, 0.06);
    font-size: 12.5px;
    color: var(--ink-soft);
}

.tfa-demo-mail code {
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--brand-dark);
}

.tfa-recovery-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 8px 0 0;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
}

.tfa-recovery-list span {
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--field);
    border: 1px solid var(--line);
    text-align: center;
}

/* ── Birthday celebration (one day only) ── */
.bday-banner {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(146, 64, 14, 0.28);
    background:
        radial-gradient(circle at 12% 20%, rgba(251, 191, 36, 0.35), transparent 42%),
        radial-gradient(circle at 88% 10%, rgba(249, 115, 22, 0.28), transparent 40%),
        radial-gradient(circle at 70% 90%, rgba(236, 72, 153, 0.18), transparent 45%),
        linear-gradient(120deg, #fef3c7 0%, #ffedd5 45%, #fce7f3 100%);
    box-shadow: 0 12px 32px rgba(146, 64, 14, 0.12);
}

.bday-banner.is-admin {
    background:
        radial-gradient(circle at 10% 30%, rgba(251, 191, 36, 0.28), transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(59, 130, 246, 0.12), transparent 42%),
        linear-gradient(120deg, #fffbeb 0%, #fef3c7 50%, #eff6ff 100%);
}

.bday-banner-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.bday-banner-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #78350f;
}

.bday-banner h2 {
    margin: 0 0 6px;
    font-size: clamp(18px, 2.4vw, 24px);
    font-weight: 850;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.bday-banner p {
    margin: 0;
    max-width: 46ch;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-soft);
    font-weight: 500;
}

.bday-banner-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.bday-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.bday-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(146, 64, 14, 0.18);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
}

.bday-chip-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #a16207, #db2777);
}

.bday-chip span {
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
}

.bday-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #fbbf24, #a16207);
    color: #7c2d12;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.profile-hero.is-birthday .profile-hero-banner {
    background:
        linear-gradient(120deg, rgba(251, 191, 36, 0.55), rgba(249, 115, 22, 0.5), rgba(236, 72, 153, 0.4)),
        linear-gradient(90deg, #b45309, #f472b6);
}

.profile-name-row .bday-pill {
    margin-left: 4px;
}

/* Confetti pieces */
.bday-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bday-confetti i {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    opacity: 0.85;
    animation: bday-fall linear infinite;
}

.bday-confetti i:nth-child(1) { left: 6%; background: #a16207; animation-duration: 4.2s; animation-delay: 0s; }
.bday-confetti i:nth-child(2) { left: 18%; background: #fbbf24; animation-duration: 3.6s; animation-delay: 0.4s; width: 6px; height: 6px; border-radius: 50%; }
.bday-confetti i:nth-child(3) { left: 32%; background: #ec4899; animation-duration: 5s; animation-delay: 0.2s; }
.bday-confetti i:nth-child(4) { left: 48%; background: #3b82f6; animation-duration: 3.8s; animation-delay: 0.8s; width: 7px; height: 7px; border-radius: 50%; }
.bday-confetti i:nth-child(5) { left: 62%; background: #a855f7; animation-duration: 4.5s; animation-delay: 0.1s; }
.bday-confetti i:nth-child(6) { left: 74%; background: #22c55e; animation-duration: 3.4s; animation-delay: 0.6s; }
.bday-confetti i:nth-child(7) { left: 86%; background: #f43f5e; animation-duration: 4.8s; animation-delay: 0.3s; width: 6px; height: 10px; }
.bday-confetti i:nth-child(8) { left: 94%; background: #fbbf24; animation-duration: 3.9s; animation-delay: 0.9s; border-radius: 50%; }

@keyframes bday-fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 0; }
    12% { opacity: 0.9; }
    100% { transform: translateY(140px) rotate(280deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bday-confetti i {
        animation: none !important;
        opacity: 0.35;
        top: 12px;
    }
}
