* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f7fb;
    color: #172033;
}

.topbar {
    background: #0f172a;
    color: white;
    padding: 16px 28px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand strong {
    font-size: 22px;
    letter-spacing: 0.03em;
}

.brand span {
    font-size: 14px;
    opacity: 0.8;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px;
}

.hero {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.hero h1 {
    margin: 0 0 12px;
    font-size: 44px;
}

.hero p {
    font-size: 18px;
    color: #475569;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.card {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 24px;
    background: #f8fafc;
}

.card h2 {
    margin-top: 0;
}

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

    .hero {
        padding: 28px;
    }
}

.login-panel {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: 24px;
    padding: 36px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 32px;
}

.muted {
    color: #64748b;
}

.alert {
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    color: #334155;
}

.login-form input {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
}

.login-form input:focus {
    outline: 2px solid #38bdf8;
    border-color: #0284c7;
}

.login-form button,
.secondary-button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: #0f172a;
    color: white;
}

.secondary-button {
    background: #e2e8f0;
    color: #0f172a;
}

.login-help {
    margin-top: 20px;
    color: #64748b;
    font-size: 14px;
}

.dashboard-header {
    background: white;
    border-radius: 24px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-header h1 {
    margin: 0 0 6px;
}

.dashboard-header p {
    margin: 0;
    color: #64748b;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    background: #e2e8f0;
    color: #0f172a;
}

.card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
}

.table-card {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th {
    text-align: left;
    color: #475569;
    font-size: 14px;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.table-card td {
    padding: 16px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.table-card span {
    color: #64748b;
    font-size: 14px;
}

.empty-state {
    margin: 0;
    color: #64748b;
}

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

.primary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    background: #0f172a;
    color: white;
}

.form-card {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

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

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    color: #334155;
}

.admin-form input,
.admin-form textarea {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
}

.admin-form input:focus,
.admin-form textarea:focus {
    outline: 2px solid #38bdf8;
    border-color: #0284c7;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-actions button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: #0f172a;
    color: white;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 700;
}

.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-muted {
    background: #e2e8f0;
    color: #334155;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

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

.table-actions form {
    margin: 0;
}

.small-link,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    text-decoration: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    background: #e2e8f0;
    color: #0f172a;
    cursor: pointer;
}

.small-button.danger {
    background: #fee2e2;
    color: #991b1b;
}

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

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

/* Admin centers/forms */

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

.primary-link-button,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
}

.primary-link-button {
    background: #0f172a;
    color: white;
}

.link-button {
    background: #e2e8f0;
    color: #0f172a;
}

.form-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

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

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    color: #334155;
}

.admin-form input,
.admin-form textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    background: white;
}

.admin-form input:focus,
.admin-form textarea:focus {
    outline: 2px solid #38bdf8;
    border-color: #0284c7;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.form-actions button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: #0f172a;
    color: white;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 700;
}

.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-muted {
    background: #e2e8f0;
    color: #334155;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

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

.table-actions form {
    margin: 0;
}

.small-link,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    text-decoration: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    background: #e2e8f0;
    color: #0f172a;
    cursor: pointer;
}

.small-button.danger {
    background: #fee2e2;
    color: #991b1b;
}

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

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

.admin-form select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    background: white;
}

.admin-form select:focus {
    outline: 2px solid #38bdf8;
    border-color: #0284c7;
}

.field-hint {
    font-weight: 400;
    color: #64748b;
    font-size: 13px;
}

