.tenant-app {
    --adtech-primary: #4f46e5;
    --adtech-primary-600: #4338ca;
    --adtech-primary-soft: rgba(79, 70, 229, 0.2);
    --adtech-surface: #ffffff;
    --adtech-muted: #f4f7ff;
    --adtech-page: #f6f8fc;
    background: var(--adtech-page);
}

/* ── Alunos filtros ─────────────────────────────────── */
.alunos-filtros {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.alunos-pesquisa {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.alunos-pesquisa-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.9rem;
}

.alunos-pesquisa-input {
    padding-left: 2.25rem !important;
}

.alunos-filtro-estado,
.alunos-filtro-turma {
    min-width: 160px;
}

.alunos-table-wrapper {
    overflow-x: auto;
    margin-top: 1.2rem;
    width: 100%;
}
.alunos-table-scroll {
    max-height: 480px;
    overflow-y: auto;
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(43,92,255,0.06);
}

.alunos-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 0.5rem 0.2rem 0.5rem;
    font-size: 1.01rem;
    color: #334155;
    background: none;
    margin-top: 0.2rem;
}
.alunos-table-info {
    font-weight: 600;
}
.alunos-table-paginacao {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.alunos-table-paginacao button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.alunos-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(43,92,255,0.06);
    font-size: 0.88rem;
    min-width: 700px;
    margin: 0;
    table-layout: auto;
}

.alunos-table th {
    background: #f3f6ff;
    color: #1e293b;
    font-weight: 800;
    padding: 0.6rem 0.5rem;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
    letter-spacing: 0.01em;
    font-size: 0.95em;
}

.alunos-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    background: #fff;
}

.alunos-table tr:last-child td {
    border-bottom: none;
}

.aluno-nome {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #1e293b;
}

.avatar-mini {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2b5cff, #1f4fd1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    box-shadow: 0 2px 8px rgba(43,92,255,0.13);
    border: 2px solid #fff;
}

.estado-ativo {
    color: #22c55e;
    font-weight: 700;
    background: #e7fbe9;
    padding: 0.32em 1.1em;
    border-radius: 999px;
    font-size: 1em;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 4px rgba(34,197,94,0.07);
}
.estado-inativo {
    color: #dc2626;
    font-weight: 700;
    background: #fee2e2;
    padding: 0.32em 1.1em;
    border-radius: 999px;
    font-size: 1em;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 4px rgba(220,38,38,0.07);
}

.kt-btn-table {
    background: #f3f6ff;
    color: #1f4fd1;
    border: none;
    border-radius: 8px;
    padding: 0.45em 1.2em;
    font-size: 1em;
    margin-right: 0.3em;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
    box-shadow: 0 1px 4px rgba(43,92,255,0.07);
    outline: none;
}
.kt-btn-table:hover {
    background: #e0e7ff;
    color: #1e40af;
}

@media (max-width: 1200px) {
    .alunos-table {
        min-width: 700px;
        font-size: 0.98rem;
    }
    .aluno-nome span {
        font-size: 1rem;
    }
}

@media (max-width: 900px) {
    .alunos-table {
        min-width: 520px;
        font-size: 0.93rem;
    }
    .aluno-nome span {
        font-size: 0.95rem;
    }
}

.sidebar {
    width: 240px;
    background: #00174b;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1rem 0.9rem;
    gap: 1rem;
}

.sidebar-header {
    display: grid;
    gap: 0.6rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    height: 36px;
    width: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #004ac6 0%, #002d7a 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 8px 20px -6px rgba(0, 74, 198, 0.6);
}

.brand-logo-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
}

.brand-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.brand-school {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.85rem;
    line-height: 1.2;
}

.sidebar-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.68rem;
    width: fit-content;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4edea3;
    box-shadow: 0 0 6px rgba(78, 222, 163, 0.5);
}

.sidebar-menu {
    display: grid;
    gap: 0.2rem;
    font-size: 0.82rem;
}

.menu-item,
.menu-group summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item i,
.menu-group summary i {
    font-size: 1rem;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 600;
}

.menu-sub a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 600;
}

.menu-group summary.group-active {
    color: #ffffff;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
}

.menu-group summary.group-active i {
    color: #ffffff;
}

.menu-item:hover,
.menu-group summary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.menu-group {
    border-radius: 14px;
    background: transparent;
    padding: 0.1rem;
    border: none;
}

.menu-group summary {
    list-style: none;
}

.menu-group summary::-webkit-details-marker {
    display: none;
}

.menu-sub {
    display: grid;
    gap: 0.1rem;
    padding: 0.1rem 0.5rem 0.3rem 1.3rem;
    position: relative;
}

