* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6fb;
    color: #111827;
    font-family: Arial, sans-serif;
}

a {
    color: inherit;
}

.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: #ffffff;
    padding: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 13px;
    color: #cbd5e1;
    margin-top: 2px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: block;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 12px;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.04);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.content {
    padding: 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
}

.page-header p {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 15px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 220px 220px 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.05);
}

.stat-card.wide {
    min-width: 0;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.stat-path {
    font-family: Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
    line-height: 1.45;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.05);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h2 {
    margin: 0;
    font-size: 20px;
}

.table-wrap {
    width: 100%;
}

.horizontal-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    background: #f9fafb;
    color: #374151;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    white-space: nowrap;
}

.data-table td {
    border-bottom: 1px solid #eef2f7;
    padding: 12px;
    vertical-align: top;
}

.data-table tr:hover td {
    background: #fafafa;
}

.data-table.compact {
    font-size: 13px;
}

.data-table.compact th,
.data-table.compact td {
    padding: 9px 10px;
}

.table-name {
    font-family: Consolas, monospace;
    font-weight: 600;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 10px;
    background: #4f46e5;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #4f46e5;
}

.button-link:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.button-link.secondary {
    background: #ffffff;
    color: #111827;
    border-color: #d1d5db;
}

.button-link.secondary:hover {
    background: #f9fafb;
}

.empty-cell {
    color: #6b7280;
    text-align: center;
    padding: 24px;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }
}
.schema-card {
    margin-bottom: 28px;
}

.schema-card-header {
    align-items: flex-start;
}

.schema-block {
    margin-top: 22px;
}

.schema-block h3 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #111827;
}

.muted-text {
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
}

.empty-box {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    color: #6b7280;
    border-radius: 12px;
    padding: 16px;
    font-size: 14px;
}

.sql-details {
    margin-top: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
    padding: 12px 14px;
}

.sql-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #374151;
}

.sql-details pre {
    margin: 12px 0 0;
    padding: 14px;
    overflow-x: auto;
    background: #111827;
    color: #e5e7eb;
    border-radius: 12px;
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
}
.participants-table th,
.participants-table td {
    min-width: 120px;
}

.participants-table th:first-child,
.participants-table td:first-child {
    min-width: 220px;
}

.person-name {
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    margin-bottom: 5px;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-empty {
    background: #f3f4f6;
    color: #6b7280;
}

.small-stat {
    font-size: 26px;
}

.second-line {
    margin-top: 12px;
}

.session-header {
    align-items: flex-start;
}

.session-status {
    text-align: right;
}

.session-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    margin: 16px 0 18px;
}

.details-table-wrap {
    margin-top: 12px;
}

@media (max-width: 1100px) {
    .session-meta-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .session-meta-grid {
        grid-template-columns: 1fr;
    }

    .session-status {
        text-align: left;
    }
}
.inline-form {
    display: inline-flex;
    margin: 0;
}

button.button-link {
    cursor: pointer;
    font-family: inherit;
}

.button-link.danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.button-link.danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.action-result {
    border-radius: 16px;
    padding: 18px;
    border: 1px solid #e5e7eb;
}

.action-ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.action-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.action-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

.action-message {
    font-size: 16px;
    margin-bottom: 10px;
}