/* Main navigation */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-title {
    color: white;
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.main-nav a,
.main-nav button {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    text-decoration: none;
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.main-nav a:hover,
.main-nav button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.main-nav form {
    margin: 0;
}

@media (max-width: 800px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-nav {
        width: 100%;
    }
}

.module-code {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    margin-bottom: 12px;
    background: #e0f2fe;
    color: #075985;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.simulator-card {
    min-height: 210px;
}

.simulator-layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    gap: 24px;
}

.console-panel,
.image-panel {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.console-panel h2,
.image-panel h2 {
    margin-top: 0;
}

.xray-placeholder {
    min-height: 420px;
    border-radius: 18px;
    background:
        radial-gradient(circle at center, rgba(148, 163, 184, 0.35), rgba(15, 23, 42, 0.95)),
        linear-gradient(135deg, #1e293b, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.xray-placeholder div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xray-placeholder strong {
    font-size: 24px;
}

.xray-placeholder span {
    color: #cbd5e1;
}

@media (max-width: 1000px) {
    .simulator-layout {
        grid-template-columns: 1fr;
    }
}

.result-panel {
    margin-top: 20px;
    border-radius: 18px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.result-panel h3 {
    margin-top: 0;
}

.result-panel ul {
    margin-bottom: 0;
    padding-left: 20px;
}

.result-panel li {
    margin-bottom: 8px;
}

/* ===== Branding xrayedu ===== */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    flex: 0 0 auto;
}

.brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
}

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

.brand-title {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.brand-text span {
    font-size: 0.82rem;
    opacity: 0.9;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 20px;
    color: #7b8798;
    font-size: 0.78rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 820px) {
    .brand-logo-link {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
    }

    .brand-text span {
        display: none;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ===== Fix cabecera xrayedu ===== */

.topbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 12px 20px !important;
    min-height: 74px !important;
    height: auto !important;
    box-sizing: border-box !important;
}

.topbar .brand {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
}

.topbar .brand-logo-link {
    display: block !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
}

.topbar .brand-logo {
    display: block !important;
    width: auto !important;
    height: 56px !important;
    max-width: 180px !important;
    object-fit: contain !important;
}

.topbar .brand-text {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
    line-height: 1.1 !important;
}

.topbar .brand-title {
    font-size: 1.35rem !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    margin: 0 !important;
}

.topbar .brand-text span {
    font-size: 0.82rem !important;
    opacity: 0.92 !important;
    white-space: nowrap !important;
}

.topbar .main-nav {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
}

.topbar .main-nav a,
.topbar .main-nav button {
    font-size: 0.84rem !important;
}

.container {
    max-width: 1400px !important;
    margin: 18px auto !important;
    padding: 0 18px !important;
    box-sizing: border-box !important;
}

.site-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 10px 18px !important;
    font-size: 0.78rem !important;
    box-sizing: border-box !important;
}

@media (max-width: 980px) {
    .topbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .topbar .brand {
        justify-content: flex-start !important;
    }

    .topbar .main-nav {
        justify-content: flex-start !important;
    }

    .topbar .brand-logo {
        height: 48px !important;
        max-width: 150px !important;
    }

    .topbar .brand-text span {
        white-space: normal !important;
    }

    .site-footer {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* ===== Revert logo topbar: usar marca textual limpia ===== */

.topbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 14px 18px !important;
    min-height: 68px !important;
}

.topbar .brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
}

.topbar .brand-logo-link,
.topbar .brand-logo,
.topbar .brand-text {
    display: none !important;
}

.topbar .brand > .brand-title {
    display: inline-block !important;
    font-size: 1.35rem !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    text-decoration: none !important;
}

.topbar .brand > span {
    display: inline-block !important;
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
    opacity: 0.92 !important;
}

.topbar .main-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

/* ===== Topbar centrada xrayedu ===== */

.topbar {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 18px 12px !important;
    min-height: 104px !important;
    text-align: center !important;
}

.topbar .brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
}

.topbar .brand > .brand-title {
    font-size: 1.45rem !important;
    line-height: 1 !important;
    font-weight: 1000 !important;
    text-decoration: none !important;
}

.topbar .brand > span {
    font-size: 0.84rem !important;
    line-height: 1.2 !important;
    opacity: 0.95 !important;
}

.topbar .main-nav {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

.topbar .main-nav a,
.topbar .main-nav button {
    font-size: 0.86rem !important;
}

/* ===== Marca de agua xrayedu en páginas internas ===== */

body {
    position: relative;
    min-height: 100vh;
}

body.internal-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;

    background-image: url("/static/brand/logo-xrayedu.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 620px auto;

    opacity: 0.08;
    filter: grayscale(10%);
}

.topbar,
.container,
.site-footer {
    position: relative;
    z-index: 1;
}

body.public-page::before {
    display: none;
}

/* ===== Fix marca de agua visible en contenido interno ===== */

body.internal-page .container {
    position: relative !important;
    overflow: hidden !important;
}

body.internal-page .container::before {
    content: "";
    position: fixed;
    left: 50%;
    top: 56%;
    width: 680px;
    height: 680px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;

    background-image: url("/static/brand/logo-xrayedu.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;

    opacity: 0.22;
    filter: grayscale(5%);
}

body.internal-page .container > * {
    position: relative;
    z-index: 1;
}

/* ===== Logo y empresa discretos en esquina superior izquierda ===== */

.topbar {
    position: relative !important;
}

.corner-brand {
    position: absolute;
    left: 18px;
    top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    opacity: 0.86;
    z-index: 3;
    max-width: 220px;
}

.corner-brand:hover {
    opacity: 1;
}

.corner-brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.94);
    padding: 2px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.16);
    flex: 0 0 auto;
}

.corner-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.05;
    white-space: nowrap;
}

