:root {
  color-scheme: light;
  --bg: #f3f7f2;
  --panel: #ffffff;
  --panel-soft: #f8fbf7;
  --text: #17211b;
  --muted: #627168;
  --line: #dce6de;
  --green: #146c3d;
  --green-2: #0f5130;
  --green-soft: #e5f2e8;
  --red: #c52b32;
  --red-soft: #fae7e9;
  --amber: #b98517;
  --amber-soft: #fff3d7;
  --blue: #276b8f;
  --blue-soft: #e5f1f7;
  --dark: #101915;
  --shadow: 0 18px 42px rgba(16, 25, 21, 0.09);
  --shadow-soft: 0 10px 24px rgba(16, 25, 21, 0.07);
  --accent: var(--green);
  --accent-soft: var(--green-soft);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

button,
.quickGrid button,
.studentList button,
.lookupResults button,
.groupRail button,
.statusFilters button {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input[readonly],
textarea[readonly] {
  background: #f3f6f3;
  color: #526158;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  background: #edf4f2;
}

.loginBrand {
  background: #0b2d27;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 56px;
  box-shadow: inset -4px 0 0 #2b7888;
}

.loginBrandTop {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.loginSeal {
  width: 172px;
  height: 172px;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
}

.loginSeal img {
  width: 138px;
  height: 138px;
  object-fit: contain;
}

.loginBrand h1 {
  margin: 8px 0 10px;
  max-width: 760px;
  font-size: 64px;
  line-height: 0.95;
  letter-spacing: 0;
}

.loginBrand .eyebrow {
  color: #75d0bc;
}

.loginBadge,
.loginFeatureGrid span {
  border: 1px solid #376057;
  border-radius: 8px;
  background: #123d35;
  color: #e7f3ef;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}

.loginFeatureGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.loginBrand p,
.topbar p,
.sectionTitle p,
.metric p,
.teacherCard p,
.quickGrid span {
  color: var(--muted);
}

.loginBrand p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
}

.loginPanel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #edf4f2;
}

.loginCard {
  width: min(100%, 430px);
  background: #ffffff;
  border: 1px solid #cbdcd7;
  border-top: 4px solid #2b7888;
  border-radius: 8px;
  box-shadow: 0 24px 58px rgba(11, 45, 39, 0.14);
  padding: 28px;
  display: grid;
  gap: 16px;
  animation: riseIn 260ms ease-out both;
}

.loginCardHead {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.loginCardHead > span {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e2f1ed;
  color: #12654f;
}

.loginCard input:focus {
  border-color: #2b7888;
  outline: 3px solid rgba(43, 120, 136, 0.14);
}

.loginCard .primary {
  background: #12654f;
}

.loginCard .primary:hover {
  background: #2b7888;
  box-shadow: 0 8px 20px rgba(43, 120, 136, 0.22);
}

.loginCard h2,
.loginCardHead p {
  margin: 0;
}

.loginCardHead p {
  color: var(--muted);
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.message {
  min-height: 22px;
  color: var(--red);
  margin: 0;
}

.primary,
.ghost,
.danger,
.small {
  min-height: 40px;
  border-radius: 8px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: var(--green);
  color: #ffffff;
}

.primary:hover {
  background: var(--green-2);
  transform: translateY(-1px);
}

.ghost,
.small {
  background: #edf4ef;
  color: var(--text);
}

.danger {
  background: var(--red-soft);
  color: var(--red);
}

.ghost:hover,
.small:hover {
  background: #e3eee6;
  transform: translateY(-1px);
}

.danger:hover {
  background: #f6dadd;
  transform: translateY(-1px);
}

.danger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.wide {
  width: 100%;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  --accent: var(--green);
  --accent-soft: var(--green-soft);
}

.role-administrador {
  --accent: var(--green);
  --accent-soft: var(--green-soft);
}

.role-docente {
  --accent: var(--blue);
  --accent-soft: var(--blue-soft);
}

.role-alumno {
  --accent: #7b5b10;
  --accent-soft: var(--amber-soft);
}

.side {
  background: var(--dark);
  color: #ffffff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.nav button {
  min-height: 48px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  padding: 8px;
}

.nav button span,
.sectionTitle > span,
.metric > span {
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.nav button span {
  width: 34px;
  height: 34px;
  color: #dff0e3;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.nav button span .icon {
  width: 18px;
  height: 18px;
}

.nav button strong {
  overflow-wrap: anywhere;
}

.nav button.selected,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav button.selected span {
  background: var(--accent);
  color: #ffffff;
}

.sideLogout {
  margin-top: auto;
  min-height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.main {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

#view {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.topbar,
.panel,
.metric,
.heroPanel,
.teacherCard,
.quickGrid button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  animation: riseIn 220ms ease-out both;
}

.topbar {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin-bottom: 4px;
  font-size: 26px;
}

.topbar p {
  margin: 0;
}

.topbarTools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.topbar > div:first-child {
  min-width: 0;
}

.cyclePill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #bdd8c3;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.searchBox {
  display: grid;
  gap: 5px;
  width: min(360px, 42vw);
}

.searchControl {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding-left: 10px;
}

.searchControl .icon {
  color: var(--muted);
}

.searchControl input {
  border: 0;
  padding-left: 0;
}

.searchBox span,
.field span,
.loginCard label span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.toast {
  border-radius: 8px;
  border: 1px solid #bdd8c3;
  background: #e9f6ec;
  color: var(--green-2);
  padding: 12px 14px;
  animation: fadeIn 160ms ease-out both;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.loading,
.errorBox,
.emptyState {
  color: var(--muted);
}

.errorBox {
  border-color: #f1c3c7;
  background: var(--red-soft);
  color: var(--red);
}

.heroPanel {
  min-height: 172px;
  padding: 24px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  background: #ffffff;
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--line));
  position: relative;
  overflow: hidden;
}

.heroPanel::before {
  content: "";
  width: 5px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--accent);
  grid-row: 1;
}

.heroPanel > div:first-child {
  grid-column: 2;
}

.heroPanel img,
.heroPanel .heroMark {
  grid-column: 3;
}

.heroPanel h2 {
  margin: 6px 0 10px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.heroPanel p {
  margin: 0;
  color: var(--muted);
}

.heroPanel img {
  width: 132px;
  height: 132px;
  object-fit: contain;
}

.heroMark {
  width: 118px;
  height: 118px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
}

.metricsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.metricsGrid.mini {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric {
  min-height: 94px;
  padding: 14px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.metric > span {
  width: 44px;
  height: 44px;
  background: var(--accent-soft);
  color: var(--accent);
}

.metric .icon {
  width: 20px;
  height: 20px;
}

.metric strong {
  display: block;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.metric p {
  margin: 4px 0 0;
}

.metric.red > span {
  background: var(--red-soft);
  color: var(--red);
}

.metric.amber > span {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric.blue > span {
  background: var(--blue-soft);
  color: var(--blue);
}

.sectionTitle {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sectionTitle > span {
  width: 42px;
  height: 42px;
  background: var(--accent-soft);
  color: var(--accent);
}

.sectionTitle .icon {
  width: 19px;
  height: 19px;
}

.sectionTitle h2 {
  margin: 0;
  font-size: 20px;
}

.sectionTitle p {
  margin: 3px 0 0;
}

.groupRail,
.statusFilters,
.actionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.moduleActions {
  margin: 0 0 14px;
}

.groupRail button,
.statusFilters button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 11px;
}

.groupRail button span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}

.groupRail button.selected,
.statusFilters button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--green-2);
}

.monthGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.monthGrid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
  display: grid;
  gap: 4px;
}

.monthGrid span,
.monthGrid small {
  color: var(--muted);
}

.lookupForm {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
}

.lookupLayout {
  display: grid;
  grid-template-columns: minmax(250px, 0.38fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.lookupResults,
.studentList {
  display: grid;
  gap: 8px;
  align-content: start;
}

.lookupResults button,
.studentList button {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  padding: 10px;
}

.lookupResults button {
  display: grid;
  gap: 4px;
}

.lookupResults button.selected,
.studentList button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lookupResults span,
.lookupResults small,
.studentList small {
  color: var(--muted);
}

.lookupDetail {
  min-width: 0;
  display: grid;
  gap: 12px;
}

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

.lookupHeader strong,
.lookupHeader span {
  display: block;
}

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

.rosterLayout {
  display: grid;
  grid-template-columns: minmax(290px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.studentList {
  max-height: 660px;
  overflow: auto;
  padding-right: 2px;
}

.studentList.compact {
  max-height: 420px;
}

.studentList button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  flex: 0 0 auto;
}

.avatar.large {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 9px;
  background: #eef2ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green-2);
}

.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.badge.amber {
  background: var(--amber-soft);
  color: #7c560c;
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.profilePanel {
  display: grid;
  gap: 16px;
}

.profileHeader {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.profileHeader h2 {
  margin: 0 0 4px;
}

.profileHeader p,
.profileHeader small {
  margin: 0;
  color: var(--muted);
}

.formGrid,
.createUser,
.createStudent,
.createGrade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.cycleCreate {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(320px, 2fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

.cycleCreate > button {
  min-height: 42px;
}

.cycleTable table {
  min-width: 1180px;
}

.cycleTable td {
  vertical-align: top;
}

.cycleTable td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.cycleStatus,
.activeCycleBadge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.activeCycleBadge,
.status-ok {
  background: var(--green-soft);
  color: var(--green-2);
}

.status-syncing,
.status-pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-initial {
  background: #eef3ef;
  color: var(--muted);
}

.status-error {
  background: var(--red-soft);
  color: var(--red);
}

.cycleTable .warningText {
  color: #7c560c;
}

.cycleTable .errorText {
  color: var(--red);
}

.cycleActions {
  min-width: 190px;
}

.createStudent,
.createGrade {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 6px;
}

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

.wideField {
  grid-column: 1 / -1;
}

.teacherGrid,
.quickGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.teacherCard {
  padding: 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
}

.teacherCard p,
.teacherCard small {
  margin: 4px 0 0;
}

.teacherCard small {
  color: var(--muted);
}

.quickGrid button {
  min-height: 124px;
  text-align: left;
  padding: 16px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.quickGrid button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.quickGrid strong,
.quickGrid span {
  display: block;
}

.quickGrid .quickCopy {
  min-width: 0;
}

.quickGrid small {
  color: var(--muted);
}

.quickAction .quickIcon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.quickAction .quickIcon .icon {
  width: 23px;
  height: 23px;
}

.quickAction i {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eef3ef;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-style: normal;
}

.quickAction i .icon {
  width: 16px;
  height: 16px;
}

.quickAction.green .quickIcon {
  color: var(--green);
  background: var(--green-soft);
}

.quickAction.blue .quickIcon {
  color: var(--blue);
  background: var(--blue-soft);
}

.quickAction.amber .quickIcon {
  color: var(--amber);
  background: var(--amber-soft);
}

.tableWrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
}

.paginationBar {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.paginationBar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paginationBar strong {
  color: var(--text);
  white-space: nowrap;
}

.paginationBar .previous .icon {
  transform: rotate(180deg);
}

.chartList,
.methodList,
.auditList,
.passwordBox,
.profileFacts,
.checkList {
  display: grid;
  gap: 10px;
}

.chartList > div,
.methodList > div,
.auditList > div,
.profileFacts > div,
.checkList > span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.chartList > div > div,
.methodList > div,
.auditList > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chartList span,
.methodList span,
.auditList span,
.auditList small,
.profileFacts span {
  color: var(--muted);
}

.auditList strong,
.auditList span,
.auditList small,
.profileFacts span,
.profileFacts strong {
  display: block;
}

.bar {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #e8eee9;
  overflow: hidden;
  margin-top: 8px;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar.red span {
  background: var(--red);
}

.bar.blue span {
  background: var(--blue);
}

.bar.amber span {
  background: var(--amber);
}

.mobileNav {
  display: none;
}

.mobileMenuLayer {
  display: none;
}

.iconButton {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--text);
}

.installAppButton[hidden] {
  display: none;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.compactTable table {
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td input,
td select {
  min-width: 120px;
}

.gradeInput {
  width: 86px;
  min-width: 76px;
}

.linkCell {
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  display: grid;
  gap: 2px;
}

.linkCell small {
  color: var(--muted);
}

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

.muted {
  color: var(--muted);
}

@media (max-width: 1280px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbarTools {
    justify-content: flex-start;
  }

  .searchBox {
    width: min(100%, 460px);
  }
}

@media (max-width: 1100px) {
  .lookupLayout,
  .rosterLayout,
  .lookupTables,
  .twoColumns {
    grid-template-columns: 1fr;
  }

  .studentList {
    max-height: 440px;
  }
}

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

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

  .loginBrand,
  .loginPanel {
    min-height: auto;
  }

  .loginBrand {
    padding: 32px;
    box-shadow: inset 0 -4px 0 #2b7888;
  }

  .loginBrand h1 {
    font-size: 44px;
  }

  .loginBrandTop {
    align-items: center;
  }

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

  .side {
    position: sticky;
    top: 0;
    z-index: 24;
    height: 72px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 22px rgba(16, 25, 21, 0.14);
  }

  .nav {
    display: none;
  }

  .brand {
    flex: 1;
    min-width: 0;
    padding-bottom: 0;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 9px;
  }

  .brand img {
    width: 44px;
    height: 44px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    margin-top: 2px;
    font-size: 12px;
  }

  .sideLogout {
    margin-top: 0;
    min-height: 44px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .main {
    gap: 12px;
    padding: 12px 12px 88px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbarTools,
  .searchBox {
    width: 100%;
  }

  .heroPanel {
    grid-template-columns: minmax(0, 1fr) 96px;
    min-height: auto;
    padding: 18px;
    gap: 14px;
  }

  .heroPanel::before {
    display: none;
  }

  .heroPanel > div:first-child,
  .heroPanel img,
  .heroPanel .heroMark {
    grid-row: 1;
  }

  .heroPanel > div:first-child {
    grid-column: 1;
  }

  .heroPanel img,
  .heroPanel .heroMark {
    grid-column: 2;
  }

  .heroPanel img,
  .heroMark {
    width: 96px;
    height: 96px;
  }

  .heroMark {
    font-size: 28px;
  }

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

  .mobileNav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(220, 230, 222, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 34px rgba(16, 25, 21, 0.18);
  }

  .mobileNav::-webkit-scrollbar {
    display: none;
  }

  .mobileNav button {
    min-width: 0;
    min-height: 58px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    gap: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.05;
    padding: 5px 3px;
  }

  .mobileNav button span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .mobileNav button .icon {
    width: 20px;
    height: 20px;
  }

  .mobileNav button.selected {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .mobileMenuLayer {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    align-items: end;
  }

  .mobileMenuLayer[hidden] {
    display: none;
  }

  .mobileMenuBackdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(16, 25, 21, 0.58);
  }

  .mobileMenuSheet {
    position: relative;
    max-height: 76dvh;
    overflow-y: auto;
    border-radius: 8px 8px 0 0;
    background: #ffffff;
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 48px rgba(16, 25, 21, 0.2);
  }

  .mobileMenuSheet header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobileMenuSheet h2 {
    margin: 3px 0 0;
    font-size: 22px;
  }

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

  .mobileMenuGrid button {
    min-height: 78px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 10px;
    text-align: left;
    background: #ffffff;
    color: var(--text);
  }

  .mobileMenuGrid button > span {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
  }

  .mobileMenuGrid button.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
}

@media (max-width: 720px) {
  .tableWrap {
    overflow: visible;
  }

  .tableWrap table,
  .compactTable table,
  .cycleTable table {
    min-width: 0;
  }

  .tableWrap thead {
    display: none;
  }

  .tableWrap tbody {
    display: grid;
    gap: 10px;
  }

  .tableWrap tr {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 6px;
  }

  .tableWrap td {
    width: 100%;
    border: 0;
    display: grid;
    grid-template-columns: minmax(88px, 0.38fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 8px;
    overflow-wrap: anywhere;
  }

  .tableWrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
  }

  .tableWrap td[data-label=""] {
    display: block;
  }

  .tableWrap td[data-label=""]::before {
    display: none;
  }

  .tableWrap td input,
  .tableWrap td select,
  .gradeInput {
    width: 100%;
    min-width: 0;
  }

  .tableActions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tableActions button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .studentList button {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .studentList .badge {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .teacherGrid,
  .quickGrid,
  .formGrid,
  .createUser,
  .createStudent,
  .createGrade {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px;
    gap: 12px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar > div:first-child .eyebrow,
  .topbar > div:first-child p {
    display: none;
  }

  .topbarTools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .topbarTools .searchBox {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .topbarTools .installAppButton {
    grid-column: 1 / -1;
  }

  .cyclePill {
    width: fit-content;
  }

  .panel {
    padding: 14px;
  }

  .heroPanel {
    grid-template-columns: minmax(0, 1fr) 72px;
    padding: 16px;
    gap: 10px;
  }

  .heroPanel h2 {
    font-size: 24px;
  }

  .heroPanel p {
    font-size: 14px;
  }

  .heroPanel img,
  .heroMark {
    width: 72px;
    height: 72px;
  }

  .heroMark {
    font-size: 22px;
  }

  .metricsGrid,
  .metricsGrid.mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 82px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .metric > span {
    width: 34px;
    height: 34px;
  }

  .metric strong {
    font-size: 16px;
  }

  .metric p {
    font-size: 12px;
  }

  .sectionTitle {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
  }

  .sectionTitle > span {
    width: 36px;
    height: 36px;
  }

  .sectionTitle h2 {
    font-size: 18px;
  }

  .sectionTitle p {
    font-size: 13px;
  }

  .groupRail,
  .statusFilters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    margin-inline: -14px;
    padding: 0 14px 6px;
  }

  .groupRail::-webkit-scrollbar,
  .statusFilters::-webkit-scrollbar {
    display: none;
  }

  .groupRail button,
  .statusFilters button {
    flex: 0 0 auto;
  }

  .monthGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studentList,
  .studentList.compact {
    max-height: none;
  }

  .actionRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actionRow > button {
    width: 100%;
  }

  .paginationBar,
  .paginationBar > div {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .paginationBar > div {
    grid-template-columns: 1fr auto 1fr;
  }

  .paginationBar button {
    min-width: 0;
    padding-inline: 8px;
  }

  .loginSeal {
    width: 124px;
    height: 124px;
  }

  .loginSeal img {
    width: 100px;
    height: 100px;
  }

  .loginBrand {
    padding: 24px;
  }

  .loginBrand h1 {
    font-size: 36px;
  }

  .loginBrand p {
    font-size: 16px;
  }

  .loginFeatureGrid {
    display: none;
  }

  .loginPanel {
    padding: 24px 16px;
  }

  .loginCard {
    padding: 22px;
  }

  .quickGrid button {
    grid-template-columns: 42px minmax(0, 1fr) 26px;
    min-height: 92px;
    padding: 12px;
  }
}
