* {
    box-sizing: border-box;
}

body {
    background: #f4f7fb;
    color: #172033;
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
}

.layout-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #07162b 0%, #0b1f3a 100%);
    color: #fff;
    grid-area: sidebar;
    min-height: 100vh;
    padding: 24px 16px;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    color: #fff;
    display: block;
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 28px;
    text-decoration: none;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    align-items: center;
    border-radius: 8px;
    color: #dbeafe;
    display: flex;
    font-size: 14px;
    font-weight: 700;
    gap: 10px;
    padding: 11px 12px;
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus {
    background: rgba(96, 165, 250, .18);
    color: #fff;
}

.layout-main {
    grid-area: main;
    min-width: 0;
}

.topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #dbe3ef;
    display: flex;
    grid-area: topbar;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.menu-toggle {
    align-items: center;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #172033;
    display: none;
    font-size: 20px;
    height: 38px;
    justify-content: center;
    width: 42px;
}

.topbar-user {
    align-items: center;
    color: #334155;
    display: flex;
    font-size: 13px;
    gap: 10px;
    margin-left: auto;
}

.user-dot {
    align-items: center;
    background: #0b1f3a;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    font-weight: 800;
    height: 30px;
    justify-content: center;
    text-transform: uppercase;
    width: 30px;
}

.app {
    margin: 0 auto;
    max-width: 1220px;
    padding: 24px 16px;
}

.login-shell {
    align-items: stretch;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 420px;
    margin: 40px auto;
    max-width: 980px;
}

.brand-panel,
.login-card,
.content-card,
.metric,
.exam-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.brand-panel {
    padding: 36px;
}

.brand-panel span,
.page-head span,
.eyebrow {
    color: #1d4ed8;
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.brand-panel h1 {
    font-size: 52px;
    margin: 0 0 12px;
}

.brand-panel p,
.page-head p {
    color: #64748b;
    margin: 0;
}

.login-card {
    padding: 28px;
}

.login-card h2,
.content-card h2,
.exam-card h2 {
    font-size: 22px;
    margin: 0 0 16px;
}

.page-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 6px;
}

.content-card {
    padding: 22px;
}

.stat-card {
    align-items: center;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    display: flex;
    gap: 14px;
    min-height: 96px;
    padding: 18px;
}

.stat-icon {
    align-items: center;
    border-radius: 10px;
    display: inline-flex;
    flex: 0 0 44px;
    font-size: 24px;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #f97316; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-card span,
.metric span {
    color: #64748b;
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.stat-card strong,
.metric strong {
    color: #172033;
    font-size: 24px;
}

.metric {
    padding: 18px;
}

.simulation-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) 170px auto;
}

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

.study-choice {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #172033;
    display: grid;
    gap: 10px;
    padding: 18px;
    text-align: left;
    text-decoration: none;
}

button.study-choice {
    cursor: pointer;
}

.study-choice:hover,
.study-choice:focus {
    border-color: #93c5fd;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.study-choice strong {
    font-size: 22px;
}

.study-choice small {
    color: #64748b;
}

.official-form,
.study-options {
    display: grid;
    gap: 10px;
}

.study-options label {
    align-items: center;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 12px;
}

.study-options label:has(input:checked) {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .12);
}

.chart-placeholder {
    align-items: end;
    border-bottom: 1px solid #dbe3ef;
    border-left: 1px solid #dbe3ef;
    display: flex;
    gap: 14px;
    height: 210px;
    justify-content: center;
    padding: 18px 18px 0;
}

.chart-point {
    background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
    border-radius: 8px 8px 0 0;
    min-width: 34px;
}

.h-35 { height: 35%; }
.h-45 { height: 45%; }
.h-55 { height: 55%; }
.h-60 { height: 60%; }
.h-70 { height: 70%; }
.h-78 { height: 78%; }

.summary-list {
    display: grid;
    gap: 12px;
}

.summary-list div {
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
}

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

.oab-status {
    align-items: center;
    display: grid;
    gap: 12px;
    justify-items: center;
    min-height: 100%;
    text-align: center;
}

.status-badge {
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    padding: 8px 16px;
}

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

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

.format-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e3a8a;
    margin-bottom: 20px;
    padding: 16px;
}

.format-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.format-tags code {
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #172033;
    padding: 4px 6px;
}

.import-panel {
    margin: 0 auto;
    max-width: 820px;
}

.platform-warning h1 {
    font-size: 28px;
    margin: 0 0 10px;
}

.code-box {
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #334155;
    font-family: Consolas, monospace;
    margin-top: 12px;
    padding: 12px;
}

.exam-card {
    height: 100%;
    padding: 18px;
}