.corner-brand-text strong {
    font-size: 0.84rem;
    font-weight: 1000;
    letter-spacing: 0.01em;
}

.corner-brand-text small {
    margin-top: 2px;
    font-size: 0.68rem;
    opacity: 0.78;
}

/* En pantallas estrechas no lo mostramos para no pisar el menú */
@media (max-width: 980px) {
    .corner-brand {
        display: none !important;
    }
}

/* ===== Ajuste tamaño corner brand ===== */

.corner-brand {
    top: 12px !important;
    left: 18px !important;
    gap: 10px !important;
}

.corner-brand-logo {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    padding: 3px !important;
}

.corner-brand-text strong {
    font-size: 0.95rem !important;
}

.corner-brand-text small {
    font-size: 0.74rem !important;
}

/* ===== Ajuste tamaño corner brand v2 ===== */

.corner-brand-logo {
    width: 56px !important;
    height: 56px !important;
}

.corner-brand-text strong {
    font-size: 1rem !important;
}

.corner-brand-text small {
    font-size: 0.78rem !important;
}

/* ===== Portada pública y login con logo xrayedu ===== */

.public-hero {
    max-width: 1180px;
    margin: 0 auto;
    padding: 54px 22px 34px;
    text-align: center;
    color: #e8eef8;
}

.public-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.public-logo {
    width: min(360px, 82vw);
    height: auto;
    display: block;
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

.public-eyebrow {
    margin: 18px 0 10px;
    color: #4fb7d8;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.public-hero h1 {
    max-width: 920px;
    margin: 0 auto;
    font-size: clamp(2.1rem, 5vw, 4.1rem);
    line-height: 1;
    color: #102033;
}

.public-lead {
    max-width: 850px;
    margin: 18px auto 0;
    color: #526174;
    font-size: 1.05rem;
    line-height: 1.65;
}

.public-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.public-primary-btn,
.public-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
}

.public-primary-btn {
    background: linear-gradient(135deg, #34d399, #2dd4bf);
    color: #061018;
}

.public-secondary-btn {
    background: rgba(15, 23, 42, 0.08);
    color: #102033;
}

.public-module-preview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 34px;
    text-align: left;
}

.public-module-preview article {
    padding: 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 34%),
        linear-gradient(180deg, #ffffff, #f5f7fb);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.public-module-preview span {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #102033;
    color: #dff7ff;
    font-weight: 1000;
    margin-bottom: 12px;
}

.public-module-preview h2 {
    margin: 0;
    color: #102033;
    font-size: 1.12rem;
}

.public-module-preview p {
    color: #607086;
    line-height: 1.45;
    margin: 8px 0 0;
}

.branded-login {
    display: flex;
    justify-content: center;
    padding-top: 28px;
}

