/* ==========================================================================
   AutoTest Técnico - Estética Clara, Moderna y Altamente Responsiva
   ========================================================================== */

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #0ea5e9;
    --color-accent: #6366f1;
    --color-bg: #f4f7fb;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-text-muted: #475569;
    --color-border: #e2e8f0;
    --color-success: #059669;
    --color-danger: #e11d48;
    --color-warning: #d97706;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.14);
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Header / Navbar */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.76rem;
    color: var(--color-text-muted);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-bg);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
}

.nav-btn {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.nav-btn:hover {
    color: var(--color-text);
}

.nav-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

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

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-text);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--color-primary);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.icon-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.icon-btn.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.icon-btn-danger:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background: rgba(225, 29, 72, 0.06);
}

/* Main Container */
.app-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* Cards & Layout */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
}

.card + .card {
    margin-top: 20px;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.card-subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Auth Screen */
.auth-container {
    min-height: calc(100vh - 88px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand .brand-logo {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 14px;
}

.auth-brand h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.auth-brand p {
    margin: 6px 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: var(--color-bg);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    margin-bottom: 22px;
}

.auth-tab {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.auth-tab.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

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

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

.form-grid .form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 0.94rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
}

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 7px 13px;
    font-size: 0.83rem;
    border-radius: 8px;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: #e9eff7;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.06);
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}

/* Inline Alerts */
.inline-banner {
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.inline-banner.info {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.25);
    color: #0369a1;
}

.inline-banner.warning {
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.25);
    color: #92400e;
}

/* Dashboard Hero */
.hero-banner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: #ffffff;
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-banner h1 {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 800;
}

.hero-banner p {
    margin: 0;
    opacity: 0.92;
    font-size: 0.95rem;
}

.selector-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

/* Quiz Stepper View */
.quiz-shell {
    max-width: 780px;
    margin: 0 auto;
}

.quiz-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.quiz-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.pill-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    border-color: rgba(37, 99, 235, 0.22);
}

.pill-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--color-success);
    border-color: rgba(5, 150, 105, 0.22);
}

.pill-danger {
    background: rgba(225, 29, 72, 0.1);
    color: var(--color-danger);
    border-color: rgba(225, 29, 72, 0.22);
}

.pill-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--color-warning);
    border-color: rgba(217, 119, 6, 0.22);
}

.progress-track {
    width: 100%;
    height: 9px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    transition: width 0.28s ease;
}

.question-number-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 22px;
    line-height: 1.55;
    white-space: pre-line;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 26px;
}

.option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 15px 16px;
    border-radius: 12px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: 0.96rem;
    color: var(--color-text);
}

.option-card:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.03);
}

.option-card.selected {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.07);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.option-letter {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-weight: 700;
    font-size: 0.86rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-card.selected .option-letter {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.option-text {
    padding-top: 3px;
    line-height: 1.45;
}

.option-card-other {
    border-style: dashed;
}

.other-answer-wrap {
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}

.recalc-note-box {
    margin-top: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.2);
    font-size: 0.88rem;
    color: var(--color-text);
    line-height: 1.5;
}

.review-recalc-bar {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.review-recalc-hint {
    font-size: 0.84rem;
    color: var(--color-text-muted);
}

.quiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

/* Results & Resolution Review */
.score-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

.review-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.filter-tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--color-bg);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
}

.review-item {
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--color-surface);
}

.review-item.is-wrong {
    border-left: 4px solid var(--color-danger);
}

.review-item.is-right {
    border-left: 4px solid var(--color-success);
}

.review-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.review-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.review-opt {
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: 0.9rem;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.review-opt.opt-correct {
    background: rgba(5, 150, 105, 0.09);
    border-color: var(--color-success);
    color: #065f46;
    font-weight: 600;
}

.review-opt.opt-wrong {
    background: rgba(225, 29, 72, 0.08);
    border-color: var(--color-danger);
    color: #9f1239;
    font-weight: 600;
}

.resolution-box {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 12px;
}

.resolution-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.resolution-text {
    font-size: 0.93rem;
    color: var(--color-text);
    white-space: pre-line;
    line-height: 1.55;
}

/* ==========================================================================
   Responsive Tables - CERO scroll horizontal en pantallas pequeñas
   ========================================================================== */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.91rem;
}

.responsive-table thead th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.responsive-table tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    word-break: break-word;
}

.responsive-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.025);
}

/* Admin Config Tabs & Color Grid */
.config-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
}

.config-tab-btn {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 9px 15px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.config-tab-btn.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
}

.color-field input[type="color"] {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.color-field-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.color-field-meta label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
}

.color-field-meta input[type="text"] {
    margin-top: 3px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 0.78rem;
    font-family: monospace;
    width: 100%;
    background: var(--color-surface);
}

.config-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

/* Loading & Empty States */
.initial-loader, .loading-card {
    text-align: center;
    padding: 56px 20px;
    color: var(--color-text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    animation: spin 0.75s linear infinite;
}

.auth-forgot-wrap {
    text-align: center;
    margin-top: 14px;
}

.text-link {
    background: none;
    border: none;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
    color: var(--color-primary-hover);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ==========================================================================
   Cuadros de diálogo Draggable - SIN blur, solo suave opacamiento
   ========================================================================== */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.34);
    /* Explícitamente SIN backdrop-filter / blur */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.app-modal-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.app-modal-header:active {
    cursor: grabbing;
}

.app-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.app-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-modal-close:hover {
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text);
}

.app-modal-body {
    padding: 20px 18px;
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.55;
    max-height: 65vh;
    overflow-y: auto;
}

.app-modal-body p {
    margin: 0 0 12px;
}

.app-modal-body p:last-child {
    margin-bottom: 0;
}

.app-modal-footer {
    padding: 14px 18px;
    background: #f8fafc;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Media Queries - Altamente Responsivo (sin scroll horizontal en tablas)
   ========================================================================== */
@media (max-width: 820px) {
    .score-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .color-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .review-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 10px 14px;
    }
    .brand-subtitle {
        display: none;
    }
    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    .nav-btn {
        flex: 1;
        text-align: center;
    }
    .user-name {
        max-width: 90px;
    }
    .app-main {
        padding: 18px 14px 48px;
    }
    .card {
        padding: 18px 16px;
    }
    .form-grid,
    .selector-grid {
        grid-template-columns: 1fr;
    }
    .color-grid {
        grid-template-columns: 1fr;
    }

    /* Tablas responsivas apiladas en tarjetas: CERO scroll horizontal */
    .responsive-table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table th,
    .responsive-table td,
    .responsive-table tr {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody tr {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: 12px;
        padding: 10px 14px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-sm);
    }

    .responsive-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--color-border);
        text-align: right;
    }

    .responsive-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 4px;
    }

    .responsive-table tbody td::before {
        content: attr(data-label);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--color-text-muted);
        text-align: left;
        flex-shrink: 0;
    }
}
