:root {
  --page: #e9eff4;
  --surface: #ffffff;
  --surface-subtle: #edf2f6;
  --text: #0b1823;
  --text-soft: #1e3344;
  --muted: #334b5c;
  --border: #bdc9d3;
  --border-strong: #8494a3;
  --navy: #174568;
  --navy-dark: #0c3049;
  --navy-muted: #385367;
  --primary: #005f93;
  --primary-hover: #004d78;
  --primary-soft: #dcecf5;
  --success: #17613d;
  --success-soft: #e2f1e9;
  --warning: #714600;
  --warning-soft: #f9edcb;
  --danger: #971f1f;
  --danger-hover: #771818;
  --danger-soft: #f7e2e2;
  --info: #005f93;
  --info-soft: #dcecf5;
  --radius-sm: 8px;
  --radius-lg: 12px;
  --sidebar-width: 280px;
  --topbar-height: 82px;
  --overlay-shadow: 0 18px 48px rgba(21, 36, 50, 0.2);
}

body {
  background: var(--page);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3,
strong {
  font-weight: 600;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.28rem;
}

h3 {
  font-size: 1.05rem;
}

input,
select,
textarea {
  border-color: var(--border-strong);
  border-radius: 7px;
  background: #ffffff;
  transition: border-color 100ms ease;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 1;
}

button:disabled {
  border-color: var(--border);
  background: #e5ebf0;
  color: #516575;
}

input:disabled,
select:disabled,
textarea:disabled {
  border-color: var(--border);
  background: #e5ebf0;
  color: #344b5d;
}

input::placeholder,
textarea::placeholder {
  color: #526779;
  opacity: 1;
}

input,
select {
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #68a4d4;
  outline-offset: 1px;
}

.context-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.brand-logo {
  width: 30px;
  height: 39px;
  flex-basis: 30px;
}

.brand-logo-large {
  width: 48px;
  height: 62px;
}

.brand-lockup {
  gap: 9px;
}

.brand-lockup strong {
  color: var(--navy-dark);
  font-size: 0.95rem;
}

.brand-lockup small,
.brand-lockup-light small {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-lockup-light {
  color: var(--text);
}

/* Acceso institucional */

.auth-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
  place-items: center;
  border-top: 6px solid var(--navy);
  background: #dfe7ee;
  padding: 44px 20px;
}

.auth-access {
  display: block;
  width: min(430px, 100%);
  min-height: 0;
  padding: 0;
}

.auth-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(22, 52, 76, 0.1);
  padding: 38px 40px;
}

.auth-institution {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.auth-institution > span {
  display: grid;
  gap: 2px;
}

.auth-institution strong {
  color: var(--navy-dark);
  font-size: 1rem;
}

.auth-institution small {
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-heading {
  margin: 28px 0 24px;
}

.auth-heading h2 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
}

.auth-heading > p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.auth-form {
  gap: 18px;
}

.form-field {
  gap: 7px;
}

.form-field > span:first-child,
.color-field legend {
  color: var(--text-soft);
  font-size: 0.87rem;
  font-weight: 600;
}

.input-shell input {
  min-height: 46px;
}

.forgot-button {
  margin-top: -2px;
  font-size: 0.84rem;
}

.button,
.icon-button,
.text-button {
  border-radius: 4px;
  font-weight: 600;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.88rem;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.button-secondary,
.button-google {
  border-color: var(--border-strong);
  background: #ffffff;
  color: var(--text-soft);
}

.button-secondary:hover:not(:disabled),
.button-google:hover:not(:disabled) {
  border-color: #8f99a5;
  background: var(--surface-subtle);
}

.button-quiet {
  border-color: var(--border);
  background: #ffffff;
  color: var(--primary-hover);
}

.button-full {
  min-height: 46px;
}

.auth-divider {
  font-size: 0.8rem;
}

.register-copy {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 15px;
}

/* Estructura de trabajo */

.app-shell {
  background: var(--page);
}

.app-sidebar {
  border-right: 1px solid var(--border);
  background: #f9fbfc;
  color: var(--text);
}

.sidebar-brand {
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.sidebar-section-heading {
  min-height: 48px;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 14px 16px 8px 20px;
}

.sidebar-add-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--primary);
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 600;
}

.sidebar-add-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sidebar-add-button svg {
  width: 14px;
  height: 14px;
}

.sidebar-search {
  margin: 0 14px 14px;
}

.sidebar-search > svg {
  color: var(--muted);
}

.sidebar-search input {
  min-height: 42px;
  border-color: var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 0.87rem;
}

.sidebar-search input::placeholder {
  color: #526779;
}

.sidebar-search input:focus {
  border-color: var(--primary);
  box-shadow: none;
}

.subject-list {
  gap: 0;
  padding: 0 10px 16px;
}

.subject-item {
  display: block;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 11px 12px 11px 15px;
}

.subject-item:hover {
  background: var(--surface-subtle);
}

.subject-item.active {
  background: var(--primary-soft);
  color: var(--navy-dark);
}

.subject-item.active::before {
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--primary);
}

