/* Keep every control reachable at normal browser zoom, including short laptop screens. */
:root { --sidebar-width: 246px; }

.sidebar .brand { margin-inline: 0; gap: 8px; }
.brand-mark { flex-shrink: 0; }
.brand-copy { min-width: 0; }
.brand-name { display: block; letter-spacing: -.8px; line-height: 1.1; }
.brand-subtitle { display: block; margin-top: 5px; font-size: calc(11px * var(--font)); font-weight: 600; letter-spacing: normal; line-height: 1.4; color: var(--muted); }
.mobile-brand { display: none; }
.workspace > div { min-width: 0; overflow-wrap: anywhere; }
.workspace .school-icon, .workspace-dot { flex-shrink: 0; }

@media (max-width: 680px) {
  .topbar .breadcrumb { display: none; }
  .topbar .mobile-brand { display: flex; flex: 1 1 160px; min-width: 0; margin: 0; gap: 6px; font-size: 20px; }
  .mobile-brand .brand-mark { font-size: 27px; }
  .topbar { flex-wrap: wrap; }
}
html { scroll-padding-block: 16px; }
.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.sidebar > * { flex-shrink: 0; }
.sidebar-bottom { margin-top: auto; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.sidebar-profile { width: 100%; min-height: 60px; padding: 10px 4px; gap: 9px; border-radius: 10px; }
.sidebar-profile[hidden] { display: none; }
.sidebar-profile .avatar { flex-shrink: 0; width: 36px; height: 36px; }
.sidebar-profile strong { display: block; font-size: 12px; line-height: 1.5; }
.sidebar-profile small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.sidebar-profile .profile-chevron { margin-left: auto; flex-shrink: 0; }
.top-actions > .profile, .top-actions > .header-divider { display: none; }
@media (max-width: 680px) { .top-actions > .profile { display: flex; } }
.app-shell { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { min-height: 80px; height: auto; padding-block: 16px; gap: 16px; }
.top-actions, .profile, .breadcrumb { min-width: 0; }
.profile > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.top-actions { flex-shrink: 0; }
main, .dashboard-grid > *, .right-column, .cards > *, .stat > div { min-width: 0; }
.page-heading, .section-heading, .panel-title { gap: 12px; }
.page-heading > div, .section-heading > div { min-width: 0; }
.date-chip { flex-shrink: 0; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 34%);
  gap: 14px;
  padding-bottom: 0;
  overflow: visible;
}
.hero-copy, .large-text .hero-copy { max-width: none; min-width: 0; padding-bottom: 28px; }
.hero h2 { max-width: none; }
.hero-art {
  position: static;
  width: 100%;
  height: auto;
  max-width: 280px;
  align-self: end;
  justify-self: end;
}
.hero-art svg { display: block; width: 100%; height: auto; }
.hero-tag { max-width: 100%; white-space: normal; }
.primary, .secondary, .text-button, .course-footer button { overflow-wrap: anywhere; }
.primary .icon, .stat-icon, .goal-icon, .nav-icon, .close, .avatar { flex-shrink: 0; }
.stat { min-width: 0; flex-wrap: wrap; }
.stat-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.stat-label, .course h3, .course-desc, .task-row h3, .task-row p { overflow-wrap: anywhere; }
.course-meta, .course-footer { flex-wrap: wrap; }
.course-footer { gap: 10px; }
.filterbar > * { max-width: 100%; }
.filter { white-space: normal; overflow-wrap: anywhere; }
.field, .field select { min-width: 0; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.class-actions { display:flex; justify-content:flex-end; margin-bottom:18px; }
.material-fields { border:0; padding:0; margin:0; min-width:0; }
.material-fields[hidden] { display:none; }
.ebook-visual { display:grid; place-items:center; background:linear-gradient(135deg,#e2eddd,#f5efd9); }
.ebook-visual>.icon { width:76px; height:76px; color:var(--green); }
.course-footer>a.primary { font-size:12px; padding:10px 14px; white-space:normal; }
@media(max-width:680px){.class-actions>.primary{width:100%}}
.schedule-toolbar { display:flex; align-items:end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.schedule-class { display:grid; gap:6px; font-size:12px; font-weight:600; }
.schedule-class select { min-width:160px; }
.schedule-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-top:22px; }
.schedule-day { min-width:0; background:white; border:1px solid var(--line); border-radius:14px; padding:15px 12px; }
.schedule-day.is-today { border-color:var(--green); }
.schedule-day-heading { border-bottom:1px solid var(--line); padding-bottom:12px; margin-bottom:12px; }
.schedule-day-heading h2 { font-size:16px; }
.schedule-day-heading span,.schedule-empty { font-size:11px; color:var(--muted); }
.schedule-entry { background:#f3f7ef; border:1px solid #e5ecdf; border-radius:10px; padding:12px 10px; margin-top:10px; overflow-wrap:anywhere; }
.schedule-time { font-size:11px; color:var(--green); font-weight:700; }
.schedule-entry h3 { font-size:12px; line-height:1.6; margin-top:8px; }
.schedule-entry p { font-size:11px; }
.schedule-notes { white-space:pre-wrap; color:var(--muted); }
.schedule-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 16px; }
.form-error { color:#9d3b25; font-size:13px; }
.large-text .schedule-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.large-text .schedule-entry h3 { font-size:17px!important; }
.large-text .schedule-entry p,.large-text .schedule-time,.large-text .schedule-empty { font-size:14px!important; }
@media(max-width:1150px){.schedule-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.schedule-grid,.large-text .schedule-grid{grid-template-columns:1fr}.schedule-form-grid{grid-template-columns:1fr}.schedule-toolbar>.primary{width:100%}}
.bottom-banner { flex-wrap: wrap; }
.bottom-banner > div { flex: 1 1 180px; min-width: 0; }
.main-footer { flex-wrap: wrap; gap: 8px 20px; }
.simple .hero { grid-template-columns: 1fr; }

/* A dialog gets its own scrolling body; its close and action buttons stay visible. */
dialog {
  max-height: calc(100dvh - 32px);
  max-width: calc(100vw - 32px);
  overflow: hidden;
}
#dialog-content { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.modal-head, .modal-footer { flex-shrink: 0; }
.modal-head { gap: 14px; }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.modal-footer { flex-wrap: wrap; }
.modal-footer button { flex: 0 1 auto; }

@media (min-width: 681px) and (max-height: 820px) {
  .sidebar { padding: 18px 16px 12px; }
  .brand { margin-bottom: 20px; font-size: 24px; }
  .brand-mark { font-size: 43px; }
  .workspace { padding: 9px; }
  .nav-label { margin: 18px 12px 8px; }
  .sidebar nav { gap: 4px; }
  .sidebar nav a { padding: 10px 12px; }
  .sidebar-bottom { padding: 12px; margin-top: auto; }
  .support-art { display: none; }
  .sidebar-bottom p { margin: 4px 0 8px; font-size: 11px; line-height: 1.5; }
  .support-button { padding: 7px 9px; font-size: 11px; }
  .settings-link { padding: 12px 4px; }
  .sidebar-foot { padding-top: 10px; }
}
@media (min-width: 681px) and (max-width: 1200px) {
  :root { --sidebar-width: 210px; }
  .topbar { padding-inline: 24px; }
  main { padding: 24px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .right-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .right-column .panel { margin-bottom: 0; }
  .right-column .encouragement { grid-column: 1 / -1; }
  .hero-art { max-width: 245px; }
  .hero { min-height: 220px; }
  .top-actions { gap: 10px; }
  .demo-pill { display: none; }
}
@media (min-width: 681px) and (max-width: 850px) {
  :root { --sidebar-width: 184px; }
  .sidebar { padding-inline: 10px; }
  .brand { margin-inline: 5px; font-size: 22px; }
  .sidebar nav a { gap: 8px; padding-inline: 10px; font-size: 12px; }
  .topbar, main { padding-inline: 18px; }
  .top-actions .header-divider, .top-actions .bell { display: none; }
  .breadcrumb span { margin-inline: 6px; }
  .profile > span:nth-child(2), .profile > span:last-child { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr) 140px; padding-inline: 20px; }
  .cards { grid-template-columns: 1fr; }
  .right-column { grid-template-columns: 1fr; }
  .course-visual { height: 160px; }
}
@media (max-width: 680px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    width: 100%; height: auto; min-height: 70px;
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
    overflow: visible;
  }
  .sidebar nav { flex: 1; min-width: 0; }
  .sidebar nav a { min-width: 0; overflow-wrap: anywhere; justify-content: center; }
  .app-shell { padding-bottom: calc(86px + env(safe-area-inset-bottom)); margin-bottom: 0; }
  .topbar { min-height: 71px; padding: 12px 16px; }
  .page-heading { flex-wrap: wrap; }
  .date-chip { margin-top: 0; }
  .hero { grid-template-columns: minmax(0, 1fr) 110px; padding: 20px 16px 0; gap: 8px; min-height: 0; }
  .hero-copy { padding-bottom: 20px; }
  .hero h2 { max-width: none; font-size: 22px; }
  .hero h2 br { display: none; }
  .hero p { max-width: none; }
  .hero-art { width: 100%; opacity: 1; }
  .hero .primary { gap: 8px; padding-inline: 12px; }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .cards { grid-template-columns: 1fr; }
  .course-visual { height: 150px; }
  .course h3 { font-size: 16px; }
  .course-desc { font-size: 12px; min-height: 0; }
  .course-body { padding: 16px; }
  .right-column { display: grid; grid-template-columns: 1fr; }
  .right-column .goal-panel, .right-column .encouragement { display: block; }
  .bottom-banner button { white-space: normal; }
  .settings-link { display: none; }
  .large-text .sidebar nav a { font-size: 11px !important; }
  .large-text .hero { grid-template-columns: 1fr; }
  .large-text .page-heading h1 { font-size: 27px; }
  .large-text .stats { grid-template-columns: 1fr; }
  .large-text .stat { text-align: left; }
  .large-text .date-chip { white-space: normal; }
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .topbar { flex-wrap: wrap; gap: 6px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 130px; justify-self: center; }
  .hero-copy { padding-bottom: 0; }
  .stats { grid-template-columns: 1fr; }
  .stat { display: flex; text-align: left; gap: 12px; }
  .stat-icon { display: grid; }
  .setting-row { flex-wrap: wrap; }
}

.announcement-card { padding: 18px 0; border-bottom: 1px solid #e5ebe5; }
.announcement-card h3 { margin: 12px 0; overflow-wrap: anywhere; }
.announcement-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }

.top-actions .bell { display: inline-flex; align-items: center; justify-content: center; }

.accessibility-fab {
  position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; padding: 2px; border-radius: 50%; background: #176553; color: #fff;
  display: grid; place-items: center; z-index: 8; box-shadow: 0 4px 18px #173d3433; border: 2px solid #fff;
}
.accessibility-fab img { display: block; width: 100%; height: 100%; }
.accessibility-fab:focus-visible { outline: 3px solid #d1841d; outline-offset: 4px; }
.high-contrast .accessibility-fab { background: #000; border-color: #fff; }
.main-footer { padding-right: 104px; }
@media (max-width: 680px) {
  .accessibility-fab { right: max(16px, env(safe-area-inset-right)); bottom: calc(106px + env(safe-area-inset-bottom)); width: 60px; height: 60px; }
  #toast { bottom: calc(180px + env(safe-area-inset-bottom)); }
}

.access-support { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.access-support h3 { margin: 0 0 8px; }
.access-support p { margin: 0 0 16px; }
.access-support button { max-width: 100%; white-space: normal; }

.task-instructions { white-space: pre-wrap; overflow-wrap: anywhere; }

.task-link { display: inline-flex; align-items: center; margin: 8px 8px 12px 0; max-width: 100%; white-space: normal; }

.badge-summary { margin-bottom: 18px; }
.badge-summary h2 { margin-top: 0; }
.badge-summary .notice { margin-bottom: 0; }
.badge-rule { margin-bottom: 24px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.animal-badge { min-width: 0; padding: 28px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); text-align: center; }
.badge-medallion { width: 160px; height: 160px; margin: 0 auto 18px; }
.badge-medallion img { display: block; width: 100%; height: 100%; object-fit: contain; }
.animal-badge.is-earned { border: 2px solid #56896b; }
.badge-level { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.animal-badge h2 { margin: 0 0 12px; font-size: 20px; overflow-wrap: anywhere; }
.badge-status { display: inline-block; padding: 5px 12px; border-radius: 20px; background: #edf1ed; color: #44574e; font-size: 12px; font-weight: 700; }
.is-earned .badge-status { background: #e6f3e9; color: #24573d; }
.animal-badge>p:not(.badge-level) { font-size: 13px; }
.animal-badge progress { display: block; width: 100%; height: 9px; accent-color: #176553; margin: 14px 0 8px; }
.badge-count { font-size: 12px; color: var(--muted); }
.high-contrast .badge-count, .high-contrast .badge-level { color: #263c31; }
@media (max-width: 1050px) { .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px) { .badge-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .badge-grid { gap: 12px; } .animal-badge { padding: 20px 12px; } .badge-medallion { width: min(132px, 100%); height: auto; aspect-ratio: 1; } .animal-badge h2 { font-size: 17px; } .large-text .badge-grid { grid-template-columns: 1fr; } }

.hero-message { min-height: 214px; }
.hero-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 20px; }
.hero-arrow { width: 44px; height: 44px; border: 1px solid #bbd0b0; border-radius: 50%; background: #ffffffb3; color: #244e37; font-size: 22px; flex-shrink: 0; }
.hero-dots { display: flex; gap: 0; }
.hero-dot { width: 28px; height: 44px; padding: 0; background: transparent; display: grid; place-items: center; }
.hero-dot span { display: block; width: 8px; height: 8px; border-radius: 50%; background: #8c9e80; }
.hero-dot[aria-pressed="true"] span { width: 20px; border-radius: 8px; background: #176553; }
.hero-slide-status { font-size: 12px; color: #435c3e; white-space: nowrap; margin-left: 4px; }
.high-contrast .hero-arrow { border-color: #244e37; background: #fff; }
.high-contrast .hero-dot span { background: #586a4c; }
.high-contrast .hero-dot[aria-pressed="true"] span { background: #063e28; }
.large-text .hero-message { min-height: 260px; }
@media (max-width: 680px) { .hero-message { min-height: 190px; } .hero-controls { gap: 2px; } .hero-dot { width: 24px; } .hero-slide-status { margin-left: 0; } }
@media (max-width: 440px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-art { display: none; } .hero-message { min-height: 175px; } .large-text .hero-message { min-height: 230px; } }

.manage-actions, .manage-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.manage-actions { margin-top: 16px; }
.manage-actions .secondary { min-height: 44px; padding: 10px 16px; font-size: 12px; }
.danger-text { color: #9b3232; }
.class-actions { gap: 10px; flex-wrap: wrap; }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.archive-row h3 { margin: 0; overflow-wrap: anywhere; }
.archive-row p { margin: 6px 0; }
.archive-row>div { min-width: 0; }
.archive-row button { flex-shrink: 0; }
.archive-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.semester-certificates { margin-bottom: 24px; }
.semester-certificates .section-heading { flex-wrap: wrap; gap: 16px; }
.semester-certificates h2 .icon { width: 22px; vertical-align: middle; margin-right: 6px; }
.certificate-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,300px),1fr)); gap: 16px; }
.semester-card { display: flex; gap: 16px; padding: 20px; border: 1px solid #d9dfce; border-radius: 12px; background: #fffdf5; min-width: 0; }
.semester-card>div { min-width: 0; }
.semester-card h3 { margin: 12px 0 8px; overflow-wrap: anywhere; }
.semester-card p { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.semester-card .secondary { display: inline-flex; margin-top: 8px; min-height: 44px; align-items: center; }
.semester-medal { color: #a28543; font-size: 38px; flex-shrink: 0; }
.certificate-confirm { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.7; margin: 20px 0; }
.certificate-confirm input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
@media(max-width:680px) { .semester-certificates .section-heading>.primary { width: 100%; } .semester-card { padding: 16px; gap: 12px; } }
@media (max-width: 680px) { .archive-actions { width: 100%; } .archive-actions button { flex: 1; min-width: 0; } }
@media (max-width: 680px) { .manage-actions>button { flex: 1; } .archive-row { flex-wrap: wrap; } .archive-row button { width: 100%; } .class-actions>.secondary { width: 100%; } .manage-toolbar { width: 100%; } .manage-toolbar>button { flex: 1; } }

/* Keep task content and controls in separate rows at every viewport size. */
.collection-intro { display: flex; gap: 16px; align-items: flex-start; padding: 20px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 16px; }
.collection-intro > .icon { width: 32px; height: 32px; flex-shrink: 0; }
.collection-intro h2 { margin: 0 0 8px; font-size: 18px; }
.collection-intro p { margin: 0; line-height: 1.7; }
.collection-intro a { color: inherit; text-decoration: underline; }
.class-intro { background: #edf4e8; color: #244e37; }
.library-intro { background: #eaf1fa; color: #24466b; }
.high-contrast .collection-intro { background: #fff; color: #102b1c; border-color: currentColor; }
@media (max-width: 680px) { .collection-intro { padding: 16px; gap: 12px; } .collection-intro p { font-size: 13px; } }

.task-row { display: grid; grid-template-columns: 55px minmax(0, 1fr); align-items: start; gap: 16px; }
.task-row .task-emoji { flex-shrink: 0; }
.task-row .task-content { min-width: 0; }
.task-row h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.5; }
.task-row .subtext { margin: 0 0 12px; }
.task-row .task-instructions { margin: 0; line-height: 1.7; }
.task-status { margin-top: 12px; }
.submission-status { display: inline-block; padding: 6px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; line-height: 1.5; }
.submission-status.pending { background: #fff1da; color: #724710; }
.submission-status.submitted { background: #eaf1fa; color: #24466b; }
.submission-status.reviewed { background: #e5f2e8; color: #24573d; }
.student-review { border-bottom: 1px solid var(--line); padding: 16px 0; }
.student-review details { border: 1px solid var(--line); border-radius: 12px; margin: 12px 0; padding: 14px; overflow-wrap: anywhere; }
.student-review summary { cursor: pointer; line-height: 1.7; }
.student-review summary .submission-status { margin: 4px 0 4px 8px; }
.evidence-link { display: inline-flex; align-items: center; min-height: 44px; margin: 12px 0; white-space: normal; overflow-wrap: anywhere; }
.student-review button { min-height: 44px; white-space: normal; }
.high-contrast .submission-status { color: #102b1c; background: #fff; border: 1px solid currentColor; }
.scope-options { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 16px 0; }
.scope-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; line-height: 1.5; }
.scope-options input { width: 22px; height: 22px; flex-shrink: 0; }
.backup-list article { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.backup-list a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 440px) { .scope-options { grid-template-columns: minmax(0,1fr); } }
.task-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.task-row button, .task-actions .task-link { margin: 0; min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
.task-actions .task-link { justify-content: center; text-align: center; }
.task-actions button[data-action="collect-task"]:disabled { cursor: default; opacity: 1; }
.task-actions .manage-actions { margin: 0 0 0 auto; gap: 8px; }
@media (max-width: 680px) {
 .task-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 16px; }
 .task-row h3 { font-size: 15px; }
 .task-row p { font-size: 13px; }
 .task-actions > button, .task-actions > .task-link { flex: 1 1 180px; font-size: 13px; }
 .task-actions .manage-actions { flex: 1 1 100%; margin: 0; }
 .task-actions .manage-actions > button { flex: 1 1 0; }
}