.action-links {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.backup-box {
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px;
}
.admin-user-box {
    margin-top: 28px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
}

.admin-user-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.admin-user-name {
    font-size: 15px;
    font-weight: 700;
}

.admin-user-time {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
    line-height: 1.35;
}

.logout-link {
    display: inline-flex;
    margin-top: 12px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}

.logout-link:hover {
    text-decoration: underline;
}

.login-body {
    background: #f4f6fb;
    min-height: 100vh;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(17, 24, 39, 0.12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-title.dark {
    color: #111827;
}

.brand-subtitle.dark {
    color: #6b7280;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.2;
}

.login-subtitle {
    margin: 0 0 20px;
    color: #6b7280;
    font-size: 15px;
    line-height: 1.45;
}

.login-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 11px 12px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-label {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-top: 4px;
}

.form-input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
}

.form-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.login-button {
    min-height: 46px;
    margin-top: 10px;
    border: 1px solid #4f46e5;
    border-radius: 12px;
    background: #4f46e5;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.login-button:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.login-note {
    margin-top: 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    border-radius: 14px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
}
.nowrap {
    white-space: nowrap;
}

.logs-limit-form {
    align-items: center;
    gap: 8px;
}

.mini-form-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.mini-select {
    min-height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 6px 10px;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    outline: none;
}

.small-details {
    max-width: 420px;
}

.small-details summary {
    cursor: pointer;
    color: #4f46e5;
    font-weight: 700;
}

.small-details pre {
    max-width: 680px;
    max-height: 260px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 12px;
    border-radius: 10px;
    background: #111827;
    color: #e5e7eb;
    font-family: Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
}
.actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.backup-instruction {
    color: #374151;
    font-size: 15px;
    line-height: 1.55;
}

.backup-instruction p {
    margin: 0 0 12px;
}

.backup-instruction pre {
    margin: 12px 0;
    padding: 14px;
    overflow-x: auto;
    background: #111827;
    color: #e5e7eb;
    border-radius: 12px;
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
}
.public-test-grid {
    display: grid;
    grid-template-columns: 1.5fr 360px;
    gap: 24px;
    margin-bottom: 24px;
}

.public-test-link-card,
.qr-card {
    margin-bottom: 0;
}

.link-box {
    margin-bottom: 16px;
}

.copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copy-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 8px 10px;
    font-family: Consolas, monospace;
    font-size: 13px;
    color: #111827;
    background: #f9fafb;
}

.small-admin-note {
    margin-top: 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    border-radius: 14px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.qr-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
}

.qr-wrap img {
    width: 230px;
    height: 230px;
    display: block;
}

.qr-url {
    margin-top: 12px;
    text-align: center;
}

.mini-progress-text {
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}

.mini-progress-bar {
    width: 150px;
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #4f46e5;
}

@media (max-width: 1200px) {
    .public-test-grid {
        grid-template-columns: 1fr;
    }

    .qr-card {
        max-width: 420px;
    }
}
/* =========================================================
   Psychotest UI redesign v1, report-inspired style
   Safe to keep after the original styles: this block overrides
   colors, spacing and responsive behavior without changing routes.
   ========================================================= */
:root {
    --pt-bg: #f6f8fc;
    --pt-bg-soft: #eef3fb;
    --pt-card: #ffffff;
    --pt-card-soft: #f8fafd;
    --pt-text: #0f172a;
    --pt-muted: #64748b;
    --pt-muted-2: #94a3b8;
    --pt-border: #d6dee9;
    --pt-border-soft: #e7edf5;
    --pt-primary: #4f46e5;
    --pt-primary-2: #7c6ff0;
    --pt-primary-dark: #3730a3;
    --pt-green: #0f766e;
    --pt-green-bg: #dffaf1;
    --pt-yellow: #b78103;
    --pt-yellow-bg: #fff7d6;
    --pt-red: #b42318;
    --pt-red-bg: #fee4e2;
    --pt-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
    --pt-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.055);
    --pt-radius: 22px;
    --pt-radius-sm: 14px;
    --pt-sidebar-width: 282px;
    --pt-font: Inter, Manrope, "Segoe UI", Arial, sans-serif;
}

html {
    min-width: 320px;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.09), transparent 34rem),
        radial-gradient(circle at right 12rem, rgba(121, 197, 184, 0.10), transparent 30rem),
        linear-gradient(180deg, #fbfcff 0%, var(--pt-bg) 44%, #f3f6fb 100%);
    color: var(--pt-text);
    font-family: var(--pt-font);
    letter-spacing: -0.01em;
}

.layout {
    grid-template-columns: var(--pt-sidebar-width) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96)),
        radial-gradient(circle at top left, rgba(124, 111, 240, 0.42), transparent 18rem);
    color: #ffffff;
    padding: 22px 18px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand,
.login-brand {
    gap: 12px;
}

