:root {
    --bg: #f7f1e8;
    --panel: rgba(255, 252, 246, 0.9);
    --panel-solid: #fffdf8;
    --ink: #203040;
    --muted: #6b7280;
    --line: rgba(32, 48, 64, 0.1);
    --blue: #0f4c81;
    --blue-deep: #0a2f57;
    --gold: #d6982f;
    --coral: #da6a4e;
    --shadow: 0 22px 60px rgba(24, 35, 48, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at top left, rgba(214, 106, 78, 0.12), transparent 28%),
        radial-gradient(circle at right center, rgba(15, 76, 129, 0.12), transparent 30%),
        linear-gradient(135deg, #fbf5ec 0%, #efe3cf 100%);
}

body.book-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--book-cover-url);
    background-size: cover;
    background-position: center;
    filter: blur(28px);
    transform: scale(1.12);
    opacity: 0.28;
    z-index: -2;
}

body.book-body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(250, 247, 240, 0.8), rgba(247, 241, 232, 0.92));
    z-index: -1;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    background: rgba(255, 251, 245, 0.72);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topbar-kicker,
.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    color: var(--blue);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.topbar-nav a {
    color: var(--blue-deep);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(32, 48, 64, 0.08);
    font-size: 14px;
}

.user-chip {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    font-size: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(90deg, var(--blue-deep), #bb1e2f);
}

.btn-secondary {
    color: var(--blue-deep);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
}

.btn-full {
    width: 100%;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    position: relative;
    overflow: hidden;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0a2f57 0%, #0f4c81 60%, #2f6db2 100%);
    z-index: 0;
}

.login-art,
.login-panel {
    position: relative;
    z-index: 1;
}

.login-art,
.login-panel {
    display: grid;
    place-items: center;
    padding: 32px;
}

.login-art {
    background: transparent;
    color: #fff;
}

.login-art-inner,
.login-card,
.hero-banner,
.stat-card,
.highlight-card,
.book-stage-panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-art-inner,
.login-card {
    border-radius: 28px;
    padding: 36px;
    width: min(560px, 100%);
}

.login-art-inner {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.login-brand {
    display: grid;
    gap: 18px;
    max-width: 420px;
}

.login-brand h1 {
    font-size: clamp(42px, 6vw, 68px);
}

.login-art .eyebrow,
.login-art h1,
.login-art .lead {
    color: #f5f4f0;
}

.login-art .art-pills span {
    color: #f5f4f0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.14);
}

.login-panel::before {
    content: "";
    position: absolute;
    inset: -40px;
    background-image:
        url("../vendor/login-covers/niteroi.webp"),
        url("../vendor/login-covers/brasil.jpg"),
        url("../vendor/login-covers/pontalingua3.jpg"),
        url("../vendor/login-covers/pontalingua5.jpg");
    background-repeat: no-repeat;
    background-size: 320px auto, 360px auto, 320px auto, 340px auto;
    background-position: 6% 12%, 72% 8%, 10% 78%, 80% 70%;
    opacity: 0.45;
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
}

.login-panel .login-card {
    position: relative;
    z-index: 1;
}

h1,
h2 {
    margin: 0;
    line-height: 0.96;
}

h1 {
    font-size: clamp(42px, 6vw, 72px);
}

h2 {
    font-size: 36px;
}

.lead,
.muted {
    color: var(--muted);
    line-height: 1.65;
}

.art-pills,
.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.art-pills span,
.book-meta span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    font-size: 14px;
}

.stack-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.stack-form label {
    display: grid;
    gap: 8px;
}

.stack-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-top: 18px;
}

.alert.error {
    background: rgba(183, 28, 28, 0.1);
    color: #8d1414;
    border: 1px solid rgba(183, 28, 28, 0.18);
}

.alert.success {
    background: rgba(26, 127, 55, 0.1);
    color: #1f6a33;
    border: 1px solid rgba(26, 127, 55, 0.18);
}

.mini-grid,
.stats-grid {
    display: grid;
    gap: 16px;
}

.mini-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 28px;
}

.mini-grid article {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
}

.dashboard-shell,
.book-page {
    padding: 28px;
}

.hero-banner {
    border-radius: 28px;
    padding: 32px;
}

.hero-editor {
    background: linear-gradient(135deg, rgba(15, 76, 129, 0.18), rgba(255, 255, 255, 0.7));
}

.hero-professor {
    background: linear-gradient(135deg, rgba(214, 152, 47, 0.18), rgba(255, 255, 255, 0.72));
}

.hero-aluno {
    background: linear-gradient(135deg, rgba(218, 106, 78, 0.18), rgba(255, 255, 255, 0.72));
}

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

.stat-card,
.highlight-card,
.book-spotlight {
    border-radius: 24px;
    padding: 24px;
}

