:root {
    --portal-info: #2563eb;
    --portal-success: #059669;
    --portal-warning: #d97706;
    --portal-danger: #dc2626;
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.page-subtitle {
    margin-top: 8px;
    color: #475569;
}

.portal-auth-wide {
    max-width: 580px;
}

.portal-auth-linkbox {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.portal-auth-linkbox p {
    color: #64748b;
    font-size: 0.94rem;
}

.portal-auth-linkbox a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}

.portal-auth-helper {
    margin-top: 10px;
    font-size: 0.82rem;
}

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

.portal-register-grid .btn-login {
    grid-column: 1 / -1;
}

.portal-input-plain {
    padding: 12px 16px;
}

.portal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.portal-stat-card {
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 244, 251, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.portal-stat-card strong {
    display: block;
    margin: 8px 0 10px;
    font-size: 2.2rem;
    line-height: 1;
    color: #0f172a;
}

.portal-stat-card p {
    margin: 0;
    color: #64748b;
}

.portal-stat-kicker,
.portal-card-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1d4ed8;
}

.portal-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.portal-admin-actions {
    margin-bottom: 16px;
}

.portal-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.portal-dashboard-single {
    display: block;
    max-width: 1480px;
    margin: 0 auto;
}

.portal-status-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 0;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.portal-status-row h2 {
    margin: 8px 0 0;
    color: #0f172a;
}

.portal-status-pill {
    padding: 8px 14px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.portal-summary-list {
    display: grid;
    gap: 12px;
    color: #334155;
}

.portal-summary-list strong {
    color: #0f172a;
}

.portal-student-dashboard-card .card-body {
    display: grid;
    gap: 24px;
    padding: 30px 32px;
}

.portal-student-dashboard-card {
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.94));
    box-shadow: 0 26px 44px rgba(15, 23, 42, 0.08);
}

.portal-student-card-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: start;
}

.portal-student-profile {
    padding: 24px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 244, 251, 0.94));
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.portal-student-panel-title {
    margin: 10px 0 18px;
    color: #0f172a;
    font-size: 1.45rem;
    line-height: 1.15;
}

.portal-summary-board {
    gap: 14px;
}

.portal-summary-board > div {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.portal-student-books {
    display: grid;
    gap: 14px;
}

.portal-student-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.portal-student-books-count {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.portal-student-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.portal-student-book-item {
    padding: 20px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.06);
}

.portal-book-card-shell .card-body {
    height: 100%;
}

.portal-book-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
    margin-top: 18px;
}

.portal-book-card-compact {
    margin-top: 0;
    grid-template-columns: 152px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}

.portal-book-cover {
    width: 100%;
    max-width: 180px;
    border-radius: 22px;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.16);
}

.portal-book-cover-large {
    max-width: 240px;
    margin: 18px 0;
}

.portal-book-copy h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.7rem;
    line-height: 1.08;
}

.portal-book-copy p {
    color: #64748b;
}

.portal-book-copy {
    display: grid;
    gap: 16px;
    align-content: start;
}

.portal-book-actions {
    margin-top: 0;
}

.portal-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.portal-check-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    color: #334155;
    cursor: pointer;
}

.portal-check-card input {
    flex: 0 0 auto;
}

.portal-check-card span {
    font-weight: 600;
}

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

.portal-inline-form {
    display: flex;
    gap: 8px;
    flex: 1 1 320px;
}

.portal-filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.portal-muted {
    color: #64748b;
    font-size: 0.86rem;
}

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

.portal-grid-span {
    grid-column: 1 / -1;
}

.portal-form-actions {
    display: flex;
    justify-content: flex-start;
}

.portal-section-title {
    margin: 0;
    color: #0f172a;
}

.portal-reader-meta {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(59, 130, 246, 0.16);
    color: #1e293b;
    font-size: 0.84rem;
    font-weight: 600;
}

.student-protection-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    z-index: 9999;
    width: min(92vw, 520px);
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #f8fafc;
    font-size: 0.94rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.student-protection-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.is-student-protection-blocked {
    filter: blur(18px) grayscale(0.55);
    user-select: none;
    pointer-events: none;
}

body[data-user-role="aluno"] .reader-screen.reader-view-aluno,
body[data-user-role="aluno"] .portal-dashboard-single {
    -webkit-user-select: none;
    user-select: none;
}

