/* ============================================
   FormLLC Test Portal - Shared Styles
   ============================================ */

:root {
    --navy-950: #08111f;
    --navy-900: #0f172a;
    --navy-800: #172554;
    --navy-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --green-600: #16a34a;
    --green-100: #dcfce7;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --red-600: #dc2626;
    --red-100: #fee2e2;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: all 0.22s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--slate-50);
    color: var(--slate-800);
    line-height: 1.6;
}

body.nav-open {
    overflow: hidden;
}

a {
    color: var(--blue-600);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--navy-800);
}

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
    color: var(--slate-900);
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.125rem;
}

.page-wrapper {
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 38%),
        radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.12), transparent 34%),
        linear-gradient(135deg, var(--navy-950), var(--navy-900) 45%, var(--navy-800));
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo h1 {
    font-size: 1.7rem;
}

.auth-logo span,
.selection-logo span,
.sidebar-brand span {
    color: var(--blue-600);
}

.auth-logo p {
    color: var(--slate-500);
    font-size: 0.95rem;
    margin-top: 6px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--slate-700);
    letter-spacing: 0.02em;
}

.form-group label .optional {
    font-weight: 500;
    color: var(--slate-500);
}

.form-control {
    width: 100%;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--slate-800);
    font: inherit;
    padding: 12px 14px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    outline: none;
}

.form-control::placeholder {
    color: var(--slate-400);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 700;
    padding: 11px 20px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
    color: var(--white);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.22);
}

.btn-secondary {
    background: var(--slate-100);
    color: var(--slate-700);
    border-color: var(--slate-200);
}

.btn-success {
    background: var(--green-600);
    color: var(--white);
}

.btn-danger {
    background: var(--red-600);
    color: var(--white);
}

.btn-warning {
    background: var(--amber-600);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    font-size: 0.84rem;
    padding: 9px 14px;
}

.btn-lg {
    padding: 14px 24px;
}

.btn-xs {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 700;
}

.btn-retest {
    background: var(--blue-100);
    color: var(--blue-600);
    border-color: rgba(37, 99, 235, 0.2);
}

.btn-ghost {
    background: var(--slate-100);
    color: var(--slate-700);
    border-color: var(--slate-200);
}

.btn-danger-ghost {
    background: var(--red-100);
    color: var(--red-600);
    border-color: rgba(220, 38, 38, 0.18);
}

.flash-message {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 500;
}

.flash-success {
    background: var(--green-100);
    border-color: #bbf7d0;
    color: #166534;
}

.flash-error {
    background: var(--red-100);
    border-color: #fecaca;
    color: #991b1b;
}