.exam-card p {
    color: #64748b;
}

.exam-shell {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    margin: 0 auto;
    max-width: 980px;
    padding: 22px;
}

.exam-top {
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
}

.exam-mode {
    color: #64748b;
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
}

.exam-top small {
    color: #64748b;
    display: block;
    font-size: 12px;
}

.remote-card {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 16px;
}

.remote-card h2 {
    font-size: 20px;
    margin: 0 0 8px;
}

.remote-card p {
    color: #64748b;
    margin: 0 0 10px;
    max-width: 620px;
}

.remote-card img {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    height: 132px;
    padding: 8px;
    width: 132px;
}

.remote-code {
    background: #fff;
    border: 1px dashed #1d4ed8;
    border-radius: 8px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-right: 12px;
    padding: 8px 12px;
}

.remote-body {
    background: #f4f7fb;
}

.remote-shell {
    margin: 0 auto;
    max-width: 520px;
    padding: 20px 14px;
}

.remote-shell h1 {
    font-size: 28px;
    font-weight: 800;
}

.remote-mobile-top {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
    padding: 14px;
}

.remote-mobile-top span,
.remote-mobile-top small,
.remote-hint {
    color: #64748b;
}

.remote-question {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    display: none;
    padding: 16px;
}

.remote-question.is-active {
    display: block;
}

.remote-question h1 {
    font-size: 24px;
}

.remote-alternatives {
    display: grid;
    gap: 10px;
}

.remote-alternatives button {
    align-items: flex-start;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #172033;
    display: flex;
    gap: 12px;
    padding: 14px;
    text-align: left;
    width: 100%;
}