@media print {
    body[data-user-role="aluno"] .navbar,
    body[data-user-role="aluno"] .main-content,
    body[data-user-role="aluno"] .footer {
        display: none !important;
    }

    body[data-user-role="aluno"]::before {
        content: "Impressao bloqueada para o portal do aluno.";
        display: block;
        padding: 56px 36px;
        color: #0f172a;
        font-family: "Segoe UI", Arial, sans-serif;
        font-size: 28px;
        font-weight: 800;
        text-align: center;
    }
}

.reader-color-input {
    width: 40px;
    min-height: 38px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(11, 61, 145, 0.24);
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.reader-range-input {
    width: 110px;
}

.reader-note-textarea {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.98);
    resize: vertical;
    font: inherit;
    color: #0f172a;
}

.reader-note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.reader-search-clear {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.portal-auth-linkbox strong {
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-toolbar-top {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    width: min(100%, 1480px);
    max-width: min(100%, 1480px);
    gap: 8px;
    margin: 0 auto 8px;
    padding: 7px 10px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 245, 249, 0.95));
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
    color: #0f172a;
    overflow: visible;
}

.reader-screen.reader-view-aluno .reader-page-status-card {
    order: 1;
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 36px;
    padding: 0 10px;
    align-items: flex-start;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.14);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.reader-screen.reader-view-aluno .reader-page-status-label {
    font-size: 0.64rem;
    color: #64748b;
}

.reader-screen.reader-view-aluno #pageStatus {
    max-width: 168px;
    font-size: 0.78rem;
    color: #0f172a;
    text-align: left;
}

.reader-screen.reader-view-aluno .reader-search-form,
.reader-screen.reader-view-aluno .reader-search-form:focus-within {
    order: 3;
    flex: 0 0 clamp(190px, 19vw, 250px);
    width: clamp(190px, 19vw, 250px);
    min-width: 170px;
    margin-left: auto;
    padding: 2px 4px;
    border-radius: 13px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.reader-screen.reader-view-aluno .reader-search-form:focus-within {
    width: clamp(210px, 20vw, 270px);
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.reader-screen.reader-view-aluno .reader-search-input {
    height: 28px;
    padding: 0 26px 0 10px;
    font-size: 0.74rem;
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-search-input::placeholder {
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-search-clear {
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-tools {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
}

.reader-screen.reader-view-aluno .reader-tools-right,
.reader-screen.reader-view-aluno .reader-tools-right.is-docked-top {
    width: auto;
    max-width: none;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding-top: 0;
    border-top: 0;
}

.reader-screen.reader-view-aluno .reader-toolbar .btn,
.reader-screen.reader-view-aluno .reader-tool-icon {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 0.74rem;
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.reader-screen.reader-view-aluno .reader-toolbar .btn:hover,
.reader-screen.reader-view-aluno .reader-tool-icon:hover:not(.is-active) {
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
    border-color: rgba(59, 130, 246, 0.28);
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-tool-icon.is-active,
.reader-screen.reader-view-aluno .reader-tool.is-active {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-color: rgba(59, 130, 246, 0.34);
    color: #fff;
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.reader-screen.reader-view-aluno #clearPage {
    background: linear-gradient(180deg, #fee2e2, #fff1f2);
    border-color: rgba(248, 113, 113, 0.32);
    color: #b91c1c;
}

.reader-screen.reader-view-aluno #clearPage:hover {
    background: linear-gradient(180deg, #fecaca, #ffe4e6);
    color: #991b1b;
}

.reader-screen.reader-view-aluno .portal-tool-meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.reader-screen.reader-view-aluno .portal-tool-meta span {
    font-size: 0.66rem;
    font-weight: 700;
    color: #475569;
}

.reader-screen.reader-view-aluno .portal-tool-meta .reader-color-input {
    width: 28px;
    min-height: 28px;
    border-color: rgba(148, 163, 184, 0.25);
    background: transparent;
    box-shadow: none;
}

.reader-screen.reader-view-aluno .portal-tool-meta-range {
    padding-right: 8px;
}

.reader-screen.reader-view-aluno .portal-tool-meta-range .reader-range-input {
    width: 68px;
}

.reader-screen.reader-view-aluno .reader-shell {
    width: min(100%, 1360px);
    margin: 0 auto;
    gap: 14px;
}

.reader-screen.reader-view-aluno .flipbook-stage {
    min-height: clamp(470px, 66vh, 820px);
    border-radius: 0;
    box-shadow: 0 26px 48px rgba(15, 23, 42, 0.1);
}

.reader-screen.reader-view-aluno .reader-stage-nav {
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.88);
}

.reader-screen.reader-view-aluno .reader-progress-wrap {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: min(54%, 460px);
    margin: 10px auto 0;
    z-index: 2;
}

.reader-screen.reader-view-aluno {
    --aluno-dark-bg-top: #07101d;
    --aluno-dark-bg-bottom: #0f172a;
    --aluno-dark-panel: rgba(8, 13, 19, 0.9);
    --aluno-dark-panel-soft: rgba(15, 23, 42, 0.82);
    --aluno-dark-panel-strong: rgba(15, 23, 42, 0.96);
    --aluno-dark-border: rgba(148, 163, 184, 0.2);
    --aluno-dark-text: #e2e8f0;
    --aluno-dark-muted: #94a3b8;
    --aluno-dark-accent: #60a5fa;
    --aluno-dark-accent-strong: #2563eb;
    position: relative;
    isolation: isolate;
    color: var(--aluno-dark-text);
}

.reader-screen.reader-view-aluno::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 34px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.24), transparent 34%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.16), transparent 28%),
        linear-gradient(180deg, var(--aluno-dark-bg-top), var(--aluno-dark-bg-bottom));
}

.reader-screen.reader-view-aluno .reader-topbar {
    border-color: rgba(96, 165, 250, 0.16);
    background: linear-gradient(180deg, rgba(8, 13, 19, 0.96), rgba(15, 23, 42, 0.9));
    box-shadow: 0 24px 48px rgba(2, 6, 23, 0.28);
}

.reader-screen.reader-view-aluno .reader-topbar-kicker {
    color: #93c5fd;
}

.reader-screen.reader-view-aluno .reader-topbar-title {
    color: #f8fafc;
}

.reader-screen.reader-view-aluno .reader-topbar-main {
    flex: 1 1 auto;
    max-width: min(100%, 760px);
}

.reader-screen.reader-view-aluno .reader-topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
}

.reader-screen.reader-view-aluno .reader-topbar-menu-student {
    width: auto;
    max-width: min(62vw, 840px);
    margin-left: auto;
    justify-content: flex-end;
    row-gap: 8px;
}

.reader-screen.reader-view-aluno .reader-back-link {
    border-color: rgba(96, 165, 250, 0.2);
    background: rgba(15, 23, 42, 0.9);
    color: #dbeafe;
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
}

.reader-screen.reader-view-aluno .reader-back-link:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.32), rgba(14, 165, 233, 0.2));
    color: #ffffff;
}