.branded-login-card {
    max-width: 430px;
    width: 100%;
    text-align: center;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.login-logo {
    width: 230px;
    max-width: 78%;
    height: auto;
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.login-company {
    margin: 4px 0 18px;
    color: #4fb7d8;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@media (max-width: 820px) {
    .public-hero {
        padding-top: 32px;
    }

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

    .public-logo {
        width: min(300px, 86vw);
    }
}

/* ===== Portada pública y login con logo xrayedu ===== */

.public-hero {
    max-width: 1180px;
    margin: 0 auto;
    padding: 54px 22px 34px;
    text-align: center;
    color: #e8eef8;
}

.public-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.public-logo {
    width: min(360px, 82vw);
    height: auto;
    display: block;
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

.public-eyebrow {
    margin: 18px 0 10px;
    color: #4fb7d8;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.public-hero h1 {
    max-width: 920px;
    margin: 0 auto;
    font-size: clamp(2.1rem, 5vw, 4.1rem);
    line-height: 1;
    color: #102033;
}

.public-lead {
    max-width: 850px;
    margin: 18px auto 0;
    color: #526174;
    font-size: 1.05rem;
    line-height: 1.65;
}

.public-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.public-primary-btn,
.public-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
}

.public-primary-btn {
    background: linear-gradient(135deg, #34d399, #2dd4bf);
    color: #061018;
}

.public-secondary-btn {
    background: rgba(15, 23, 42, 0.08);
    color: #102033;
}

.public-module-preview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 34px;
    text-align: left;
}

.public-module-preview article {
    padding: 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 34%),
        linear-gradient(180deg, #ffffff, #f5f7fb);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.public-module-preview span {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #102033;
    color: #dff7ff;
    font-weight: 1000;
    margin-bottom: 12px;
}

.public-module-preview h2 {
    margin: 0;
    color: #102033;
    font-size: 1.12rem;
}

.public-module-preview p {
    color: #607086;
    line-height: 1.45;
    margin: 8px 0 0;
}

.branded-login {
    display: flex;
    justify-content: center;
    padding-top: 28px;
}

.branded-login-card {
    max-width: 430px;
    width: 100%;
    text-align: center;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.login-logo {
    width: 230px;
    max-width: 78%;
    height: auto;
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.login-company {
    margin: 4px 0 18px;
    color: #4fb7d8;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@media (max-width: 820px) {
    .public-hero {
        padding-top: 32px;
    }

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

    .public-logo {
        width: min(300px, 86vw);
    }
}

/* ===== Fix: no recortar simuladores panorámicos ===== */

/* La marca de agua no debe cortar layouts tipo consola */
body.internal-page .container {
    overflow: visible !important;
}

/* En páginas de simulador permitimos que los layouts full-width respiren */
body.internal-page .container:has(.xray-page),
body.internal-page .container:has(.modality-demo),
body.internal-page .container:has(.sim-catalog-page) {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Evita que la marca de agua tape visualmente bordes de consola */
body.internal-page .container:has(.xray-page)::before,
body.internal-page .container:has(.modality-demo)::before {
    opacity: 0.08 !important;
}

.danger-button {
    background: #ef4444 !important;
    color: white !important;
    border: 0 !important;
}

.danger-button:hover {
    filter: brightness(1.05);
}

/* ===== Botones específicos banco de imágenes ===== */

.image-bank-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    border-radius: 14px !important;
    border: 0 !important;
    text-decoration: none !important;
    font-weight: 900 !important;
    font-size: 0.88rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
}

.image-bank-btn-primary {
    background: linear-gradient(135deg, #34d399, #2dd4bf) !important;
    color: #061018 !important;
    box-shadow: 0 10px 24px rgba(45, 212, 191, 0.18) !important;
}

.image-bank-btn-secondary {
    background: rgba(15, 23, 42, 0.10) !important;
    color: #102033 !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

.image-bank-btn-small {
    min-height: 34px !important;
    padding: 0 12px !important;
    border-radius: 11px !important;
    font-size: 0.82rem !important;
    margin-right: 4px !important;
}

.image-bank-btn:hover {
    filter: brightness(1.05) !important;
    transform: translateY(-1px) !important;
}

/* ===== Botones definitivos banco de imágenes ===== */

.image-bank-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

.xb-btn,
a.xb-btn,
button.xb-btn {
    appearance: none !important;
    -webkit-appearance: none !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-height: 40px !important;
    height: 40px !important;
    padding: 0 16px !important;

    border-radius: 13px !important;
    border: 1px solid transparent !important;

    font-family: inherit !important;
    font-size: 0.86rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;

    text-decoration: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;

    transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease !important;
}

.xb-btn:hover,
a.xb-btn:hover,
button.xb-btn:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.04) !important;
}

.xb-btn-primary,
a.xb-btn-primary,
button.xb-btn-primary {
    background: linear-gradient(135deg, #34d399, #2dd4bf) !important;
    color: #061018 !important;
    border-color: rgba(45, 212, 191, 0.35) !important;
    box-shadow: 0 10px 22px rgba(45, 212, 191, 0.18) !important;
}

.xb-btn-secondary,
a.xb-btn-secondary,
button.xb-btn-secondary {
    background: #e7edf6 !important;
    color: #102033 !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    box-shadow: none !important;
}

.xb-btn-danger,
a.xb-btn-danger,
button.xb-btn-danger {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: rgba(185, 28, 28, 0.25) !important;
    box-shadow: none !important;
}

.xb-btn-small,
a.xb-btn-small,
button.xb-btn-small {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 11px !important;
    font-size: 0.80rem !important;
    margin: 2px 3px 2px 0 !important;
}

.xb-inline-form {
    display: inline-flex !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

.admin-table td {
    vertical-align: middle !important;
}

.admin-table td .xb-btn,
.admin-table td .xb-inline-form {
    vertical-align: middle !important;
}

/* ===== Fix: evitar marca de agua duplicada ===== */

/* Desactivamos la marca de agua antigua del body */
body.internal-page::before {
    display: none !important;
    content: none !important;
    background-image: none !important;
}

/* Dejamos una sola marca de agua interna */
body.internal-page .container::before {
    content: "" !important;
    position: fixed !important;
    left: 50% !important;
    top: 56% !important;
    width: 680px !important;
    height: 680px !important;
    transform: translate(-50%, -50%) !important;
    pointer-events: none !important;
    z-index: 0 !important;

    background-image: url("/static/brand/logo-xrayedu.png") !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: contain !important;

    opacity: 0.16 !important;
    filter: grayscale(5%) !important;
}

body.internal-page .container > * {
    position: relative !important;
    z-index: 1 !important;
}

/* ===== Cabecera final xrayedu: logo centrado y menú distribuido ===== */

.topbar {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    padding: 14px 18px 12px !important;
    min-height: 132px !important;
    text-align: center !important;
}

.corner-brand {
    display: none !important;
}

.brand-centered {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
}

.brand-main-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 14px !important;
    text-decoration: none !important;
    color: inherit !important;
}

.topbar-logo {
    width: 76px !important;
    height: 76px !important;
    object-fit: contain !important;
    display: block !important;
    opacity: 1 !important;
    filter: none !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    padding: 4px !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16) !important;
}

.brand-copy {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    line-height: 1.08 !important;
}

.brand-copy .brand-title {
    display: block !important;
    font-size: 1.62rem !important;
    font-weight: 1000 !important;
    letter-spacing: 0.01em !important;
}

.brand-copy span {
    display: block !important;
    font-size: 0.86rem !important;
    opacity: 0.96 !important;
    white-space: nowrap !important;
}

.topbar .main-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

.topbar .main-nav a,
.topbar .main-nav button {
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    font-size: 0.86rem !important;
    font-weight: 800 !important;
}

@media (max-width: 760px) {
    .topbar {
        min-height: 120px !important;
        gap: 10px !important;
    }

    .brand-main-link {
        gap: 10px !important;
    }

    .topbar-logo {
        width: 58px !important;
        height: 58px !important;
        border-radius: 15px !important;
    }

    .brand-copy {
        align-items: flex-start !important;
    }

    .brand-copy .brand-title {
        font-size: 1.28rem !important;
    }

    .brand-copy span {
        font-size: 0.72rem !important;
        white-space: normal !important;
        text-align: left !important;
    }

    .topbar .main-nav {
        gap: 6px !important;
    }

    .topbar .main-nav a,
    .topbar .main-nav button {
        min-height: 32px !important;
        padding: 0 10px !important;
        font-size: 0.78rem !important;
    }
}

/* ===== Dashboard con logo central ===== */

.dashboard-main-panel {
    position: relative;
    margin-top: 20px;
    padding: 28px;
    border-radius: 30px;
    background:
        radial-gradient(circle at center, rgba(45, 212, 191, 0.10), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 252, 0.92));
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.10);
    overflow: hidden;
}

.dashboard-logo-center {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 26px;
}

.dashboard-main-logo {
    width: min(340px, 72vw);
    height: auto;
    display: block;
    opacity: 1;
    filter: none;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.98);
    padding: 10px;
    box-shadow:
        0 24px 58px rgba(15, 23, 42, 0.14),
        0 0 0 1px rgba(15, 23, 42, 0.06);
}

.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.dashboard-action-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    border-radius: 24px !important;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 36%),
        linear-gradient(180deg, #ffffff, #f6f8fb) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08) !important;
}