.remote-alternatives button.is-selected {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.remote-alternatives strong {
    align-items: center;
    background: #dbeafe;
    border-radius: 50%;
    color: #1d4ed8;
    display: inline-flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
}

.remote-hint {
    margin-top: 12px;
    text-align: center;
}

.question-card { display: none; }
.question-card.is-active { display: block; }

.question-meta {
    color: #64748b;
    display: flex;
    font-size: 13px;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.question-card h1 {
    font-size: 22px;
    line-height: 1.35;
    margin: 0 0 20px;
}

.alternatives {
    display: grid;
    gap: 10px;
}

.alternatives label {
    align-items: flex-start;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 14px;
}

.alternatives label:has(input:checked) {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.question-nav-panel {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    margin: 22px 0;
    padding: 14px;
}

.question-nav-toolbar,
.question-nav-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.question-nav-toolbar {
    margin-bottom: 12px;
}

.question-nav-toolbar span,
.question-nav-toolbar label span {
    color: #64748b;
    display: block;
    font-size: 12px;
}

.question-nav-toolbar label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.question-nav-toolbar .form-select {
    min-width: 96px;
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.question-nav button {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    min-height: 36px;
    min-width: 36px;
}

.question-nav button.is-current {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.question-nav button.is-answered:not(.is-current) {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.question-nav button.is-empty:not(.is-current) {
    background: #f8fafc;
}

.exam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.discipline-row {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.discipline-row span {
    color: #64748b;
    display: block;
    font-size: 13px;
}

.progress-thin {
    height: 8px;
}

.bar-0 { width: 0%; }
.bar-5 { width: 5%; }
.bar-10 { width: 10%; }
.bar-15 { width: 15%; }
.bar-20 { width: 20%; }
.bar-25 { width: 25%; }
.bar-30 { width: 30%; }
.bar-35 { width: 35%; }
.bar-40 { width: 40%; }
.bar-45 { width: 45%; }
.bar-50 { width: 50%; }
.bar-55 { width: 55%; }
.bar-60 { width: 60%; }
.bar-65 { width: 65%; }
.bar-70 { width: 70%; }
.bar-75 { width: 75%; }
.bar-80 { width: 80%; }
.bar-85 { width: 85%; }
.bar-90 { width: 90%; }
.bar-95 { width: 95%; }
.bar-100 { width: 100%; }

.result-question {
    border-top: 1px solid #e2e8f0;
    padding: 14px 0;
}

.result-alternatives {
    display: grid;
    gap: 8px;
    margin: 10px 0;
}

.result-alternatives div {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

.result-alternatives .is-correct {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.result-alternatives .is-wrong {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

@media (max-width: 992px) {
    .simulation-form,
    .study-choice-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .layout-shell {
        display: block;
    }

    .sidebar {
        bottom: 0;
        left: 0;
        max-width: 280px;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 82%;
        z-index: 20;
    }

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

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

    .topbar {
        padding: 0 14px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        margin: 12px auto;
    }

    .brand-panel,
    .login-card,
    .content-card,
    .page-head,
    .exam-shell {
        padding: 18px;
    }

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

    .page-head,
    .exam-actions {
        flex-direction: column;
    }

    .brand-panel h1 {
        font-size: 40px;
    }

    .question-card h1 {
        font-size: 19px;
    }
}

/* ── Sala de Estudo: Host Panel ──────────────────────────────────────── */

.sala-qr-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #fafafa 100%);
}

.sala-qr-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sala-codigo-display {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--color-text-primary, #111);
}

/* Alternativas com barra de estatística */
.sala-alternatives-host {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sala-alt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color .2s;
}

.sala-alt-item.is-correct {
    border-color: #86efac;
    background: #dcfce7;
}

.sala-alt-letra {
    font-weight: 700;
    min-width: 22px;
    color: #4a5568;
}

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

.sala-alt-texto {
    font-size: .9rem;
    display: block;
    margin-bottom: 4px;
}

.sala-alt-bar-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.sala-alt-bar-fill {
    height: 100%;
    background: #6366f1;
    border-radius: 4px;
    transition: width .4s ease;
}

.sala-alt-pct {
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
    min-width: 52px;
    text-align: right;
}

/* Participantes */
.sala-participantes-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.sala-part-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}

/* Ranking */
.sala-ranking-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.sala-rank-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .88rem;
}

.sala-rank-pos {
    min-width: 28px;
    font-weight: 700;
    font-size: .9rem;
}

.sala-rank-nome {
    flex: 1;
}

.sala-rank-pts {
    font-size: .82rem;
}

/* Enunciado da questão no painel host */
.sala-enunciado {
    font-size: .95rem;
    line-height: 1.6;
    color: #1e293b;
}


/* ── OS-039: Painel de resultado do Controle Remoto ─────────────────── */

.remote-result-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px 12px;
    margin-top: 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    text-align: center;
}

.remote-result-icon {
    font-size: 2.4rem;
    line-height: 1;
    display: block;
}

.remote-result-icon.is-correct-icon { color: #16a34a; }
.remote-result-icon.is-wrong-icon   { color: #dc2626; }

.remote-result-label {
    font-size: 1.1rem;
    display: block;
}

.remote-result-label--ok  { color: #15803d; }
.remote-result-label--err { color: #b91c1c; }

.remote-result-gabarito {
    margin: 0;
    font-size: .9rem;
    color: #475569;
}

.remote-result-gabarito strong {
    color: #1e293b;
    font-size: 1rem;
}

.remote-result-btn {
    margin-top: 6px;
    background: #1e293b;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: .85rem;
    cursor: pointer;
}

.remote-result-btn:hover {
    background: #334155;
    color: #fff;
}

.remote-countdown {
    font-size: .78rem;
    opacity: .75;
}

/* Botões de alternativa — estado gabarito no controle remoto */
.remote-alternatives button.is-correct {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.remote-alternatives button.is-wrong {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}


/* ── Sala Assíncrona: participar.php ─────────────────────────────────── */

.sala-alt-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: .9rem;
    line-height: 1.5;
}

.sala-alt-btn:hover:not(:disabled) {
    border-color: #6366f1;
    background: #f5f3ff;
}

.sala-alt-btn strong {
    min-width: 20px;
    font-weight: 700;
    color: #4a5568;
    flex-shrink: 0;
}

.sala-alt-btn.is-selected {
    border-color: #6366f1;
    background: #eef2ff;
}

.sala-alt-btn.is-correct {
    border-color: #86efac !important;
    background: #dcfce7 !important;
    color: #166534;
}

.sala-alt-btn.is-wrong {
    border-color: #fecaca !important;
    background: #fee2e2 !important;
    color: #991b1b;
}

.sala-alt-btn.is-loading {
    opacity: .7;
}

.sala-alt-btn:disabled {
    cursor: default;
    opacity: .85;
}

.sala-comentario-txt {
    font-size: .85rem;
    color: #475569;
    border-left: 3px solid #6366f1;
    padding-left: 10px;
    text-align: left;
    width: 100%;
    margin-bottom: 0;
}

/* ── resultado.php: hero percentual ──────────────────────────────────── */

.sala-result-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 10px;
}

.sala-result-pct {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.sala-result-label {
    font-size: 1rem;
    margin-top: 4px;
}

.sala-result-hero.is-aprovado .sala-result-pct { color: #15803d; }
.sala-result-hero.is-aprovado .sala-result-label { color: #166534; }
.sala-result-hero.is-reprovado .sala-result-pct { color: #b91c1c; }
.sala-result-hero.is-reprovado .sala-result-label { color: #991b1b; }

