/* --- RANKING SYSTEM STYLES (CORRIGIDO E FUNCIONAL) --- */

/* --- 1. CONFIGURAÇÃO DA LISTA DE RANKINGS --- */
.ranking-filters {
    padding: 10px 16px;
    background-color: var(--bg-body);
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-bar-container {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.search-bar-container input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-size: 0.95rem;
}

.rankings-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 80px 16px;
}

/* Cards de Ranking */
.ranking-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform 0.1s;
}

.ranking-card:active {
    transform: scale(0.98);
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ranking-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 188, 212, 0.15);
    color: var(--teti-primary);
    font-weight: bold;
    text-transform: uppercase;
}

.ranking-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 8px 0 4px 0;
}

.ranking-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.ranking-stats-row {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-value {
    color: var(--text-main);
    font-weight: bold;
}

/* --- 2. MODAL NOVO (UX FIXED: SCROLL INTERNO & LIMITES) --- */

/* Classe Utilitária para esconder elementos (Obrigatória) */
.hidden {
    display: none !important;
}

/* Ajuste do Modal (Overlay) */
#modal-create-ranking,
.hub-creator-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Bottom Sheet */
    
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

#modal-create-ranking.hidden,
.hub-creator-overlay.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* O Conteúdo (A Gaveta) - AGORA COM SCROLL */
#modal-create-ranking .modal-content,
.hub-creator-overlay .modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 600px;
    
    /* ALTURA MÁXIMA PARA NÃO ESTOURAR A TELA */
    max-height: 90vh; /* Ocupa no máximo 90% da altura da tela */
    height: auto;
    
    border-radius: 24px 24px 0 0;
    margin: 0;
    
    /* FLEXBOX PARA GERENCIAR CABEÇALHO FIXO E CORPO COM SCROLL */
    display: flex;
    flex-direction: column;
    
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

#modal-create-ranking.hidden .modal-content,
.hub-creator-overlay.hidden .modal-content {
    transform: translateY(100%);
}

/* Cabeçalho do Modal (Fixo no topo da gaveta) */
.modal-header-sheet {
    flex-shrink: 0; /* Não encolhe */
    padding: 24px 20px 10px 20px;
    background: var(--bg-card);
    border-radius: 24px 24px 0 0;
    z-index: 2;
}

/* Corpo do Modal (Onde vai o Wizard) - COM SCROLL */
.modal-body-sheet {
    flex: 1; /* Ocupa o espaço restante */
    overflow-y: auto; /* SCROLL VERTICAL AUTOMÁTICO */
    padding: 10px 20px 40px 20px; /* Padding bottom maior para segurança no touch */
    
    /* Suavizar scroll no mobile */
    -webkit-overflow-scrolling: touch; 
}

/* Barra de rolagem estilizada (opcional) */
.modal-body-sheet::-webkit-scrollbar {
    width: 6px;
}
.modal-body-sheet::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* ELEMENTOS INTERNOS DO MODAL */

.sheet-indicator {
    width: 40px; 
    height: 4px; 
    background: var(--border-color);
    margin: 0 auto 15px auto; 
    border-radius: 10px;
    opacity: 0.6;
}

.modal-header-sheet h3 {
    text-align: center;
    margin: 0 0 10px 0;
    color: var(--text-main);
}

.creation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.create-option {
    background: var(--bg-hover);
    padding: 24px 12px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.create-option:active {
    transform: scale(0.96);
}

.create-option.ai-option {
    background: rgba(0, 188, 212, 0.08);
    border-color: rgba(0, 188, 212, 0.3);
}

.create-option.manual-option {
    background: var(--bg-body);
    border-color: var(--border-color);
}

.create-option .text strong {
    display: block;
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--text-main);
}

.create-option .text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.btn-cancel-sheet {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

/* --- FASE 2: ESTILOS DA INTELIGÊNCIA ARTIFICIAL --- */

.ai-flow-container.hidden {
    display: none;
}

.ai-instruction {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.teti-textarea {
    width: 100%;
    height: 150px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    resize: none;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.teti-textarea:focus {
    border-color: var(--teti-primary);
}

.btn-primary-action {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--teti-primary), var(--teti-primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.btn-secondary-action {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.action-buttons-row {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    margin-bottom: 10px;
}

/* Spinner Específico da IA */
.spinner-ai {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 188, 212, 0.1);
    border-left-color: var(--teti-primary);
    border-radius: 50%;
    margin: 0 auto 16px auto;
    animation: spin 1s linear infinite;
}

.pulsing-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Preview do Resultado */
.result-card {
    background: var(--bg-hover);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.preview-item {
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}
.preview-label { color: var(--text-muted); }
.preview-value { color: var(--text-main); font-weight: 600; text-align: right; }

/* --- ESTILOS DE UPLOAD (FASE 2) --- */

.upload-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    background: var(--bg-hover);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.upload-drop-zone:hover, .upload-drop-zone.dragover {
    border-color: var(--teti-primary);
    background: rgba(0, 188, 212, 0.05);
}

.upload-icon {
    font-size: 40px;
    color: var(--teti-primary);
    margin-bottom: 8px;
    display: block;
}

.file-name {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--teti-primary);
    font-weight: 600;
}

.separator-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 10px 0;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Ajuste no Loading para parecer mais profissional */
.loading-details {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- WIZARD 2.0: UI/UX REVAMP (MANTIDO E INTEGRADO) --- */

.wizard-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 10px;
    position: relative;
}

.progress-track {
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 3px;
    background: var(--bg-hover);
    z-index: 0;
    transform: translateY(-50%);
}

.progress-fill {
    position: absolute;
    top: 50%; left: 0;
    height: 3px;
    background: var(--teti-primary);
    z-index: 0;
    transform: translateY(-50%);
    transition: width 0.3s ease;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.step-item.active .step-circle {
    background: var(--teti-primary);
    border-color: var(--teti-primary);
    color: white;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.4);
}

.step-item.completed .step-circle {
    background: var(--teti-primary);
    border-color: var(--teti-primary);
    color: white;
}

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

.step-item.active .step-label { color: var(--teti-primary); }

/* --- FORMS & INPUTS --- */
.wiz-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 20px 0 15px 0;
    display: flex; align-items: center; gap: 8px;
}

.input-group-modern {
    margin-bottom: 16px;
}

.input-group-modern label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-modern {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.input-modern:focus {
    border-color: var(--teti-primary);
    outline: none;
    background: var(--bg-card);
}

.row-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* --- SWITCHES & CHECKBOXES --- */
.toggle-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-hover);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.toggle-label strong { display: block; font-size: 0.9rem; color: var(--text-main); }
.toggle-label span { font-size: 0.8rem; color: var(--text-muted); }

/* --- ESTILIZAÇÃO DA LISTA DE CIDADES (LOCALIDADES) --- */
.dynamic-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 6px;
}

.localidade-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.localidade-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* --- NOVO LAYOUT DE VAGAS (SCROLL UNIFICADO) --- */
.vagas-wrapper {
    display: flex;
    gap: 0; /* O espaçamento é interno nas colunas */
    overflow-x: auto; /* O scroll acontece aqui para TODOS os itens */
    padding: 12px;
    background: var(--bg-hover);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    align-items: stretch;
}

/* Scrollbar estilizada */
.vagas-wrapper::-webkit-scrollbar { height: 8px; }
.vagas-wrapper::-webkit-scrollbar-track { background: var(--bg-hover); }
.vagas-wrapper::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.vagas-wrapper::-webkit-scrollbar-thumb:hover { background: var(--teti-primary); }

/* Coluna Genérica (Serve tanto para Ampla quanto Cotas) */
.vaga-column {
    flex: 0 0 170px; /* Largura fixa para todas */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 15px; /* Espaçamento interno */
    border-right: 1px dashed var(--border-color);
}

.vaga-column:last-child { 
    border-right: none; 
}

/* Estilo específico para destacar levemente a Ampla, mas mantendo o scroll */
.vaga-column.ampla-col {
    background-color: rgba(var(--teti-primary-rgb), 0.03); /* Leve destaque de fundo se desejar */
    border-right: 2px solid var(--border-color); /* Separador mais forte */
    font-weight: 500;
}

/* Títulos e Labels (Mantidos) */
.vaga-header-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--teti-primary);
    margin-bottom: 8px;
    text-align: center;
    white-space: nowrap;
}
.vaga-header-title.quota { color: var(--text-main); }

.vaga-labels-row {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Inputs (Mantidos) */
.vaga-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.input-vaga {
    width: 100%;
    padding: 8px 4px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-body);
    color: var(--text-main);
    transition: all 0.2s;
}
.input-vaga:focus {
    border-color: var(--teti-primary);
    background: var(--bg-card);
    outline: none;
}
.input-vaga::-webkit-outer-spin-button,
.input-vaga::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- REPARAÇÃO DA ESTILIZAÇÃO DAS MATÉRIAS (Ponto 5) --- */
.materia-card {
    background: var(--bg-body);
    border-left: 4px solid var(--teti-primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.materia-header {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; color: var(--text-main); font-size: 1rem;
}

.materia-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.mini-input-group label { 
    font-size: 0.75rem; color: var(--text-muted); display: block; margin-bottom: 4px; 
}
.mini-input { 
    width: 100%; padding: 8px; 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    background: var(--bg-card);
    color: var(--text-main); font-size: 0.9rem;
}

/* --- DISCIPLINAS --- */
.materia-card {
    background: var(--bg-body);
    border-left: 3px solid var(--teti-primary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.materia-header {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600; color: var(--text-main);
}

.materia-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.btn-add-item {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--teti-primary);
    color: var(--teti-primary);
    background: rgba(0, 188, 212, 0.05);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-add-item:hover { background: rgba(0, 188, 212, 0.1); }

.btn-delete-item {
    color: #ff5252; background: none; border: none; cursor: pointer;
}

/* --- GRUPOS DE MATÉRIAS --- */
.grupo-materias {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.grupo-header {
    background: var(--bg-hover);
    padding: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
    display: flex; justify-content: space-between;
}

/* Garantir que os passos ocupem o espaço corretamente */
.wizard-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- WIZARD 3.1 ADDONS --- */

/* Upload de Capa */
.cover-upload-wrapper {
    width: 100%;
    height: 120px;
    background: var(--bg-hover);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
#ranking-cover-placeholder {
    display: flex; flex-direction: column; align-items: center; color: var(--text-muted);
}

/* Grid de Vagas Complexo */
.vagas-header-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr; /* Rótulo, Imediata, CR */
    gap: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-align: center;
}

.vaga-row-item {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.vaga-label {
    font-size: 0.8rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vagas-grid-wrapper {
    background: var(--bg-hover);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* Chips de Blocos */
.chips-container {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.bloco-chip {
    background: var(--teti-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex; align-items: center; gap: 5px;
}
.bloco-chip i { cursor: pointer; font-style: normal; font-weight: bold; }

/* Display de Cálculo */
.calc-display {
    text-align: center;
    font-size: 0.9rem;
    color: #00e676;
    margin-top: 5px;
    font-weight: bold;
}

/* Cadernos */
.caderno-item {
    background: var(--bg-hover);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}
.caderno-row { display: flex; gap: 10px; margin-bottom: 8px; }
.btn-small-file {
    font-size: 0.8rem; color: var(--teti-primary);
    cursor: pointer; display: flex; align-items: center; gap: 5px;
}
.btn-small-action {
    background: rgba(var(--teti-primary-rgb), 0.1); 
    border: 1px dashed var(--teti-primary);
    color: var(--teti-primary); 
    padding: 8px 12px; 
    border-radius: 8px; 
    font-size: 0.85rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.2s;
}
.btn-small-action:hover {
    background: rgba(var(--teti-primary-rgb), 0.2);
}

/* GABARITO GRID */
.answers-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsivo */
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-hover);
    border-radius: 12px;
    margin-top: 15px;
}

.answer-row {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.q-num {
    font-weight: 700;
    width: 30px;
    color: var(--text-muted);
}

.q-options {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

.bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-main);
    color: var(--text-muted);
}

.bubble:hover {
    border-color: var(--teti-primary);
    color: var(--teti-primary);
}

.bubble.selected {
    background: var(--teti-primary);
    color: #fff;
    border-color: var(--teti-primary);
    box-shadow: 0 2px 8px rgba(0, 188, 212, 0.4);
}

/* --- DASHBOARD STYLES (Fase 3.3) --- */

.rd-full-screen {
    width: 100%; height: 100%;
    background: var(--bg-body);
    display: flex; flex-direction: column;
}

.rd-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.rd-top-bar {
    display: flex; align-items: center; padding: 10px; gap: 10px;
}

.rd-title h3 { margin: 0; font-size: 1rem; color: var(--text-main); }
.rd-title span { font-size: 0.8rem; color: var(--text-muted); }

.rd-status-badge {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex; align-items: center; gap: 5px;
}

.rd-alert-banner {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    margin: 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex; align-items: flex-start; gap: 8px;
}

.rd-body {
    flex: 1; overflow-y: auto; padding: 10px;
}

/* Card Pessoal */
.my-stats-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border: 1px solid var(--teti-primary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.1);
}

.my-stat-row { display: flex; justify-content: space-between; margin-bottom: 10px; }
.ms-item { display: flex; flex-direction: column; align-items: center; }
.ms-item.big .ms-value { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.ms-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.ms-value { font-weight: bold; }
.ms-sub { font-size: 0.7rem; color: var(--text-muted); }

.status-green { color: #00e676; }
.status-red { color: #ff5252; }

.ms-footer { 
    border-top: 1px solid var(--border-color); 
    padding-top: 8px; font-size: 0.8rem; color: var(--text-muted); text-align: center;
}

/* Tabela */
.ranking-table {
    width: 100%; border-collapse: collapse;
}
.ranking-table th {
    text-align: left; font-size: 0.75rem; color: var(--text-muted);
    padding: 8px; border-bottom: 2px solid var(--border-color);
}
.ranking-table td {
    padding: 10px 8px; border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.row-me { background: rgba(0, 188, 212, 0.05); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.table-avatar { width: 32px; height: 32px; border-radius: 50%; }
.u-nick { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.u-meta { display: block; font-size: 0.75rem; color: var(--text-muted); }

.col-note strong { display: block; color: var(--text-main); font-size: 1rem; }
.col-note small { color: var(--text-muted); font-size: 0.75rem; }

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}

/* --- NOVOS ESTILOS FASE 3 --- */

/* CARD APRIMORADO */
.ranking-card.enhanced {
    border: none;
    overflow: hidden;
    position: relative;
    padding: 0; /* Reset */
    display: flex;
    flex-direction: column;
    min-height: 180px;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 16px;
    color: white; /* Texto branco por padrão se tiver imagem */
}

.ranking-card.enhanced::before {
    /* Overlay escuro para legibilidade se tiver imagem */
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.8));
    z-index: 0;
    pointer-events: none;
}

.ranking-header, .ranking-body-content, .ranking-actions-row {
    position: relative; z-index: 1; padding: 16px;
}

.ranking-header { padding-bottom: 0; display:flex; justify-content:space-between; align-items:center;}
.ranking-body-content { flex: 1; display:flex; flex-direction:column; justify-content:center; }
.ranking-actions-row { 
    display: flex; gap: 10px; padding-top: 10px; 
    background: rgba(0,0,0,0.3); backdrop-filter: blur(5px);
}

.ranking-title { font-size: 1.2rem; font-weight: 800; color: #fff; margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.ranking-info { color: rgba(255,255,255,0.9); font-size: 0.9rem; margin-bottom: 8px; }
.ranking-meta-row { display: flex; gap: 15px; font-size: 0.8rem; color: rgba(255,255,255,0.7); }
.ranking-meta-row i { font-size: 14px; margin-right: 4px; vertical-align: middle; }

.status-pill {
    padding: 4px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: bold;
    display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.6) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}

/* Botões do Card */
.btn-primary-action.outlined {
    background: transparent; border: 1px solid var(--teti-primary); color: var(--teti-primary);
}
.btn-secondary-action.glass {
    background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3);
}

/* DASHBOARD */
.rd-header { background: var(--bg-card); padding: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.rd-meta-grid { 
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px;
    background: var(--bg-hover); font-size: 0.8rem; color: var(--text-muted);
}
.meta-item { display: flex; align-items: center; gap: 6px; }
.click-action { color: var(--teti-primary); cursor: pointer; font-weight: bold; }

.rd-main-card {
    background: var(--bg-card); margin: 15px; padding: 15px;
    border-radius: 16px; border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.status-approved-border { border-left: 5px solid #00e676; }
.status-eliminated-border { border-left: 5px solid #ff5252; }

.rd-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.rd-avatar-large { width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--border-color); }
.rd-user-rank { font-size: 0.8rem; color: var(--text-muted); font-weight: bold; }
.rd-user-nick { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
.rd-status-tag { margin-left: auto; padding: 4px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: bold; }
.status-approved { background: rgba(0, 230, 118, 0.15); color: #00e676; }
.status-eliminated { background: rgba(255, 82, 82, 0.15); color: #ff5252; }

.rd-card-scores { display: flex; justify-content: space-between; text-align: center; margin-bottom: 15px; }
.score-box { display: flex; flex-direction: column; }
.score-box .lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.score-box .val { font-size: 1.2rem; font-weight: bold; color: var(--text-main); }
.score-box .val.big { font-size: 1.8rem; color: var(--teti-primary); }

.rd-section-title { padding: 0 15px; font-size: 0.9rem; font-weight: bold; color: var(--text-muted); margin-bottom: 10px; margin-top: 20px; }

/* TABELA DE RANKING */
.ranking-table-full { width: 100%; border-collapse: collapse; }
.ranking-table-full th { text-align: left; padding: 10px 15px; color: var(--text-muted); font-size: 0.75rem; border-bottom: 2px solid var(--border-color); }
.ranking-table-full td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }

.row-me { background: rgba(0, 188, 212, 0.1); }
.row-approved td { border-left: 3px solid #00e676; }
.row-eliminated td { border-left: 3px solid #ff5252; } /* Apenas visual indicativo */

.user-cell-compact { display: flex; align-items: center; gap: 10px; }
.user-cell-compact img { width: 32px; height: 32px; border-radius: 50%; }
.user-cell-compact div { display: flex; flex-direction: column; }
.user-cell-compact span { font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.user-cell-compact small { font-size: 0.7rem; color: var(--text-muted); }

/* RANKING DE CURSINHOS */
.course-list { padding: 0 15px 30px 15px; }
.course-rank-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); margin-bottom: 8px; padding: 12px;
    border-radius: 10px; border: 1px solid var(--border-color);
}
.cr-pos { font-weight: bold; color: var(--text-muted); width: 30px; }
.cr-name { flex: 1; font-weight: 600; color: var(--text-main); }
.cr-stats { text-align: right; display: flex; flex-direction: column; }
.cr-avg { font-weight: bold; color: var(--teti-primary); }
.cr-count { font-size: 0.7rem; color: var(--text-muted); }

/* --- V3 UPDATES --- */

/* Barra de Progresso no Card */
.ranking-status-track {
    width: 100%; height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}
.status-bar { height: 100%; transition: width 0.5s; }
.status-crowd { background: #ff9800; }
.status-prelim { background: #2196f3; }
.status-official { background: #00e676; }
.status-label-small { font-size: 0.7rem; color: rgba(255,255,255,0.8); margin-top: 4px; }

/* Botão Delete (Lixeira) */
.btn-icon-delete {
    background: rgba(255, 82, 82, 0.2); color: #ff5252;
    border: none; border-radius: 50%; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

/* Filtros e Paginação */
/* Garante que o container de filtros e a barra de vagas não briguem */
.rd-filters-bar {
    display: flex; 
    flex-direction: column; /* Empilha: Filtros em cima, Vagas embaixo */
    padding: 0; /* Remove padding global para controlar nos filhos */
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

/* Container específico das ABAS (Filtros) */
.rd-tabs-area {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 10px 15px;
    width: 100%;
}
.tabs-scroll { display: flex; gap: 8px; overflow-x: auto; }
.filter-tab {
    padding: 6px 12px; border-radius: 20px;
    background: var(--bg-hover); color: var(--text-muted);
    border: 1px solid var(--border-color); cursor: pointer; font-size: 0.8rem;
    white-space: nowrap;
}
.filter-tab.active {
    background: var(--teti-primary); color: white; border-color: var(--teti-primary);
}
.rd-select-small {
    background: var(--bg-body); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 4px; border-radius: 6px; font-size: 0.8rem;
}

/* Tabela Detalhada com Scroll */
.table-scroll-wrapper { overflow-x: auto; margin-bottom: 10px; }
.ranking-table-detailed { width: 100%; border-collapse: collapse; min-width: 500px; }
.ranking-table-detailed th { 
    background: var(--bg-hover); position: sticky; top: 0;
    padding: 10px; font-size: 0.75rem; text-align: center; color: var(--text-muted);
}
.ranking-table-detailed td { padding: 10px; text-align: center; border-bottom: 1px solid var(--border-color); }
.col-pos { font-weight: bold; color: var(--text-muted); }
.col-total { color: var(--teti-primary); font-weight: bold; }

/* Paginação Botões */
.pagination-controls { display: flex; justify-content: center; gap: 15px; align-items: center; margin-bottom: 20px; }
.pagination-controls button {
    padding: 6px 12px; background: var(--bg-hover); border: 1px solid var(--border-color);
    border-radius: 6px; color: var(--text-main); cursor: pointer;
}
.pagination-controls button:disabled { opacity: 0.5; cursor: default; }

/* Visual do Meu Gabarito */
.gabarito-visual-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px; margin-top: 15px; max-height: 400px; overflow-y: auto;
}
.gab-item { display: flex; flex-direction: column; align-items: center; }
.gab-num { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 2px; }
.gab-bubble {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; border: 2px solid;
}
/* Feedback Gabarito */
.gab-bubble.correct { background: #00e676; border-color: #00e676; color: #fff; }
.gab-bubble.wrong { background: #ff5252; border-color: #ff5252; color: #fff; }
.opt-feedback { display: none; font-size: 0.6rem; color: #ff5252; margin-top: 2px; }
.gab-bubble.neutral { border-color: var(--border-color); color: var(--text-muted); }

/* Status Bar */
.ranking-status-track { background: rgba(255,255,255,0.1); border-radius: 4px; height: 6px; width: 100%; overflow: hidden; }
.ranking-status-track > div { height: 100%; border-radius: 4px; }

/* Modal Stats List */
.stats-list-container { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.stat-row { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 12px; background: var(--bg-hover); border-radius: 8px; border: 1px solid var(--border-color);
}

/* Destaque Cursinho */
.my-course-highlight { border: 1px solid var(--teti-primary) !important; background: rgba(0,188,212,0.05) !important; }
.link-oficial { background: rgba(255,255,255,0.1); padding: 4px 8px; border-radius: 6px; }

/* --- GESTOR DE GABARITO (ADMIN) --- */
.gab-manager-header {
    background: var(--bg-hover);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.gab-manager-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.gab-input-area {
    width: 100%;
    min-height: 100px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    color: var(--text-main);
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
}

.gab-grid-editor {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-hover);
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.gab-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px;
}

.gab-cell label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.gab-cell input {
    width: 30px;
    height: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-body);
    color: var(--text-main);
    font-weight: bold;
    text-transform: uppercase;
}
.gab-cell input:focus {
    border-color: var(--teti-primary);
    background: rgba(0, 188, 212, 0.1);
}

.status-toggle-group {
    display: flex;
    background: var(--bg-body);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.status-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.status-btn.active.prelim { background: #2196f3; color: white; }
.status-btn.active.official { background: #00e676; color: white; }

/* --- NOVOS ESTILOS PARA PROCESSAMENTO AUTO DE GABARITO --- */

/* Botão de IA no Input de Arquivo */
.file-ai-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.btn-magic-read {
    background: linear-gradient(135deg, #6200ea, #aa00ff); /* Roxo IA */
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(170, 0, 255, 0.3);
    transition: transform 0.2s;
}

.btn-magic-read:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(170, 0, 255, 0.5);
}

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

.btn-view-grid {
    background: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 5px;
}

/* Container do Grid dentro do Wizard */
.wizard-gab-grid-wrapper {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: none; /* Oculto por padrão */
}

.wizard-gab-grid-wrapper.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wiz-grid-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; font-size: 0.8rem; color: var(--text-muted);
}

/* --- EDIÇÃO DE GABARITO (MODAL MEU GABARITO) --- */

.gab-bubble-input {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.gab-bubble-input:focus {
    border-color: var(--teti-primary);
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}

/* Feedback Visual na Edição */
.gab-bubble-input.border-correct {
    border-color: #00e676;
    background: rgba(0, 230, 118, 0.1);
}

.gab-bubble-input.border-wrong {
    border-color: #ff5252;
    background: rgba(255, 82, 82, 0.1);
}

/* --- CORREÇÃO PONTO 2: Botão Fechar (X) dos Modais Novos --- */
.modal-header-sheet {
    position: relative; /* Garante que o botão absoluto se posicione aqui */
    display: flex;
    justify-content: center; /* Centraliza o título */
    align-items: center;
}

.btn-icon-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.btn-icon-close:hover {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
}

/* --- CORREÇÃO PONTO 3: Tabela Centralizada e Otimizada --- */
.ranking-table-detailed th,
.ranking-table-detailed td {
    text-align: center !important; /* Força centralização global */
    padding: 8px 4px; /* Reduz padding lateral para caber mais */
    font-size: 0.85rem;
}

.ranking-table-detailed th:nth-child(2),
.ranking-table-detailed td:nth-child(2) {
    /* Coluna do Candidato */
    text-align: left !important; /* Nome mantém alinhamento à esquerda visualmente */
    padding-left: 10px;
}

.user-cell-compact {
    justify-content: flex-start; /* Alinha avatar e nome à esquerda */
}

.user-cell-compact span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Corta nomes muito longos */
    max-width: 130px;
    display: block;
}

/* --- CORREÇÃO PONTO 4: Card de Stats (Topo) Melhorado --- */
.rd-main-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-hover));
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.rd-card-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.rd-user-nick {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

/* Container de Scores mais elegante */
.rd-card-scores {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.score-box {
    align-items: center;
}

.score-box .val.big {
    color: #00e676;
    text-shadow: 0 0 15px rgba(0, 230, 118, 0.3);
}

/* --- CORREÇÃO PONTO 6: Display de Nota no Modal Meu Gabarito --- */
.modal-score-display {
    background: var(--bg-hover);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 15px;
    border: 1px solid var(--teti-primary);
    color: var(--teti-primary);
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.15);
}

/* --- ATUALIZAÇÃO: INDICADORES DE VAGAS E STATUS (PONTOS 1, 2, 3) --- */

/* Barra de Vagas (Ajuste para não estourar) */
.vacancy-tracker-bar {
    background: rgba(0, 188, 212, 0.03); /* Fundo sutil */
    border-top: 1px solid var(--border-color);
    padding: 8px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.vp-val { font-weight: bold; color: var(--text-main);}
.vp-label { font-size: 0.75rem; text-transform: uppercase; }

/* Status da Linha (Candidato) */
/* Aprovado (Dentro das Vagas) */
.row-status-approved td:nth-child(2) { /* Aplica apenas na célula do nome para não poluir tudo */
    border-left: 4px solid #00e676;
    background: linear-gradient(90deg, rgba(0, 230, 118, 0.1), transparent);
}
.row-status-approved .col-pos {
    color: #00e676;
    font-weight: 900;
}

/* Reprovado (Fora das Vagas ou Nota Insuficiente) */
.row-status-rejected td:nth-child(2) {
    border-left: 4px solid #ff5252;
    background: linear-gradient(90deg, rgba(255, 82, 82, 0.1), transparent);
}
.row-status-rejected .col-pos {
    color: #ff5252;
}

/* Status da Nota por Matéria (Célula) */
.score-cell-pass {
    color: #00e676 !important;
    font-weight: bold;
    background: rgba(0, 230, 118, 0.05);
}

.score-cell-fail {
    color: #ff5252 !important;
    font-weight: bold;
    background: rgba(255, 82, 82, 0.05);
    text-decoration: line-through; /* Opcional: riscar nota vermelha */
}

/* Ajuste na Tabela para não quebrar com nomes grandes */
.ranking-table-detailed th, .ranking-table-detailed td {
    white-space: nowrap; /* Evita quebra de linha indesejada */
}

/* --- MÓDULO RANKING (Sub-view) --- */
.module-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: var(--bg-body);
    z-index: 50; /* Acima do menu principal */
    display: flex;
    flex-direction: column;
    padding-bottom: 70px; /* Nav bar area */
}

.module-container.hidden { display: none; }

.module-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    gap: 16px;
}

.module-header h3 { flex: 1; margin: 0; font-size: 1.1rem; }

.btn-icon-back {
    background: none; border: none; color: var(--text-main); font-size: 1.2rem; cursor: pointer;
}

.btn-create-ranking {
    background: var(--teti-primary);
    color: #fff; border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}

/* Filtros do Módulo */
.ranking-filters-bar { padding: 12px 16px; background: var(--bg-body); }
.search-input-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0 12px;
    height: 40px;
    display: flex; align-items: center; gap: 10px;
    color: var(--text-muted);
}
.search-input-wrapper input {
    background: transparent; border: none; color: var(--text-main); width: 100%; outline: none;
}

/* Lista Scrollável */
.rankings-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Modal Bottom Sheet Refinado */
.modal-header-sheet {
    text-align: center; padding-bottom: 16px;
}
.sheet-indicator {
    width: 40px; height: 4px; background: var(--border-color);
    margin: 0 auto 12px; border-radius: 2px;
}
.creation-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px;
}
.create-option {
    background: var(--bg-hover);
    padding: 20px; border-radius: 16px;
    text-align: center; cursor: pointer;
    border: 1px solid transparent;
}
.create-option.ai-option {
    background: rgba(0,188,212,0.1); border-color: var(--teti-primary);
}
.create-option i { font-size: 1.8rem; margin-bottom: 8px; display: block; }
.create-option.ai-option i { color: var(--teti-primary); }
.create-option .text strong { display: block; margin-bottom: 4px; }
.create-option .text span { font-size: 0.75rem; color: var(--text-muted); }

.btn-cancel-sheet {
    width: 100%; padding: 12px; background: transparent;
    border: 1px solid var(--border-color); color: var(--text-muted);
    border-radius: 12px; font-weight: 600;
}

/* --- INTELLIGENCE GRID (DASHBOARD v4.0) --- */

.intel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Colunas */
    gap: 10px;
    padding: 10px 15px;
}

.intel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 90px;
    transition: transform 0.1s, border-color 0.2s;
}

.intel-card.action {
    cursor: pointer;
}
.intel-card.action:active {
    transform: scale(0.98);
}
.intel-card.action:hover {
    border-color: var(--teti-primary);
}

.intel-card.empty {
    justify-content: center; align-items: center;
    background: rgba(0,0,0,0.05); border-style: dashed;
    color: var(--text-muted);
}

.intel-card.eliminated {
    border-left: 3px solid #ff5252;
}

/* Ícone de Fundo Translúcido */
.ic-icon {
    position: absolute;
    top: -5px; right: -5px;
    opacity: 0.05;
    transform: rotate(15deg);
}
.ic-icon span { font-size: 60px; color: var(--text-main); }

/* Dados */
.ic-data {
    display: flex; flex-direction: column;
    margin-bottom: 4px;
    z-index: 1;
}
.ic-val {
    font-size: 1.3rem; font-weight: 800; color: var(--text-main);
    line-height: 1.1;
}
.ic-lbl {
    font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted);
    font-weight: 600; margin-top: 2px;
}

/* Subtextos e Badges */
.ic-sub {
    font-size: 0.7rem; color: var(--text-muted); z-index: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ic-sub.click { color: var(--teti-primary); font-weight: bold; }

.ic-badge {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0, 230, 118, 0.1); color: #00e676;
    font-size: 0.6rem; font-weight: bold; padding: 2px 6px; border-radius: 4px;
}

/* Barra de Progresso Interna */
.ic-prog-bar {
    width: 100%; height: 4px; background: rgba(0,0,0,0.1);
    border-radius: 2px; margin-top: auto; overflow: hidden;
}
.ic-prog-bar div {
    height: 100%; background: var(--teti-primary);
}

/* Identidade do Usuário (Strip) */
.user-identity-strip {
    display: flex; align-items: center; gap: 10px;
    margin: 5px 15px 15px 15px;
    background: var(--bg-hover);
    padding: 10px; border-radius: 12px;
    border: 1px solid var(--border-color);
}
.ui-avatar { width: 36px; height: 36px; border-radius: 50%; }
.ui-info { flex: 1; display: flex; flex-direction: column; }
.ui-info strong { font-size: 0.9rem; color: var(--text-main); }
.ui-info span { font-size: 0.75rem; color: var(--text-muted); }

/* Estilo do Modal de Comparação de Rank */
.rank-comparison-box {
    display: flex; gap: 10px; align-items: center; justify-content: center;
    background: var(--bg-hover); padding: 20px; border-radius: 12px;
    margin-bottom: 10px;
}
.rc-item { text-align: center; flex: 1; }
.rc-item.highlight .val { color: var(--teti-primary); }
.rc-item .lbl { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.rc-item .val { display: block; font-size: 1.8rem; font-weight: 800; color: var(--text-main); margin: 5px 0; }
.rc-item small { font-size: 0.7rem; color: var(--text-muted); }

.rc-divider { width: 1px; height: 50px; background: var(--border-color); }

/* --- USER IDENTITY STRIP ENHANCED (Item 4) --- */

.user-identity-strip.enhanced {
    display: flex;
    flex-wrap: wrap; /* Permite quebrar em telas muito pequenas */
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
}

.ui-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 140px;
}

.ui-score {
    display: block;
    font-size: 0.8rem;
    color: var(--teti-primary);
    font-weight: 600;
}

/* Área de Badges de Ranking */
.ui-ranks-area {
    display: flex;
    gap: 8px;
}

.ui-rank-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--bg-body);
}

.ui-rank-badge .material-icons-round {
    font-size: 18px;
}

.ui-rank-badge.status-green {
    background: rgba(0, 230, 118, 0.1);
    border-color: rgba(0, 230, 118, 0.3);
    color: #00e676;
}

.ui-rank-badge.status-red {
    background: rgba(255, 82, 82, 0.1);
    border-color: rgba(255, 82, 82, 0.3);
    color: #ff5252;
}

.rb-info {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.rb-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.8;
}

.rb-val {
    font-size: 0.9rem;
    font-weight: 800;
}

.btn-icon-action {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-icon-action:hover {
    color: var(--teti-primary);
    border-color: var(--teti-primary);
}

/* Estilos para o Acordeão de Stats */
.stat-card-expandable {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.stat-row.clickable {
    cursor: pointer;
    padding: 12px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.stat-row.clickable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.stats-accordion-content {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin: 0 10px 10px 10px;
    padding: 10px;
    border-left: 3px solid var(--teti-primary);
}

.stat-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.stat-detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
}

.detail-avg {
    font-weight: bold;
    color: var(--text-main);
    margin-right: 5px;
}

.detail-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Barra de Identidade v3 (Layout: Nota+Botão acima, Rankings abaixo) --- */
.user-identity-strip.enhanced-v3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card-light, #2a2a2a);
    border-top: 1px solid rgba(255,255,255,0.1);
    min-height: 90px;
}

/* Grupo Identidade (Esquerda) */
.ui-group-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ui-avatar-large {
    width: 52px; /* Aumentado levemente */
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--teti-primary);
    object-fit: cover;
}

.ui-text-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ui-nick-large {
    font-size: 1.05rem;
    color: var(--text-main);
    line-height: 1.2;
}

.ui-booklet-badge {
    font-size: 0.75rem;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}

/* Grupo de Performance (Direita) */
.ui-performance-cluster {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Alinha tudo à direita */
    gap: 6px;
}

/* Linha Superior: Nota + Botão */
.ui-top-row {
    display: flex;
    align-items: center;
    gap: 15px; /* Espaço entre a nota e o botão */
}

.ui-score-group {
    text-align: right;
    line-height: 1;
}

.ui-score-val-huge {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--teti-primary);
}

.ui-score-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.btn-gabarito-action {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-gabarito-action:hover {
    background: var(--teti-primary);
    color: #000;
    border-color: var(--teti-primary);
}

/* Linha Inferior: Badges de Ranking */
.ui-bottom-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

/* Mobile: Ajusta para coluna se faltar espaço */
@media (max-width: 600px) {
    .user-identity-strip.enhanced-v3 {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .ui-performance-cluster {
        width: 100%;
        align-items: center; /* Centraliza no mobile */
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 10px;
    }
    .ui-top-row {
        width: 100%;
        justify-content: space-between; /* Espalha nota e botão */
    }
    .ui-bottom-row {
        justify-content: center;
    }
}

/* --- Layout V3 Ajustado: Linha Principal (Identidade/Nota) + Linha Ranks --- */
.user-identity-strip.enhanced-v3 {
    display: flex;
    flex-direction: column; /* Empilha as duas linhas */
    padding: 12px 16px;
    background: var(--bg-card-light, #2a2a2a);
    border-top: 1px solid rgba(255,255,255,0.1);
    gap: 8px; /* Espaço entre a linha do nome e a linha dos ranks */
}

/* LINHA 1: Identidade (Esq) e Nota/Botão (Dir) */
.ui-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Grupo Identidade */
.ui-group-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ui-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--teti-primary);
    object-fit: cover;
}
.ui-nick-large {
    font-size: 1.05rem;
    color: var(--text-main);
    line-height: 1.2;
}
.ui-booklet-badge {
    font-size: 0.75rem;
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}

/* Grupo Nota + Botão */
.ui-score-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Distância entre a nota e o botão */
}
.ui-score-display {
    text-align: right;
    line-height: 1;
    margin-left: 5px;
}
.ui-score-val-huge {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--teti-primary);
}
.ui-score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}
.btn-gabarito-action {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-gabarito-action:hover {
    background: var(--teti-primary);
    color: #000;
    border-color: var(--teti-primary);
}

/* LINHA 2: Rankings (Alinhados à direita) */
.ui-ranks-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05); /* Separação sutil */
}

/* Mobile: Ajustes para telas pequenas */
@media (max-width: 500px) {
    .ui-ranks-row {
        justify-content: center; /* Centraliza badges no mobile */
    }
}

/* --- Novo Layout do Header do Dashboard --- */

/* Título em Linha */
.rd-title-row {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    flex: 1;
    min-width: 0; /* Evita quebra em flex */
}

.rd-title-row h3 {
    margin: 0;
    font-size: 1.4rem;
    white-space: nowrap;
}

.rd-title-row span {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Container de Ações do Dono (Organizado) */
.owner-actions-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.btn-group-stacked {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Botões Compactos para o Header */
.btn-mini-header {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-mini-header:hover { background: rgba(255,255,255,0.2); }

/* Barra de Progresso Stepper (3 Pontos) */
.ranking-stepper-container {
    padding: 15px 20px 10px 20px;
    width: 100%;
}

.ranking-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 20px;
}

/* Linha de Fundo */
.ranking-stepper::before {
    content: '';
    position: absolute;
    top: 7px; /* Metade da altura da bolinha (14px) */
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.2);
    z-index: 0;
}

/* Linha de Progresso Ativa */
.stepper-progress-line {
    position: absolute;
    top: 7px;
    left: 0;
    height: 2px;
    background: var(--teti-primary); /* Cor Verde/Tema */
    z-index: 0;
    transition: width 0.5s ease;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 33%; 
}

.step-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #444;
    border: 2px solid #666;
    transition: all 0.3s;
}

.step-label {
    position: absolute;
    top: 22px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 15px;
}

.step-label-gab {
    position: absolute;
    top: 22px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Estados Ativos */
.step-item.active .step-dot {
    background: var(--teti-primary);
    border-color: var(--teti-primary);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

.step-item.active .step-label {
    color: white;
}

/* Mobile Adjusts */
@media (max-width: 600px) {
    .rd-title-row {
        flex-direction: column; /* Em mobile volta pra coluna pra não cortar */
        gap: 2px;
    }
    .rd-top-bar {
        padding-bottom: 40px; /* Espaço extra para os botões */
    }
}

/* --- Novo Layout Fluido do Header (Correção Mobile) --- */

/* Container Principal Flexível */
.rd-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    /* Em telas grandes, não quebra */
    flex-wrap: nowrap; 
    gap: 10px;
    padding-bottom: 10px;
}

/* Área do Título (Esquerda) */
.rd-header-left {
    display: flex;
    align-items: center;
    flex: 1; /* Ocupa o espaço que sobrar */
    min-width: 0; /* Permite que o texto seja cortado com reticências se preciso */
    gap: 10px;
}

.rd-title-row {
    display: flex;
    flex-direction: column; /* Padrão: Título em cima, cargo embaixo */
    justify-content: center;
    line-height: 1.2;
    min-width: 0;
}

.rd-title-row h3 {
    margin: 0;
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rd-title-row span {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Área de Ações (Direita) */
.rd-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* Impede que os botões sejam esmagados */
}

/* Toolbar do Dono */
.owner-actions-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Grupo de Botões (Padrão: Empilhado para economizar largura no Desktop) */
.btn-group-stacked {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-mini-header {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    text-decoration: none;
    white-space: nowrap;
    width: 100%; /* Garante alinhamento */
}
.btn-mini-header:hover { background: rgba(255,255,255,0.2); }

/* --- MEDIA QUERY: A MÁGICA PARA MOBILE ( < 600px ) --- */
@media (max-width: 600px) {
    .rd-top-bar {
        /* Permite quebrar em duas linhas */
        flex-wrap: wrap; 
        align-items: flex-start; /* Alinha no topo */
        gap: 15px; 
    }

    /* Linha 1: Título ocupa 100% */
    .rd-header-left {
        flex: 0 0 100%; 
        width: 100%;
    }
    
    /* Permite que o texto quebre linha e não trunque no mobile */
    .rd-title-row h3, 
    .rd-title-row span {
        white-space: normal; 
        overflow: visible;
    }

    /* Linha 2: Botões ocupam 100% e alinham à direita */
    .rd-header-right {
        flex: 0 0 100%;
        justify-content: flex-end; /* Joga os botões para o final */
        margin-top: -5px;
    }

    /* Transforma a pilha vertical em LINHA RETA horizontal */
    .btn-group-stacked {
        flex-direction: row; /* <--- AQUI ESTÁ A MUDANÇA */
        gap: 8px;
    }

    .btn-mini-header {
        padding: 6px 12px; /* Botões maiores para toque */
        font-size: 0.75rem;
    }
    
    .owner-actions-toolbar {
        /* REMOVIDO: position: absolute; top: 60px; right: 16px; */
        /* O Flexbox do container pai cuidará do alinhamento agora */
        position: relative; 
        background: rgba(0,0,0,0.5);
        margin-left: 8px; /* Dá um espaço do botão de compartilhar */
        top: auto;
        right: auto;
    }
}

/* --- Nova Linha de Detalhamento por Matéria --- */
.ui-subjects-row {
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 2px 0 8px 0; /* Espaçamento leve */
    overflow-x: auto; /* Permite scroll horizontal */
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.05); /* Separador sutil */
    
    /* Esconde barra de rolagem (Firefox/Chrome) para visual limpo */
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.ui-subjects-row::-webkit-scrollbar { 
    display: none; 
}

/* Pílula de cada matéria */
.subj-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 50px;
}

.subj-lbl { 
    font-size: 0.6rem; 
    text-transform: uppercase;
    color: var(--text-muted); 
    opacity: 0.8;
    margin-bottom: 2px;
}

.subj-val { 
    font-size: 0.9rem; 
    font-weight: bold; 
    color: #e0e0e0; 
}

/* Destaque visual se a nota for alta (opcional, cor verde claro) */
.subj-pill.high-score .subj-val {
    color: #00e676;
}

/* --- Barra de Navegação (Chat, Fórum, Recursos) --- */
.rd-nav-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 16px 5px 16px; /* Espaçamento ajustado */
    width: 100%;
}

.btn-nav-tab {
    flex: 1; /* Faz os botões ocuparem espaços iguais */
    background: rgba(255, 255, 255, 0.05); /* Fundo sutil */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main, #fff);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-nav-tab i {
    font-size: 1.2rem;
    opacity: 0.8;
}

.btn-nav-tab:hover {
    background: var(--teti-primary, #00e676);
    color: #000;
    border-color: var(--teti-primary, #00e676);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 230, 118, 0.2);
}

.btn-nav-tab:active {
    transform: translateY(0);
}

/* Ajuste Mobile: Se a tela for muito pequena, diminui a fonte */
@media (max-width: 400px) {
    .btn-nav-tab {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Modal de Confirmação de Chat */
.bridge-modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    animation: zoomInBridge 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.bridge-icon-circle {
    width: 60px;
    height: 60px;
    background: rgba(0, 230, 118, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.bridge-icon-circle span {
    font-size: 32px;
    color: #00e676;
}

.bridge-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.bridge-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

@keyframes zoomInBridge {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* CSS para Filtros Inteligentes */
.smart-filters-scroll {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}
.filter-chip {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-chip.active {
    background: var(--teti-primary);
    color: white;
    border-color: var(--teti-primary);
}

/* --- CORREÇÃO PONTOS 5.1 e 5.2: Grid de Gabarito Organizado --- */

.wizard-gab-grid-wrapper {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    /* Resolve o overlap garantindo block context */
    display: none; 
    overflow: hidden;
}

.wizard-gab-grid-wrapper.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.grid-section-title {
    width: 100%;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--teti-primary);
    text-transform: uppercase;
    margin: 15px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-color);
    letter-spacing: 0.5px;
}

/* Remove margem do primeiro título */
.grid-section-title:first-child { margin-top: 0; }

.grid-section-cells {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.gab-cell-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px;
    width: 36px;
}

.gab-cell-mini label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.gab-cell-mini input {
    width: 28px;
    height: 28px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-main);
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    padding: 0;
}

.gab-cell-mini input:focus {
    border-color: var(--teti-primary);
    background: var(--bg-card);
    outline: none;
}

/* --- CORREÇÃO PONTO 6: Card de Estatísticas do Wizard --- */

.stats-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-item .lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-item .val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-item .val small {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

.stat-item .val.warn { color: #ff9800; }
.stat-item .val.highlight { color: var(--teti-primary); }

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
    margin: 0 10px;
}

.stats-alert-bar {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s;
}

/* --- CORREÇÃO VISUAL: Gabarito Admin (Estilo Bolinhas Responsivo) --- */

/* Container da Grade */
.grid-section-cells-admin {
    display: grid;
    /* No mobile fica 1 coluna, no PC expande para quantas couberem (min 260px) */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* Card de cada Questão (Q1 + Bolinhas) */
.gab-admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Número da Questão */
.gab-admin-card .q-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 30px;
}

/* Linha de Bolinhas */
.gab-bubbles-row {
    display: flex;
    gap: 6px;
}

/* A Bolinha Individual */
.gab-bubble-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gab-bubble-mini:hover {
    border-color: var(--teti-primary);
    color: var(--teti-primary);
}

/* Estado Selecionado */
.gab-bubble-mini.selected {
    background: var(--teti-primary);
    color: #000; /* Texto preto para contraste no verde */
    border-color: var(--teti-primary);
    font-weight: 800;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 230, 118, 0.3);
}

/* Título da Matéria (Garante que ocupe a linha toda) */
.grid-section-title {
    grid-column: 1 / -1; /* Ocupa todas as colunas do grid */
    margin-top: 15px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid rgba(255,255,255,0.05);
    color: var(--teti-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

/* Ajuste Mobile Específico */
@media (max-width: 480px) {
    .gab-bubble-mini {
        width: 32px; /* Maior para o dedo */
        height: 32px;
        font-size: 0.85rem;
    }
    
    .grid-section-cells-admin {
        grid-template-columns: 1fr; /* Força 1 por linha em telas muito pequenas */
    }
}

/* --- ADICIONE OU SUBSTITUA ESTES BLOCOS NO FINAL DO ARQUIVO ranking.css --- */

/* CORREÇÃO PONTO 3: Ajuste dos botões de ação do dono no Mobile (Header) */
@media (max-width: 600px) {
    /* Esconde o texto dos botões de ação no mobile, mantendo apenas ícones */
    .owner-actions-toolbar .btn-mini-header {
        font-size: 0; /* Some com o texto */
        padding: 8px; /* Ajusta padding para ficar quadrado/redondo */
        width: 32px;
        height: 32px;
    }
    
    .owner-actions-toolbar .btn-mini-header span {
        font-size: 16px !important; /* Força o ícone a aparecer */
        margin: 0;
    }

    /* Garante que a toolbar não estoure a largura */
    .owner-actions-toolbar {
        flex-wrap: wrap;
        max-width: 100%;
    }
}

/* CORREÇÃO PONTO 4: Tabela Espremida e Filtros no Mobile */

/* 1. Força a tabela a ter largura suficiente para não espremer as colunas */
.ranking-table-detailed {
    min-width: 650px; /* Garante que as colunas de redação e matérias caibam */
}

/* 2. Ajusta a barra de filtros para empilhar em telas pequenas (iPhone XS) */
@media (max-width: 480px) {
    .rd-tabs-area {
        flex-direction: column; /* Empilha as abas e a paginação */
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .tabs-scroll {
        width: 100%;
        padding-bottom: 5px; /* Espaço para scrollbar se necessário */
    }

    /* Ajusta o select de paginação para ocupar largura total ou ficar centralizado */
    .rd-tabs-area .rd-select-small {
        width: 100%;
        text-align: center;
        padding: 8px;
    }
    
    /* Garante que o container de paginação (botões Ant/Prox) não quebre */
    .pagination-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
}