.dashboard-action-card h2 {
    margin-bottom: 8px;
}

.dashboard-action-card p {
    margin: 0;
}

.dashboard-action-card:hover {
    transform: translateY(-3px);
}

/* En el dashboard quitamos la marca de agua de fondo para que no duplique el logo */
body.internal-page .container:has(.dashboard-main-panel)::before {
    display: none !important;
    content: none !important;
    background-image: none !important;
}

@media (max-width: 1050px) {
    .dashboard-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-main-logo {
        width: min(300px, 74vw);
    }
}

@media (max-width: 700px) {
    .dashboard-main-panel {
        padding: 20px;
        border-radius: 24px;
    }

    .dashboard-actions-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-main-logo {
        width: min(260px, 82vw);
    }

    .dashboard-action-card {
        min-height: 125px;
    }
}

/* ===== Dashboard compacto sin scroll ===== */

body.internal-page:has(.dashboard-main-panel) .topbar {
    min-height: 108px !important;
    padding: 10px 18px 9px !important;
    gap: 8px !important;
}

body.internal-page:has(.dashboard-main-panel) .topbar-logo {
    width: 60px !important;
    height: 60px !important;
    border-radius: 15px !important;
    padding: 3px !important;
}

body.internal-page:has(.dashboard-main-panel) .brand-copy .brand-title {
    font-size: 1.38rem !important;
}