.reader-screen.reader-view-aluno .reader-topbar-actions .btn {
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(96, 165, 250, 0.22);
    color: #e2e8f0;
    box-shadow: 0 14px 24px rgba(2, 6, 23, 0.18);
}

.reader-screen.reader-view-aluno .reader-topbar-actions .btn:hover {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.9), rgba(29, 78, 216, 0.92));
    border-color: rgba(147, 197, 253, 0.3);
    color: #ffffff;
}

.reader-screen.reader-view-aluno .portal-reader-meta {
    background: rgba(15, 23, 42, 0.84);
    border-color: rgba(96, 165, 250, 0.18);
    color: #dbeafe;
}

.reader-screen.reader-view-aluno .portal-reader-meta-student-name {
    color: #f8fafc;
    font-weight: 800;
}

.reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"] {
    padding: 0 10px 0;
    background: transparent;
}

.reader-screen.reader-view-aluno .reader-toolbar-top {
    border-color: rgba(96, 165, 250, 0.12);
    background:
        linear-gradient(180deg, rgba(8, 13, 19, 0.96), rgba(15, 23, 42, 0.92));
    box-shadow: 0 24px 44px rgba(2, 6, 23, 0.24);
    color: var(--aluno-dark-text);
}

.reader-screen.reader-view-aluno .reader-page-status-card {
    border-color: rgba(96, 165, 250, 0.14);
    background: rgba(15, 23, 42, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.reader-screen.reader-view-aluno .reader-page-status-label {
    color: var(--aluno-dark-muted);
}

.reader-screen.reader-view-aluno #pageStatus {
    color: #f8fafc;
}

.reader-screen.reader-view-aluno .reader-search-form,
.reader-screen.reader-view-aluno .reader-search-form:focus-within {
    border-color: rgba(96, 165, 250, 0.14);
    background: rgba(15, 23, 42, 0.88);
    box-shadow: 0 14px 24px rgba(2, 6, 23, 0.18);
}

.reader-screen.reader-view-aluno .reader-search-form:focus-within {
    border-color: rgba(96, 165, 250, 0.32);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.reader-screen.reader-view-aluno .reader-search-icon-inline {
    color: var(--aluno-dark-accent);
}

.reader-screen.reader-view-aluno .reader-search-input {
    color: #f8fafc;
}

.reader-screen.reader-view-aluno .reader-search-input::placeholder {
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-search-clear {
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-tools-right,
.reader-screen.reader-view-aluno .reader-tools-right.is-docked-top {
    border-top-color: rgba(51, 65, 85, 0.95);
}

.reader-screen.reader-view-aluno .reader-toolbar .btn,
.reader-screen.reader-view-aluno .reader-tool-icon {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
    color: var(--aluno-dark-text);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 12px 20px rgba(2, 6, 23, 0.2);
}

.reader-screen.reader-view-aluno .reader-toolbar .btn:hover,
.reader-screen.reader-view-aluno .reader-tool-icon:hover:not(.is-active) {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.24), rgba(15, 23, 42, 0.98));
    border-color: rgba(96, 165, 250, 0.34);
    color: #ffffff;
}

.reader-screen.reader-view-aluno .reader-tool-icon.is-active,
.reader-screen.reader-view-aluno .reader-tool.is-active {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-color: rgba(147, 197, 253, 0.34);
    color: #ffffff;
    box-shadow: 0 18px 28px rgba(37, 99, 235, 0.28);
}

.reader-screen.reader-view-aluno #clearPage {
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.96), rgba(69, 10, 10, 0.96));
    border-color: rgba(248, 113, 113, 0.22);
    color: #fecaca;
}