.highlight-card,
.book-spotlight {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.muted-card {
    background: rgba(255, 255, 255, 0.68);
}

.book-card {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    background: rgba(255, 252, 246, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 26px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.book-card img {
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 16px 36px rgba(15, 47, 87, 0.16);
}

.book-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.book-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.reader-tools {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.progress-box {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

.progress-bar {
    width: 220px;
    height: 8px;
    border-radius: 999px;
    background: rgba(15, 76, 129, 0.12);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a2f57, #bb1e2f);
}

.notes-form {
    margin-top: 18px;
    display: grid;
    gap: 14px;
}

.notes-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
}

.book-grid {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.book-tile {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    background: rgba(255, 252, 246, 0.92);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 18px;
    box-shadow: var(--shadow);
}

.book-tile img {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(15, 47, 87, 0.15);
}

.notes-grid {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.note-card {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    background: rgba(255, 252, 246, 0.92);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 18px;
    box-shadow: var(--shadow);
}

.note-cover img {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(15, 47, 87, 0.15);
}

.note-text {
    margin: 12px 0;
    line-height: 1.6;
}

.admin-grid {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 20px;
    margin-top: 24px;
}

.admin-grid-wide {
    grid-template-columns: 520px minmax(0, 1fr);
}

.editor-card {
    background: rgba(255, 252, 246, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    border-radius: 28px;
    padding: 26px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.stack-form select,
.stack-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.admin-table {
    overflow: auto;
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    vertical-align: top;
    padding: 14px 10px;
    border-bottom: 1px solid rgba(32, 48, 64, 0.08);
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

.table-sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.file-stack {
    display: grid;
    gap: 6px;
    font-size: 14px;
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-pill.is-active {
    background: rgba(26, 127, 55, 0.12);
    color: #1f6a33;
}

.status-pill.is-inactive {
    background: rgba(183, 28, 28, 0.1);
    color: #8d1414;
}

.status-pill.is-new {
    background: rgba(218, 106, 78, 0.14);
    color: #b44c32;
}

.status-pill.is-read {
    background: rgba(15, 76, 129, 0.14);
    color: #0a2f57;
}

.status-pill.is-done {
    background: rgba(26, 127, 55, 0.14);
    color: #1f6a33;
}

.btn-danger {
    color: #fff;
    background: linear-gradient(90deg, #8d1414, #c72f2f);
}

.book-stage {
    max-width: 1220px;
    margin: 0 auto;
}

.book-stage-panel {
    border-radius: 34px;
    padding: 34px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 243, 0.9)),
        var(--panel);
}

.book-stage-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.book-side {
    display: grid;
    justify-items: center;
    gap: 22px;
    padding: 12px 8px;
}

.brand-stamp {
    width: 140px;
    aspect-ratio: 1;
    border-radius: 22px;
    display: grid;
    place-items: center;
    text-align: center;
    font-weight: 700;
    color: var(--blue-deep);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 30px rgba(15, 47, 87, 0.1);
}

.cover-display {
    width: min(100%, 270px);
    padding: 14px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 20px 50px rgba(24, 35, 48, 0.12);
}

.cover-display-image {
    width: 100%;
    display: block;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 47, 87, 0.16);
}

.cover-caption {
    text-align: center;
}

.cover-caption h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.cover-caption p {
    margin: 0;
    color: #b53535;
    font-weight: 700;
}

.book-main {
    padding-top: 10px;
}

.book-main h1 {
    font-size: clamp(38px, 4vw, 60px);
    line-height: 1.02;
    max-width: 760px;
}

.book-main .lead {
    max-width: 760px;
    font-size: 20px;
}

.book-action-bar {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.viewer-frame-wrap {
    margin-top: 24px;
    padding: 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.viewer-frame {
    width: 100%;
    min-height: 720px;
    border: 0;
    border-radius: 18px;
    background: #fff;
}

.page-viewer {
    margin-top: 24px;
    display: grid;
    gap: 16px;
}

.flipbook-shell {
    margin-top: 24px;
    display: grid;
    gap: 16px;
}

.flipbook-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 30px rgba(15, 47, 87, 0.08);
}

.flipbook-stage {
    position: relative;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 26px;
    padding: 6px;
    box-shadow: 0 18px 50px rgba(24, 35, 48, 0.14);
}

.flipbook-stage::after {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    width: 1px;
    background: rgba(0, 0, 0, 0.18);
    transform: translateX(-0.5px);
    pointer-events: none;
}

.flipbook {
    margin: 0 auto;
}

.flipbook .page {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

.flipbook {
    width: 100%;
}

.page-canvas,
.draw-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.draw-canvas {
    position: absolute;
    inset: 0;
    cursor: crosshair;
}

.flipbook-notes {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 16px;
}

.flipbook-notes textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    font: inherit;
    background: rgba(255, 255, 255, 0.95);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 10px;
    border-radius: 14px;
}

.toolbar-group .btn.is-active {
    background: rgba(15, 76, 129, 0.12);
    border: 1px solid rgba(15, 76, 129, 0.2);
}

.page-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.page-status {
    font-weight: 700;
    color: var(--blue-deep);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-canvas {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 22px;
    padding: 18px;
}

.page-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(24, 35, 48, 0.14);
    user-select: none;
    pointer-events: none;
}

.page-image.is-flipping {
    opacity: 0.6;
    filter: blur(2px);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.page-input {
    width: 80px;
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 6px 10px;
    font: inherit;
    background: rgba(255, 255, 255, 0.9);
}

.page-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-tools .btn.is-active {
    background: rgba(15, 76, 129, 0.14);
    border: 1px solid rgba(15, 76, 129, 0.2);
}

.tool-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.tool-size,
.tool-color {
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.9);
    font: inherit;
}

.page-draw {
    position: absolute;
    inset: 18px;
    width: calc(100% - 36px);
    height: calc(100% - 36px);
    border-radius: 16px;
    cursor: crosshair;
}

@media (max-width: 960px) {
    .login-shell,
    .stats-grid,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .highlight-card,
    .book-spotlight,
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .viewer-frame {
        min-height: 540px;
    }

    .book-stage-panel {
        padding: 24px;
    }

    .book-stage-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .book-side {
        justify-items: start;
    }

    .cover-caption {
        text-align: left;
    }

    .admin-grid,
    .admin-grid-wide,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }

    .topbar-nav {
        flex-wrap: wrap;
        margin-right: 0;
    }
}