.menu-sub::before {
    content: "";
    position: absolute;
    left: 0.9rem;
    top: 0.1rem;
    bottom: 0.3rem;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.menu-sub a,
.menu-sub-group summary,
.menu-sub-item {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.menu-sub-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.menu-sub-icon {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.3);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.menu-sub-item:hover .menu-sub-icon,
.menu-sub a.active .menu-sub-icon {
    color: rgba(255, 255, 255, 0.7);
}

.menu-item-btn.menu-item-popover {
    justify-content: flex-start;
    color: rgba(255, 255, 255, 0.7);
}

.menu-item-btn.menu-item-popover:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.menu-sub a:hover,
.menu-sub-group summary:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.menu-item-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: #64748b;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
}

.menu-item-btn:hover {
    background: #eef2ff;
    color: #0f172a;
}

.menu-sub-group {
    display: grid;
    gap: 0.3rem;
}

.menu-sub-group summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.menu-sub-group summary::-webkit-details-marker {
    display: none;
}

.menu-sub-group a {
    padding-left: 1rem;
}

.sidebar-support {
    margin-top: auto;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 1rem;
    display: grid;
    gap: 0.6rem;
}

.support-title {
    font-weight: 600;
}

.support-text {
    color: #64748b;
    font-size: 0.85rem;
}

.support-link {
    color: var(--adtech-primary);
    font-weight: 600;
    text-decoration: none;
}

.tenant-app aside {
    background: var(--adtech-surface);
}

.tenant-app nav a {
    transition: all 0.2s ease;
}

.tenant-app nav a:hover {
    background: var(--adtech-muted);
}

.tenant-app header {
    backdrop-filter: blur(12px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1.5rem;
    background: #ffffff;
    color: #191c1e;
    border-bottom: 1px solid rgba(195, 198, 215, 0.4);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
}

.topbar-title {
    font-weight: 600;
    color: #191c1e;
    font-size: 0.85rem;
}

.topbar-ambiente-badge {
    background: #f59e0b;
    color: #fff;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-left: 0.4rem;
}

.topbar-divider {
    width: 1px;
    height: 14px;
    background: rgba(115, 118, 134, 0.3);
}

.topbar-meta {
    color: #434655;
    font-size: 0.78rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.topbar-link {
    color: #004ac6;
    text-decoration: none;
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 74, 198, 0.06);
    border: none;
    cursor: pointer;
}

.topbar-link:hover {
    background: rgba(0, 74, 198, 0.12);
}

.topbar-subscricao-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.topbar-subscricao-btn:hover {
    opacity: 0.85;
}

.topbar-subscricao-btn .material-symbols-outlined {
    font-size: 0.95rem;
}

.topbar-subscricao-aviso {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.topbar-subscricao-expirada {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    animation: pulse-subscricao 2s infinite;
}

@keyframes pulse-subscricao {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.icon-button {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(195, 198, 215, 0.5);
    background: #f1f5f9;
    color: #434655;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.icon-button:hover {
    background: #e6e8ea;
    color: #191c1e;
}

.icon-button i {
    font-size: 1rem;
}

.badge {
    top: -3px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    padding: 0.05rem 0.3rem;
    border-radius: 999px;
}

.profile-menu {
    position: relative;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid rgba(195, 198, 215, 0.5);
    color: #434655;
    cursor: pointer;
    list-style: none;
}

.profile-button::-webkit-details-marker {
    display: none;
}

.profile-identidade {
    display: grid;
    line-height: 1.1;
    text-align: right;
    padding-right: 0.15rem;
}

.profile-identidade strong {
    font-size: 0.75rem;
    font-weight: 700;
    color: #191c1e;
}

.profile-identidade small {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 700;
    color: #434655;
}

@media (max-width: 640px) {
    .profile-identidade {
        display: none;
    }
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #1e293b;
    font-size: 0.7rem;
    font-weight: 700;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: 46px;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    padding: 0.6rem;
    min-width: 180px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.2);
    display: grid;
    gap: 0.4rem;
    z-index: 10;
}

.profile-dropdown a {
    text-decoration: none;
    color: #0f172a;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    font-size: 0.85rem;
}

.profile-action {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    text-align: left;
    font-size: 0.85rem;
    color: #0f172a;
    cursor: pointer;
}

.profile-action:hover {
    background: #f1f5f9;
}

.perfil-acesso-modal {
    width: min(100%, 680px);
}

.perfil-acesso-popover {
    display: grid;
}

.perfil-acesso-popover .modal-container {
    max-width: none;
    width: 100%;
    max-height: min(88vh, 620px);
}

.perfil-acesso-info {
    display: grid;
    gap: .4rem;
    margin-bottom: 1rem;
    padding: .8rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
}

.perfil-acesso-nota {
    font-size: .82rem;
    color: #475569;
}

.perfil-acesso-form {
    display: grid;
    gap: .75rem;
}

.topbar-side-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    background: rgba(60, 23, 42, .35);
    z-index: 1100;
    display: none;
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
}

.topbar-side-overlay:popover-open {
    display: flex;
}

.topbar-chat-panel {
    width: min(420px, 100vw);
    height: 100vh;
    position: absolute;
    top: 0;
    right: 0;
    background: #e5ddd5;
    box-shadow: -18px 0 45px rgba(15, 23, 42, .24);
    display: flex;
    flex-direction: column;
    margin-left: auto;
    margin-right: 0;
}

.topbar-chat-header,
.topbar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.topbar-chat-header strong,
.topbar-panel-header strong {
    color: #0f172a;
    font-size: 1rem;
}

.topbar-chat-header p,
.topbar-panel-header p {
    margin: .2rem 0 0;
    color: #64748b;
    font-size: .82rem;
}

.topbar-chat-lista {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    gap: .65rem;
    align-content: start;
}

.topbar-chat-msg {
    display: flex;
    justify-content: flex-start;
}

.topbar-chat-msg--minha {
    justify-content: flex-end;
}

.topbar-chat-msg > div {
    max-width: 82%;
    background: #fff;
    color: #0f172a;
    border-radius: 12px 12px 12px 2px;
    padding: .65rem .75rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.topbar-chat-msg--minha > div {
    background: #dcf8c6;
    border-radius: 12px 12px 2px 12px;
}

.topbar-chat-msg p {
    margin: .25rem 0;
    font-size: .9rem;
}

.topbar-chat-msg small {
    display: block;
    text-align: right;
    color: #64748b;
    font-size: .72rem;
}

.topbar-chat-footer {
    display: flex;
    gap: .5rem;
    padding: .85rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.topbar-top-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    background: rgba(15, 23, 42, .25);
    z-index: 1100;
    display: none;
    padding: 1rem;
}

.topbar-top-overlay:popover-open {
    display: grid;
    place-items: center;
}

.topbar-notificacoes-panel {
    width: min(620px, calc(100vw - 2rem));
    max-height: min(78vh, 620px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    overflow: hidden;
}

.topbar-notificacoes-lista {
    display: grid;
    gap: .65rem;
    padding: 1rem;
    max-height: 520px;
    overflow-y: auto;
}

.topbar-notificacao {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .75rem;
    padding: .8rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.topbar-notificacao--nova {
    border-left: 4px solid #2563eb;
    background: #eff6ff;
}

.topbar-notificacao > span {
    display: inline-flex;
    height: fit-content;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: .72rem;
    font-weight: 700;
}

.topbar-notificacao strong {
    color: #0f172a;
}

.topbar-notificacao p {
    margin: .2rem 0;
    color: #475569;
    font-size: .88rem;
}

.topbar-notificacao small {
    color: #94a3b8;
    font-size: .75rem;
}

.calendario-topbar-modal {
    width: min(620px, 96vw);
}

.calendario-topbar-lista {
    display: grid;
    gap: .75rem;
}

.calendario-topbar-evento {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: .9rem;
    padding: .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.calendario-topbar-data {
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #1d4ed8;
    color: #fff;
    padding: .55rem;
}

.calendario-topbar-data strong {
    font-size: 1.4rem;
    line-height: 1;
}

.calendario-topbar-data span,
.calendario-topbar-evento span {
    font-size: .78rem;
}

.calendario-topbar-evento strong {
    display: block;
    margin-top: .15rem;
    color: #0f172a;
}

.calendario-topbar-evento p {
    margin: .2rem 0 0;
    color: #475569;
    font-size: .88rem;
}

/* ── Calendário Google Calendar ────────────────────────── */
.calendario-google {
    width: min(520px, 96vw);
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, .18);
    overflow: hidden;
}

.calendario-topbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .5rem;
    border-bottom: 1px solid #e5e7eb;
}

.calendario-topbar-titulo {
    flex: 1;
    text-align: center;
}

.calendario-topbar-titulo h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #3c4043;
    margin: 0;
    text-transform: capitalize;
}

.calendario-topbar-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.calendario-hoje-btn {
    padding: .35rem .85rem;
    border: 1px solid #dadce0;
    border-radius: 18px;
    background: transparent;
    color: #1a73e8;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.calendario-hoje-btn:hover {
    background: #e8f0fe;
}

.calendario-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    transition: background .15s;
}

.calendario-nav-btn:hover {
    background: #f1f3f4;
}

.calendario-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e5e7eb;
}

.calendario-dia-semana {
    text-align: center;
    font-size: .7rem;
    font-weight: 600;
    color: #70757a;
    padding: .5rem 0;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.calendario-grid {
    display: flex;
    flex-direction: column;
}

.calendario-semana {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e5e7eb;
}

.calendario-semana:last-child {
    border-bottom: none;
}

.calendario-celula {
    position: relative;
    min-height: 72px;
    padding: .25rem;
    border-right: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background .1s;
}

.calendario-celula:last-child {
    border-right: none;
}

.calendario-celula:hover {
    background: #f8f9fa;
}

.calendario-celula--faded {
    background: #fafafa;
}

.calendario-celula--faded:hover {
    background: #f5f5f5;
}

.calendario-celula--hoje {
    background: #fef7e0 !important;
}

.calendario-celula--hoje:hover {
    background: #fdecc0 !important;
}

.calendario-celula--selecionado {
    background: #e8f0fe !important;
}

.calendario-dia-numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: .82rem;
    color: #3c4043;
    font-weight: 500;
}

.calendario-dia-numero--faded {
    color: #b0b0b0;
}

.calendario-dia-numero--hoje {
    background: #1a73e8;
    color: #fff;
    font-weight: 700;
}

.calendario-eventos-celula {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 1px;
}

.calendario-faixa-inteira {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.calendario-faixa-inteira--amarelo {
    background: #fdd663;
    color: #7c5e00;
}

.calendario-faixa-inteira--verde {
    background: #81c995;
    color: #0d5527;
}

.calendario-faixa-inteira--laranja {
    background: #fbbc04;
    color: #7c3e00;
}

.calendario-faixa-inteira--azul {
    background: #a8c7fa;
    color: #174ea6;
}

.calendario-evento-card {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: .68rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    cursor: pointer;
}

.calendario-evento-card--verde {
    background: #ceead6;
    color: #0d5527;
}

.calendario-evento-card--laranja {
    background: #fce8b2;
    color: #7c3e00;
}

.calendario-evento-card--azul {
    background: #d2e3fc;
    color: #174ea6;
}

.calendario-evento-card--cinza {
    background: #e8eaed;
    color: #3c4043;
}

.calendario-evento-ponto {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendario-evento-ponto--verde { background: #34a853; }
.calendario-evento-ponto--laranja { background: #ea8600; }
.calendario-evento-ponto--azul { background: #1a73e8; }
.calendario-evento-ponto--cinza { background: #9aa0a6; }

.calendario-evento-texto {
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendario-mais-eventos {
    font-size: .65rem;
    color: #70757a;
    padding: 0 4px;
    font-weight: 500;
}

.calendario-upgrade-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .6rem .5rem;
    padding: .5rem .75rem;
    background: linear-gradient(135deg, #fff7ed, #fef3c7);
    border: 1px solid #fbbf24;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 600;
    color: #92400e;
}

.calendario-upgrade-badge .material-symbols-outlined {
    font-size: 1rem;
    color: #d97706;
}

/* ── Notificações Bloqueadas Enterprise ────────────────── */
.topbar-notificacoes-bloqueado {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.notificacoes-bloqueado-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    margin-bottom: 1.25rem;
}

.notificacoes-bloqueado-icon .material-symbols-outlined {
    font-size: 2.2rem;
    color: #d97706;
}

.topbar-notificacoes-bloqueado h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 .5rem;
}

.topbar-notificacoes-bloqueado p {
    font-size: .88rem;
    color: #6b7280;
    margin: 0 0 .35rem;
    line-height: 1.5;
}

.topbar-notificacoes-bloqueado p strong {
    color: #d97706;
}

.notificacoes-bloqueado-sub {
    font-size: .8rem !important;
    color: #9ca3af !important;
    max-width: 320px;
}

.notificacoes-bloqueado-features {
    display: grid;
    gap: .6rem;
    margin-top: 1.25rem;
    width: 100%;
    max-width: 320px;
}

.notificacoes-feature-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .85rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: .82rem;
    color: #374151;
    text-align: left;
}

.notificacoes-feature-item .material-symbols-outlined {
    font-size: 1.1rem;
    color: #10b981;
    flex-shrink: 0;
}

/* ── Mensagens Bloqueadas Enterprise PRO ───────────────── */
.mensagens-bloqueado {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
    flex: 1;
}

.mensagens-bloqueado-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    margin-bottom: 1.25rem;
}

.mensagens-bloqueado-icon .material-symbols-outlined {
    font-size: 2.2rem;
    color: #2563eb;
}

.mensagens-bloqueado h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 .5rem;
}

.mensagens-bloqueado p {
    font-size: .88rem;
    color: #6b7280;
    margin: 0 0 .35rem;
    line-height: 1.5;
}

.mensagens-bloqueado p strong {
    color: #2563eb;
}

.mensagens-bloqueado-sub {
    font-size: .8rem !important;
    color: #9ca3af !important;
    max-width: 320px;
}

.mensagens-bloqueado-features {
    display: grid;
    gap: .6rem;
    margin-top: 1.25rem;
    width: 100%;
    max-width: 320px;
}

.mensagens-feature-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .85rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: .82rem;
    color: #374151;
    text-align: left;
}

.mensagens-feature-item .material-symbols-outlined {
    font-size: 1.1rem;
    color: #10b981;
    flex-shrink: 0;
}

/* ── Modal Atribuição Disciplina (Wizard) ─────────────── */
.modal-atribuicao {
    width: min(680px, 95vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-atribuicao-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-atribuicao-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.modal-atribuicao-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.step {
    display: flex;
    align-items: center;
    gap: .4rem;
    opacity: .4;
}

.step--active {
    opacity: 1;
}

.step--done .step-numero {
    background: #10b981;
    color: #fff;
}

.step-numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: .78rem;
    font-weight: 700;
}

.step--active .step-numero {
    background: #4f46e5;
    color: #fff;
}

.step-label {
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
}

.step-line {
    width: 40px;
    height: 2px;
    background: #e2e8f0;
    margin: 0 .5rem;
}

.step-line--active {
    background: #4f46e5;
}

.modal-atribuicao-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.atribuicao-campo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 700px) {
    .atribuicao-campo-grid {
        grid-template-columns: 1fr;
    }
}

.modal-atribuicao-footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.atribuicao-seleccoes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .atribuicao-seleccoes-grid {
        grid-template-columns: 1fr;
    }
}

.atribuicao-seleccao-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: .85rem;
}

.atribuicao-seleccao-card h4 {
    font-size: .85rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 .6rem;
}

.atribuicao-checkbox-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .5rem;
    border-radius: 6px;
    font-size: .82rem;
    color: #374151;
    cursor: pointer;
    transition: background .1s;
}