.subject-copy {
  gap: 3px;
}

.subject-copy strong {
  font-size: 0.92rem;
}

.subject-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.sidebar-account {
  min-height: 76px;
  border-top: 1px solid var(--border);
  background: #edf2f6;
  padding: 11px 12px;
}

.user-avatar,
.student-avatar {
  border-radius: 50%;
  background: #e7ebef;
  color: var(--navy);
}

.account-copy strong {
  color: var(--text);
  font-size: 0.9rem;
}

.account-copy small {
  color: var(--muted);
  font-size: 0.8rem;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-color: var(--border);
  border-radius: 4px;
  background: #ffffff;
}

.icon-button-dark,
.icon-button-accent {
  border-color: var(--border);
  background: #ffffff;
  color: var(--muted);
}

.icon-button-dark:hover:not(:disabled),
.icon-button-accent:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
  color: var(--text);
}

.topbar {
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  padding: 12px 28px;
}

.topbar-context h1 {
  margin-top: 2px;
  color: var(--navy-dark);
}

.topbar-actions {
  gap: 7px;
}

.workspace-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 28px 44px;
}

.workspace-tabs {
  position: sticky;
  z-index: 30;
  top: var(--topbar-height);
  min-height: 60px;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-top: 0;
  background: #ffffff;
  padding: 0 6px;
}

.tab-button {
  min-height: 59px;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 0 18px;
  font-size: 0.96rem;
  font-weight: 650;
}

.tab-button:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.tab-button.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 700;
}

.tab-button::after {
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 4px;
  background: var(--primary);
}

.tab-button svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.workspace-page {
  padding-top: 28px;
}

.welcome-state {
  width: min(580px, 100%);
  min-height: 0;
  justify-items: start;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(22, 52, 76, 0.06);
  margin: 44px auto;
  padding: 40px;
  text-align: left;
}

.welcome-state .empty-icon,
.inline-empty-state .empty-icon {
  display: none;
}

.welcome-state h2 {
  font-size: 1.45rem;
}

.welcome-state > p:not(.empty-state-context) {
  max-width: 440px;
  margin: 7px 0 20px;
  color: var(--muted);
  font-size: 0.94rem;
}

.empty-state-context {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

/* Resumen operativo */

.teacher-focus {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 0 20px;
}

.teacher-focus-copy {
  max-width: 630px;
}

.teacher-focus h2 {
  color: var(--navy-dark);
  font-size: 1.35rem;
}

.teacher-focus p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.quick-actions {
  display: flex;
  width: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.quick-action {
  width: auto;
  min-height: 42px;
  justify-content: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: none;
  margin-top: 20px;
}

.stat-card,
.stat-card:first-child {
  display: block;
  min-height: 112px;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  padding: 21px 22px;
}

.stat-card:first-child {
  border-left: 0;
}

.stat-copy {
  display: grid;
  gap: 3px;
}

.stat-copy small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: none;
}

.stat-copy strong {
  margin-top: 4px;
  color: var(--navy-dark);
  font-size: 1.9rem;
  line-height: 1.1;
}

.stat-copy > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 20px;
  margin-top: 20px;
}

.surface-section,
.data-surface,
.history-panel {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  box-shadow: none;
}

.surface-section {
  padding: 22px;
}

.section-heading {
  min-height: 40px;
}

.section-heading h2 {
  color: var(--navy-dark);
  font-size: 1.08rem;
}

.subtle-badge,
.save-status,
.toolbar-note,
.autosave-note {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.8rem;
  font-weight: 500;
}

.performance-summary {
  margin-top: 14px;
}

.stacked-progress,
.mini-progress {
  height: 6px;
  border-radius: 0;
  background: #e8ecf0;
}

.stacked-progress span,
.mini-progress span {
  border-radius: 0;
}

.progress-legend {
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
}

