/* Tabelas, estatísticas e validação cadastral */

.upload-box small {
    display: block;
    color: var(--muted);
    margin-bottom: 14px;
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    padding: 16px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    color: var(--primary-dark);
}

.stat-card.success strong {
    color: var(--success);
}

.stat-card.danger strong {
    color: var(--danger);
}

.table-wrapper {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: none;
    background: #ffffff;
}

.table-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.table-toolbar-search {
    display: grid;
    gap: 8px;
    min-width: min(100%, 320px);
}

.table-toolbar-search label {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary-dark);
}

.table-toolbar-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.table-pagination-info {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.historico-registros-pagination--numerica,
.pagination-numerica-container {
    width: 100%;
    justify-content: space-between !important;
}

.pagination-numerica {
    display: inline-flex;
    align-items: stretch;
}

.pagination-numerica-pagina,
.pagination-numerica-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 0 12px;
    color: #4b5f7a;
    background: #fff;
    border: 1px solid #d6e0ec;
    border-right-width: 0;
    font-size: 14px;
    text-decoration: none;
}

.pagination-numerica-nav {
    min-width: 72px;
}

.pagination-numerica > :first-child {
    border-radius: 4px 0 0 4px;
}

.pagination-numerica > :last-child {
    border-right-width: 1px;
    border-radius: 0 4px 4px 0;
}

.pagination-numerica-pagina:hover,
.pagination-numerica-nav:hover {
    background: #f4f8fc;
}

.pagination-numerica-pagina.is-active {
    color: #fff;
    background: #1688dc;
    border-color: #1688dc;
}

.pagination-numerica-reticencias {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    color: #66778d;
    background: #fff;
    border: 1px solid #d6e0ec;
    border-right-width: 0;
}

/* Evita o "piscar" ao trocar de página pelos links da paginação. */
[data-pagination-region] {
    transition: opacity 140ms ease;
}

[data-pagination-region].is-paging {
    position: relative;
    opacity: .7;
    pointer-events: none;
}

[data-pagination-region].is-paging::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #93c5fd;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ke-pagination-spin 0.7s linear infinite;
    z-index: 5;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
    background: #ffffff;
}

.data-table th {
    background: #f4f7fb;
    color: var(--primary-dark);
    font-size: 12px;
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    vertical-align: top;
}

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

.linha-pendente {
    background: #fff7f7;
}

.linha-validada {
    background: #f6fffa;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge.erro {
    background: #fee4e2;
    color: #b42318;
}

.status-badge.pendencia {
    background: #fff3d6;
    color: #9a6700;
}

.status-badge.ok {
    background: #d1fadf;
    color: #067647;
}

.status-pendente {
    background: #fee4e2;
    color: #b42318;
}

.status-validado {
    background: #d1fadf;
    color: #067647;
}

.manual-form {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 320px;
}

.manual-form input {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 10px;
    font-size: 13px;
    min-width: 160px;
}

.manual-form button {
    min-height: 38px;
    padding: 0 14px;
    font-size: 12px;
}

.manual-aluno-preview {
    color: var(--text-muted, #667085);
    font-size: 12px;
    line-height: 1.25;
    max-width: 220px;
}

.keepedu-app-page #modal-preencher-id .app-modal-dialog {
    width: min(calc(100vw - 32px), 520px);
}

.keepedu-app-page #modal-preencher-id .app-modal-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5edf5;
}

.manual-aluno-preview--modal {
    display: none;
    position: relative;
    min-height: 76px;
    margin: 16px 0 0;
    padding: 38px 18px 14px 70px;
    border: 1px solid #ccebd7;
    border-radius: 12px;
    background: linear-gradient(135deg, #f6fff9, #ecfdf3);
    box-shadow: 0 5px 14px rgba(22, 101, 52, .08);
    color: #14532d;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.manual-aluno-preview--modal:not(:empty) {
    display: block;
}

.manual-aluno-preview--modal::before {
    position: absolute;
    top: 50%;
    left: 18px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: #16a34a;
    color: #fff;
    content: "✓";
    font-size: 20px;
    font-weight: 800;
    line-height: 34px;
    text-align: center;
}

.manual-aluno-preview--modal::after {
    position: absolute;
    top: 13px;
    left: 70px;
    color: #15803d;
    content: "ALUNO LOCALIZADO";
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}

.manual-aluno-preview--modal[data-status="buscando"] {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 700;
    padding-top: 14px;
}

.manual-aluno-preview--modal[data-status="buscando"]::before {
    background: transparent;
    border: 2px solid #2563eb;
    border-right-color: transparent;
    content: "";
    animation: manual-action-spin .7s linear infinite;
}

.manual-aluno-preview--modal[data-status="buscando"]::after {
    content: "CONSULTANDO CADASTRO";
    color: #2563eb;
}

.manual-aluno-preview--modal[data-status="erro"] {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.manual-aluno-preview--modal[data-status="erro"]::before {
    background: #dc2626;
    content: "!";
}

.manual-aluno-preview--modal[data-status="erro"]::after {
    content: "NÃO FOI POSSÍVEL LOCALIZAR";
    color: #dc2626;
}

.manual-action-btn[aria-busy="true"]::before,
#modal-id-aluno-salvar[aria-busy="true"]::before,
#modal-desfazer-confirmar[aria-busy="true"]::before {
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 7px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -1px;
    animation: manual-action-spin .7s linear infinite;
}

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

/* Modal de identificação manual */
.keepedu-app-page #modal-preencher-id .modal-preencher-id-dialog {
    width: min(calc(100vw - 32px), 540px);
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.keepedu-app-page #modal-preencher-id .modal-preencher-id-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #e7edf4;
    background: linear-gradient(135deg, #f8fbff 0%, #fff 72%);
}

.modal-preencher-id-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-preencher-id-title-group .section-kicker {
    display: block;
    margin-bottom: 3px;
    color: #64748b;
    font-size: 10px;
    letter-spacing: .08em;
}

.modal-preencher-id-title-group h3 {
    margin: 0;
    color: #17365d;
    font-size: 23px;
    letter-spacing: -.03em;
}

.modal-preencher-id-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    background: #e8f2ff;
    color: #2478c5;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .03em;
}