.atribuicao-checkbox-item:hover {
    background: #e2e8f0;
}

.atribuicao-checkbox-item input[type="checkbox"] {
    accent-color: #4f46e5;
    width: 16px;
    height: 16px;
}

.atribuicao-conflitos {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: .85rem;
    margin-bottom: 1rem;
}

.atribuicao-conflitos h4 {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 .5rem;
}

.atribuicao-conflitos h4 .material-symbols-outlined {
    font-size: 1.1rem;
    color: #dc2626;
}

.atribuicao-conflito-item {
    font-size: .8rem;
    color: #7f1d1d;
    padding: .25rem 0;
    border-bottom: 1px solid #fecaca;
}

.atribuicao-conflito-item:last-child {
    border-bottom: none;
}

.atribuicao-preview {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: .85rem;
}

.atribuicao-preview h4 {
    font-size: .85rem;
    font-weight: 700;
    color: #166534;
    margin: 0 0 .5rem;
}

.profile-dropdown a:hover {
    background: #f1f5f9;
}

.mobile-menu-drawer {
    display: none;
    position: relative;
}

/* ── Mobile drawer trigger (botão hamburger) ── */
.mobile-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid rgba(195, 198, 215, 0.5);
    color: #434655;
    cursor: pointer;
    list-style: none;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    min-width: 44px;
}

.mobile-menu-trigger::-webkit-details-marker {
    display: none;
}

.mobile-menu-trigger .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ── Mobile drawer overlay ── */
.mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
}
.mobile-drawer-overlay.aberto {
    opacity: 1;
    pointer-events: auto;
}

/* ── Mobile drawer lateral ── */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 85vw);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #00174b 0%, #002d7a 100%);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}
.mobile-drawer.aberto {
    transform: translateX(0);
}

/* ── Drawer header ── */
.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.mobile-drawer-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

.mobile-drawer-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    transition: background 0.15s;
}
.mobile-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.mobile-drawer-close .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ── Drawer nav ── */
.mobile-drawer-nav {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

/* ── Drawer itens ── */
.mobile-drawer .menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px;
    font-size: 0.88rem;
}
.mobile-drawer .menu-item:hover,
.mobile-drawer .menu-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.mobile-drawer .menu-item .material-symbols-outlined {
    font-size: 1.15rem;
}
.mobile-drawer .menu-lock-icon {
    margin-left: auto;
    font-size: 0.9rem;
    opacity: 0.5;
}

/* ── Drawer grupos expandíveis ── */
.mobile-drawer-group {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}
.mobile-drawer-group summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    min-height: 44px;
    font-size: 0.88rem;
    transition: all 0.15s ease;
}
.mobile-drawer-group summary::-webkit-details-marker { display: none; }
.mobile-drawer-group summary:hover,
.mobile-drawer-group summary.group-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.mobile-drawer-group summary .material-symbols-outlined {
    font-size: 1.15rem;
}

/* ── Drawer sub-itens ── */
.mobile-drawer-sub {
    display: grid;
    gap: 0.1rem;
    padding: 0.1rem 0.5rem 0.4rem 1.2rem;
}
.mobile-drawer-sub a,
.mobile-drawer-sub summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    text-decoration: none;
    min-height: 40px;
    transition: all 0.15s ease;
}
.mobile-drawer-sub a:hover,
.mobile-drawer-sub a.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.mobile-drawer-sub .menu-sub-icon {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}
.mobile-drawer-sub a:hover .menu-sub-icon,
.mobile-drawer-sub a.active .menu-sub-icon {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Drawer sub-grupos ── */
.mobile-drawer-subgroup {
    display: grid;
    gap: 0.1rem;
}
.mobile-drawer-subgroup summary {
    list-style: none;
    cursor: pointer;
}
.mobile-drawer-subgroup summary::-webkit-details-marker { display: none; }
.mobile-drawer-subgroup a {
    padding-left: 1rem;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2rem 2.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: #ffffff;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.app-header p {
    color: #64748b;
    max-width: 32rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    color: #94a3b8;
}

.tenant-app .kt-btn-primary {
    background: linear-gradient(135deg, var(--adtech-primary), var(--adtech-primary-600));
    border: none;
}

.tenant-app .kt-btn-outline {
    border-color: #cbd5f5;
}

.app-main {
    padding: 1rem 1.5rem 1.5rem;
    display: grid;
    gap: 1.2rem;
    background: var(--adtech-page);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--adtech-surface);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    padding: 1.4rem;
    box-shadow: 0 18px 32px rgba(148, 163, 184, 0.18);
    display: grid;
    gap: 0.6rem;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.85rem;
}

.stat-header i {
    font-size: 1.2rem;
    color: var(--adtech-primary-600);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
}

.stat-meta {
    font-size: 0.8rem;
    color: #94a3b8;
}

.stat-meta.positive {
    color: #16a34a;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card-panel {
    background: var(--adtech-surface);
    border-radius: 20px;
    padding: 1.6rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 20px 36px rgba(148, 163, 184, 0.2);
    display: grid;
    gap: 1.2rem;
}