.reader-screen.reader-view-aluno #clearPage:hover {
    background: linear-gradient(180deg, rgba(153, 27, 27, 0.96), rgba(69, 10, 10, 0.98));
    color: #ffffff;
}

.reader-screen.reader-view-aluno .portal-tool-meta {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 12px 20px rgba(2, 6, 23, 0.18);
}

.reader-screen.reader-view-aluno .portal-tool-meta span {
    color: #cbd5e1;
}

.reader-screen.reader-view-aluno .portal-tool-meta .reader-color-input {
    border-color: rgba(148, 163, 184, 0.2);
}

.reader-screen.reader-view-aluno .reader-thumbnails {
    border-color: var(--aluno-dark-border);
    background: rgba(8, 13, 19, 0.82);
    box-shadow: 0 26px 46px rgba(2, 6, 23, 0.24);
}

.reader-screen.reader-view-aluno .reader-thumbnails-kicker,
.reader-screen.reader-view-aluno .reader-thumbnail-physical,
.reader-screen.reader-view-aluno .reader-search-panel-kicker {
    color: var(--aluno-dark-muted);
}

.reader-screen.reader-view-aluno .reader-thumbnails-title,
.reader-screen.reader-view-aluno .reader-thumbnail-label,
.reader-screen.reader-view-aluno .reader-search-panel-title {
    color: #f8fafc;
}

.reader-screen.reader-view-aluno .reader-thumbnails-toggle {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

.reader-screen.reader-view-aluno .reader-thumbnails-empty {
    border-color: rgba(96, 165, 250, 0.18);
    background: rgba(15, 23, 42, 0.76);
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-thumbnail {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.84);
}

.reader-screen.reader-view-aluno .reader-thumbnail:hover {
    border-color: rgba(96, 165, 250, 0.32);
    box-shadow: 0 16px 28px rgba(2, 6, 23, 0.24);
}

.reader-screen.reader-view-aluno .reader-thumbnail.is-visible {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

.reader-screen.reader-view-aluno .reader-thumbnail.is-active {
    border-color: rgba(96, 165, 250, 0.44);
    background: linear-gradient(180deg, rgba(30, 64, 175, 0.42), rgba(15, 23, 42, 0.92));
    box-shadow: 0 18px 28px rgba(2, 6, 23, 0.28);
}

.reader-screen.reader-view-aluno .reader-thumbnail-canvas-wrap {
    border-color: rgba(51, 65, 85, 0.96);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(8, 13, 19, 0.98));
}

.reader-screen.reader-view-aluno .reader-search-panel {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(8, 13, 19, 0.95);
    box-shadow: 0 24px 44px rgba(2, 6, 23, 0.3);
}

.reader-screen.reader-view-aluno .reader-search-status,
.reader-screen.reader-view-aluno .reader-search-results {
    color: #cbd5e1;
}

.reader-screen.reader-view-aluno .reader-search-panel-close {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(148, 163, 184, 0.22);
    color: #f8fafc;
}

.reader-screen.reader-view-aluno .flipbook-stage {
    border-color: rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 13, 19, 0.98));
    border-radius: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 30px 56px rgba(2, 6, 23, 0.3);
}