.compact-list {
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.compact-row {
  min-height: 62px;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  padding: 8px 0;
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-value {
  color: var(--text);
  font-size: 0.86rem;
}

.compact-row-copy strong,
.attendance-ring-copy strong {
  font-size: 0.9rem;
}

.compact-row-copy small,
.attendance-ring-copy span {
  font-size: 0.82rem;
}

.empty-compact {
  font-size: 0.84rem;
}

.attendance-overview {
  margin-top: 10px;
}

.attendance-ring-row {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 12px;
  border: 0;
  background: var(--surface-subtle);
  border-radius: 4px;
  padding: 13px 15px;
}

.attendance-ring {
  display: block;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  color: var(--navy-dark);
  font-size: 1.35rem;
}

.recent-heading {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

/* Páginas y tablas */

.page-heading {
  min-height: 72px;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.page-heading h2 {
  color: var(--navy-dark);
  font-size: 1.38rem;
}

.page-heading > div:first-child > p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.data-surface {
  overflow: hidden;
}

.data-toolbar {
  min-height: 64px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  padding: 10px 12px;
}

.search-control {
  width: min(330px, 100%);
}

.search-control input {
  min-height: 42px;
  background: var(--surface-subtle);
  font-size: 0.88rem;
}

.select-control {
  font-size: 0.84rem;
}

.select-control select {
  min-height: 42px;
}

.table-wrap {
  background: #ffffff;
}

.gradebook-wrap {
  max-height: none;
  min-height: 0;
  overflow-x: auto;
}

.gradebook-table th {
  position: static;
}

.gradebook-table th:first-child {
  top: auto;
}

.students-table,
.gradebook-table {
  color: var(--text);
  font-size: 0.88rem;
}

.students-table th,
.gradebook-table th {
  height: 50px;
  border-bottom: 1px solid var(--border-strong);
  background: #e5ebf0;
  color: #263d4e;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.students-table td,
.gradebook-table td {
  height: 64px;
  border-bottom: 1px solid #e6eaee;
  background: #ffffff;
}

.students-table tbody tr:hover td,
.gradebook-table tbody tr:hover td {
  background: #edf3f7;
}

.student-avatar {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 0.78rem;
}

.student-primary strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.student-primary small,
.grade-progress small {
  font-size: 0.8rem;
}

.gradebook-table .period-column small {
  font-size: 0.76rem;
}

.gradebook-input {
  width: 76px;
  min-height: 40px;
  border-color: #aeb7c1;
  border-radius: 4px;
  background: #ffffff;
  font-size: 1rem;
  font-weight: 600;
}

.gradebook-input.dirty {
  border-color: var(--warning);
  background: #fffaf0;
}

.gradebook-row.dirty td:first-child {
  box-shadow: inset 3px 0 0 var(--warning);
}

.average-value {
  color: var(--navy-dark);
  font-weight: 600;
}

.status-badge {
  min-height: 30px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: transparent;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 600;
}

.status-badge.approved {
  color: var(--success);
}

.status-badge.risk {
  color: var(--danger);
}

.status-badge.pending {
  color: var(--muted);
}

.inline-empty-state {
  min-height: 230px;
  border: 0;
  background: #ffffff;
  color: var(--muted);
}

/* Asistencia */

.date-navigation {
  gap: 5px;
}

.period-control {
  border-left: 1px solid var(--border);
  margin-left: 5px;
  padding-left: 10px;
}

.period-control > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.attendance-stats {
  min-height: 52px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #ffffff;
  padding: 11px 14px;
  font-size: 0.84rem;
}

.attendance-layout {
  gap: 16px;
}

.attendance-list {
  padding: 0;
}

.attendance-row {
  min-height: 74px;
  border-bottom: 1px solid #e6eaee;
  border-radius: 0;
  background: #ffffff;
  padding: 11px 14px;
}

.attendance-row:last-child {
  border-bottom: 0;
}

.attendance-student-copy strong {
  font-size: 0.92rem;
}

.attendance-student-copy small {
  font-size: 0.8rem;
}

.attendance-actions {
  border: 1px solid var(--border);
  border-radius: 4px;
}

.attendance-button {
  min-height: 42px;
  border-radius: 0;
  background: #ffffff;
  font-size: 0.8rem;
}

.attendance-button.active.presente,
.attendance-button.active.retardo,
.attendance-button.active.falta,
.attendance-button.active.justificado {
  box-shadow: inset 0 -2px 0 currentColor;
}

.history-panel {
  overflow: hidden;
}

.history-panel > .section-heading {
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

.history-item {
  min-height: 64px;
  border-radius: 0;
  background: #ffffff;
}

.history-item.active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.history-date-block {
  border-radius: 4px;
  background: #edf0f3;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.history-copy strong {
  font-size: 0.88rem;
}

.history-copy small,
.history-rate,
.history-empty {
  font-size: 0.78rem;
}

.history-rate {
  color: var(--muted);
  font-weight: 600;
}

/* Formularios */

.modal-backdrop {
  background: rgba(17, 30, 42, 0.48);
}

.modal-dialog {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--overlay-shadow);
}

.modal-dialog-small {
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-header {
  min-height: 70px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  padding: 15px 20px;
}

.modal-header h2 {
  color: var(--navy-dark);
  font-size: 1.28rem;
}

.modal-form {
  gap: 20px;
  padding: 20px;
}

.form-grid {
  gap: 16px;
}

.rounding-settings,
.period-weights-field {
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafbfc;
  padding: 16px;
}

.rounding-settings-heading h3,
.period-weights-heading h3 {
  color: var(--text);
  font-size: 0.98rem;
}

.rounding-example,
.period-weight-total {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text-soft);
  padding: 5px 9px;
}

.period-weight-total.invalid {
  border-color: var(--danger);
}

.period-weight-input > span {
  font-size: 0.8rem;
}

.acta-weight-note {
  border: 1px solid #c8d8e5;
  border-left: 3px solid var(--primary);
  background: #f6f9fb;
  font-size: 0.86rem;
}

.rounding-settings-heading p,
.period-weights-field > p,
.modal-subsection-heading p,
.toast-copy span {
  font-size: 0.84rem;
}

.color-field {
  display: none;
}

.color-options {
  gap: 7px;
}

.color-swatch span {
  width: 22px;
  height: 22px;
  border-radius: 2px;
}

.modal-subsection {
  border-top: 1px solid var(--border);
}

.modal-footer {
  border-top: 1px solid var(--border);
  margin: 0;
  background: #fafbfc;
  padding: 15px 20px;
}

.modal-form > .modal-footer {
  margin: 0 -20px -20px;
}

.modal-dialog-small > .modal-footer {
  border-top: 1px solid var(--border);
  margin: 0;
  padding: 14px 20px 18px;
}

.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 4px;
}

.confirm-preference {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.confirm-preference[hidden] {
  display: none;
}

.confirm-preference input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.toast {
  border-radius: 6px;
}

@media (max-width: 1240px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 980px) {
  .app-sidebar {
    box-shadow: 8px 0 24px rgba(21, 36, 50, 0.12);
  }

  .sidebar-backdrop {
    background: rgba(17, 30, 42, 0.42);
  }

  .teacher-focus {
    align-items: flex-start;
    flex-direction: column;
  }

  .quick-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .stat-card:nth-child(3) {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .stat-card:nth-child(4) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  :root {
    --topbar-height: 68px;
  }

  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .auth-view {
    align-items: start;
    background: #ffffff;
    padding: 18px 12px;
  }

  .auth-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 22px 16px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .workspace-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .workspace-tabs {
    position: fixed;
    z-index: 80;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: calc(68px + env(safe-area-inset-bottom));
    align-items: start;
    gap: 0;
    border-top: 2px solid var(--border-strong);
    border-bottom: 0;
    border-right: 0;
    border-left: 0;
    background: #ffffff;
    box-shadow: 0 -4px 14px rgba(12, 48, 73, 0.1);
    padding: 6px 4px calc(5px + env(safe-area-inset-bottom));
  }

  .tab-button {
    min-width: 0;
    min-height: 56px;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    border-radius: 0;
    font-size: 0.8rem;
    padding: 6px 2px;
  }

  .tab-button svg {
    display: block;
    width: 20px;
    height: 20px;
  }

  .tab-button::after {
    top: 0;
    right: 8px;
    bottom: auto;
    left: 8px;
  }

  .teacher-focus {
    padding: 0 0 18px;
  }

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

  .quick-action,
  .quick-action:first-child {
    grid-column: auto;
    width: 100%;
    min-height: 46px;
  }

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

  .stat-card,
  .stat-card:first-child,
  .stat-card:nth-child(3),
  .stat-card:nth-child(4) {
    min-height: 100px;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    padding: 16px;
  }

  .stat-card:nth-child(odd) {
    border-left: 0;
  }

  .stat-card:nth-child(-n + 2) {
    border-top: 0;
  }

  .surface-section {
    padding: 17px;
  }

  .page-heading {
    align-items: stretch;
  }

  .data-toolbar {
    padding: 9px;
  }

  .students-table td::before,
  .grade-cell::before,
  .grade-summary::before {
    font-size: 0.76rem;
  }

  .gradebook-wrap {
    background: var(--page);
  }

  .gradebook-table .gradebook-row {
    border-radius: 0;
    box-shadow: none;
  }

  .grade-summary {
    border-radius: 0;
  }

  .attendance-stats {
    border-bottom: 1px solid var(--border);
  }

  .attendance-row {
    padding: 14px 12px;
  }

  .modal-dialog {
    border-radius: 8px 8px 0 0;
  }

  .modal-form > .modal-footer {
    margin-right: -15px;
    margin-left: -15px;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card,
  .stat-card:first-child,
  .stat-card:nth-child(2),
  .stat-card:nth-child(3),
  .stat-card:nth-child(4) {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .stat-card:first-child {
    border-top: 0;
  }

  .rounding-controls,
  .period-weights-grid {
    grid-template-columns: 1fr;
  }
}