.flash-info {
    background: var(--blue-100);
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.flash-warning {
    background: var(--amber-100);
    border-color: #fde68a;
    color: #92400e;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--slate-100);
}

.card-body {
    padding: 22px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.badge-success {
    background: var(--green-100);
    color: #166534;
}

.badge-warning {
    background: var(--amber-100);
    color: #92400e;
}

.badge-danger {
    background: var(--red-100);
    color: #991b1b;
}

.badge-info {
    background: var(--blue-100);
    color: #1d4ed8;
}

.badge-neutral {
    background: var(--slate-100);
    color: var(--slate-700);
}

.score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.score-pass {
    background: var(--green-100);
    color: #166534;
}

.score-fail {
    background: var(--red-100);
    color: #991b1b;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--slate-500); }
.fw-600 { font-weight: 600; }
.fs-sm { font-size: 0.84rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.hidden { display: none !important; }
.inline-form { display: inline; }

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 32%),
        linear-gradient(180deg, var(--navy-950), var(--navy-900));
    color: var(--white);
    z-index: 240;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h2 {
    color: var(--white);
    font-size: 1.15rem;
}

.sidebar-brand p {
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.8rem;
    margin-top: 4px;
}

.sidebar-close {
    display: none;
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 6px 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.92rem;
    font-weight: 600;
}

.nav-item:hover,
.nav-item.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.18);
}

.nav-item--danger {
    color: #fca5a5;
}

.nav-item--danger:hover {
    background: rgba(220, 38, 38, 0.14);
    color: #fecaca;
}

.nav-icon {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.sidebar-footer {
    padding: 16px 20px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 180;
}

.sidebar-overlay.visible {
    display: block;
}

.admin-main {
    flex: 1;
    min-width: 0;
    margin-left: 270px;
    padding: 28px;
}

.admin-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

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

.admin-title-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.hamburger-btn span {
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: var(--slate-700);
}

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

.stat-card {
    position: relative;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: var(--white);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.stat-card.blue::after { background: var(--blue-600); }
.stat-card.green::after { background: var(--green-600); }
.stat-card.amber::after { background: var(--amber-600); }
.stat-card.red::after { background: var(--red-600); }

.stat-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1;
}

.stat-label {
    color: var(--slate-500);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 6px;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card-body {
    min-height: 320px;
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-form .form-control {
    max-width: 260px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-count {
    white-space: nowrap;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    background: var(--white);
}

.table-wrapper--flat {
    border: 0;
    border-radius: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--slate-50);
    color: var(--slate-600);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
    color: var(--slate-700);
}

.data-table tbody tr:hover {
    background: var(--slate-50);
}

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

.table-empty-cell,
.card-empty-state {
    padding: 32px 20px;
}

.question-table-cell {
    min-width: 320px;
}

.question-table-title {
    font-weight: 600;
    color: var(--slate-900);
}

.result-cards,
.question-cards,
.candidate-cards {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.result-card,
.question-card,
.ccard {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.result-card__header,
.ccard__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.result-card__name,
.ccard__name {
    font-weight: 700;
    color: var(--slate-900);
}

.result-card__email,
.ccard__email {
    color: var(--slate-500);
    font-size: 0.85rem;
    word-break: break-word;
}

.result-card__meta,
.ccard__meta,
.question-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.result-card__score,
.result-card__subline {
    margin-top: 12px;
}

.result-card .btn,
.question-card .btn {
    margin-top: 14px;
}

.ccard--retest {
    border-color: #f59e0b;
    background: #fffaf0;
}

.ccard__avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
    color: var(--white);
    font-weight: 800;
}

.ccard__info {
    flex: 1;
    min-width: 0;
}

.ccard__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--slate-100);
}

.action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-retest {
    background: #fff8e8 !important;
}

.row-retest:hover {
    background: #fff1cc !important;
}

.question-card__text {
    font-weight: 600;
    color: var(--slate-900);
}

.question-card__options {
    margin-top: 12px;
    display: grid;
    gap: 6px;
}

.question-card__action {
    margin-top: 12px;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.65);
}

.modal-card {
    width: min(100%, 720px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.selection-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 34%),
        radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.12), transparent 30%),
        linear-gradient(135deg, var(--navy-950), var(--navy-900) 45%, var(--navy-800));
}

.selection-card {
    width: 100%;
    max-width: 620px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 34px;
}

.selection-header {
    text-align: center;
    margin-bottom: 28px;
}

.selection-logo {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.selection-header p {
    color: var(--slate-500);
    margin-top: 10px;
}

.selection-note {
    font-size: 0.84rem;
}

.app-type-grid,
.role-cards {
    display: grid;
    gap: 12px;
}

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

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

.role-card {
    padding: 18px 16px;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.role-card:hover,
.role-card.selected {
    border-color: var(--blue-500);
    background: #eff6ff;
}

.role-icon {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--blue-600);
    margin-bottom: 10px;
}

.role-name {
    font-weight: 700;
    color: var(--slate-900);
}

.score-display {
    margin: 20px 0;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    text-align: center;
}

.score-label {
    color: var(--slate-500);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 10px 0 6px;
}

.score-sub {
    color: var(--slate-500);
    font-size: 0.84rem;
}

.test-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--slate-50);
}

.test-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--navy-950), var(--navy-900));
    color: var(--white);
    flex-shrink: 0;
}

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

.user-name {
    font-weight: 700;
}

.user-role {
    color: rgba(219, 234, 254, 0.84);
    font-size: 0.85rem;
}

.timer-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
}

.timer-box.warning {
    color: #fcd34d;
}

.timer-box.danger {
    color: #fca5a5;
}

.mobile-nav-toggle {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(15, 23, 42, 0.55);
}

.mobile-nav-overlay.visible {
    display: block;
}

.test-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.question-area {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 28px 32px;
}

.question-counter {
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.question-text {
    font-size: 1.14rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 24px;
}

.options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover,
.option-item.selected {
    border-color: var(--blue-500);
    background: #eff6ff;
}

.option-letter {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-weight: 800;
}

.option-item.selected .option-letter {
    background: var(--blue-600);
    color: var(--white);
}

.test-textarea {
    min-height: 220px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.question-nav-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--white);
    border-left: 1px solid var(--slate-200);
    padding: 22px;
    overflow-y: auto;
}

.question-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.question-nav-close {
    display: none;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    background: var(--slate-100);
    color: var(--slate-700);
    padding: 6px 10px;
    font: inherit;
    font-weight: 700;
}

