/* Regras compartilhadas: o conteúdo encolhe; tabelas rolam dentro do próprio card. */
.workspace, main, .page-heading > *, .grid > *, .content-grid > * { min-width: 0; }
img, video { max-width: 100%; }
input, select, textarea { max-width: 100%; min-width: 0; }
.table-wrap { max-width: 100%; overscroll-behavior-inline: contain; }
.card, .question, .reading { overflow-wrap: anywhere; }
.filters > label, .inline > label { min-width: 0; flex: 1 1 150px; }
.inline { max-width: 100%; }
.topbar { display: flex; flex-wrap: wrap; gap: 16px; }
.topbar-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 18px; margin-left: auto; min-width: 0; }
.topbar .account { min-width: 0; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account form { margin: 0; }
.page-heading > .inline { margin-bottom: 0; }
dialog { overscroll-behavior: contain; }

@media (max-width: 1250px) {
    .theme-caption { display: none; }
    .topbar > .eyebrow { display: none; }
    .topbar-tools { width: 100%; justify-content: space-between; }
}

@media (min-width: 761px) and (max-width: 1000px) {
    .grid.metrics, .grid.two, .grid.cards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .topbar { padding: 12px 16px; align-items: flex-start; }
    .topbar-tools { display: contents; }
    .topbar .account { margin-left: auto; min-height: 44px; }
    .topbar .theme-control { order: 3; flex: 1 0 100%; justify-content: flex-end; }
    .theme-caption { display: block; margin-right: auto; }
    html[data-theme] .theme-option { min-height: 44px; }
    .account-name { max-width: 150px; }
    main { padding: 22px 16px; }
    .filters { align-items: stretch; }
    .filters > button { align-self: flex-end; }
    .page-heading { align-items: stretch; }
    .page-heading > .inline { width: 100%; }
    .dialog-actions { flex-wrap: wrap; }
    .dialog-actions button { flex: 1 1 120px; }
    dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); margin: auto; }
    .student .bottom-nav a { min-height: 44px; min-width: 44px; justify-content: center; }
}

@media (max-width: 420px) {
    .theme-caption { display: none; }
    .topbar .theme-control { justify-content: center; }
    .theme-options { width: 100%; justify-content: space-between; }
    html[data-theme] .theme-option { flex: 1; padding-inline: 6px; }
    .metric { flex-wrap: wrap; gap: 16px; }
    .filters > label { flex-basis: 100%; }
    .filters > button { width: 100%; }
    .alternative { gap: 10px; padding: 12px 10px; }
    .hub-card { gap: 12px; }
    .hub-card h3 { font-size: 19px; }
    .bar-row { grid-template-columns: minmax(0, 1fr) 65px 36px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.menu-backdrop[hidden], .student-menu-heading { display: none; }
@media (max-width: 760px) {
    .student .sidebar { width: min(300px, 88vw); z-index: 40; visibility: hidden; }
    .student.nav-open .sidebar { visibility: visible; }
    .student.nav-open { overflow: hidden; }
    .student .menu-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 35; border: 0; border-radius: 0; background: #14141480; }
    .student-menu-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--muted); font-size: 11px; }
    .student .menu-dismiss { display: grid; place-items: center; min-height: 44px; width: 44px; padding: 0; }
}

/* A tela de acesso usa os mesmos temas, com preferência independente da conta. */
.login-card .theme-control { margin-bottom: 28px; justify-content: center; }
.login-card .theme-caption { display: none; }
.login-card .theme-option { width: auto; margin: 0; justify-content: center; }
.login-page > * { min-width: 0; }
.login-card .theme-options { width: 100%; justify-content: space-between; }
.login-card .theme-option { flex: 1; padding-inline: 6px; }
.connection-notice[hidden] { display: none; }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-180%); z-index: 100; padding: 12px 20px; border-radius: 8px; background: var(--theme-surface); }
.skip-link:focus { transform: none; }
button.is-submitting { cursor: progress; opacity: .7; }
button.is-submitting::after { content: '…'; }
.hub-card { transition: transform .16s ease, box-shadow .16s ease; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .hub-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
}
@media (max-width: 760px) {
    .menu-dismiss { min-width: 44px; min-height: 44px; }
    .login-card { padding: 28px 22px; }
    .empty { padding: 28px 18px; }
}