.keepedu-app-page #modal-preencher-id .app-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #64748b;
}

.modal-preencher-id-content {
    padding: 20px 24px 6px;
}

.keepedu-app-page #modal-preencher-id .app-modal-text {
    margin: 0 0 20px;
    color: #52657d;
    font-size: 14px;
    line-height: 1.5;
}

.modal-id-field {
    gap: 7px;
}

.modal-id-field > span {
    color: #1f3e65;
    font-size: 13px;
}

.modal-id-field small {
    color: #8291a5;
    font-size: 11px;
}

.modal-id-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid #c8d6e5;
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.modal-id-input-wrap:focus-within {
    border-color: #2a8cdb;
    box-shadow: 0 0 0 3px rgba(42, 140, 219, .13);
}

.modal-id-input-wrap > span {
    padding: 0 12px 0 15px;
    color: #90a2b7;
    font-size: 16px;
    font-weight: 700;
}

.keepedu-app-page .modal-id-input-wrap input#modal-id-aluno-input {
    width: 100%;
    height: 46px;
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #1f3655;
    font-size: 16px;
    font-weight: 700;
    outline: 0;
}

.manual-aluno-preview--modal {
    min-height: 74px;
    margin: 18px 0 10px;
    padding: 37px 18px 14px 66px;
    border-radius: 11px;
    box-shadow: none;
    font-size: 16px;
}

.manual-aluno-preview--modal::before {
    left: 17px;
    width: 32px;
    height: 32px;
    line-height: 32px;
}

.manual-aluno-preview--modal::after {
    top: 12px;
    left: 66px;
}

.keepedu-app-page #modal-preencher-id .app-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 0;
    padding: 16px 24px 20px;
    border-top: 1px solid #e7edf4;
    background: #f8fafc;
}

.keepedu-app-page #modal-preencher-id .app-modal-actions button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
}

.keepedu-app-page #modal-desfazer-correcao .modal-desfazer-correcao-dialog {
    width: min(calc(100vw - 32px), 470px);
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.modal-desfazer-correcao-header {
    padding: 21px 24px 17px;
    border-bottom: 1px solid #f2dfdf;
    background: linear-gradient(135deg, #fff9f9, #fff);
}

.modal-desfazer-correcao-header h3 {
    margin: 3px 0 0;
    color: #7f1d1d;
    font-size: 21px;
}

.modal-desfazer-correcao-content {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 22px 24px;
}

.modal-desfazer-correcao-content p {
    margin: 0;
    color: #5b6879;
    font-size: 14px;
    line-height: 1.5;
}

.modal-desfazer-correcao-icon {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    font-weight: 800;
}

.keepedu-app-page #modal-desfazer-correcao .app-modal-actions {
    justify-content: center;
    margin: 0;
    padding: 15px 24px 20px;
    border-top: 1px solid #edf1f5;
    background: #fafbfc;
}

/* Resultado como identidade do aluno, sem aparência de alerta/cartão. */
.manual-aluno-preview--modal {
    width: 100%;
    max-width: none;
    min-height: 58px;
    margin: 18px 0 8px;
    padding: 25px 0 6px 52px;
    border: 0;
    border-top: 1px solid #e4edf5;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #1e3a5f;
    font-size: 18px;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manual-aluno-preview--modal::before {
    top: 30px;
    left: 4px;
    width: 32px;
    height: 32px;
    border: 2px solid #bbebca;
    background: #effcf3;
    color: #159447;
    font-size: 18px;
    line-height: 28px;
}

.manual-aluno-preview--modal::after {
    top: 7px;
    left: 52px;
    color: #75859a;
    content: "Nome do aluno";
    font-size: 10px;
    letter-spacing: .04em;
}

.manual-aluno-preview--modal[data-status="buscando"] {
    padding-top: 15px;
    border-top-color: #d8e8f8;
    background: transparent;
    color: #3572ad;
    font-size: 14px;
}

.manual-aluno-preview--modal[data-status="buscando"]::before {
    top: 28px;
    border-color: #5792cc;
    background: transparent;
}

.manual-aluno-preview--modal[data-status="buscando"]::after {
    top: 7px;
    color: #6d8ead;
    content: "Consultando cadastro";
}

.manual-aluno-preview--modal[data-status="erro"] {
    border-top-color: #fee2e2;
    background: transparent;
    color: #bd3434;
}

.manual-aluno-preview--modal[data-status="erro"]::before {
    border-color: #fecaca;
    background: #fff5f5;
}

.manual-aluno-preview--modal[data-status="erro"]::after {
    color: #bc6a6a;
    content: "Consulta não concluída";
}

.viewer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

#proxima-pendencia,
#proxima-com-erro,
#imagem-anterior,
#proxima-imagem {
    min-width: 110px;
}

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

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.summary-card:hover {
    border-color: #bfd0e5;
    box-shadow: 0 6px 12px rgba(15, 37, 77, 0.04);
}

.summary-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 32px;
    color: var(--primary-dark);
}

.summary-card p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}