.reader-screen.reader-view-aluno .flipbook,
.reader-screen.reader-view-aluno .reader-turn-page,
.reader-screen.reader-view-aluno .reader-turn-page .reader-turn-page-surface {
    border-radius: 0 !important;
}

.reader-screen.reader-view-aluno .reader-stage-nav {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    box-shadow: 0 14px 26px rgba(2, 6, 23, 0.22);
}

.reader-screen.reader-view-aluno .reader-stage-nav:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.34), rgba(14, 165, 233, 0.2));
    box-shadow: 0 18px 30px rgba(2, 6, 23, 0.28);
}

.reader-screen.reader-view-aluno .reader-progress-wrap {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(8, 13, 19, 0.74);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: 0 16px 28px rgba(2, 6, 23, 0.24);
}

.reader-screen.reader-view-aluno .reader-progress-input {
    height: 6px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.42), rgba(255, 255, 255, 0.14));
}

.reader-screen.reader-view-aluno .reader-progress-input::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.96);
    background: linear-gradient(180deg, #f8fafc, #bfdbfe);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.28);
}

.reader-screen.reader-view-aluno .reader-progress-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.96);
    background: linear-gradient(180deg, #f8fafc, #bfdbfe);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.28);
}

.reader-screen.reader-view-aluno .reader-zoom-stack {
    top: 14px;
    right: 14px;
    bottom: auto;
    gap: 6px;
}

.reader-screen.reader-view-aluno .reader-main {
    gap: 10px;
    overflow: visible;
}

.reader-screen.reader-view-aluno .reader-zoom-btn {
    width: 36px;
    height: 36px;
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(8, 13, 19, 0.9);
    color: #f8fafc;
    font-size: 19px;
}

.reader-screen.reader-view-aluno .reader-zoom-btn:hover {
    background: rgba(15, 23, 42, 0.98);
}

.reader-screen.reader-view-aluno .reader-note-modal {
    align-items: center;
    padding: 20px 14px;
}

.reader-screen.reader-view-aluno .reader-note-modal-backdrop {
    background: rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(6px);
}