.brand-mark,
.test-brand-mark {
    background: linear-gradient(135deg, var(--pt-primary), var(--pt-primary-2));
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.28);
    border-radius: 16px;
    letter-spacing: -0.04em;
}

.brand-title,
.test-brand-title {
    font-family: Manrope, Inter, "Segoe UI", Arial, sans-serif;
    font-weight: 850;
    letter-spacing: -0.03em;
}

.brand-subtitle,
.test-brand-subtitle {
    color: #aeb9c8;
}

.nav {
    gap: 8px;
}

.nav-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #e6edf7;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 720;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.17);
    transform: translateX(2px);
}

.admin-user-box {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
}

.content {
    width: 100%;
    max-width: 1480px;
    padding: 32px clamp(18px, 3vw, 42px) 44px;
}

.page-header {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--pt-border-soft);
    border-radius: 26px;
    padding: 20px 20px;
    box-shadow: var(--pt-shadow-soft);
    backdrop-filter: blur(10px);
}

.page-header h1 {
    font-family: Manrope, Inter, "Segoe UI", Arial, sans-serif;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 850;
    letter-spacing: -0.045em;
    color: var(--pt-text);
}

.page-header p,
.muted-text,
.stat-label,
.login-subtitle,
.small-admin-note,
.login-note {
    color: var(--pt-muted);
}

.header-actions,
.actions-row,
.button-row,
.action-links {
    gap: 9px;
}

.stats-grid {
    grid-template-columns: repeat(2, minmax(180px, 220px)) minmax(280px, 1fr);
    gap: 14px;
}

.card,
.stat-card,
.login-card,
.action-result {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius);
    box-shadow: var(--pt-shadow-soft);
}

.card,
.stat-card {
    padding: 18px;
}

.card-header h2 {
    font-family: Manrope, Inter, "Segoe UI", Arial, sans-serif;
    font-weight: 820;
    letter-spacing: -0.03em;
}

.stat-value {
    font-family: Manrope, Inter, "Segoe UI", Arial, sans-serif;
    font-weight: 850;
    letter-spacing: -0.045em;
}

.stat-path,
.table-name,
.copy-input,
.sql-details pre,
.backup-instruction pre,
.small-details pre {
    font-family: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

.table-wrap {
    border: 1px solid var(--pt-border-soft);
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
}

.horizontal-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.data-table th {
    background: #f6f8fc;
    color: #334155;
    border-bottom: 1px solid var(--pt-border-soft);
    font-size: 12px;
    letter-spacing: 0.01em;
    text-transform: none;
}

.data-table td {
    border-bottom: 1px solid #edf2f7;
}

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

.data-table tr:hover td {
    background: #fbfcff;
}

.button-link,
.login-button {
    min-height: 38px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--pt-primary), var(--pt-primary-2));
    border: 1px solid rgba(79, 70, 229, 0.88);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.16);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.button-link:hover,
.login-button:hover {
    background: linear-gradient(135deg, #4338ca, #6d5eea);
    border-color: #4338ca;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.22);
    transform: translateY(-1px);
}

.button-link.secondary {
    color: var(--pt-text);
    background: #ffffff;
    border-color: var(--pt-border);
    box-shadow: none;
}

.button-link.secondary:hover {
    color: var(--pt-primary-dark);
    background: #f7f8ff;
    border-color: #c7d2fe;
}

.button-link.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-color: #dc2626;
}

.button-link.danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    border-color: #b91c1c;
}

.form-input,
.copy-input,
.mini-select {
    border-color: var(--pt-border);
    border-radius: 13px;
}

.form-input:focus,
.copy-input:focus,
.mini-select:focus {
    border-color: var(--pt-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10);
}

.status-pill,
.mini-tag {
    border-radius: 999px;
    font-weight: 780;
}

.status-completed {
    background: var(--pt-green-bg);
    color: #027a48;
}

.status-progress {
    background: var(--pt-yellow-bg);
    color: var(--pt-yellow);
}

.status-empty {
    background: #f1f5f9;
    color: var(--pt-muted);
}