body.internal-page:has(.dashboard-main-panel) .brand-copy span {
    font-size: 0.78rem !important;
}

body.internal-page:has(.dashboard-main-panel) .topbar .main-nav a,
body.internal-page:has(.dashboard-main-panel) .topbar .main-nav button {
    min-height: 31px !important;
    padding: 0 12px !important;
    font-size: 0.80rem !important;
}

body.internal-page:has(.dashboard-main-panel) .container {
    margin: 10px auto !important;
}

.dashboard-header {
    padding: 14px 18px !important;
    margin-bottom: 10px !important;
    border-radius: 22px !important;
}

.dashboard-header h1 {
    font-size: 1.45rem !important;
    margin-bottom: 4px !important;
}

.dashboard-header p {
    font-size: 0.88rem !important;
    margin: 0 !important;
}

.dashboard-main-panel {
    margin-top: 10px !important;
    padding: 18px !important;
    border-radius: 24px !important;
}

.dashboard-logo-center {
    margin-bottom: 16px !important;
}

.dashboard-main-logo {
    width: min(245px, 46vw) !important;
    border-radius: 22px !important;
    padding: 7px !important;
}

.dashboard-actions-grid {
    gap: 12px !important;
}

.dashboard-action-card {
    min-height: 112px !important;
    padding: 16px !important;
    border-radius: 20px !important;
}