.reader-screen.reader-view-aluno .reader-note-modal-dialog {
    position: relative;
    width: min(430px, calc(100% - 28px));
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.98));
    box-shadow: 0 30px 54px rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-note-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.reader-screen.reader-view-aluno .reader-note-modal-kicker {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.reader-screen.reader-view-aluno .reader-note-modal-head h2 {
    margin: 10px 0 0;
    font-size: 1.18rem;
    line-height: 1.12;
    font-weight: 800;
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-note-modal-copy {
    margin: 8px 0 0;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.45;
}

.reader-screen.reader-view-aluno .reader-note-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.reader-screen.reader-view-aluno .reader-note-modal-close:hover {
    background: #eff6ff;
    color: #0f172a;
    transform: translateY(-1px);
}

.reader-screen.reader-view-aluno .reader-note-textarea {
    min-height: 152px;
    padding: 14px 15px;
    border-radius: 16px;
    border-color: rgba(148, 163, 184, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    color: #0f172a;
    font-size: 0.94rem;
    line-height: 1.55;
}

.reader-screen.reader-view-aluno .reader-note-textarea::placeholder {
    color: #94a3b8;
}

.reader-screen.reader-view-aluno .reader-note-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.reader-screen.reader-view-aluno .reader-note-modal-helper {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.4;
}

.reader-screen.reader-view-aluno .reader-note-modal-buttons {
    display: inline-flex;
    gap: 10px;
}

.reader-screen.reader-view-aluno .reader-note-modal-buttons .btn {
    min-width: 132px;
    min-height: 42px;
    border-radius: 14px;
}

.reader-screen.reader-view-aluno .reader-favorites-modal {
    position: absolute;
    inset: 0;
    z-index: 520;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px 14px;
}

.reader-screen.reader-view-aluno .reader-favorites-modal.is-open {
    display: flex;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(6px);
}

.reader-screen.reader-view-aluno .reader-favorites-modal-dialog {
    position: relative;
    width: min(460px, calc(100% - 28px));
    max-height: min(78vh, 620px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.98));
    box-shadow: 0 30px 54px rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-kicker {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-heading h2 {
    margin: 10px 0 0;
    font-size: 1.18rem;
    line-height: 1.12;
    font-weight: 800;
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-copy {
    margin: 8px 0 0;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.45;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.reader-screen.reader-view-aluno .reader-favorites-list {
    display: grid;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.reader-screen.reader-view-aluno .reader-favorites-empty {
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.34);
    background: rgba(248, 250, 252, 0.96);
    color: #64748b;
    text-align: center;
    font-size: 0.9rem;
}

.reader-screen.reader-view-aluno .reader-favorites-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.reader-screen.reader-view-aluno .reader-favorites-entry:hover {
    border-color: rgba(59, 130, 246, 0.32);
    background: #eff6ff;
    box-shadow: 0 12px 22px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

.reader-screen.reader-view-aluno .reader-favorites-entry.is-current {
    border-color: rgba(37, 99, 235, 0.34);
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.94), rgba(239, 246, 255, 0.98));
}

.reader-screen.reader-view-aluno .reader-favorites-entry-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.reader-screen.reader-view-aluno .reader-favorites-entry-label {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
}

.reader-screen.reader-view-aluno .reader-favorites-entry-caption {
    font-size: 0.78rem;
    color: #64748b;
}

.reader-screen.reader-view-aluno .reader-favorites-entry-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-size: 0.74rem;
    font-weight: 800;
}

.reader-screen.reader-view-aluno .reader-favorites-modal-actions {
    display: flex;
    justify-content: flex-end;
}

.reader-screen.reader-view-aluno .reader-turn-page-label {
    display: none !important;
}

.reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"]:fullscreen,
.reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"]:-webkit-full-screen {
    background: #08101d;
}

.reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"]:fullscreen .reader-toolbar-top,
.reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"]:-webkit-full-screen .reader-toolbar-top {
    background: rgba(8, 13, 19, 0.96);
    border-color: rgba(148, 163, 184, 0.12);
}

@media (max-width: 980px) {
    .portal-dashboard-grid,
    .portal-book-card {
        grid-template-columns: 1fr;
    }

    .portal-book-cover,
    .portal-book-cover-large {
        margin: 0 auto;
    }

    .reader-screen.reader-view-aluno .reader-toolbar-top {
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    .reader-screen.reader-view-aluno .reader-topbar-main,
    .reader-screen.reader-view-aluno .reader-topbar-right {
        width: 100%;
        max-width: none;
    }

    .reader-screen.reader-view-aluno .reader-topbar-right {
        justify-content: flex-start;
        margin-left: 0;
    }

    .reader-screen.reader-view-aluno .reader-topbar-menu-student {
        width: 100%;
        max-width: none;
        margin-left: 0;
        justify-content: flex-start;
    }

    .reader-screen.reader-view-aluno .reader-search-form,
    .reader-screen.reader-view-aluno .reader-search-form:focus-within {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin-left: 0;
    }

    .reader-screen.reader-view-aluno .reader-tools {
        flex: 1 1 100%;
        width: 100%;
    }

    .reader-screen.reader-view-aluno .reader-tools-right,
    .reader-screen.reader-view-aluno .reader-tools-right.is-docked-top {
        width: 100%;
        flex: 1 1 100%;
        justify-content: flex-start;
        padding-top: 0;
    }

    .reader-screen.reader-view-aluno .flipbook-stage {
        min-height: clamp(440px, 62vh, 720px);
    }

    .reader-screen.reader-view-aluno .reader-progress-wrap {
        width: min(68%, 420px);
    }
}

@media (max-width: 768px) {
    .portal-register-grid,
    .portal-form-grid {
        grid-template-columns: 1fr;
    }

    .portal-toolbar,
    .portal-inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-status-row {
        flex-direction: column;
    }

    .reader-screen.reader-view-aluno .reader-toolbar-top {
        display: none;
    }

    .reader-screen.reader-view-aluno .reader-screen-panel[data-reader-panel="leitor"] {
        padding-top: 0;
    }

    .reader-screen.reader-view-aluno .reader-shell {
        gap: 8px;
    }

    .reader-screen.reader-view-aluno .reader-main {
        gap: 8px;
    }

    .reader-screen.reader-view-aluno .reader-tools-right,
    .reader-screen.reader-view-aluno .reader-tools-right.is-docked-top {
        gap: 5px;
        padding-top: 0;
    }

    .reader-screen.reader-view-aluno .flipbook-stage {
        min-height: clamp(320px, 46vh, 460px);
        box-shadow: 0 18px 32px rgba(15, 23, 42, 0.14);
    }

    .reader-screen.reader-view-aluno .reader-progress-wrap {
        width: min(92%, 320px);
        margin-top: 8px;
    }

    .reader-screen.reader-view-aluno .reader-zoom-stack {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .reader-screen.reader-view-aluno .reader-zoom-btn {
        width: 40px;
        height: 40px;
    }

    .reader-screen.reader-view-aluno .reader-stage-nav {
        width: 44px;
        height: 44px;
    }

    .reader-screen.reader-view-aluno .reader-note-modal-dialog {
        width: min(100%, calc(100% - 18px));
        padding: 16px;
    }

    .reader-screen.reader-view-aluno .reader-favorites-modal-dialog {
        width: min(100%, calc(100% - 18px));
        padding: 16px;
    }

    .reader-screen.reader-view-aluno .reader-note-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .reader-screen.reader-view-aluno .reader-note-modal-buttons {
        width: 100%;
    }

    .reader-screen.reader-view-aluno .reader-note-modal-buttons .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .reader-screen.reader-view-aluno .reader-favorites-entry {
        padding: 12px 14px;
    }

}

@media (max-width: 560px) {
    .reader-screen.reader-view-aluno .reader-topbar {
        padding: 12px;
    }

    .reader-screen.reader-view-aluno .reader-topbar-main,
    .reader-screen.reader-view-aluno .reader-topbar-right {
        width: 100%;
        max-width: none;
    }

    .reader-screen.reader-view-aluno .reader-topbar-right,
    .reader-screen.reader-view-aluno .reader-topbar-menu-student {
        justify-content: flex-end;
    }

    .reader-screen.reader-view-aluno .reader-topbar-menu-student {
        gap: 6px;
    }

    .reader-screen.reader-view-aluno .portal-reader-meta {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .reader-screen.reader-view-aluno .flipbook-stage {
        min-height: clamp(300px, 42vh, 400px);
    }

    .reader-screen.reader-view-aluno .reader-progress-wrap {
        width: min(94%, 286px);
    }

    .reader-screen.reader-view-aluno .reader-stage-nav {
        width: 40px;
        height: 40px;
    }
}

/* Student Portal Responsive Refinements */
.portal-auth-wide {
    max-width: min(100%, 620px);
}

@media (max-width: 1100px) {
    .portal-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .portal-student-card-grid {
        grid-template-columns: 1fr;
    }

    .portal-student-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-book-card {
        grid-template-columns: 160px minmax(0, 1fr);
        gap: 18px;
    }
}

@media (max-width: 640px) {
    .portal-dashboard-grid {
        gap: 16px;
    }

    .portal-status-row {
        gap: 12px;
        margin-bottom: 16px;
    }

    .portal-summary-list {
        gap: 10px;
        font-size: 0.96rem;
    }

    .portal-book-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 16px;
    }

    .portal-student-dashboard-card .card-body {
        padding: 22px 18px;
    }

    .portal-student-profile {
        padding: 18px;
        border-radius: 22px;
    }

    .portal-student-books-grid {
        grid-template-columns: 1fr;
    }

    .portal-student-book-item {
        padding: 16px;
        border-radius: 22px;
    }

    .portal-book-cover {
        max-width: 160px;
    }

    .portal-book-copy {
        width: 100%;
    }

    .portal-book-copy h2 {
        font-size: 1.3rem;
        line-height: 1.2;
    }

    .portal-book-actions {
        display: flex;
        justify-content: center;
    }

    .portal-book-actions .btn {
        width: 100%;
        max-width: 260px;
    }

    .portal-auth-linkbox p {
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .portal-stat-card {
        padding: 18px;
    }

    .portal-stat-card strong {
        font-size: 1.9rem;
    }

    .portal-form-actions .btn,
    .portal-action-grid .btn {
        width: 100%;
    }
}