.nav-panel-title {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--slate-500);
    text-transform: uppercase;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.q-num {
    width: 100%;
    aspect-ratio: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    background: var(--white);
    color: var(--slate-700);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.q-num.active {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: var(--white);
}

.q-num.answered {
    background: var(--green-600);
    border-color: var(--green-600);
    color: var(--white);
}

.nav-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--slate-100);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--slate-500);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

.test-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    border-top: 1px solid var(--slate-200);
    background: var(--white);
    flex-shrink: 0;
}

.test-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-warning-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.82);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.tab-warning-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.tab-warning-box {
    width: min(100%, 440px);
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 30px 26px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.warning-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--red-100);
    color: var(--red-600);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.tab-warning-box h2 {
    margin-bottom: 10px;
}

.tab-warning-box p {
    color: var(--slate-600);
    margin-bottom: 14px;
}

.detail-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.info-grid {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px 14px;
}

.info-grid dt {
    color: var(--slate-500);
    font-weight: 600;
}

.info-grid dd {
    margin: 0;
    color: var(--slate-900);
    font-weight: 700;
}

.score-ring {
    width: 126px;
    height: 126px;
    margin: 0 auto 14px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    font-weight: 800;
}

.detail-score-line {
    font-size: 1.05rem;
}

.detail-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.detail-stat-value {
    font-size: 1.55rem;
    font-weight: 800;
}

.detail-stat-green { color: var(--green-600); }
.detail-stat-red { color: var(--red-600); }
.detail-stat-muted { color: var(--slate-400); }

.section-title {
    margin: 28px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--slate-200);
    font-size: 1.08rem;
    font-weight: 800;
}

.result-question {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-left: 4px solid var(--slate-300);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.result-question.correct { border-left-color: var(--green-600); }
.result-question.wrong { border-left-color: var(--red-600); }
.result-question.subjective { border-left-color: var(--blue-600); }

.result-question-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.result-question-label {
    color: var(--slate-500);
    font-size: 0.84rem;
}

.result-question-text {
    color: var(--slate-900);
    font-weight: 600;
    margin-top: 6px;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.q-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    background: var(--slate-50);
}

.q-option.is-correct {
    background: var(--green-100);
    border-color: #bbf7d0;
}

.q-option.is-wrong {
    background: var(--red-100);
    border-color: #fecaca;
}

.q-option-indicator {
    margin-left: auto;
    color: var(--slate-600);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.answer-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.answer-correct {
    background: var(--green-100);
    color: #166534;
}

.answer-wrong {
    background: var(--red-100);
    color: #991b1b;
}

.text-response {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    background: var(--slate-50);
    white-space: pre-wrap;
}

@media (max-width: 1180px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .admin-main {
        padding: 22px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 14px;
    }

    .detail-header {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .form-row,
    .role-cards {
        grid-template-columns: 1fr;
    }

    .auth-page,
    .selection-page {
        padding: 16px;
    }

    .auth-card,
    .selection-card {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.24s ease;
    }

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

    .sidebar-close,
    .hamburger-btn {
        display: inline-flex;
    }

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    .admin-topbar {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .topbar-left {
        width: 100%;
    }

    .admin-actions,
    .filter-form,
    .filter-actions {
        width: 100%;
    }

    .filter-form .form-control {
        max-width: none;
        flex: 1 1 180px;
    }

    .table-wrapper {
        display: none;
    }

    .result-cards,
    .question-cards,
    .candidate-cards {
        display: flex;
    }

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

    .question-area {
        padding: 18px 16px;
    }

    .question-text {
        font-size: 1rem;
    }

    .test-topbar {
        padding: 12px 14px;
        flex-wrap: wrap;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .question-nav-panel {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(86vw, 320px);
        transform: translateX(100%);
        transition: transform 0.24s ease;
        z-index: 320;
        box-shadow: -10px 0 30px rgba(15, 23, 42, 0.16);
    }

    .question-nav-panel.mobile-open {
        transform: translateX(0);
    }

    .question-nav-close {
        display: inline-flex;
    }

    .test-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
    }

    .test-footer-actions {
        width: 100%;
    }

    .test-footer .btn,
    .test-footer-actions .btn {
        flex: 1;
    }

    .result-question {
        padding: 16px;
    }

    .modal-shell {
        padding: 12px;
    }
}

@media (max-width: 540px) {
    h1 {
        font-size: 1.6rem;
    }

    .stats-grid,
    .app-type-grid {
        grid-template-columns: 1fr;
    }

    .result-card__header,
    .ccard__header,
    .ccard__footer {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .detail-stats {
        gap: 18px;
    }

    .test-topbar-left {
        width: 100%;
        justify-content: space-between;
    }

    .timer-box {
        width: 100%;
        justify-content: center;
    }

    .option-item {
        align-items: flex-start;
    }
}