.card-panel.span-2 {
    grid-column: span 2;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-header p {
    font-size: 0.85rem;
    color: #64748b;
}

.card-header a {
    color: var(--adtech-primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.workflow-grid div {
    background: #f3f6ff;
    border-radius: 14px;
    padding: 0.9rem;
    display: grid;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #64748b;
}

.workflow-grid div strong {
    font-size: 0.88rem;
    color: #0f172a;
}

.workflow-highlight {
    background: #ffffff;
    border: 1px solid rgba(43, 92, 255, 0.2);
    box-shadow: 0 12px 24px rgba(43, 92, 255, 0.12);
}

.workflow-highlight strong {
    font-size: 0.95rem;
}

.workflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.workflow-actions a {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(43, 92, 255, 0.12);
    color: #1f4fd1;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
}

.workflow-actions a:hover {
    background: rgba(43, 92, 255, 0.2);
}

.workflow-grid strong {
    color: #0f172a;
    font-size: 1.1rem;
}

.shortcut-list {
    display: grid;
    gap: 0.7rem;
}

.shortcut-list a {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: #f3f6ff;
    text-decoration: none;
    color: #0f172a;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shortcut-list a:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(148, 163, 184, 0.2);
}

.aparencia-popover {
    width: min(660px, calc(100vw - 2rem));
    max-height: min(88vh, 620px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    padding: 0;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
    inset: 0;
    margin: auto;
    overflow: hidden;
}

.configuracao-escola-popover {
    width: min(420px, calc(100vw - 2rem));
    max-height: min(88vh, 620px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    padding: 0;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
    inset: 0;
    margin: auto;
    overflow: hidden;
}

.aparencia-popover::backdrop {
    background: rgba(15, 23, 42, 0.35);
}

.configuracao-escola-popover::backdrop {
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}

.aparencia-popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #e2e8f0;
}

.aparencia-popover-header p {
    margin: .2rem 0 0;
    color: #64748b;
    font-size: .85rem;
}

.aparencia-popover-body {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
    overflow-y: auto;
}

.aparencia-popover-body p {
    margin: 0;
    color: #64748b;
    font-size: .9rem;
}

@media (max-width: 640px) {
    .aparencia-popover,
    .configuracao-escola-popover {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }
}

@media (max-width: 1200px) {
    .card-panel.span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 1024px) {
    .tenant-app {
        background: #f8fafc;
    }

    .topbar-left {
        gap: 0.65rem;
    }

    .mobile-menu-drawer {
        display: block;
    }
}

@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar-divider {
        display: none;
    }

    .topbar-title {
        width: 100%;
    }

    .topbar-meta {
        display: inline-flex;
    }
}

:root[data-tema="escuro"] .tenant-app {
    --adtech-primary: #4c7dff;
    --adtech-primary-600: #6fa0ff;
    --adtech-primary-soft: rgba(76, 125, 255, 0.18);
    --adtech-surface: #111827;
    --adtech-muted: #1f2937;
    --adtech-page: #0b1220;
    color: #e2e8f0;
    background: var(--adtech-page);
}

:root[data-tema="escuro"] .sidebar {
    background: #0f172a;
    border-right-color: rgba(148, 163, 184, 0.25);
}

:root[data-tema="escuro"] .sidebar-status {
    background: rgba(76, 125, 255, 0.2);
    color: #e2e8f0;
}

:root[data-tema="escuro"] .menu-item,
:root[data-tema="escuro"] .menu-group summary {
    color: #cbd5f5;
}

:root[data-tema="escuro"] .menu-item.active {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
    border-left: 4px solid #fca5a5;
    border-radius: 0 10px 10px 0;
}

:root[data-tema="escuro"] .menu-sub a.active,
:root[data-tema="escuro"] .menu-sub-item.active {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
    border-left: 4px solid #fca5a5;
    border-radius: 0 10px 10px 0;
}

:root[data-tema="escuro"] .menu-group summary.group-active {
    color: #fca5a5 !important;
    background: rgba(248, 113, 113, 0.12);
    border-left: 4px solid #fca5a5;
    border-radius: 0 10px 10px 0;
}
:root[data-tema="escuro"] .menu-group summary.group-active i {
    color: #fca5a5 !important;
}

:root[data-tema="escuro"] .menu-group {
    background: #111827;
    border-color: rgba(148, 163, 184, 0.2);
}

:root[data-tema="escuro"] .menu-sub a,
:root[data-tema="escuro"] .menu-sub-group summary,
:root[data-tema="escuro"] .menu-sub-item {
    color: #94a3b8;
}

:root[data-tema="escuro"] .menu-sub a:hover,
:root[data-tema="escuro"] .menu-sub-group summary:hover,
:root[data-tema="escuro"] .menu-sub-item:hover {
    background: #1f2937;
    color: #e2e8f0;
}

:root[data-tema="escuro"] .menu-sub-icon {
    color: #64748b;
}

:root[data-tema="escuro"] .menu-sub-item:hover .menu-sub-icon,
:root[data-tema="escuro"] .menu-sub a.active .menu-sub-icon {
    color: #e2e8f0;
}

:root[data-tema="escuro"] .sidebar-support,
:root[data-tema="escuro"] .menu-item.active {
    background: #1f2937;
}

:root[data-tema="escuro"] .topbar {
    background: #050814;
}

:root[data-tema="escuro"] .topbar-link,
:root[data-tema="escuro"] .icon-button,
:root[data-tema="escuro"] .profile-button {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.3);
}

:root[data-tema="escuro"] .topbar-subscricao-aviso {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

:root[data-tema="escuro"] .topbar-subscricao-expirada {
    background: rgba(248, 215, 218, 0.15);
    color: #f5c2c7;
    border-color: rgba(245, 194, 199, 0.3);
}

:root[data-tema="escuro"] .app-header,
:root[data-tema="escuro"] .stat-card,
:root[data-tema="escuro"] .card-panel {
    background: #111827;
    border-color: rgba(148, 163, 184, 0.2);
}

:root[data-tema="escuro"] .app-header p,
:root[data-tema="escuro"] .stat-header,
:root[data-tema="escuro"] .stat-meta,
:root[data-tema="escuro"] .card-header p,
:root[data-tema="escuro"] .workflow-grid div,
:root[data-tema="escuro"] .shortcut-list a {
    color: #cbd5f5;
}

:root[data-tema="escuro"] .workflow-grid div,
:root[data-tema="escuro"] .shortcut-list a {
    background: #1f2937;
}

:root[data-tema="escuro"] .workflow-grid div strong {
    color: #e2e8f0;
}

:root[data-tema="escuro"] .workflow-highlight {
    background: #0f172a;
    border-color: rgba(76, 125, 255, 0.3);
}

:root[data-tema="escuro"] .workflow-actions a {
    background: rgba(76, 125, 255, 0.2);
    color: #cbd5f5;
}

:root[data-tema="escuro"] .profile-dropdown,
:root[data-tema="escuro"] .profile-dropdown a,
:root[data-tema="escuro"] .profile-action {
    background: #111827;
    color: #e2e8f0;
}

:root[data-tema="escuro"] .profile-dropdown a:hover,
:root[data-tema="escuro"] .profile-action:hover {
    background: #1f2937;
}

/* ── Calendário Google - Tema Escuro ──────────────────── */
:root[data-tema="escuro"] .calendario-google {
    background: #1f2937;
    border-color: #374151;
}

:root[data-tema="escuro"] .calendario-topbar {
    border-bottom-color: #374151;
}

:root[data-tema="escuro"] .calendario-topbar-titulo h3 {
    color: #e2e8f0;
}

:root[data-tema="escuro"] .calendario-hoje-btn {
    border-color: #4b5563;
    color: #60a5fa;
}

:root[data-tema="escuro"] .calendario-hoje-btn:hover {
    background: #1e3a5f;
}

:root[data-tema="escuro"] .calendario-nav-btn {
    color: #9ca3af;
}

:root[data-tema="escuro"] .calendario-nav-btn:hover {
    background: #374151;
}

:root[data-tema="escuro"] .calendario-grid-header {
    border-bottom-color: #374151;
}

:root[data-tema="escuro"] .calendario-dia-semana {
    color: #9ca3af;
}

:root[data-tema="escuro"] .calendario-semana {
    border-bottom-color: #374151;
}

:root[data-tema="escuro"] .calendario-celula {
    border-right-color: #2d3748;
}

:root[data-tema="escuro"] .calendario-celula:hover {
    background: #2d3748;
}

:root[data-tema="escuro"] .calendario-celula--faded {
    background: #1a202c;
}

:root[data-tema="escuro"] .calendario-celula--faded:hover {
    background: #2d3748;
}

:root[data-tema="escuro"] .calendario-celula--hoje {
    background: #42361a !important;
}

:root[data-tema="escuro"] .calendario-celula--hoje:hover {
    background: #4a3d1e !important;
}

:root[data-tema="escuro"] .calendario-celula--selecionado {
    background: #1e3a5f !important;
}

:root[data-tema="escuro"] .calendario-dia-numero {
    color: #d1d5db;
}

:root[data-tema="escuro"] .calendario-dia-numero--faded {
    color: #6b7280;
}

:root[data-tema="escuro"] .calendario-evento-card--verde {
    background: #1a3a2a;
    color: #86efac;
}

:root[data-tema="escuro"] .calendario-evento-card--laranja {
    background: #3d2e0a;
    color: #fcd34d;
}

:root[data-tema="escuro"] .calendario-evento-card--azul {
    background: #1a2d4a;
    color: #93c5fd;
}

:root[data-tema="escuro"] .calendario-evento-card--cinza {
    background: #374151;
    color: #d1d5db;
}

:root[data-tema="escuro"] .calendario-mais-eventos {
    color: #9ca3af;
}

:root[data-tema="escuro"] .calendario-upgrade-badge {
    background: linear-gradient(135deg, #422006, #451a03);
    border-color: #92400e;
    color: #fcd34d;
}

/* ── Notificações Bloqueadas - Tema Escuro ────────────── */
:root[data-tema="escuro"] .topbar-notificacoes-bloqueado h4 {
    color: #e2e8f0;
}

:root[data-tema="escuro"] .topbar-notificacoes-bloqueado p {
    color: #9ca3af;
}

:root[data-tema="escuro"] .notificacoes-bloqueado-sub {
    color: #6b7280 !important;
}

:root[data-tema="escuro"] .notificacoes-feature-item {
    background: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

/* ── Mensagens Bloqueadas - Tema Escuro ───────────────── */
:root[data-tema="escuro"] .mensagens-bloqueado-icon {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
}

:root[data-tema="escuro"] .mensagens-bloqueado-icon .material-symbols-outlined {
    color: #60a5fa;
}

:root[data-tema="escuro"] .mensagens-bloqueado h4 {
    color: #e2e8f0;
}

:root[data-tema="escuro"] .mensagens-bloqueado p {
    color: #9ca3af;
}

:root[data-tema="escuro"] .mensagens-bloqueado p strong {
    color: #60a5fa;
}

:root[data-tema="escuro"] .mensagens-bloqueado-sub {
    color: #6b7280 !important;
}

:root[data-tema="escuro"] .mensagens-feature-item {
    background: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

/* ============================================================================
   Ajuste de contraste do menu lateral (tema claro)
   ============================================================================ */

:root:not([data-tema="escuro"]) .tenant-app .sidebar {
    background: #00174b;
    border-right-color: rgba(255, 255, 255, 0.06);
}

:root:not([data-tema="escuro"]) .tenant-app .brand-label {
    color: #c7d2fe;
}

:root:not([data-tema="escuro"]) .tenant-app .brand-school {
    color: #ffffff;
}

:root:not([data-tema="escuro"]) .tenant-app .sidebar-status {
    background: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}

:root:not([data-tema="escuro"]) .tenant-app .menu-item,
:root:not([data-tema="escuro"]) .tenant-app .menu-group summary,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub a,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub-group summary,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub-item {
    color: #dbeafe;
}

:root:not([data-tema="escuro"]) .tenant-app .menu-sub-icon {
    color: rgba(255, 255, 255, 0.4);
}

:root:not([data-tema="escuro"]) .tenant-app .menu-group {
    background: rgba(15, 23, 42, 0.2);
    border-color: rgba(226, 232, 240, 0.16);
}

:root:not([data-tema="escuro"]) .tenant-app .menu-item:hover,
:root:not([data-tema="escuro"]) .tenant-app .menu-group summary:hover,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub a:hover,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub-group summary:hover,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub-item:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

:root:not([data-tema="escuro"]) .tenant-app .menu-item.active,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub a.active,
:root:not([data-tema="escuro"]) .tenant-app .menu-sub-item.active,
:root:not([data-tema="escuro"]) .tenant-app .menu-group summary.group-active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-left: none;
    border-radius: 12px;
}

:root:not([data-tema="escuro"]) .tenant-app .menu-group summary.group-active i {
    color: #ffffff !important;
}

/* =============================================================================
   Anos Letivos — Lista + Detalhe
   ============================================================================= */

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem 2.5rem 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0.15rem 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.page-header p {
    color: #64748b;
    font-size: 0.92rem;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

/* ── Button variants ─────────────────────────────────────── */
.qs-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.qs-btn-secondary:hover { background: #e2e8f0; }

.qs-btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
}

.qs-btn-success:hover { background: linear-gradient(135deg, #15803d, #166534); }

.qs-btn-sm {
    padding: .35rem .85rem;
    font-size: 0.85rem;
}

/* ── Alerts ──────────────────────────────────────────────── */
.form-alert {
    border-radius: 10px;
    padding: .65rem 1rem;
    font-size: .9rem;
    font-weight: 500;
    margin: 0 2.5rem .75rem;
    border-left: 4px solid;
}

.form-alert-error   { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.form-alert-success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }

/* ── Panel card ──────────────────────────────────────────── */
.panel-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(43,92,255,0.06);
    margin: .5rem 2.5rem 1.5rem;
    padding: 1.5rem;
    border: 1px solid #f1f5f9;
}

.panel-card-inner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

/* ── Form helpers ────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin-bottom: .75rem;
}

.field-group label {
    font-size: .85rem;
    font-weight: 600;
    color: #374151;
}

.form-input {
    border: 1.5px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: .5rem .75rem !important;
    font-size: .93rem;
    width: 100%;
    background: #fff;
    color: #1e293b;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-input:focus {
    border-color: var(--adtech-primary) !important;
    box-shadow: 0 0 0 3px var(--adtech-primary-soft) !important;
}

.form-input-upper {
    text-transform: uppercase;
    letter-spacing: .02em;
}

.form-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: .75rem;
    border-top: 1px solid #f1f5f9;
}

.form-card {
    max-width: 720px;
}

/* ── Loading & empty states ──────────────────────────────── */
.loading-state {
    color: #64748b;
    font-size: .95rem;
    padding: 2rem;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.empty-icon { margin-bottom: 1rem; }

.empty-state-inline {
    color: #94a3b8;
    font-size: .9rem;
    padding: 1.5rem 0;
    text-align: center;
}

/* ── Spinner / overlay partilhados ───────────────────────── */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: currentColor;
    border-radius: 50%;
    vertical-align: -.2em;
    animation: spinner-rodar .8s linear infinite;
}

.qs-btn .spinner,
.qs-btn > span .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.qs-btn-ghost .spinner,
.qs-btn-outline .spinner { border-color: rgba(37, 99, 235, .25); border-top-color: #2563eb; }

.al-btn .spinner,
.al-btn-icon .spinner { width: 12px; height: 12px; border-width: 2px; border-color: rgba(37, 99, 235, .25); border-top-color: #2563eb; vertical-align: middle; }

.overlay-carregamento {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(1px);
}

.overlay-carregamento-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: min(420px, 92vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
}

.overlay-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spinner-rodar .9s linear infinite;
}

@keyframes spinner-rodar {
    to { transform: rotate(360deg); }
}

/* ── Anos Letivos table ──────────────────────────────────── */
.al-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .95rem;
}

.al-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .7rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}

.al-table td {
    padding: .85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #1e293b;
    background: #fff;
}

.al-table tr:last-child td { border-bottom: none; }

.al-table-compact th,
.al-table-compact td { padding: .55rem .75rem; }

.al-row-active { background: #f0fdf4 !important; }
.al-row-inactive td { color: #94a3b8; }

.al-actions-col { width: 120px; text-align: center; }

.al-actions { display: flex; gap: .35rem; justify-content: center; align-items: center; }

.al-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    padding: .3rem .5rem;
    transition: background .15s;
    text-decoration: none;
    background: #f1f5f9;
    color: #334155;
}

.al-btn:hover { background: #e2e8f0; }

.al-btn-icon { width: 32px; height: 32px; padding: 0; }

.al-btn-activar { color: #16a34a; background: #f0fdf4; }
.al-btn-activar:hover { background: #dcfce7; }

.al-btn-danger { color: #dc2626; background: #fef2f2; }
.al-btn-danger:hover { background: #fee2e2; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: .22em .8em;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.badge-success   { background: #dcfce7; color: #15803d; }
.badge-warning   { background: #fef9c3; color: #a16207; }
.badge-info      { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-default   { background: #f1f5f9; color: #64748b; }

.badge-nivel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.badge-nivel-p { background: #dbeafe; color: #1d4ed8; }
.badge-nivel-s { background: #fef3c7; color: #92400e; }
.badge-nivel-m { background: #ede9fe; color: #6d28d9; }

.linha-disciplina-existente {
    opacity: 0.55;
}

.linha-disciplina-existente td {
    text-decoration: line-through;
    text-decoration-color: rgba(100,116,139,0.4);
}

.al-code {
    font-family: 'Courier New', monospace;
    font-size: .82em;
    background: #f1f5f9;
    color: #334155;
    border-radius: 5px;
    padding: .15em .5em;
    border: 1px solid #e2e8f0;
}

.al-code-lg {
    font-size: 1rem;
    padding: .2em .65em;
}

/* ── Detalhe header ──────────────────────────────────────── */
.al-detalhe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem 2.5rem 1rem;
    flex-wrap: wrap;
}

.al-detalhe-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .5rem;
    flex-wrap: wrap;
}

.al-meta-text {
    color: #64748b;
    font-size: .9rem;
}

.al-detalhe-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

/* ── Tabs ────────────────────────────────────────────────── */
.al-tabs {
    display: flex;
    gap: .3rem;
    padding: 0 2.5rem .25rem;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.al-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.1rem;
    border: none;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: #64748b;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.al-tab:hover { background: #f8fafc; color: #334155; }

.al-tab-active {
    background: #fff;
    color: var(--adtech-primary);
    border-bottom: 2px solid var(--adtech-primary);
    box-shadow: 0 -2px 8px rgba(43,92,255,.06);
}

.al-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--adtech-primary-soft);
    color: var(--adtech-primary);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

/* ── Section headers ─────────────────────────────────────── */
.al-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.al-section-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.al-form-title {
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}

/* ── Currículo resumo ────────────────────────────────────── */
.al-curriculo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.25rem;
}

.al-curriculo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.4rem 1rem;
    gap: .35rem;
}

.al-curriculo-valor {
    font-size: 2rem;
    font-weight: 800;
    color: var(--adtech-primary);
}

.al-curriculo-label {
    font-size: .82rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.al-curriculo-hint {
    font-size: .9rem;
    color: #64748b;
    margin-top: .5rem;
}

.al-curriculo-hint a {
    color: var(--adtech-primary);
    font-weight: 600;
    text-decoration: underline;
}

/* ── Button base + variants ──────────────────────────────── */
.qs-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: 8px;
    border: none;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}

.qs-btn:active { transform: scale(0.97); }

.qs-btn:disabled,
.qs-btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }

.qs-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.qs-btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #1f4fd1, #1840c0); }

.qs-btn-ghost {
    background: transparent;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.qs-btn-ghost:hover { background: #f8fafc; }

.qs-btn-outline {
    background: transparent;
    color: #2563eb;
    border: 1px solid #2563eb;
}

.qs-btn-outline:hover { background: #eff6ff; }

.qs-btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.qs-btn-warning:hover:not(:disabled) { background: linear-gradient(135deg, #d97706, #b45309); }

.qs-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.qs-btn-danger:hover:not(:disabled) { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ── Badge extra ─────────────────────────────────────────── */
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ── Modal global ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay[popover] {
    display: none;
}

.modal-overlay[popover]:popover-open {
    display: flex;
}

.modal-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    width: min(100%, 720px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-container {
    background: var(--surface, #fff);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border, #e2e8f0);
    flex-shrink: 0;
}

.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-header h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: .35rem;
    border-radius: 6px;
    color: #64748b;
    line-height: 1;
    transition: background .15s;
}

.modal-close:hover { background: #f1f5f9; }

.modal-body {
    background: #fff;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.menu-item-bloqueado,
.menu-sub-item-bloqueado,
.menu-group-bloqueado summary {
    opacity: .7;
}

.menu-item-bloqueado,
.menu-sub-item-bloqueado {
    width: 100%;
    text-align: left;
    background: rgba(148, 163, 184, 0.08);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    cursor: pointer;
}

.menu-item-bloqueado:hover,
.menu-sub-item-bloqueado:hover,
.menu-group-bloqueado summary:hover {
    background: rgba(59, 130, 246, 0.08);
}

.menu-lock-icon {
    margin-left: auto;
    font-size: 1rem;
    color: #f59e0b;
}

/* ── Toast sucesso ───────────────────────────────────────── */
.toast-sucesso {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #16a34a;
    color: #fff;
    padding: .75rem 1.25rem;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
    box-shadow: 0 6px 20px rgba(22,163,74,.35);
    z-index: 2000;
    animation: toast-in .25s ease both;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .page-header,
    .al-detalhe-header { padding: 1.25rem 1rem .75rem; }
    .panel-card { margin: .4rem 1rem 1rem; padding: 1rem; }
    .form-alert { margin: 0 1rem .5rem; }
    .al-tabs { padding: 0 1rem .25rem; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ─── Horário — grelha semanal ─────────────────────────────── */
.horario-grelha .tempo-col { min-width: 80px; }
.horario-grelha .tempo-ordem { font-weight: 600; font-size: .8rem; color: var(--muted-foreground); }
.horario-grelha .tempo-hora { font-size: .75rem; color: var(--muted-foreground); }
.horario-grelha .celula-ocupada { background: var(--accent); vertical-align: top; padding: .25rem; }
.horario-grelha .celula-livre { min-width: 100px; }
.atribuicao-card { position: relative; background: var(--card); border: 1px solid var(--border); border-left: 3px solid #4f46e5; border-radius: .375rem; padding: .35rem .5rem; font-size: .8rem; }
.atribuicao-disciplina { font-weight: 600; color: var(--foreground); }
.atribuicao-professor { color: var(--muted-foreground); }
.atribuicao-sala { color: var(--muted-foreground); font-style: italic; }
.atribuicao-remover { position: absolute; top: .2rem; right: .2rem; background: none; border: none; cursor: pointer; color: var(--destructive); padding: 0; font-size: .75rem; }
.atribuicao-remover:hover { color: var(--destructive-foreground); }

/* ============================================================================
   Layout fixo da Sidebar e conteudo principal (alinhado ao dasboard.html)
   ============================================================================ */
.tenant-app { position: relative; min-height: 100vh; }

.tenant-app .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 18rem;
    overflow-y: auto;
    z-index: 50;
    padding: 1.25rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tenant-app .sidebar::-webkit-scrollbar { width: 4px; }
.tenant-app .sidebar::-webkit-scrollbar-track { background: transparent; }
.tenant-app .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.tenant-app > div.flex.flex-col.grow { margin-left: 18rem; min-width: 0; }

.tenant-app .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #ffffff;
    backdrop-filter: blur(6px);
}

@media (max-width: 1023px) {
    .tenant-app .sidebar { display: none; }
    .tenant-app > div.flex.flex-col.grow { margin-left: 0; }
}


/* Material symbols dentro do menu/topbar */
.tenant-app .menu-item .material-symbols-outlined,
.tenant-app .menu-group summary .material-symbols-outlined { font-size: 1.25rem; vertical-align: middle; }
.tenant-app .icon-button .material-symbols-outlined { font-size: 1.2rem; }
.tenant-app .profile-button .material-symbols-outlined { font-size: 1rem; color: #64748b; }
.tenant-app .modal-close .material-symbols-outlined { font-size: 1.1rem; }


/* ============================================================================
   Botoes (kt-btn) - base global, complementa .qs-btn
   ============================================================================ */
.kt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.05rem;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #f1f5f9;
    color: #1e293b;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
}

.kt-btn:hover { background: #e2e8f0; }
.kt-btn:active { transform: scale(.98); }
.kt-btn:focus-visible { outline: 2px solid rgba(0,74,198,0.35); outline-offset: 2px; }
.kt-btn:disabled, .kt-btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }

.kt-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: transparent;
}
.kt-btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); color: #fff; }

.kt-btn-outline {
    background: #fff;
    color: #1e40af;
    border-color: #cbd5f5;
}
.kt-btn-outline:hover { background: #eff6ff; color: #1e3a8a; }

.kt-btn-ghost {
    background: transparent;
    color: #475569;
    border-color: transparent;
}
.kt-btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

.kt-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.kt-btn-danger:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }

.kt-btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
}
.kt-btn-success:hover { background: linear-gradient(135deg, #15803d, #166534); color: #fff; }

.kt-btn-sm { padding: .35rem .75rem; font-size: .8rem; border-radius: 8px; }
.kt-btn-lg { padding: .75rem 1.4rem; font-size: 1rem; border-radius: 12px; }

.kt-btn .material-symbols-outlined { font-size: 1.1rem; }

/* Tenant-app overrides garantem cores mesmo quando os botoes estao dentro do layout */
.tenant-app .kt-btn { background: #f1f5f9; color: #1e293b; }
.tenant-app .kt-btn:hover { background: #e2e8f0; }
.tenant-app .kt-btn-primary { background: linear-gradient(135deg, var(--adtech-primary), var(--adtech-primary-600)); color: #fff; border: none; }
.tenant-app .kt-btn-outline { background: #fff; color: #1e40af; border-color: #cbd5f5; }
.tenant-app .kt-btn-ghost { background: transparent; color: #475569; }
.tenant-app .kt-btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border: none; }

/* Footer das modais (kt-btn alinhado a direita por padrao) */
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(226, 232, 240, .8); background: #f8fafc; display: flex; justify-content: flex-end; gap: .6rem; }
.modal-footer .kt-btn { min-width: 110px; }

/* Cabecalho da modal: garantir botao fechar visivel */
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid rgba(226, 232, 240, .8); background: #fff; }
.modal-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: transparent; border: none; border-radius: 8px; color: #64748b; cursor: pointer; }
.modal-close:hover { background: #f1f5f9; color: #0f172a; }
.modal-close .material-symbols-outlined { font-size: 1.25rem; }

/* ── Layout compacto 15" (1366px) ──────────────────────────────── */
@media (max-width: 1520px) {
    .alunos-table { min-width: 550px; font-size: 0.82rem; }
    .alunos-table th { padding: .45rem .5rem; font-size: .78rem; }
    .alunos-table td { padding: .4rem .5rem; }
    .al-table { font-size: .82rem; }
    .al-table th { padding: .4rem .55rem; font-size: .72rem; }
    .al-table td { padding: .4rem .55rem; }
    .al-table-compact th,
    .al-table-compact td { padding: .35rem .5rem; }
    .boletim-table { font-size: .8rem; }
    .boletim-table th { padding: .35rem .4rem; font-size: .7rem; }
    .boletim-table td { padding: .3rem .4rem; }
}

.rh-btn-sm { font-size: .75rem !important; padding: .2rem .6rem !important; }
.rh-panel { padding: .75rem; margin-bottom: .75rem; }
.rh-section-title { font-size: .85rem; margin: 0 0 .5rem; }
.rh-filter-bar { display: flex; gap: .4rem; align-items: end; flex-wrap: wrap; }
.rh-counter { font-size: .75rem; color: #64748b; }

.rh-table { font-size: .78rem !important; }
.rh-table th { font-size: .72rem !important; padding: .35rem .4rem !important; white-space: nowrap; }
.rh-table td { padding: .3rem .4rem !important; }
.rh-num { text-align: right; white-space: nowrap; }

.rh-paginacao { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; padding-top: .5rem; border-top: 1px solid #e2e8f0; }
.rh-paginacao-info { font-size: .75rem; color: #64748b; }
.rh-paginacao-botoes { display: flex; align-items: center; gap: .3rem; }
.rh-pagina-num { font-size: .8rem; font-weight: 600; min-width: 1.5rem; text-align: center; }

/* ── Alunos page wrapper ──────────────────────────────── */
.alunos-page { padding: 0 12px; }

/* ── Layout compacto 10-12" (1024-1280px) ─────────────── */
@media (max-width: 1280px) {
    .alunos-page { padding: 0 8px; }
    .page-header { padding: 1.25rem 1.25rem .75rem; gap: .75rem; }
    .page-header h1 { font-size: 1.3rem; }
    .page-header p { font-size: .82rem; }
    .page-actions { gap: .4rem; }
    .page-actions .qs-btn { font-size: .78rem; padding: .35rem .7rem; }

    .rh-panel { padding: .5rem; margin-bottom: .5rem; }
    .rh-filter-bar { gap: .3rem; }
    .rh-filter-bar .form-label { font-size: .68rem; }
    .rh-filter-bar .form-input { font-size: .75rem; padding: .3rem .5rem; }

    .alunos-table { min-width: 600px; font-size: .78rem; border-radius: 10px; }
    .alunos-table th { padding: .4rem .35rem; font-size: .72rem; }
    .alunos-table td { padding: .35rem .35rem; }
    .aluno-nome { gap: .3rem; }
    .aluno-nome span:not(.avatar-mini) { font-size: .78rem; }
    .avatar-mini { width: 24px; height: 24px; font-size: .78rem; }
    .badge { font-size: .65rem; padding: .12rem .4rem; }

    .hide-sm { display: none; }

    .rh-paginacao { padding: .3rem 0; }
    .rh-paginacao-info { font-size: .68rem; }
}

/* ── Layout ultra-compacto <10" ───────────────────────── */
@media (max-width: 1024px) {
    .alunos-table { min-width: 550px; font-size: .75rem; }
    .alunos-table th { padding: .35rem .3rem; font-size: .7rem; }
    .alunos-table td { padding: .3rem .3rem; }
    .avatar-mini { width: 22px; height: 22px; font-size: .7rem; }
    .page-header { padding: 1rem .75rem .5rem; }
    .page-header h1 { font-size: 1.1rem; }
    .page-actions .qs-btn { font-size: .72rem; padding: .3rem .55rem; }
}

@media (max-width: 900px) {
    .alunos-table { min-width: 480px; font-size: .72rem; }
    .alunos-table th { padding: .3rem .25rem; font-size: .68rem; }
    .alunos-table td { padding: .25rem .25rem; }
    .avatar-mini { width: 20px; height: 20px; font-size: .65rem; }
}

.rh-cards-row { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.rh-card { flex: 1; min-width: 130px; text-align: center; background: #fff; border-radius: 6px; padding: .5rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.rh-card-label { font-size: .7rem; color: #64748b; text-transform: uppercase; letter-spacing: .03em; }
.rh-card-value { font-size: 1.1rem; font-weight: 700; }

.rh-checklist { max-height: 180px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: .3rem; margin-bottom: .5rem; }
.rh-checklist-item { display: flex; align-items: center; gap: .4rem; padding: .2rem .25rem; font-size: .78rem; cursor: pointer; border-radius: 4px; }
.rh-checklist-item.selected { background: #eff6ff; }
.rh-checklist-item .rh-muted { color: #94a3b8; font-size: .7rem; margin-left: auto; }

/* ── Modal Upgrade de Plano ──────────────────────────────── */
.modal-overlay-upgrade {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-container-upgrade {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header-upgrade {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header-upgrade h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.modal-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: #64748b;
}

.modal-close-upgrade {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 8px;
    color: #64748b;
    transition: background 0.15s;
}

.modal-close-upgrade:hover {
    background: #f1f5f9;
}

.modal-body-upgrade {
    padding: 1.25rem 1.5rem;
}

.upgrade-passo {
    display: grid;
    gap: 1rem;
}

.upgrade-alerta-expirado {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    color: #9a3412;
    font-size: 0.88rem;
}

.upgrade-alerta-expirado .material-symbols-outlined {
    font-size: 1.2rem;
    color: #f59e0b;
}

.upgrade-info-actual {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #475569;
}

.upgrade-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.upgrade-planos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.upgrade-plano-card {
    display: grid;
    gap: 0.25rem;
    padding: 1rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.upgrade-plano-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.upgrade-plano-card.selecionado {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.upgrade-plano-nome {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.upgrade-plano-nivel {
    font-size: 0.75rem;
    color: #64748b;
}

.upgrade-plano-preco {
    font-size: 0.78rem;
    color: #3b82f6;
    font-weight: 600;
    margin-top: 0.25rem;
}

.upgrade-ciclos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.upgrade-ciclo-btn {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.upgrade-ciclo-btn:hover {
    border-color: #93c5fd;
}

.upgrade-ciclo-btn.selecionado {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.upgrade-ciclo-descricao {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
}

.upgrade-ciclo-valor {
    font-size: 0.85rem;
    font-weight: 700;
    color: #3b82f6;
}

.upgrade-ciclo-mensal {
    font-size: 0.72rem;
    color: #64748b;
}

.upgrade-metodos-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.upgrade-metodo-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.5rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.upgrade-metodo-tab .material-symbols-outlined {
    font-size: 1.3rem;
}

.upgrade-metodo-tab:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.upgrade-metodo-tab.ativo {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
}

.upgrade-metodo-conteudo {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.upgrade-metodo-iban,
.upgrade-metodo-referencia,
.upgrade-metodo-express {
    display: grid;
    gap: 0.75rem;
}

.upgrade-dado-pagamento {
    display: grid;
    gap: 0.15rem;
}

.upgrade-dado-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.upgrade-dado-valor {
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 500;
}

.upgrade-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.05em;
}

.upgrade-destaque {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d4ed8;
}

.upgrade-instrucao {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.upgrade-input-grupo {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.upgrade-input-grupo:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.upgrade-input-prefixo {
    padding: 0.65rem 0.75rem;
    background: #f1f5f9;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    border-right: 1px solid #e2e8f0;
}

.upgrade-input {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.08em;
}

.upgrade-input::placeholder {
    color: #94a3b8;
    font-family: inherit;
    letter-spacing: 0.05em;
}

.upgrade-input-erro {
    color: #dc2626;
}

.upgrade-erro-msg {
    font-size: 0.78rem;
    color: #dc2626;
}

.upgrade-resumo-box {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: grid;
    gap: 0.5rem;
}

.upgrade-resumo-box h4 {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.upgrade-resumo-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
}

.upgrade-resumo-label {
    color: #64748b;
}

.upgrade-resumo-valor {
    font-weight: 600;
    color: #0f172a;
}

.upgrade-resumo-total {
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.upgrade-resumo-total .upgrade-resumo-valor {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d4ed8;
}

.upgrade-resumo-ref-mensal {
    font-size: 0.78rem;
    color: #64748b;
    text-align: right;
}

.upgrade-pagamento-resumo {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: grid;
    gap: 0.5rem;
}

.upgrade-pagamento-resumo h4 {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.upgrade-mensagem-suporte {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #1e40af;
    line-height: 1.5;
}

.upgrade-mensagem-suporte .material-symbols-outlined {
    font-size: 1.1rem;
    color: #3b82f6;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.upgrade-passo-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.upgrade-btn-finalizar {
    min-width: 200px;
}

.upgrade-sem-planos {
    padding: 1.5rem;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.35rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Mobile 440–480px — Financeiro ─────────────────────────── */
@media (max-width: 480px) {

    /* ── Page header: empilhar verticalmente ── */
    .page-header {
        flex-direction: column;
        padding: 1rem 0.75rem 0.5rem;
        gap: .5rem;
    }
    .page-header h1 { font-size: 1.1rem; }
    .page-header p  { font-size: .8rem; }
    .page-actions   { width: 100%; display: flex; gap: .4rem; }
    .page-actions .qs-btn,
    .page-actions .kt-btn { flex: 1; justify-content: center; min-width: 0; font-size: .78rem; padding: .45rem .6rem; }

    /* ── Filtros / panel-card: empilhar ── */
    .panel-card > div[style*="flex"] { flex-direction: column !important; gap: .6rem !important; }
    .panel-card .form-input { max-width: 100% !important; width: 100%; }
    .panel-card .form-label { margin-bottom: .15rem; }

    /* ── Tabelas → layout cartão ── */
    .alunos-table,
    .al-table {
        min-width: 0 !important;
        width: 100%;
        display: block;
        border-radius: 12px;
        overflow: hidden;
    }
    .alunos-table thead,
    .al-table thead { display: none; }

    .alunos-table tbody,
    .al-table tbody {
        display: flex;
        flex-direction: column;
        gap: .5rem;
        padding: .5rem;
        background: transparent;
    }

    .alunos-table tr,
    .al-table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 10px;
        padding: .65rem .75rem;
        box-shadow: 0 1px 4px rgba(0,0,0,.06);
        border: 1px solid #eef2f7;
    }

    .alunos-table td,
    .al-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: .3rem 0;
        border: none;
        font-size: .82rem;
        gap: .5rem;
    }

    .alunos-table td::before,
    .al-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .03em;
        flex-shrink: 0;
        min-width: 35%;
    }

    /* Coluna de acções: separador visual no fundo */
    .alunos-table td.al-actions-col,
    .al-table td.al-actions-col {
        justify-content: flex-end !important;
        padding-top: .4rem !important;
        margin-top: .15rem;
        border-top: 1px solid #eef2f7;
    }
    .alunos-table td.al-actions-col::before,
    .al-table td.al-actions-col::before { display: none; }

    /* ── Paginação ── */
    .alunos-table-footer {
        flex-direction: column;
        gap: .4rem;
        text-align: center;
        padding: .6rem .5rem .2rem;
    }
    .alunos-table-paginacao { justify-content: center; }

    /* ── Totais card (AlunosComDividas) ── */
    .totais-grid { grid-template-columns: 1fr !important; }
    .totais-cell + .totais-cell { border-left: 0 !important; border-top: 1px solid #eef2f7; }
    .totais-head { flex-direction: column; align-items: flex-start; gap: .4rem; }
    .totais-head-actions { width: 100%; flex-wrap: wrap; gap: .4rem; }

    /* ── Relatórios: rf-acoes / rf-head ── */
    .rf-acoes { grid-template-columns: 1fr !important; }
    .rf-head { flex-direction: column; align-items: flex-start; gap: .4rem; }
    .rf-head-actions { width: 100%; }
    .rf-detalhe { grid-template-columns: 1fr !important; }

    /* ── Modal: ajustar para 440px ── */
    .modal-container {
        max-width: calc(100vw - 1rem);
        margin: 0 .5rem;
        border-radius: 12px;
    }
    .modal-box {
        max-width: calc(100vw - 1rem);
        margin: 0 .5rem;
        border-radius: 12px;
    }
    .modal-header { padding: .85rem 1rem; }
    .modal-header h3,
    .modal-header h2 { font-size: .95rem; }
    .modal-body   { padding: 1rem; }
    .modal-footer { padding: .75rem 1rem; flex-wrap: wrap; gap: .4rem; }
    .modal-footer .qs-btn,
    .modal-footer .kt-btn { flex: 1; min-width: 0; justify-content: center; font-size: .8rem; }

    /* ── EmitirDocumento: flex com % → empilhar ── */
    .flex.gap-6.flex-1 { flex-direction: column !important; overflow-y: auto !important; }
    .flex.gap-6.flex-1 > aside { width: 100% !important; max-height: none !important; border-left: none !important; border-top: 1px solid #e2e8f0; }
    .flex.gap-3.mt-3 { flex-direction: column !important; gap: .6rem !important; }
    .flex.gap-3.mt-3 > div { width: 100% !important; flex: none !important; min-width: 0 !important; }
    footer.flex.justify-between { flex-wrap: wrap; gap: .5rem; justify-content: center !important; }
    footer.flex.justify-between > div { width: 100%; justify-content: center; display: flex; flex-wrap: wrap; gap: .4rem; }

    /* ── Empty state ── */
    .empty-state { padding: 1.5rem 1rem; }
    .empty-state p { font-size: .85rem; }

    /* ── Toast ── */
    .toast-sucesso { left: .5rem; right: .5rem; bottom: .5rem; font-size: .8rem; }

    /* ── Upgrade modal (existente) ── */
    .modal-container-upgrade { max-width: 100%; margin: 0.5rem; }
    .upgrade-planos-grid { grid-template-columns: 1fr 1fr; }
    .upgrade-ciclos { grid-template-columns: 1fr 1fr; }
    .upgrade-metodos-tabs { grid-template-columns: 1fr; }

    /* ════════════════════════════════════════════════════════
       TOPBAR MOBILE
       ════════════════════════════════════════════════════════ */
    .topbar {
        padding: .45rem .75rem;
        gap: .5rem;
    }
    .topbar-left {
        gap: .4rem;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .topbar-divider { display: none; }
    .topbar-meta { display: none; }
    .topbar-title {
        font-size: .78rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }
    .topbar-actions {
        gap: .35rem;
    }
    .topbar-link { display: none; }
    .topbar-subscricao-btn {
        font-size: 0;
        padding: 0.25rem;
    }
    .topbar-subscricao-btn .material-symbols-outlined {
        font-size: 1.1rem;
    }
    .icon-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    .icon-button .material-symbols-outlined { font-size: 1.15rem; }
    .profile-identidade { display: none; }
    .profile-button {
        padding: .3rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    .profile-button .material-symbols-outlined { font-size: 1.1rem; }
    .avatar {
        width: 30px;
        height: 30px;
        font-size: .7rem;
    }

    /* ════════════════════════════════════════════════════════
       DASHBOARD MOBILE
       ════════════════════════════════════════════════════════ */

    /* Header: empilhar */
    .dashboard-header {
        flex-direction: column !important;
        gap: .5rem;
        padding: .75rem !important;
    }
    .dashboard-header-right {
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Grid principal: 1 coluna */
    .dashboard-main-grid {
        grid-template-columns: 1fr !important;
    }

    /* 4 métricas: manter 2×2 mas com gap menor */
    .dashboard-metrics {
        gap: .5rem !important;
    }

    /* Cards de métricas: padding e fontes */
    .dashboard-metric-card {
        padding: .75rem !important;
    }
    .dashboard-metric-card .text-2xl,
    .dashboard-metric-card [class*="text-2xl"] {
        font-size: 1.1rem;
    }

    /* Contexto decisões: 1 coluna */
    .dashboard-decisoes {
        grid-template-columns: 1fr !important;
    }

    /* Sidebar direita: 1 coluna */
    .dashboard-sidebar {
        grid-column: span 1 !important;
    }

    /* Gráfico saúde financeira: altura reduzida */
    .dashboard-chart {
        height: 120px !important;
    }

    /* Barras de progresso: mais grossas para legibilidade */
    .dashboard-progress {
        height: 8px !important;
    }

    /* Labels e valores: tamanhos mínimos legíveis */
    .dashboard-label {
        font-size: .6rem;
    }
    .dashboard-value {
        font-size: 1.1rem;
    }
}
