:root {
    --wine: #7c1f3a;
    --wine-dark: #59162a;
    --cream: #f8f3ec;
    --ivory: #fffdf9;
    --sand: #e8ddd0;
    --terracotta: #b38c78;
    --ink: #302b29;
    --muted: #746b67;
    --botanical: #75806a;
    --danger: #982e45;
    --success: #5e7454;
    --warning: #9b6a30;
    --info: #756757;
    --border: rgba(89, 22, 42, .14);
    --font-title: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body: 'Montserrat', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--cream);
    font-family: var(--font-body);
    font-size: .94rem;
    line-height: 1.65;
}

body:not(.admin-body):not(.auth-body) { display: flex; flex-direction: column; }

button, input, select, textarea { font: inherit; }
a { color: var(--wine); text-underline-offset: 3px; }
img { max-width: 100%; }

h1, h2, h3 {
    margin: 0 0 .65rem;
    color: var(--wine-dark);
    font-family: var(--font-title);
    font-weight: 600;
    line-height: 1.08;
}

h1 { font-size: clamp(2.15rem, 4vw, 3.35rem); }
h2 { font-size: clamp(1.65rem, 3vw, 2.15rem); }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .35rem; color: var(--terracotta); font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
    padding: 1rem max(1rem, calc((100% - 1080px) / 2));
    border-bottom: 1px solid var(--border);
    background: var(--ivory);
}

.brand { display: inline-flex; align-items: center; gap: 1rem; color: var(--wine-dark); text-decoration: none; }
.brand img { display: block; width: 180px; max-height: 58px; object-fit: contain; }
.brand-placeholder { font-family: var(--font-title); font-size: 1.6rem; font-weight: 700; }
.area-label { padding-left: 1rem; border-left: 1px solid var(--sand); color: var(--muted); }

.container { width: min(100% - 2rem, 1080px); margin: 2.5rem auto; flex: 1; }
.site-footer { padding: 1.5rem; color: var(--muted); text-align: center; }

.card, .panel-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--ivory);
    box-shadow: 0 8px 28px rgba(89, 22, 42, .04);
}
.card { max-width: 650px; margin: 0 auto; padding: clamp(1.35rem, 4vw, 2.5rem); }
.card-wide { max-width: 1080px; }