.status-danger,
.action-error {
    background: var(--pt-red-bg);
    color: var(--pt-red);
    border-color: #fecaca;
}

.action-ok {
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.login-body {
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.12), transparent 30rem),
        linear-gradient(180deg, #fbfcff 0%, #f4f7fb 100%);
}

.login-card {
    max-width: 470px;
    padding: 30px;
}

.login-card h1 {
    font-family: Manrope, Inter, "Segoe UI", Arial, sans-serif;
    font-weight: 850;
    letter-spacing: -0.045em;
}

.login-note,
.small-admin-note,
.empty-box,
.backup-box,
.sql-details,
.score-details {
    background: #f8fafd;
    border-color: var(--pt-border-soft);
}

.public-test-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 360px);
}

.qr-wrap {
    border-color: var(--pt-border-soft);
    background: linear-gradient(180deg, #ffffff, #f8fafd);
}

.mini-progress-fill {
    background: linear-gradient(90deg, var(--pt-primary), var(--pt-primary-2));
}

/* Better mobile behavior */
@media (max-width: 1180px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        overflow: visible;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .brand {
        margin-bottom: 14px;
    }

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

    .nav-link {
        justify-content: center;
        text-align: center;
        min-height: 40px;
        padding: 9px 10px;
        font-size: 13px;
    }

    .nav-link:hover {
        transform: none;
    }

    .admin-user-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 14px;
        padding: 12px;
    }

    .admin-user-time {
        display: none;
    }

    .content {
        max-width: 100%;
    }

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

    .stat-card.wide {
        grid-column: 1 / -1;
    }

    .public-test-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    body {
        background: #f6f8fc;
    }

    .sidebar {
        padding: 14px 12px;
        border-radius: 0 0 22px 22px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        font-size: 19px;
    }

    .nav {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scroll-snap-type: x proximity;
    }

    .nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .admin-user-box {
        display: none;
    }

    .content {
        padding: 16px 10px 28px;
    }

    .page-header {
        padding: 16px;
        border-radius: 22px;
        margin-bottom: 16px;
    }

    .page-header h1 {
        font-size: 25px;
    }

    .page-header p {
        font-size: 14px;
    }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .header-actions .button-link,
    .header-actions .inline-form,
    .header-actions button.button-link {
        width: 100%;
    }

    .inline-form {
        width: 100%;
    }

    .stats-grid,
    .session-meta-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .card,
    .stat-card {
        padding: 14px;
        border-radius: 20px;
        margin-bottom: 16px;
    }

    .card-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .copy-row,
    .actions-row {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-row .button-link,
    .actions-row .button-link,
    .actions-row .inline-form,
    .actions-row button.button-link,
    .button-link {
        width: 100%;
    }

    .table-wrap {
        border-radius: 16px;
    }

    .data-table {
        min-width: 760px;
        font-size: 13px;
    }

    .participants-table {
        min-width: 980px;
    }

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

    .login-page {
        align-items: flex-start;
        padding: 16px 10px;
    }

    .login-card {
        padding: 22px;
        border-radius: 22px;
    }

    .qr-card {
        max-width: none;
    }

    .qr-wrap img {
        width: min(230px, 70vw);
        height: min(230px, 70vw);
    }
}

@media (max-width: 430px) {
    .page-header h1 {
        font-size: 23px;
    }

    .stat-value {
        font-size: 28px;
    }

    .brand-title,
    .test-brand-title {
        font-size: 16px;
    }

    .brand-subtitle,
    .test-brand-subtitle {
        font-size: 12px;
    }
}

/* =========================================================
   Mobile admin stage 2
   Makes admin pages usable on phones without horizontal page overflow.
   Participants page gets a native card layout on small screens.
   ========================================================= */
.layout,
.content,
.sidebar,
.page-header,
.card,
.stat-card,
.table-wrap,
.public-test-grid,
.copy-row,
.actions-row,
.header-actions {
    min-width: 0;
}

body {
    overflow-x: hidden;
}

.card {
    max-width: 100%;
}

.table-wrap,
.table-wrap.horizontal-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-wrap::after {
    content: "";
    display: block;
    clear: both;
}

.participants-mobile-list {
    display: none;
}

@media (max-width: 760px) {
    .content {
        padding-left: 8px;
        padding-right: 8px;
    }

    .sidebar {
        margin-bottom: 2px;
    }

    .brand {
        margin-bottom: 10px;
    }

    .nav {
        margin-left: -2px;
        margin-right: -2px;
        padding-left: 2px;
        padding-right: 2px;
    }

    .nav-link {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 12.5px;
        border-radius: 12px;
    }

    .page-header {
        padding: 14px;
        border-radius: 20px;
    }

    .page-header h1 {
        font-size: 24px;
        line-height: 1.12;
    }

    .page-header p {
        line-height: 1.38;
    }

    .header-actions {
        gap: 8px;
    }

    .button-link,
    .login-button {
        min-height: 42px;
        padding: 9px 12px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 13px;
    }

    .stat-value {
        font-size: 27px;
    }

    .card {
        padding: 12px;
        border-radius: 18px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .participants-desktop-table {
        display: none;
    }

    .participants-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .participant-mobile-card {
        width: 100%;
        background: #ffffff;
        border: 1px solid var(--pt-border-soft);
        border-radius: 18px;
        padding: 13px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
    }

    .participant-mobile-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: center;
        margin-bottom: 12px;
    }

    .participant-mobile-person {
        min-width: 0;
    }

    .participant-mobile-open {
        width: auto !important;
        min-width: 86px;
        white-space: nowrap;
    }

    .participant-mobile-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .mobile-meta-item {
        min-width: 0;
        background: #f8fafd;
        border: 1px solid var(--pt-border-soft);
        border-radius: 14px;
        padding: 9px 10px;
    }

    .mobile-meta-item span,
    .mobile-section-label {
        display: block;
        color: var(--pt-muted);
        font-size: 11.5px;
        font-weight: 760;
        letter-spacing: 0.01em;
        margin-bottom: 4px;
    }

    .mobile-meta-item strong {
        display: block;
        min-width: 0;
        color: var(--pt-text);
        font-size: 13px;
        font-weight: 800;
        overflow-wrap: anywhere;
    }

    .participant-mobile-block {
        padding-top: 11px;
        border-top: 1px solid var(--pt-border-soft);
        margin-top: 10px;
    }

    .mobile-method-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mobile-method-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        background: #fbfcff;
        border: 1px solid var(--pt-border-soft);
        border-radius: 14px;
        padding: 9px 10px;
    }

    .mobile-method-title {
        min-width: 0;
        color: var(--pt-text);
        font-size: 13px;
        font-weight: 800;
        line-height: 1.25;
    }

    .mobile-method-status {
        text-align: right;
        min-width: 86px;
    }

    .mobile-method-status .status-pill {
        margin-bottom: 3px;
    }

    .table-wrap:not(.participants-desktop-table) {
        border-radius: 14px;
    }

    .data-table:not(.participants-table) {
        min-width: 680px;
    }

    .small-details,
    .small-details pre,
    .sql-details pre,
    .backup-instruction pre {
        max-width: 100%;
    }

    .copy-input {
        min-width: 0;
        font-size: 12px;
    }

    .public-test-grid {
        gap: 14px;
    }
}

@media (max-width: 430px) {
    .content {
        padding-left: 7px;
        padding-right: 7px;
    }

    .participant-mobile-card {
        padding: 11px;
        border-radius: 16px;
    }

    .participant-mobile-head {
        grid-template-columns: 1fr;
    }

    .participant-mobile-open {
        width: 100% !important;
    }

    .participant-mobile-meta {
        grid-template-columns: 1fr;
    }

    .mobile-method-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .mobile-method-status {
        text-align: left;
    }
}

/* Stage 3: contact columns */
.data-table td,
.participant-mobile-card,
.stat-path {
    overflow-wrap: anywhere;
}

.participant-mobile-meta .mobile-meta-item strong {
    overflow-wrap: anywhere;
}