.dashboard-action-card h2 {
    font-size: 1.05rem !important;
    margin: 0 0 6px !important;
}

.dashboard-action-card p {
    font-size: 0.84rem !important;
    line-height: 1.32 !important;
}

/* En pantallas altas podemos permitir el logo algo mayor */
@media (min-height: 850px) {
    .dashboard-main-logo {
        width: min(285px, 52vw) !important;
    }

    .dashboard-action-card {
        min-height: 125px !important;
    }
}

/* En portátiles bajos, todavía más compacto */
@media (max-height: 780px) {
    body.internal-page:has(.dashboard-main-panel) .topbar {
        min-height: 96px !important;
    }

    body.internal-page:has(.dashboard-main-panel) .topbar-logo {
        width: 52px !important;
        height: 52px !important;
    }

    .dashboard-main-logo {
        width: min(210px, 42vw) !important;
    }

    .dashboard-action-card {
        min-height: 96px !important;
        padding: 13px !important;
    }

    .dashboard-main-panel {
        padding: 14px !important;
    }
}

/* ===== Mis prácticas ===== */

.attempts-table td {
    vertical-align: top;
}

.attempt-feedback-row td {
    padding-top: 0 !important;
    color: #64748b;
    background: rgba(15, 23, 42, 0.025);
}

.attempt-feedback-row small {
    display: block;
    max-width: 980px;
    line-height: 1.35;
}

/* ===== Filtros prácticas de alumnos ===== */

.attempt-filter-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(130px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.attempt-filter-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 900;
}

.attempt-filter-card select,
.attempt-filter-card input {
    width: 100%;
    min-height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    padding: 8px 10px;
    font: inherit;
    background: #ffffff;
    color: #0f172a;
}

.attempt-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 1150px) {
    .attempt-filter-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .attempt-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 680px) {
    .attempt-filter-card {
        grid-template-columns: 1fr;
    }
}

/* ===== Detalle de práctica ===== */

.attempt-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.attempt-detail-result {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
    gap: 16px;
}

.attempt-detail-card h2 {
    margin-bottom: 10px;
}

.attempt-detail-card p {
    margin: 6px 0;
}

.attempt-image-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 360px;
    border-radius: 18px;
    background: #020617;
    overflow: hidden;
}

.attempt-image-wrap img {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    display: block;
}

.attempt-feedback-text {
    line-height: 1.5;
    color: #334155;
}

@media (max-width: 1100px) {
    .attempt-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 680px) {
    .attempt-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Corrección docente de práctica ===== */

.attempt-teacher-review {
    margin: 18px 0;
}

.teacher-review-current {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.18);
    margin-bottom: 14px;
}

.teacher-review-form {
    display: grid;
    grid-template-columns: 180px minmax(280px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.teacher-review-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 900;
}

.teacher-review-form input,
.teacher-review-form textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
    color: #0f172a;
}

.teacher-review-form textarea {
    resize: vertical;
    min-height: 88px;
}

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

/* Ajustes responsive generales para acceso externo/móvil */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: min(100% - 24px, 1200px);
    margin-left: auto;
    margin-right: auto;
}

.topbar {
    gap: 16px;
    flex-wrap: wrap;
}

.brand-main-link {
    min-width: 0;
}

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

.main-nav {
    flex-wrap: wrap;
    gap: 10px;
}

.main-nav a,
.main-nav button {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }

    .brand,
    .brand-centered {
        justify-content: center;
        text-align: center;
    }

    .brand-main-link {
        justify-content: center;
    }

    .brand-copy span {
        display: block;
        font-size: 0.82rem;
        line-height: 1.2;
    }

    .main-nav {
        justify-content: center;
        width: 100%;
    }

    .main-nav a,
    .main-nav button {
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    .container {
        width: min(100% - 16px, 1200px);
        padding-left: 0;
        padding-right: 0;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    .site-footer {
        text-align: center;
        padding-left: 12px;
        padding-right: 12px;
    }
}