label { display: block; margin: 0 0 .4rem; color: var(--ink); font-size: .85rem; font-weight: 600; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: .7rem .8rem;
    border: 1px solid #d7c8bb;
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
}
textarea { display: block; min-height: 120px; resize: vertical; }
input[readonly] { color: var(--muted); background: #f4eee7; cursor: not-allowed; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(124, 31, 58, .16); outline-offset: 2px; border-color: var(--wine); }
.field { margin-bottom: 1.15rem; }
.field small { display: block; margin-top: .35rem; color: var(--muted); font-size: .76rem; }

.button, button:not(.menu-toggle):not(.student-menu-toggle):not(.sidebar-overlay):not(.text-button):not(.student-logout):not(.sidebar-logout-button) {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: .68rem 1.1rem;
    border: 1px solid var(--wine);
    border-radius: 7px;
    color: #fff;
    background: var(--wine);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.button:hover, button:not(.menu-toggle):not(.student-menu-toggle):not(.sidebar-overlay):not(.text-button):not(.student-logout):not(.sidebar-logout-button):hover { border-color: var(--wine-dark); background: var(--wine-dark); }
.button-outline, .button-secondary { color: var(--wine); background: transparent; }
.button-block { width: 100%; margin-top: .35rem; }
.text-button { padding: 0; border: 0; color: var(--wine); background: transparent; font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.actions, .form-actions, .quick-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.5rem; }
.inline-form { display: inline; margin: 0; }
.inline-form button { margin: 0; }

.alert { margin: 0 0 1rem; padding: .85rem 1rem; border: 1px solid; border-left-width: 4px; border-radius: 7px; background: var(--ivory); }
.alert-error { border-color: rgba(152, 46, 69, .4); border-left-color: var(--danger); }
.alert-success { border-color: rgba(94, 116, 84, .4); border-left-color: var(--success); }
.alert-warning { border-color: rgba(155, 106, 48, .4); border-left-color: var(--warning); }
.alert-info { border-color: rgba(117, 101, 87, .4); border-left-color: var(--info); }
.alert ul { margin: 0; padding-left: 1.15rem; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.3rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; }

/* Login */
.auth-body { background: var(--cream); }
.auth-body::before, .auth-body::after { position: fixed; width: 300px; height: 300px; border: 1px solid rgba(117, 128, 106, .12); border-radius: 50%; content: ''; pointer-events: none; }
.auth-body::before { top: -180px; left: -130px; }
.auth-body::after { right: -170px; bottom: -190px; }
.auth-layout { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { position: relative; z-index: 1; width: min(100%, 470px); padding: clamp(1.6rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 14px; background: var(--ivory); box-shadow: 0 18px 60px rgba(89, 22, 42, .07); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .7rem; margin-bottom: 2rem; }
.auth-brand img { width: min(100%, 255px); max-height: 75px; object-fit: contain; }
.auth-area-label { color: var(--terracotta); font-size: .69rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; }
.auth-heading { margin-bottom: 1.7rem; text-align: center; }
.auth-heading h1 { font-size: clamp(2.35rem, 7vw, 3.2rem); }
.auth-heading p:last-child { color: var(--muted); }
.auth-help { display: block; margin-top: 1.25rem; color: var(--muted); font-size: .8rem; text-align: center; }
.auth-logout { margin-top: 1.25rem; text-align: center; }
.auth-admin .auth-card { border-top: 3px solid var(--wine); }

/* Admin shell */
.admin-body { overflow-x: hidden; background: #f5efe8; }
.admin-shell { min-height: 100vh; }
.admin-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 270px; display: flex; overflow-y: auto; flex-direction: column; padding: 1.7rem 1.25rem 1.35rem; border-right: 1px solid var(--border); background: var(--ivory); }
.sidebar-brand { padding: 0 .25rem 1.65rem; border-bottom: 1px solid var(--sand); text-align: center; }
.sidebar-brand-logo { width: 100%; height: 84px; display: flex; overflow: hidden; align-items: center; justify-content: center; }
.sidebar-brand img { width: 470px; max-width: none; flex: 0 0 auto; object-fit: contain; }
.sidebar-brand span { display: block; margin-top: .8rem; color: var(--terracotta); font-family: var(--font-title); font-size: 1.2rem; letter-spacing: .04em; }
.admin-nav { display: flex; flex-direction: column; gap: .2rem; margin-top: 1.5rem; }
.admin-nav-link { display: flex; min-height: 44px; align-items: center; justify-content: space-between; padding: .65rem .8rem; border-left: 2px solid transparent; color: #504844; font-size: .84rem; font-weight: 500; text-decoration: none; }
.admin-nav-link:hover { color: var(--wine); background: var(--cream); }
.admin-nav-link.is-active { border-left-color: var(--wine); color: var(--wine-dark); background: #f8f0f1; font-weight: 600; }
.admin-nav-link.is-disabled { color: #a69d97; cursor: default; }
.admin-nav-link small { padding: .1rem .35rem; border: 1px solid var(--sand); border-radius: 20px; font-size: .61rem; }
.sidebar-logout { margin-top: auto; padding-top: 1.35rem; border-top: 1px solid var(--sand); }
.sidebar-logout-button { width: 100%; min-height: 44px; padding: .65rem 1rem; border: 1px solid rgba(124, 31, 58, .42); border-radius: 7px; color: var(--wine-dark); background: #fbf6f3; font-weight: 600; cursor: pointer; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.sidebar-logout-button:hover { border-color: var(--wine); color: var(--ivory); background: var(--wine); }

.admin-workspace { min-height: 100vh; margin-left: 270px; display: flex; flex-direction: column; }
.admin-topbar { min-height: 76px; display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--border); background: rgba(255, 253, 249, .94); }
.admin-topbar-title { color: var(--wine-dark); font-family: var(--font-title); font-size: 1.35rem; font-weight: 600; }
.admin-user-name { margin-left: auto; color: var(--muted); font-size: .78rem; }
.menu-toggle { display: none; width: 42px; height: 42px; padding: 9px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.menu-toggle span { display: block; height: 1px; margin: 5px 0; background: var(--wine-dark); }
.sidebar-overlay { display: none; }
.admin-content { width: min(100%, 1320px); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem); flex: 1; }
.admin-footer { padding: 1.2rem 2rem; color: var(--muted); font-size: .74rem; text-align: center; }

.page-heading { margin-bottom: 2rem; }
.page-heading > p:last-child, .page-heading > div > p:last-child { max-width: 700px; color: var(--muted); }
.heading-with-action { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.heading-with-action .button { flex: 0 0 auto; }
.panel-section { padding: clamp(1.2rem, 3vw, 2rem); }
.section-heading { display: flex; align-items: end; justify-content: space-between; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { min-height: 145px; display: flex; flex-direction: column; justify-content: space-between; padding: 1.35rem; border: 1px solid var(--border); border-radius: 10px; background: var(--ivory); }
.stat-card span { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.stat-card strong { color: var(--wine-dark); font-family: var(--font-title); font-size: 3rem; font-weight: 600; line-height: 1; }
.stat-card .stat-text { font-size: 1.75rem; }
.stat-card-botanical { border-color: rgba(117, 128, 106, .3); background: #f3f4ef; }
.stat-card-botanical strong { color: var(--botanical); }

.search-form { display: grid; grid-template-columns: minmax(220px, 520px) auto auto; align-items: center; gap: .65rem; margin-bottom: 1.5rem; }
.search-form button { margin: 0; }
.search-form a { padding: .5rem; font-size: .8rem; }
.table-wrap { width: 100%; overflow-x: auto; }
.responsive-table { width: 100%; border-collapse: collapse; }
.responsive-table th { padding: .75rem; border-bottom: 1px solid var(--sand); color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.responsive-table td { padding: 1rem .75rem; border-bottom: 1px solid #eee5db; vertical-align: top; }
.responsive-table tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; flex-wrap: wrap; gap: .35rem .8rem; min-width: 180px; }
.table-actions a, .table-actions .text-button { font-size: .78rem; }
.table-actions form { margin: 0; }
.status-badge { display: inline-flex; padding: .18rem .55rem; border-radius: 20px; font-size: .68rem; font-weight: 600; }
.status-active { color: #4d6346; background: #edf2e9; }
.status-inactive { color: #866271; background: #f4e9ed; }
.status-locked, .status-draft { color: #866b51; background: #f5eee4; }
.status-hidden { color: #746e6b; background: #efedeb; }
.status-published { color: #4d6346; background: #edf2e9; }
.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state p { color: var(--muted); }

.form-panel { max-width: 900px; }
.form-panel-narrow { max-width: 620px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.field-full { grid-column: 1 / -1; }
.checkbox-field { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: .65rem; margin: .4rem 0; font-weight: 500; }
.checkbox-field input { width: 18px; min-height: 18px; margin-top: .2rem; accent-color: var(--wine); }
.success-summary { max-width: 700px; border-left: 4px solid var(--success); }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.content-create-panel { margin-top: 1.5rem; }

/* Área da aluna */
.student-body { min-height: 100vh; background: var(--ivory); }
.student-header { position: relative; z-index: 20; border-bottom: 1px solid rgba(89, 22, 42, .1); background: rgba(255, 253, 249, .97); }
.student-header-inner { width: min(100% - 2rem, 1220px); min-height: 104px; margin: 0 auto; display: flex; align-items: center; gap: clamp(1.25rem, 2.5vw, 2.5rem); }
.student-brand { display: flex; flex: 0 1 auto; align-items: center; gap: 1.25rem; color: var(--wine-dark); text-decoration: none; }
.student-brand-logo { width: 180px; height: 80px; display: flex; overflow: hidden; flex: 0 0 auto; align-items: center; justify-content: center; }
.student-brand-logo img { width: 420px; max-width: none; flex: 0 0 auto; object-fit: contain; }
.student-brand-title { padding-left: 1.25rem; border-left: 1px solid var(--sand); font-family: var(--font-title); font-size: 1.18rem; line-height: 1.15; white-space: nowrap; }
.student-nav { margin-left: auto; display: flex; align-items: center; gap: clamp(.9rem, 1.7vw, 1.65rem); }
.student-nav a, .student-logout { color: #5f5652; font-size: .77rem; font-weight: 500; text-decoration: none; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.student-nav a { padding: .5rem 0; white-space: nowrap; }
.student-nav a:hover, .student-logout:hover { color: var(--wine-dark); }
.student-nav form { margin: 0; }
.student-logout { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: .42rem .78rem; border: 1px solid rgba(124, 31, 58, .3); border-radius: 6px; color: var(--wine-dark); background: transparent; cursor: pointer; }
.student-logout:hover { border-color: var(--wine); background: #f8f0f1; }
.student-menu-toggle { display: none; width: 42px; height: 42px; margin-left: auto; padding: 9px; border: 0; border-radius: 7px; color: var(--wine-dark); background: transparent; cursor: pointer; }
.student-menu-toggle:hover { background: #f8f0f1; }
.student-menu-toggle span { display: block; height: 1px; margin: 5px 0; background: var(--wine-dark); }
.student-main { width: min(100% - 2rem, 1120px); min-height: calc(100vh - 180px); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0; }
.student-footer { width: min(100% - 2rem, 1120px); margin: 0 auto; padding: 1.5rem 0 2.5rem; display: flex; justify-content: space-between; border-top: 1px solid var(--sand); color: var(--muted); font-family: var(--font-title); }

.study-hero { position: relative; max-width: 820px; margin: 0 auto clamp(4rem, 9vw, 8rem); text-align: center; }
.study-greeting { margin-bottom: 2rem; color: var(--muted); font-size: .8rem; }
.study-open-message { margin: -1.5rem 0 2rem; color: var(--botanical); font-family: var(--font-title); font-size: 1.05rem; }
.study-hero h1 { font-size: clamp(3.2rem, 9vw, 6.5rem); letter-spacing: .03em; text-transform: uppercase; }
.study-lead { max-width: 650px; margin: 1.5rem auto 0; color: var(--muted); font-family: var(--font-title); font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.45; }
.botanical-rule { width: 130px; height: 25px; margin: 0 auto 1.2rem; position: relative; }
.botanical-rule::before, .botanical-rule::after { position: absolute; top: 12px; width: 54px; height: 1px; background: var(--terracotta); content: ''; }
.botanical-rule::before { left: 0; transform: rotate(-5deg); }
.botanical-rule::after { right: 0; transform: rotate(5deg); }
.botanical-rule span { position: absolute; left: 58px; top: 7px; width: 13px; height: 13px; border: 1px solid var(--botanical); border-radius: 70% 0 70% 0; transform: rotate(45deg); }

.season-journey { border-top: 1px solid var(--sand); }
.season-chapter { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); min-height: 250px; padding: clamp(2.2rem, 6vw, 4.5rem) 0; border-bottom: 1px solid var(--sand); }
.season-number { color: var(--terracotta); font-family: var(--font-title); font-size: clamp(3.5rem, 7vw, 5.5rem); line-height: .85; }
.season-copy { max-width: 740px; }
.season-copy h2 { font-size: clamp(2.25rem, 5vw, 3.8rem); text-transform: uppercase; }
.season-copy > p:not(.eyebrow) { color: var(--muted); }
.season-progress { width: min(100%, 260px); display: flex; align-items: baseline; justify-content: space-between; margin: 1.25rem 0 .35rem; padding-top: .8rem; border-top: 1px solid var(--sand); color: var(--botanical); }
.season-progress span { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.season-progress strong { font-family: var(--font-title); font-size: 1.45rem; }
.season-chapter.is-locked { opacity: .64; }
.chapter-link, .resource-link { display: inline-flex; align-items: center; gap: .65rem; margin-top: .7rem; color: var(--wine); font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-decoration: none; text-transform: uppercase; }
.chapter-link:hover, .resource-link:hover { text-decoration: underline; }
.locked-message { display: inline-flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .78rem; }
.quiet-lock { position: relative; width: 12px; height: 10px; display: inline-block; border: 1px solid currentColor; border-radius: 2px; }
.quiet-lock::before { position: absolute; left: 2px; top: -7px; width: 6px; height: 7px; border: 1px solid currentColor; border-bottom: 0; border-radius: 6px 6px 0 0; content: ''; }

.breadcrumbs { margin-bottom: clamp(2rem, 5vw, 4rem); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .72rem; }
.breadcrumbs li:not(:last-child)::after { margin-left: .45rem; color: var(--terracotta); content: '→'; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }

.chapter-hero, .notebook-hero, .section-hero { position: relative; max-width: 820px; margin-bottom: clamp(3rem, 8vw, 6rem); padding-left: clamp(0rem, 9vw, 7rem); }
.chapter-hero h1, .notebook-hero h1, .section-hero h1 { font-size: clamp(3rem, 8vw, 5.8rem); }
.chapter-hero > p:last-child, .intro-copy { max-width: 700px; color: var(--muted); font-family: var(--font-title); font-size: 1.25rem; }
.chapter-roman { position: absolute; left: 0; top: -.25rem; color: rgba(179, 140, 120, .35); font-family: var(--font-title); font-size: 5.5rem; line-height: 1; }
.notebook-period { color: var(--terracotta); font-family: var(--font-title); font-size: 1.35rem; }
.notebook-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .7rem 1.5rem; align-items: end; max-width: 920px; margin: 0 0 clamp(3rem, 7vw, 5rem) auto; padding: 1.25rem 0; border-top: 1px solid var(--sand); border-bottom: 1px solid var(--sand); }
.notebook-progress p { margin: 0 0 .2rem; }
.notebook-progress strong { font-family: var(--font-title); font-size: 1.35rem; font-weight: 600; }
.notebook-progress > span { color: var(--botanical); font-family: var(--font-title); font-size: 1.65rem; }
.progress-track { grid-column: 1 / -1; height: 4px; overflow: hidden; background: #e9e4dc; }
.progress-track span { display: block; height: 100%; background: var(--botanical); transition: width .25s ease; }

.notebook-list { border-top: 1px solid var(--sand); }
.notebook-entry { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; padding: clamp(1.7rem, 4vw, 3rem) 0; border-bottom: 1px solid var(--sand); }
.notebook-entry h2 { margin-bottom: .3rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.notebook-entry p { margin: 0; color: var(--muted); }
.notebook-entry.is-locked { opacity: .62; }
.notebook-mark { width: 15px; height: 34px; border: 1px solid var(--terracotta); border-radius: 50% 50% 45% 45%; transform: rotate(25deg); }

.section-trail { max-width: 920px; margin-left: auto; }
.trail-entry { display: grid; grid-template-columns: 55px minmax(0, 1fr) auto; align-items: center; gap: 1.5rem; min-height: 125px; padding: 1.5rem 0; border-bottom: 1px solid var(--sand); }
.trail-number { color: var(--terracotta); font-family: var(--font-title); font-size: 1.35rem; }
.trail-entry h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.35rem); }
.trail-entry p { margin: .35rem 0 0; color: var(--muted); }
.trail-entry > a { color: var(--wine); font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-decoration: none; text-transform: uppercase; }
.trail-entry.is-locked { opacity: .58; }

.content-flow { max-width: 850px; margin: 0 auto; }
.study-content { padding: clamp(1.8rem, 5vw, 3.5rem) 0; border-top: 1px solid var(--sand); }
.study-content h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.study-content.is-completed { border-top-color: rgba(117, 128, 106, .45); }
.content-body { color: #4f4844; line-height: 1.85; }
.video-frame { position: relative; width: 100%; margin-top: 1.5rem; padding-top: 56.25%; overflow: hidden; border-radius: 8px; background: #251f1d; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.study-empty { padding: 4rem 1rem; color: var(--muted); font-family: var(--font-title); font-size: 1.35rem; text-align: center; }
.study-empty-room { border-top: 1px solid var(--sand); }
.botanical-dot { display: block; width: 10px; height: 10px; margin: 0 auto 1rem; border: 1px solid var(--botanical); border-radius: 70% 0 70% 0; transform: rotate(45deg); }
.progress-action { margin-top: 1.8rem; }
.study-content .progress-action .progress-button { min-height: 38px; padding: .45rem .8rem; border: 1px solid var(--sand); color: var(--wine); background: transparent; font-size: .73rem; font-weight: 500; }
.study-content .progress-action .progress-button:hover { border-color: var(--wine); color: #fff; background: var(--wine); }
.study-content .progress-action .progress-button.is-completed { border-color: rgba(117, 128, 106, .35); color: var(--botanical); background: #f2f4ef; }

.clareira-hero { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.clareira-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.clareira-form-wrap { padding: clamp(1.4rem, 4vw, 2.4rem); border: 1px solid rgba(117, 128, 106, .24); border-radius: 12px; background: #f7f6f1; }
.clareira-history { padding-top: .5rem; }
.clareira-entry-list { border-top: 1px solid var(--sand); }
.clareira-entry { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto auto; gap: .75rem 1rem; align-items: center; padding: 1.15rem 0; border-bottom: 1px solid var(--sand); color: var(--ink); text-decoration: none; }
.clareira-entry:hover strong { color: var(--wine); }
.clareira-entry > span { color: var(--muted); font-size: .72rem; }
.clareira-entry strong { font-family: var(--font-title); font-size: 1.2rem; font-weight: 600; }
.clareira-type { color: var(--terracotta) !important; font-size: .66rem !important; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.clareira-status { display: inline-flex; width: fit-content; padding: .18rem .5rem; border-radius: 20px; font-size: .66rem !important; font-weight: 600; white-space: nowrap; }
.clareira-status-new { color: #866b51 !important; background: #f5eee4; }
.clareira-status-answered { color: #4d6346 !important; background: #edf2e9; }
.clareira-status-closed { color: #746e6b !important; background: #efedeb; }
.clareira-empty { padding: 2rem 0; color: var(--muted); font-family: var(--font-title); font-size: 1.1rem; }
.clareira-entry-wide { grid-template-columns: 90px 170px minmax(0, 1fr) auto auto; }
.clareira-notebook { font-family: var(--font-title); font-size: .9rem !important; }
.clareira-detail-hero { margin-bottom: 2.5rem; }
.clareira-meta { color: var(--muted); font-size: .78rem; }
.clareira-conversation { max-width: 820px; margin: 0 auto 2rem; }
.clareira-message { padding: clamp(1.5rem, 4vw, 2.5rem); border-top: 1px solid var(--sand); line-height: 1.85; }
.clareira-message.admin-reply { margin: 1rem 0 0 clamp(0rem, 8vw, 5rem); border: 1px solid rgba(117, 128, 106, .25); border-radius: 10px; background: #f5f6f1; }
.clareira-message time { display: block; margin-top: 1rem; color: var(--muted); font-size: .7rem; }
.clareira-waiting { padding: 3rem 1rem; border-top: 1px solid var(--sand); color: var(--muted); font-family: var(--font-title); font-size: 1.15rem; text-align: center; }

.admin-season-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admin-season-card { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 1rem; padding: 1.5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--ivory); }
.admin-season-roman { color: var(--terracotta); font-family: var(--font-title); font-size: 3.2rem; line-height: 1; }
.admin-season-card h2 { margin-top: .65rem; font-size: 1.8rem; }
.admin-season-card p { color: var(--muted); }
.admin-season-actions { grid-column: 1 / -1; display: flex; gap: 1rem; padding-top: .9rem; border-top: 1px solid var(--sand); font-size: .78rem; }
.stat-card-clareira { border-color: rgba(117, 128, 106, .3); }
.clareira-admin-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.clareira-admin-counts > div { display: flex; align-items: baseline; justify-content: space-between; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: 9px; background: var(--ivory); }
.clareira-admin-counts span { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.clareira-admin-counts strong { color: var(--wine-dark); font-family: var(--font-title); font-size: 2rem; }
.filter-form { display: grid; grid-template-columns: 150px minmax(160px, 1fr) minmax(160px, 1fr) minmax(220px, 1.4fr) auto auto; gap: .7rem; align-items: end; margin-bottom: 1.5rem; }
.filter-form .field { margin: 0; }
.filter-form button { min-height: 46px; }
.filter-form > a { padding: .7rem .3rem; font-size: .78rem; }
.admin-clareira-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); gap: 1rem; align-items: start; }
.clareira-original-message { margin-top: 1.8rem; padding-top: 1.5rem; border-top: 1px solid var(--sand); line-height: 1.8; }
.admin-reply-item { margin-top: 1.2rem; padding: 1.2rem; border-left: 3px solid var(--botanical); background: #f5f6f1; }
.admin-reply-item small { display: block; margin-top: .8rem; color: var(--muted); }
.clareira-response-panel { position: sticky; top: 1rem; }
.close-entry-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--sand); }
.close-entry-form button { width: 100%; }
.back-link { display: inline-block; margin-top: 1.2rem; font-size: .78rem; }
.closed-note { color: var(--muted); }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-form button { align-self: end; }
    .student-header-inner { gap: 1.25rem; }
    .student-brand-logo { width: 170px; }
    .student-brand-logo img { width: 400px; }
    .student-brand-title { padding-left: 1rem; font-size: 1.08rem; }
    .student-nav { gap: .9rem; }
}

@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-101%); transition: transform .22s ease; }
    .admin-workspace { margin-left: 0; }
    .menu-toggle { display: block; }
    .admin-shell.sidebar-open .admin-sidebar { transform: translateX(0); }
    .sidebar-overlay { position: fixed; z-index: 20; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(48, 43, 41, .35); }
    .admin-shell.sidebar-open .sidebar-overlay { display: block; }
    .account-grid { grid-template-columns: 1fr; }
    .student-header-inner { min-height: 88px; }
    .student-menu-toggle { display: block; }
    .student-nav { position: absolute; top: 100%; left: 0; right: 0; display: none; align-items: stretch; flex-direction: column; gap: 0; padding: .6rem max(1rem, calc((100% - 760px) / 2)) 1rem; border-bottom: 1px solid var(--sand); background: var(--ivory); box-shadow: 0 12px 24px rgba(89, 22, 42, .07); }
    .student-nav.is-open { display: flex; }
    .student-nav a, .student-logout-form { padding: .78rem 0; border-bottom: 1px solid #f0e8df; }
    .student-nav a { font-size: .82rem; }
    .student-logout-form { border-bottom: 0; }
    .student-logout { width: 100%; min-height: 40px; justify-content: flex-start; padding: .45rem 0; border: 0; border-radius: 0; font-size: .82rem; text-align: left; background: transparent; }
    .student-logout:hover { color: var(--wine-dark); background: transparent; }
}

@media (max-width: 720px) {
    .admin-content { padding: 1.4rem 1rem; }
    .admin-user-name { display: none; }
    .heading-with-action { align-items: stretch; flex-direction: column; }
    .heading-with-action .button { align-self: flex-start; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .stat-card { min-height: 120px; padding: 1rem; }
    .stat-card strong { font-size: 2.5rem; }
    .stat-card .stat-text { font-size: 1.4rem; }
    .search-form { grid-template-columns: 1fr auto; }
    .search-form a { grid-column: 1 / -1; }

    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .responsive-table tbody { display: grid; gap: .9rem; }
    .responsive-table tr { padding: .75rem 1rem; border: 1px solid var(--sand); border-radius: 9px; background: #fff; }
    .responsive-table td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: .75rem; padding: .5rem 0; border-bottom: 1px solid #f0e8df; overflow-wrap: anywhere; }
    .responsive-table td::before { color: var(--muted); content: attr(data-label); font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
    .responsive-table td:last-child { border-bottom: 0; }
    .table-actions { min-width: 0; }
    .table-actions::before { grid-row: 1 / span 3; }
    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .student-brand-logo { width: 150px; height: 66px; }
    .student-brand-logo img { width: 380px; }
    .student-brand-title { display: none; }
    .season-chapter { grid-template-columns: 55px minmax(0, 1fr); gap: 1rem; min-height: 0; }
    .season-number { font-size: 3.2rem; }
    .notebook-entry { grid-template-columns: 25px minmax(0, 1fr); }
    .notebook-entry > .chapter-link, .notebook-entry > .locked-message { grid-column: 2; justify-self: start; }
    .trail-entry { grid-template-columns: 40px minmax(0, 1fr); gap: .75rem; }
    .trail-entry > a, .trail-entry > .locked-message { grid-column: 2; justify-self: start; }
    .chapter-hero, .notebook-hero, .section-hero { padding-left: 0; }
    .chapter-roman { position: static; display: block; margin-bottom: .7rem; font-size: 3.5rem; }
    .admin-season-grid { grid-template-columns: 1fr; }
    .clareira-layout, .admin-clareira-layout { grid-template-columns: 1fr; }
    .clareira-response-panel { position: static; }
    .clareira-entry, .clareira-entry-wide { grid-template-columns: 90px minmax(0, 1fr) auto; }
    .clareira-entry-wide .clareira-notebook { grid-column: 2 / -1; grid-row: 1; }
}

@media (max-width: 430px) {
    .container { width: min(100% - 1.25rem, 1080px); margin: 1rem auto; }
    .auth-layout { padding: .75rem; }
    .auth-card { padding: 1.4rem 1.1rem; }
    .auth-brand { margin-bottom: 1.35rem; }
    .stat-grid { grid-template-columns: 1fr; }
    .quick-actions, .form-actions { align-items: stretch; flex-direction: column; }
    .quick-actions .button, .form-actions .button, .form-actions button { width: 100%; }
    .responsive-table td { grid-template-columns: 85px minmax(0, 1fr); }
    .notebook-progress { grid-template-columns: 1fr auto; }
    .clareira-entry, .clareira-entry-wide { grid-template-columns: 1fr auto; gap: .35rem .75rem; }
    .clareira-entry .clareira-type { grid-column: 1; }
    .clareira-entry strong, .clareira-entry-wide strong { grid-column: 1 / -1; }
    .clareira-entry-wide .clareira-notebook { grid-column: 1 / -1; grid-row: auto; }
    .clareira-admin-counts { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr; }
    .clareira-message.admin-reply { margin-left: 0; }
}
