:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #66736f;
  --line: #dce5e1;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #d9f4ef;
  --warn: #a16207;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(18, 32, 28, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, Helvetica, sans-serif;
}

.hidden {
  display: none !important;
}

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

button,
.file-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover,
.file-action:hover {
  border-color: var(--accent);
}

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

button.primary:hover {
  background: var(--accent-dark);
}

button.small {
  min-height: 34px;
  padding: 7px 10px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #10221f, #edf5f2);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card h2 {
  margin: 0;
  font-size: 19px;
}

.login-card .actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-captcha {
  display: grid;
  gap: 8px;
}

.login-captcha-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.login-captcha-controls img {
  width: 180px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.app-version {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff4d2;
  color: #6b4a00;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  vertical-align: middle;
}

.form-message {
  color: var(--danger);
  min-height: 18px;
  font-weight: 700;
}

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

select:not(.availability-mode),
input[type="search"] {
  border-color: #86b2a9;
  background-color: #f6fbf9;
  box-shadow: inset 3px 0 0 var(--accent);
}

select:not(.availability-mode):hover:not(:disabled),
input[type="search"]:hover:not(:disabled) {
  border-color: var(--accent);
}

select:focus,
input[type="search"]:focus {
  border-color: var(--accent);
  outline: 3px solid #bfe8df;
  outline-offset: 1px;
}

input[type="search"]::placeholder {
  color: #536a63;
  opacity: 1;
}

select:disabled,
input[type="search"]:disabled {
  box-shadow: none;
  background-color: #f0f3f2;
  opacity: .65;
}

textarea {
  min-height: 180px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

select[multiple] {
  min-height: 132px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.subpanel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
}

.subpanel > strong {
  color: var(--text);
  font-size: 14px;
}

.schedule-config-panel select[multiple] {
  min-height: 82px;
}

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

.import-text-panel {
  border: 2px solid #f6c343;
  border-radius: 8px;
  padding: 10px;
  background: #fff7df;
  color: var(--text);
}

.import-text-panel textarea {
  border-color: #f6c343;
  background: #ffffff;
  min-height: 210px;
}

.checkbox-list {
  display: grid;
  gap: 3px;
  max-height: 210px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.checkbox-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
}

.checkbox-option.contraturno-option {
  grid-template-columns: 16px minmax(0, 1fr) 48px 48px;
  align-items: center;
}

.checkbox-option:hover,
.checkbox-option:has(input:checked) {
  background: var(--accent-soft);
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--accent);
}

.checkbox-option .contraturno-aulas-input,
.checkbox-option .contraturno-min-sequencia-input {
  width: 48px;
  min-height: 30px;
  padding: 5px 6px;
  text-align: center;
}

.checkbox-option small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0;
  font-size: 11px;
}

.advanced-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdfc;
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.advanced-panel[open] {
  display: grid;
  gap: 10px;
}

.distribution-check-panel {
  margin-bottom: 16px;
}

.teacher-load-report {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
}

.teacher-load-report.danger {
  border-left: 4px solid var(--danger);
}

.teacher-load-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.teacher-load-head strong {
  font-size: 16px;
}

.teacher-load-head span {
  color: var(--muted);
}

.teacher-load-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
}

.teacher-load-kpis span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fbfa;
  color: var(--muted);
}

.teacher-load-kpis strong {
  color: var(--text);
}

.compact-load th,
.compact-load td {
  padding: 6px 8px;
}

.distribution-check-panel summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.raw-items-panel {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.raw-items-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.matrix-item-editor {
  display: grid;
  gap: 8px;
}

.matrix-item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) 76px minmax(90px, .8fr) 72px 40px;
  gap: 6px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.matrix-item-row label {
  gap: 4px;
  font-size: 11px;
}

.matrix-item-row input {
  min-height: 34px;
  padding: 7px 8px;
}

.matrix-item-remove {
  min-height: 34px;
  padding: 6px;
}

.matrix-item-actions {
  display: flex;
  gap: 8px;
}

.matrix-item-add {
  align-items: center;
  flex-wrap: wrap;
}

.matrix-item-add select {
  flex: 1 1 260px;
}

.matrix-item-add input {
  width: 90px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  transition: grid-template-columns .18s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #172320;
  color: #f9fbfa;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-head {
  display: grid;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f0bf4c;
  color: #172320;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 3px 0 0;
  color: #b8c5c1;
  font-size: 13px;
}

.brand-text {
  min-width: 0;
}

.brand .app-version {
  margin: 4px 0 0;
  background: rgba(240, 191, 76, .18);
  color: #f8d47d;
}

.sidebar-toggle {
  margin-left: auto;
  min-height: 34px;
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.nav {
  display: grid;
  gap: 2px;
}

.nav-btn {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  text-align: left;
  background: transparent;
  color: #dce5e1;
  border-color: transparent;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-color: rgba(255,255,255,.14);
}

.nav-link {
  text-decoration: none;
}

body.sidebar-collapsed .sidebar {
  padding: 14px 10px;
  gap: 14px;
}

body.sidebar-collapsed .brand {
  display: grid;
  justify-items: center;
  gap: 10px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav,
body.sidebar-collapsed .sidebar-actions,
body.sidebar-collapsed .sidebar-session {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  width: 46px;
  height: 46px;
}

body.sidebar-collapsed .sidebar-toggle {
  margin-left: 0;
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebar-action-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}

.sidebar-logout {
  margin-top: 0;
}

.session-info {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  color: #d9f4ef;
  font-size: 13px;
}

.session-info strong {
  color: #fff;
  font-size: 15px;
}

.session-info .save-error {
  color: #fee2e2;
  font-weight: 800;
}

.sidebar-actions button,
.sidebar-actions .file-action {
  width: 100%;
  text-align: center;
}

.generation-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.generation-action .button-spinner {
  display: none;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: generation-spin .8s linear infinite;
}

.generation-action.is-working .button-spinner {
  display: block;
}

.teacher-directory-active.generation-action {
  width: 52px;
  min-height: 24px;
  margin: auto;
}

.teacher-directory-active.generation-action .button-spinner {
  display: block;
  visibility: hidden;
}

.teacher-directory-active.generation-action.is-working .button-spinner {
  visibility: visible;
}

.login-card button[aria-busy="true"],
.login-card button:disabled {
  cursor: progress;
}

body.is-generating,
body.is-generating * {
  cursor: progress !important;
}

.generation-busy-dialog {
  width: min(390px, calc(100vw - 32px));
  margin: auto;
  padding: 20px 24px;
  border: 1px solid #cbdad6;
  border-radius: 8px;
  background: #fff;
  color: #172724;
  box-shadow: 0 14px 40px #152a2633;
}

.generation-busy-dialog::backdrop {
  background: #10211d80;
}

.generation-busy-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.generation-busy-content strong {
  display: block;
  font-size: 16px;
}

.generation-busy-content p {
  margin: 5px 0 0;
  color: #4d615b;
  font-size: 13px;
  line-height: 1.4;
}

.generation-busy-spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 3px solid #cee0db;
  border-top-color: #0b8177;
  border-radius: 50%;
  will-change: transform;
}

@keyframes generation-spin {
  to { transform: rotate(360deg); }
}

.sidebar-field {
  display: grid;
  gap: 4px;
  color: #d9f4ef;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-field select {
  width: 100%;
  min-height: 36px;
}

.generation-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 4px 0 0;
  border: 0;
  min-width: 0;
}

.generation-periods legend {
  color: #d9f4ef;
  font-size: 12px;
  font-weight: 800;
  padding: 0;
}

.sidebar-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d9f4ef;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.sidebar-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.sidebar-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-school-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-school-row.selected {
  border-color: var(--primary);
  background: #e8f7f4;
}

.admin-school-row + .admin-school-row {
  margin-top: 10px;
}

.admin-school-row strong,
.admin-school-row span {
  display: block;
}

.admin-license-panel {
  margin-top: 16px;
}

.admin-license-fields {
  align-items: end;
}

.admin-license-generate {
  display: flex;
  align-items: end;
  min-height: 58px;
}

.admin-license-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.admin-license-result .inline-status {
  grid-column: 1 / -1;
}

.admin-school-row span {
  color: var(--muted);
}

.admin-session-panel {
  margin-top: 16px;
}

.admin-session-list {
  margin-top: 8px;
}

.admin-session-list .table-wrap {
  overflow-x: auto;
}

.admin-session-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.admin-session-table th,
.admin-session-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.admin-session-table small,
.admin-session-table td span {
  display: block;
  color: var(--muted);
}

.admin-session-table td:last-child {
  text-align: right;
}

.admin-session-settings {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.admin-session-settings label {
  width: min(280px, 100%);
}

.admin-session-settings input {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .generation-action .button-spinner {
    animation: none;
  }

}

.file-action input {
  display: none;
}

.content {
  padding: 28px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0;
  font-size: 28px;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.head-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 280px;
}

.head-actions > select,
.head-actions > button {
  min-width: 118px;
}

#grade .head-actions {
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

#grade .head-actions > select {
  width: auto;
  flex: 0 0 auto;
}

.grade-print-actions {
  display: grid;
  gap: 5px;
  min-width: 142px;
}

.grade-print-actions > button {
  width: 100%;
}

.grade-print-all-toggle {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.grade-print-all-toggle input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.teacher-print-batch {
  display: none;
}

#gradeTipo {
  min-width: 155px;
}

#gradePeriodo {
  min-width: 130px;
}

#gradeEstiloRelatorio {
  min-width: 148px;
}

#gradeFormatoImpressao {
  min-width: 205px;
}

.print-hide-control {
  display: none;
  flex-direction: column;
  min-width: 190px;
  max-width: 230px;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.print-hide-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  order: 2;
  min-height: 18px;
  color: var(--muted);
}

.print-hide-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.print-hide-list {
  order: 1;
  width: 100%;
  height: 78px;
  overflow: auto;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.print-hide-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.print-hide-item input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.print-hide-empty {
  display: block;
  padding: 8px 4px;
  color: var(--muted);
  font-weight: 600;
}

.mode-selector {
  min-width: 240px;
}

.distribution-vinculo-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.distribution-vinculo-filter-copy {
  display: grid;
  gap: 2px;
  min-width: 230px;
}

.distribution-vinculo-filter-copy strong {
  font-size: 14px;
}

.distribution-vinculo-filter-copy span {
  color: var(--muted);
  font-size: 12px;
}

.distribution-vinculo-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.distribution-vinculo-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.distribution-vinculo-option:has(input:checked) {
  border-color: #9edbd2;
  background: var(--accent-soft);
}

.distribution-vinculo-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.professores-head {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: start;
}

.professores-primary-action {
  display: flex;
  margin-top: 12px;
}

.entity-primary-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.entity-editor-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 22px 60px rgb(10 28 24 / 24%);
}

.entity-editor-dialog::backdrop {
  background: rgb(8 22 19 / 58%);
}


.entity-editor-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 32px);
}

.entity-editor-head,
.entity-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.entity-editor-head {
  border-bottom: 1px solid var(--line);
}

.entity-editor-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.entity-editor-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.entity-dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 6px;
  font-size: 25px;
  line-height: 1;
}

.entity-editor-content {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
}

.entity-editor-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

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

.discipline-form-grid .span-2 {
  grid-column: 1 / -1;
}

.discipline-form-grid label,
.discipline-checks label,
.discipline-list-panel > label {
  font-size: 13px;
}

.discipline-form-grid input,
.discipline-form-grid select,
.discipline-list-panel > label input {
  min-height: 40px;
  padding: 9px 11px;
  font-size: 14px;
}

.discipline-form-grid input[type="color"] {
  width: 100%;
  padding: 4px 7px;
}

.discipline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.discipline-list-panel {
  width: 100%;
}

.discipline-list {
  margin-top: 12px;
}

.discipline-table-scroll,
.teacher-directory-scroll {
  width: 100%;
  overflow-x: auto;
}

.discipline-table,
.teacher-directory-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.discipline-table {
  min-width: 880px;
}

.teacher-directory-table {
  min-width: 660px;
}

.discipline-table th,
.discipline-table td,
.teacher-directory-table th,
.teacher-directory-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.discipline-table th,
.teacher-directory-table th {
  background: var(--accent-soft);
  font-size: 12px;
  white-space: nowrap;
}

.discipline-table td:not(:first-child):not(:last-child) {
  width: 126px;
  text-align: center;
}

.discipline-table input[data-rule-field] {
  width: 68px;
  min-height: 34px;
  text-align: center;
  font-weight: 700;
}

.discipline-table td:first-child,
.teacher-directory-table td:first-child {
  min-width: 210px;
}

.discipline-table strong,
.teacher-directory-table strong {
  font-size: 14px;
}

.discipline-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.discipline-table .item-actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.discipline-rule-error {
  min-width: 150px;
  color: #a33232 !important;
}

.teacher-directory-panel {
  margin-bottom: 16px;
}

.teacher-directory-panel summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.teacher-directory-panel[open] summary {
  margin-bottom: 16px;
}

.sequence-actions {
  white-space: nowrap;
}

.sequence-scope-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.sequence-scope-picker label {
  position: relative;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}

.sequence-scope-picker label + label {
  border-left: 1px solid var(--line);
}

.sequence-scope-picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
}

.sequence-scope-picker label:has(input:checked) {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.sequence-scope-picker label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.sequence-scope-picker label:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.teacher-directory-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.teacher-directory-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.teacher-directory-search {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 13px;
}

.teacher-directory-search input {
  min-height: 40px;
}

.teacher-directory-table select {
  min-width: 130px;
  max-width: 220px;
  width: 100%;
}

.teacher-directory-active {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  cursor: pointer;
}

.teacher-directory-active input {
  width: 17px;
  height: 17px;
}

.teacher-directory-empty {
  color: var(--muted);
  text-align: center;
}

.refinement-status {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #eef7f5;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.refinement-status:empty {
  display: none;
}

.refinement-save-retry {
  display: block;
  margin-top: 8px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 6px;
  padding: 3px 8px;
  border: 1px solid #b8d8d2;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0b6158;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.discipline-list .list-item {
  padding: 12px 14px;
}

.discipline-list .list-item strong {
  font-size: 15px;
}

.discipline-list .list-item span {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .entity-editor-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .entity-editor-card {
    max-height: calc(100vh - 16px);
  }

  .discipline-form-grid {
    grid-template-columns: 1fr;
  }

  .discipline-form-grid .span-2 {
    grid-column: 1;
  }

}

.teacher-top-tools {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(260px, .9fr) minmax(360px, 1.2fr);
  gap: 10px;
  width: 100%;
}

.teacher-import-card,
.teacher-vinculo-card,
.teacher-report-tools {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
  box-shadow: var(--shadow);
}

.teacher-import-card textarea {
  min-height: 66px;
  resize: vertical;
}

.teacher-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.teacher-import-actions button {
  flex: 1 1 120px;
}

.professor-match-dialog {
  width: min(980px, calc(100vw - 32px));
}

.global-catalog-editor-dialog {
  width: min(760px, calc(100vw - 32px));
}

.global-catalog-editor-content {
  gap: 12px;
}

.global-editor-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.global-editor-common {
  grid-template-columns: 1fr;
}

.global-editor-group label {
  font-size: 13px;
}

.global-editor-group input {
  min-height: 42px;
  font-size: 14px;
}

.catalog-admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.professor-match-status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.professor-match-list {
  display: grid;
  gap: 8px;
}

.professor-match-row {
  display: grid;
  grid-template-columns: minmax(190px, .55fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
}

.professor-match-name strong,
.professor-match-name span {
  display: block;
}

.professor-match-name strong {
  font-size: 15px;
}

.professor-match-name span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.professor-match-row select {
  min-height: 42px;
  font-size: 14px;
}

@media (max-width: 720px) {
  .professor-match-row {
    grid-template-columns: 1fr;
  }

  .global-editor-group {
    grid-template-columns: 1fr;
  }
}

.teacher-vinculo-card select[multiple],
.teacher-report-tools select[multiple] {
  min-height: 64px;
}

.inline-actions {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto auto;
  gap: 6px;
  align-items: end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.catalog-grid .span-2 {
  grid-column: 1 / -1;
}

#listaMatrizesGlobais,
#listaDisciplinasGlobais,
#listaProfessoresGlobais {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#listaMatrizesGlobais {
  max-height: 430px;
}

#listaDisciplinasGlobais {
  max-height: 280px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#listaProfessoresGlobais {
  max-height: 260px;
}

.selectable-list-item {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
}

.selectable-list-item input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.selectable-list-item:has(input:checked) {
  background: #d9f5ef;
}

.compact-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compact-table th,
.compact-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: center;
}

.compact-table input {
  max-width: 96px;
  min-height: 32px;
  padding: 6px 8px;
  text-align: center;
}

.compact-table th {
  position: sticky;
  top: 0;
  background: #eef6f3;
  color: var(--text);
}

.special-class-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.special-class-fields .checkline {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.special-pattern-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.special-pattern-fields button {
  grid-column: 1 / -1;
  min-height: 36px;
  white-space: normal;
}

.aee-pattern-panel {
  margin: 8px 0;
  padding: 8px 10px;
}

.aee-pattern-panel summary {
  font-size: 14px;
}

.special-attendance-wrap {
  max-height: 300px;
  max-width: 100%;
  overflow: auto;
}

.special-attendance-table {
  font-size: 12px;
  min-width: 470px;
}

.special-attendance-table th:first-child,
.special-attendance-table td:first-child {
  width: 54px;
  min-width: 54px;
}

.special-attendance-table th {
  padding: 5px 4px;
}

.special-attendance-table tbody th span,
.special-attendance-table tbody th small {
  display: block;
  line-height: 1.15;
}

.special-attendance-table select {
  min-height: 30px;
  padding: 4px 6px;
  min-width: 58px;
}

.list-item.compact {
  min-height: auto;
  padding: 10px 12px;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.license-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.license-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.license-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.license-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.license-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.license-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.license-grid .pill {
  display: inline-block;
  font-style: normal;
  padding: 4px 8px;
}

.license-actions {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
}

.license-actions label {
  min-width: 0;
}

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

.panel-title h3 {
  margin: 0;
  font-size: 17px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.panel-actions .file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.backup-list,
.history-list {
  display: grid;
  gap: 8px;
}

.backup-row,
.history-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.backup-row strong,
.backup-row span,
.history-row strong,
.history-row span {
  display: block;
}

.backup-row span,
.history-row span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.form-grid,
form.panel {
  display: grid;
  gap: 14px;
}

.form-grid.three {
  grid-template-columns: 2fr 1fr 1fr;
  align-items: start;
}

.config-preferences {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 14px 0 6px;
}

.two-column {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.two-column.wide-left {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

#turmas .two-column {
  grid-template-columns: minmax(500px, 560px) minmax(420px, 1fr);
}

#turmas .panel {
  min-width: 0;
}

.class-editor-dialog {
  width: min(1180px, calc(100vw - 32px));
}

.class-editor-content,
.environment-editor-content {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.class-editor-content .span-2,
.environment-editor-content .span-2 {
  grid-column: 1 / -1;
}

.class-editor-content > label,
.environment-editor-content > label,
.environment-rule-grid label {
  font-size: 13px;
}

.class-editor-content > label input,
.class-editor-content > label select,
.environment-editor-content > label input,
.environment-editor-content > label select,
.environment-editor-content > label textarea,
.environment-rule-grid input,
.environment-rule-grid select {
  min-height: 40px;
  padding: 9px 11px;
  font-size: 14px;
}

.class-editor-content > .advanced-panel {
  padding: 12px;
}

.class-list-panel,
.environment-list-panel {
  width: 100%;
}

.class-list .list-item,
.environment-list .list-item,
.environment-rule-list .list-item {
  padding: 13px 14px;
}

.class-list .list-item strong,
.environment-list .list-item strong,
.environment-rule-list .list-item strong {
  font-size: 15px;
}

.class-list .list-item span,
.environment-list .list-item span,
.environment-rule-list .list-item span {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

#ambientes .environment-layout {
  grid-template-columns: minmax(340px, 440px) minmax(480px, 1fr);
}

.environment-editor-dialog {
  width: min(760px, calc(100vw - 32px));
}

#ambienteObservacoes {
  min-height: 58px;
  height: 58px;
  font-family: inherit;
}

.environment-rules-panel {
  margin-top: 16px;
}

@media (max-width: 720px) {
  .class-editor-content,
  .environment-editor-content {
    grid-template-columns: 1fr;
  }

  .class-editor-content .span-2,
  .environment-editor-content .span-2 {
    grid-column: 1;
  }
}

.environment-rule-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(220px, 1.2fr) minmax(150px, .7fr) auto;
  gap: 10px;
  align-items: end;
}

.environment-rule-grid .form-actions {
  grid-column: 4;
  margin: 0;
  white-space: nowrap;
}

.environment-rule-option {
  grid-column: 1 / 4;
}

.environment-allowed-rooms {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px 10px;
}

.environment-allowed-rooms > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 16px;
}

.environment-allowed-rooms label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.environment-allowed-rooms input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}

.sport-court-disciplines {
  margin-top: 12px;
}

.sport-court-disciplines > div {
  max-height: 190px;
  overflow-y: auto;
}

.environment-rule-grid .environment-rule-option input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}

.environment-class-selection {
  grid-column: 1 / -1;
}

.environment-class-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 8px 20px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
}

.environment-class-selection label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.environment-class-selection input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.environment-class-list small {
  display: block;
  font-size: 13px;
}

.environment-rule-list {
  margin-top: 16px;
}

.environment-rule-group {
  margin-top: 8px;
  padding: 6px 2px 5px 10px;
  border-left: 4px solid var(--subject-color);
  color: var(--text);
  font-weight: 700;
}

.environment-rule-list .environment-rule-item {
  border-left: 4px solid var(--subject-color);
  background: color-mix(in srgb, var(--subject-color) 8%, white);
}

.environment-rule-list .environment-rule-item:focus-within {
  outline: 2px solid #0b746d;
  outline-offset: 2px;
}

.environment-rule-teachers {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.muted-item {
  opacity: .68;
}

.teacher-workspace {
  display: block;
}

.teacher-availability-panel {
  width: 100%;
  min-width: 0;
}

.teacher-availability-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.teacher-availability-tools label {
  min-width: 0;
}

.teacher-availability-picker {
  display: grid;
  gap: 5px;
}

.teacher-availability-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.teacher-availability-initial {
  position: absolute;
  z-index: 1;
  left: 9px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 5px;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
}

.teacher-availability-select-wrap select {
  width: 100%;
  padding-left: 44px;
  font-weight: 800;
  border-color: #9bc8c1;
  background: #f7fcfa;
}

.teacher-availability-select-wrap:focus-within select {
  border-color: #0f766e;
  outline: 2px solid #b9e5db;
  outline-offset: 1px;
}

.teacher-editor-dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 22px 60px rgb(10 28 24 / 24%);
}

.teacher-editor-dialog::backdrop {
  background: rgb(8 22 19 / 58%);
}

.teacher-editor-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 32px);
}

.teacher-editor-head,
.teacher-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.teacher-editor-head {
  border-bottom: 1px solid var(--line);
}

.teacher-editor-head h2 {
  margin: 2px 0 0;
  font-size: 21px;
}

.teacher-editor-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.teacher-dialog-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
}

.teacher-editor-content {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 16px 18px;
  overflow-y: auto;
}

.teacher-editor-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.teacher-report-tools {
  grid-template-columns: minmax(120px, .75fr) minmax(150px, 1fr) auto;
  align-items: end;
}

.availability-head-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.availability-head-check input {
  flex: 0 0 auto;
}

.teacher-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.teacher-summary strong,
.teacher-summary span {
  display: block;
}

.teacher-summary strong {
  font-size: 15px;
}

.teacher-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.teacher-summary .teacher-load-line {
  margin-top: 7px;
  color: var(--text);
}

.teacher-summary .teacher-load-line strong,
.teacher-workload-details strong,
.teacher-other-school strong {
  display: inline;
  font-size: inherit;
}

.teacher-workload-details {
  margin-top: 7px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.teacher-workload-details summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.teacher-workload-details[open] {
  display: grid;
  gap: 6px;
}

.teacher-load-kpis-compact {
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 5px;
  margin-top: 2px;
}

.teacher-load-kpis-compact span {
  margin: 0;
  padding: 5px 7px;
  font-size: 11px;
}

.teacher-external-note {
  color: var(--muted);
  font-size: 11px;
}

.teacher-other-schools {
  display: grid;
  gap: 5px;
}

.teacher-other-school {
  border-left: 3px solid var(--primary);
  background: #fff;
  padding: 6px 8px;
}

.teacher-other-school span,
.teacher-load-muted {
  margin-top: 2px;
  font-size: 11px;
}

@media (max-width: 720px) {
  .teacher-load-kpis-compact {
    grid-template-columns: repeat(2, minmax(70px, 1fr));
  }
}

#formMatrizCurricular {
  gap: 0;
  padding: 0;
}

#formMatrizCurricular label {
  gap: 5px;
  font-size: 13px;
}

#formMatrizCurricular input,
#formMatrizCurricular select {
  min-height: 40px;
  padding: 9px 11px;
  font-size: 14px;
}

.matrix-editor-dialog {
  width: min(1100px, calc(100vw - 32px));
}

.matrix-editor-content {
  gap: 12px;
}

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

.matrix-meta-grid .wide {
  grid-column: 1 / -1;
}

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

.teacher-form-grid .wide,
.teacher-form-grid .span-4 {
  grid-column: 1 / -1;
}

.teacher-form-grid .span-2 {
  grid-column: span 2;
}

.teacher-form-grid .span-3 {
  grid-column: span 3;
}

.teacher-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.compact-subpanel {
  padding: 10px;
}

.list-search {
  margin-bottom: 10px;
  min-height: 34px;
  padding: 7px 9px;
}

#formMatrizCurricular .subpanel,
#formMatrizCurricular .advanced-panel {
  padding: 12px;
}

#formMatrizCurricular .field-hint {
  margin: 0;
}

#formMatrizCurricular .form-actions {
  gap: 6px;
}

.matrix-import-dialog {
  width: min(780px, calc(100vw - 32px));
}

.matrix-import-content p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.matrix-import-content label {
  font-size: 14px;
}

.matrix-import-content textarea {
  min-height: 360px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
}

.matrix-list-panel {
  width: 100%;
}

.matrix-list .list-item {
  padding: 13px 14px;
}

.matrix-list .list-item strong {
  font-size: 15px;
}

.matrix-list .list-item span {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto minmax(120px, .8fr);
  gap: 12px;
  align-items: end;
}

#formEmailConta {
  margin-top: 16px;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto auto minmax(130px, .8fr);
}

#formAdminSmtp {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

#formAdminSmtp .actions-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  #formAdminSmtp { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #formEmailConta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-school-row { grid-template-columns: minmax(0, 1fr) auto auto; }
}

@media (max-width: 600px) {
  #formAdminSmtp, #formEmailConta, .admin-school-row { grid-template-columns: minmax(0, 1fr); }
}

.inline-status {
  display: none;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #94d8cf;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.inline-status.visible {
  display: inline-flex;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.list-item strong {
  display: block;
  font-size: 15px;
}

.list-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.list-item.selectable-list-item {
  grid-template-columns: auto minmax(0, 1fr);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.item-actions button {
  min-height: 32px;
  padding: 6px 9px;
}

.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

.availability {
  overflow-x: auto;
}

.availability-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.availability-legend span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  padding: 4px 8px;
}

.availability table,
.schedule {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.availability th,
.availability td,
.schedule th,
.schedule td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.availability th,
.schedule th {
  background: #eef4f2;
  font-size: 13px;
}

.availability tbody tr.availability-period-heading th {
  padding: 7px 12px;
  border-top: 3px solid #1f4541;
  background: #e7f2ef;
  color: #164a44;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
}

.availability tbody tr.availability-period-tarde th {
  border-top-color: #a56c14;
  background: #fbf1df;
  color: #775014;
}

.availability tbody tr.availability-period-noite th {
  border-top-color: #435671;
  background: #eaf0f6;
  color: #344762;
}

.schedule th:first-child {
  width: 104px;
  min-width: 104px;
}

.schedule-slot span,
.schedule-slot small {
  display: block;
  line-height: 1.25;
}

.schedule-slot span {
  font-weight: 900;
}

.schedule-slot small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.availability input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.availability-period-toggles {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 5px;
}

.availability-period-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 900;
}

.availability-period-toggles input {
  width: 14px;
  height: 14px;
}

.availability-cell {
  min-width: 72px;
}

.availability-cell-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.availability-external {
  background: #eef7fb;
  box-shadow: inset 0 0 0 2px #61a8c2;
}

.external-school-marker {
  min-width: 34px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid #2d718b;
  border-radius: 5px;
  background: #d8eef6;
  color: #164e63;
  font-size: 10px;
  font-weight: 900;
}

.external-school-marker:hover,
.external-school-marker:focus-visible {
  background: #bfe2ef;
  border-color: #164e63;
}

.availability-mode {
  width: 94px;
  min-width: 94px;
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.availability-ha {
  background: #fff3d8;
}

.availability-fixa {
  background: #e8f5f3;
}

.availability-fixa .availability-cell-control {
  flex-wrap: wrap;
}

.availability-fixa .availability-mode {
  border-color: #0f766e;
  background: #f1faf8;
  color: #115e59;
}

.availability-fixed-label {
  display: block;
  width: 100%;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #115e59;
}

.lesson-fixed-label {
  display: block;
  width: fit-content;
  margin-top: 3px;
  padding: 1px 3px;
  border: 1px solid #0f766e;
  color: #115e59;
  font-size: 9px;
  font-weight: 800;
}

.availability-bloqueado {
  background: #f8fafc;
}

.availability-ha .availability-mode,
.availability-mode-ha {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #92400e;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.24);
}

.availability-bloqueado .availability-mode,
.availability-mode-bloqueado {
  color: var(--muted);
}

.schedule-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  #gradeTabela .schedule { min-width: 980px; }
}

.grade-manual-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.grade-manual-controls[hidden] { display: none; }
.grade-manual-controls > span { color: var(--muted); font-size: 13px; }
.grade-chain-dialog { width: min(640px, calc(100vw - 32px)); }
.grade-chain-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-chain-fields label { min-width: 0; font-size: 13px; }
.grade-chain-fields select { display: block; width: 100%; min-height: 40px; margin-top: 6px; }
.grade-chain-preview { grid-column: 1 / -1; min-height: 20px; margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .grade-chain-fields { grid-template-columns: 1fr; }
  .grade-chain-preview { grid-column: 1; }
}
.schedule td.manual-swap-slot { cursor: pointer; }
.schedule td.manual-swap-slot:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.schedule td.manual-activity-target { background: #e9f7ef; outline: 1px dashed #4b9473; outline-offset: -3px; }
.schedule td.manual-swap-selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.schedule td.manual-swap-slot:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.schedule td {
  height: 86px;
  background: #fff;
}

.schedule tbody tr.schedule-period-start > th,
.schedule tbody tr.schedule-period-start > td {
  border-top: 4px solid #163a35;
}

.schedule td.unavailable-slot {
  background: #f2f5f4;
  color: var(--muted);
}

.lesson {
  height: 100%;
  border-left: 5px solid var(--accent);
  background: #f7fbfa;
  border-radius: 6px;
  padding: 8px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 4px;
}

.lesson strong,
.lesson span {
  overflow-wrap: anywhere;
}

.lesson span {
  color: var(--muted);
  font-size: 12px;
}

.lesson-environment {
  color: #334155;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.lesson .lesson-meta,
/* Keep status badges beside names so print rows stay the same height. */
.compact-lesson .lesson-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.lesson-meta-name,
.lesson-meta .lesson-environment {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-meta-name {
  flex: 1 1 auto;
}

.lesson-meta-separator {
  flex: none;
}

.lesson-meta .lesson-environment {
  flex: 0 1 auto;
  max-width: 45%;
}

.lesson-substitution {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: #26332f;
  white-space: normal;
  overflow-wrap: anywhere;
  margin-top: 3px;
}

.substitution-badge {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 3px;
  font: bold 10px/1.4 sans-serif;
  color: #563800;
  background: #fff4cc;
}

.lesson-substitution-inline {
  display: inline-flex;
  align-items: center;
  flex: none;
  white-space: nowrap;
}

.substitution-legend {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media print {
  .lesson-substitution, .substitution-legend {
    font-size: 9px;
    color: #000;
  }
  .substitution-badge {
    color: #000;
    background: #fff;
    font-size: 8px;
  }
}

.lesson.activity {
  border-left-color: #64748b;
  background: #f1f5f9;
}

.overview-schedule {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  color: #000;
  border: 3px solid #000;
}

.print-overview-table {
  display: none;
}

.print-overview-pages {
  display: none;
}

.landscape-overview-page {
  display: none;
}

.overview-schedule th,
.overview-schedule td {
  border: 2px solid #000;
  padding: 3px 4px;
  text-align: center;
  vertical-align: middle;
}

.overview-schedule thead th {
  background: #fff;
  font-size: 14px;
  font-weight: 900;
}

.overview-schedule tbody tr.overview-day-start > th,
.overview-schedule tbody tr.overview-day-start > td {
  border-top-width: 4px;
}

.overview-title th {
  border-left-color: #fff;
  border-right-color: #fff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-school {
  text-align: left;
}

.overview-date,
.overview-period {
  text-align: center;
}

.overview-day-col {
  width: 38px;
}

.overview-hour-col {
  width: 86px;
}

.overview-day {
  width: 38px;
  font-size: 14px;
  font-weight: 900;
}

.overview-hour {
  width: 86px;
  font-size: 10px;
}

.overview-hour span,
.overview-hour small {
  display: block;
  line-height: 1.25;
}

.overview-hour span {
  font-weight: 900;
}

.overview-hour small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

.compact-lesson {
  min-height: 40px;
  display: grid;
  align-content: center;
  gap: 2px;
  line-height: 1.12;
  text-transform: uppercase;
}

.compact-lesson strong {
  font-size: 10px;
  overflow-wrap: anywhere;
}

.compact-lesson span {
  font-size: 9px;
  overflow-wrap: anywhere;
}

.compact-lesson .lesson-meta {
  justify-content: center;
}

.compact-lesson .lesson-meta-name {
  flex: 0 1 auto;
}

.compact-lesson .lesson-environment {
  font-size: 8px;
}

#grade.grade-report-colorido .subject-colored {
  background: color-mix(in srgb, var(--subject-color) 14%, white);
  box-shadow: inset 4px 0 0 var(--subject-color);
}

#grade.grade-report-colorido .lesson.subject-colored {
  border-left-color: var(--subject-color);
  box-shadow: none;
}

#grade.grade-report-colorido .compact-lesson.subject-colored {
  padding: 2px 4px;
}

#grade.grade-report-pb .lesson.subject-colored {
  border-left-color: #111 !important;
  background: #fff;
}

#grade.grade-report-pb .compact-lesson.subject-colored {
  background: #fff;
  box-shadow: none;
}

.activity-report {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, Helvetica, sans-serif;
}

.activity-report .activity-day-col {
  width: 34px;
}

.activity-report .activity-hour-col {
  width: 46px;
}

.activity-report .activity-period-col {
  width: auto;
}

.activity-report th,
.activity-report td {
  border: 1px solid #111;
  padding: 3px 4px;
  font-size: 11px;
  vertical-align: top;
}

.activity-report th {
  background: #fff;
  font-weight: 900;
}

.activity-report caption {
  caption-side: top;
  font-size: 20px;
  font-weight: 900;
  padding: 4px 0 2px;
  text-align: center;
}

.activity-report thead th {
  border-top-width: 3px;
  border-bottom-width: 3px;
  font-size: 18px;
  text-align: center;
}

.activity-report .activity-day {
  border-top: 3px double #111;
  border-bottom: 3px double #111;
  font-size: 16px;
  text-align: center;
  vertical-align: middle;
}

.activity-report .activity-hour {
  text-align: center;
  white-space: nowrap;
  font-size: 10px;
}

.activity-report td {
  font-family: "Arial Narrow", "Roboto Condensed", Arial, Helvetica, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-professor-name {
  color: #111;
}

.activity-name-separator {
  color: #111;
}

.compact-activity-names {
  display: inline;
  line-height: 1.35;
}

.compact-activity-names .activity-professor-name {
  display: inline;
  white-space: nowrap;
}

#grade.grade-report-colorido .activity-professor-name {
  color: var(--activity-subject-text);
  border-bottom: 2px solid var(--activity-subject-color);
  border-radius: 2px;
  background: color-mix(in srgb, var(--activity-subject-color) 12%, white);
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

#grade.grade-report-pb .activity-professor-name {
  color: #111 !important;
  border-bottom: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}

.activity-report tr.activity-day-start > th,
.activity-report tr.activity-day-start > td {
  border-top: 3px double #111;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.grade-history-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.grade-history-preview[hidden] {
  display: none;
}

.grade-history-preview button {
  flex: 0 0 auto;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
}

.pill.ok {
  background: var(--accent-soft);
  border-color: #a9ddd5;
  color: #07554f;
}

.pill.warn {
  background: #fff7df;
  border-color: #efd790;
  color: var(--warn);
}

.alert-list {
  display: grid;
  gap: 8px;
}

.alert {
  border: 1px solid var(--line);
  border-left: 5px solid var(--warn);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: #3d3020;
}

.alert.danger {
  border-left-color: var(--danger);
}

.alert.success {
  border-left-color: var(--accent);
  color: #173b36;
}

.backup-row.backup-protected {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

.backup-history-notice {
  margin-bottom: 10px;
}

.backup-history-notice p {
  margin: 7px 0 10px;
}

.grade-availability-impact p {
  margin: 7px 0;
}

.grade-availability-impact details {
  margin-top: 8px;
}

.grade-availability-impact summary {
  cursor: pointer;
}

.grade-availability-impact ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.pending-guidance-intro {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.pending-guidance-item {
  border: 1px solid var(--line);
  border-left: 5px solid var(--danger);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.pending-guidance-item h4 {
  margin: 0 0 5px;
  font-size: 15px;
}

.pending-guidance-item p {
  margin: 5px 0;
}

.pending-guidance-rules {
  color: var(--muted);
  font-size: 13px;
}

.pending-guidance-item ul {
  margin: 5px 0 10px;
  padding-left: 20px;
}

.pending-guidance-item li + li {
  margin-top: 4px;
}

.pending-guidance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

.pending-guidance-item details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pending-guidance-item summary {
  cursor: pointer;
}

.empty {
  color: var(--muted);
  padding: 10px 0;
}

.distribution-wrap {
  overflow-x: auto;
}

.distribution-board-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-bottom: 18px;
}

.distribution-board-header h3 {
  margin: 0;
  font-size: 16px;
}

.distribution-launch {
  display: flex;
  flex: 1 1 640px;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  min-width: 0;
}

.distribution-launch h3 {
  align-self: center;
}

.distribution-launch label {
  flex: 0 1 88px;
  min-width: 0;
  margin: 0;
  font-size: 14px;
}

.distribution-launch label:nth-of-type(2) {
  flex-basis: 190px;
}

.distribution-launch input {
  width: 100%;
  min-height: 38px;
  font-size: 14px;
}

.distribution-launch button {
  min-height: 38px;
}

.distribution-professor-title {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.distribution-professor-title .inline-status {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.distribution-board {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.25fr) minmax(260px, 1.1fr);
  gap: 14px;
}

.distribution-board.professor-mode > div:nth-child(1) {
  order: 2;
}

.distribution-board.professor-mode > div:nth-child(2) {
  order: 3;
}

.distribution-board.professor-mode > div:nth-child(3) {
  order: 1;
}

.board-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.board-search {
  margin-bottom: 8px;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.board-list {
  min-height: 320px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.board-row {
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
}

.board-row:hover,
.board-row.active {
  background: #e8f4f1;
}

.board-row.saldo-positive {
  background: #eefaf1;
}

.board-row.saldo-positive:hover,
.board-row.saldo-positive.active {
  background: #d9f3df;
}

.board-row.saldo-zero {
  background: #fff7df;
}

.board-row.saldo-zero:hover,
.board-row.saldo-zero.active {
  background: #ffedb8;
}

.board-row.saldo-negative {
  background: #fff0ed;
}

.board-row.saldo-negative:hover,
.board-row.saldo-negative.active {
  background: #ffe0da;
}

.board-row strong,
.board-row small {
  display: block;
}

.board-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.saldo {
  min-width: 42px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 7px 9px;
  text-align: center;
  font-weight: 900;
}

.saldo.zero {
  background: #eef2f1;
  color: var(--muted);
}

.saldo.danger {
  background: #ffe4e0;
  color: var(--danger);
}

.distribution-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px 12px;
}

.distribution-total span {
  color: var(--accent-dark);
  font-weight: 900;
}

.distribution-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
}

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

.distribution-table th {
  background: #eef5f3;
  font-size: 13px;
}

.distribution-table input,
.distribution-table select {
  width: 100%;
  min-width: 72px;
}

.distribution-table td:first-child {
  min-width: 210px;
}

.distribution-table td:nth-child(2) {
  min-width: 240px;
}

.report-table {
  min-width: 760px;
}

.check-table {
  min-width: 860px;
}

.status-pill {
  display: inline-block;
  min-width: 82px;
  border-radius: 999px;
  padding: 5px 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ok {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-pill.warn {
  background: #fff3c4;
  color: #7a4d00;
}

.status-pill.danger {
  background: #ffe4e0;
  color: var(--danger);
}

.matrix-class-list {
  min-height: 520px;
}

.matrix-table {
  margin-top: 14px;
  min-width: 640px;
}

.matrix-table td:first-child {
  min-width: 90px;
  width: 110px;
}

.matrix-table td:nth-child(2) {
  min-width: 280px;
}

.matrix-table .matrix-aulas {
  max-width: 82px;
  text-align: center;
  font-weight: 900;
}

@media (max-width: 960px) {
  #grade .head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #ambientes .environment-layout,
  .environment-rule-grid {
    grid-template-columns: 1fr;
  }

  .environment-rule-grid .form-actions {
    grid-column: 1;
    white-space: normal;
  }

  .environment-rule-option {
    grid-column: 1;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .sidebar-action-group,
  .sidebar-logout {
    grid-column: 1 / -1;
  }

  .stats-grid,
  .two-column,
  .two-column.wide-left,
  #professores .two-column,
  .form-grid.three,
  .license-grid,
  .distribution-board {
    grid-template-columns: 1fr;
  }

  .teacher-availability-tools {
    grid-template-columns: 1fr;
  }

  .teacher-editor-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .teacher-editor-card {
    max-height: calc(100vh - 16px);
  }

  .teacher-report-tools {
    grid-template-columns: 1fr;
  }

  .teacher-top-tools,
  .inline-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .distribution-vinculo-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .distribution-vinculo-options {
    justify-content: flex-start;
  }

  .matrix-meta-grid,
  .teacher-form-grid,
  .schedule-period-grid {
    grid-template-columns: 1fr;
  }

  .teacher-form-grid .span-2,
  .teacher-form-grid .span-3,
  .teacher-form-grid .span-4 {
    grid-column: 1 / -1;
  }

  .page-head {
    display: grid;
  }

  .head-actions {
    min-width: 0;
    width: 100%;
  }
}

@media print {
  .sidebar,
  #grade .page-head,
  #gradeHistoricoPreviewAviso,
  #gradeManualControls,
  #gradeProblemas,
  #gradeStatus,
  #grade > .panel {
    display: none;
  }

  .schedule td.manual-swap-selected,
  .schedule td.manual-swap-slot {
    outline: none;
  }

  #grade.print-all-teachers #gradeTabela {
    display: none;
  }

  #grade.print-all-teachers #gradeProfessoresImpressao {
    display: block;
  }

  .teacher-print-page {
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }

  .teacher-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
    width: 100%;
    max-width: none;
  }

  .panel,
  .stat-card {
    box-shadow: none;
  }

  @page {
    size: A4 portrait;
    margin: 6mm;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
  }

  .overview-schedule {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-family: "Arial Narrow", "Aptos Narrow", "Roboto Condensed", Arial, Helvetica, sans-serif;
    border-width: 0 1px 1px;
  }

  #grade.grade-report-colorido,
  #grade.grade-report-colorido .overview-schedule,
  #grade.grade-report-colorido .schedule,
  #grade.grade-report-colorido .lesson,
  #grade.grade-report-colorido .compact-lesson {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #grade.grade-report-colorido .subject-colored {
    background: color-mix(in srgb, var(--subject-color) 18%, white) !important;
  }

  #grade.grade-report-colorido .compact-lesson.subject-colored {
    box-shadow: inset 3px 0 0 var(--subject-color);
  }

  #grade.grade-report-colorido .activity-professor-name {
    color: var(--activity-subject-text) !important;
    border-bottom-color: var(--activity-subject-color) !important;
    background: color-mix(in srgb, var(--activity-subject-color) 15%, white) !important;
  }

  #grade.grade-report-pb .subject-colored {
    background: #fff !important;
    box-shadow: none !important;
    border-left-color: #111 !important;
    color: #000 !important;
  }

  .screen-overview-table {
    display: none !important;
  }

  .print-overview-pages {
    display: block;
  }

  .print-overview-page {
    display: block;
    width: 100%;
    break-after: page;
    page-break-after: always;
  }

  .print-overview-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-overview-table {
    display: table;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.grade-print-landscape .print-overview-pages {
    display: none !important;
  }

  body.grade-print-landscape .landscape-overview-page {
    display: block;
    width: 100%;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.grade-print-landscape .landscape-overview-table {
    display: table;
    width: 100%;
    min-width: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.grade-print-landscape .landscape-overview-table .overview-day-col {
    width: 9mm;
  }

  body.grade-print-landscape .landscape-overview-table .overview-hour-col {
    width: 18mm;
  }

  body.grade-print-landscape .landscape-overview-table .overview-activity-col {
    width: 48mm;
  }

  body.grade-print-landscape .landscape-overview-table th,
  body.grade-print-landscape .landscape-overview-table td {
    height: 33px;
    padding: 2px 3px;
  }

  body.grade-print-landscape .landscape-overview-table .compact-lesson {
    min-height: 25px;
  }

  body.grade-print-landscape .landscape-overview-table .compact-lesson strong {
    font-size: 9px;
  }

  body.grade-print-landscape .landscape-overview-table .compact-lesson span {
    font-size: 8px;
  }

  #grade,
  #gradeTabela {
    width: 100%;
    max-width: none;
  }

  #gradeTabela,
  .schedule-wrap {
    overflow: visible;
    margin-bottom: 0;
  }

  .overview-day-col {
    width: 22px;
  }

  .overview-hour-col {
    width: 55px;
  }

  .overview-activity-col {
    width: var(--overview-activity-width, 22%);
  }

  .overview-schedule th,
  .overview-schedule td {
    border-width: 1px;
    padding: 2px 2.5px;
    line-height: 1.08;
    height: var(--overview-print-row-height, 35px);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .overview-schedule tbody tr.overview-day-start > th,
  .overview-schedule tbody tr.overview-day-start > td {
    border-top-width: 3px;
  }

  .overview-title th {
    border-top: 0;
    font-size: 12px;
    padding: 2px 3px;
    height: 20px;
  }

  .overview-hour,
  .overview-hour small {
    font-size: 9px;
  }

  .overview-day {
    font-size: 12px;
  }

  .compact-lesson {
    min-height: 28px;
    line-height: 1.06;
  }

  .compact-lesson strong {
    font-size: 10.5px;
  }

  .compact-lesson span {
    font-size: 9px;
  }

  .print-overview-table.overview-density-standard .compact-lesson strong {
    font-size: 10.5px;
  }

  .print-overview-table.overview-density-standard .compact-lesson span {
    font-size: 9px;
  }

  .print-overview-table.overview-density-spacious .overview-title th,
  .print-overview-table.overview-density-spacious thead tr:last-child th {
    font-size: 12.5px;
  }

  .print-overview-table.overview-density-spacious .compact-lesson strong {
    font-size: 11px;
  }

  .print-overview-table.overview-density-spacious .compact-lesson span {
    font-size: 9.4px;
  }

  .activity-report th,
  .activity-report td {
    height: 28px;
    padding: 3px 4px;
    font-size: 11.5px;
    line-height: 1.08;
  }

  .activity-report caption {
    font-size: 19px;
    padding: 2px 0 4px;
  }

  .activity-report thead th {
    font-size: 16px;
  }

  .activity-report .activity-day {
    font-size: 14px;
  }

  .activity-report .activity-hour {
    font-size: 10.5px;
  }

  .schedule {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 10px;
  }

  .schedule caption {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .schedule th,
  .schedule td {
    padding: 3px;
  }

  .schedule th:first-child {
    width: 78px;
    min-width: 78px;
  }

  .schedule td {
    height: 54px;
  }

  .schedule tbody tr.schedule-period-start > th,
  .schedule tbody tr.schedule-period-start > td {
    border-top-width: 3px;
    border-top-color: #000;
  }

  .lesson {
    border-left-width: 3px;
    border-radius: 3px;
    padding: 4px;
    gap: 2px;
  }

  .lesson strong {
    font-size: 10px;
    line-height: 1.1;
  }

  .lesson span,
  .schedule-slot small {
    font-size: 9px;
  }
}
/* Validacao do arquivo de integracao antes do download. */
.seed-validation-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid #cfdad7;
  border-radius: 8px;
  color: #10221f;
  background: #fff;
  box-shadow: 0 22px 60px rgb(10 28 24 / 24%);
}

.seed-validation-dialog::backdrop {
  background: rgb(8 22 19 / 58%);
}

.seed-validation-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(820px, calc(100vh - 32px));
}

.seed-validation-head,
.seed-validation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.seed-validation-head {
  border-bottom: 1px solid #dbe4e1;
}

.seed-validation-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.seed-validation-eyebrow {
  color: #52706a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.seed-dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 6px;
  font-size: 25px;
  line-height: 1;
}

.seed-validation-content {
  min-height: 0;
  padding: 18px 20px;
  overflow: auto;
}

.seed-validation-summary {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 6px;
}

.seed-validation-summary.ready {
  border-color: #8fd8c8;
  background: #ecfaf6;
}

.seed-validation-summary.blocked {
  border-color: #efb0aa;
  background: #fff2f0;
}

.seed-validation-summary span {
  color: #526762;
  font-size: 13px;
}

.seed-validation-section {
  margin-top: 18px;
}

.seed-validation-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dbe4e1;
}

.seed-validation-section-title h3 {
  margin: 0;
  font-size: 16px;
}

.seed-validation-count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.seed-validation-count.danger {
  color: #8e2018;
  background: #ffe1dd;
}

.seed-validation-count.warn {
  color: #754d00;
  background: #fff0c2;
}

.seed-validation-section ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.seed-validation-section li {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid #bd3126;
  background: #f8faf9;
}

.seed-validation-section:nth-of-type(2) li {
  border-left-color: #d79400;
}

.seed-validation-section li span,
.seed-validation-note,
.seed-validation-empty {
  color: #526762;
  font-size: 13px;
}

.seed-validation-empty {
  padding: 12px 0;
}

.seed-validation-note {
  margin: 18px 0 0;
}

.seed-validation-actions {
  justify-content: flex-end;
  border-top: 1px solid #dbe4e1;
}

/* Afastamentos e atribuicao de substitutos por ocorrencia datada. */
.substitution-top-grid {
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
}

.substitution-date-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#afastamentoObservacao {
  height: 72px;
  min-height: 72px;
}

.substitution-list-title select {
  width: auto;
  min-width: 170px;
}

.substitution-leave-row {
  cursor: pointer;
}

.substitution-leave-row.selected {
  border-color: #58b7aa;
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.status-text.ok {
  color: var(--accent-dark);
}

.status-text.warn {
  color: var(--warn);
}

.substitution-assignment-tools {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.substitution-period-assignment {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.substitution-period-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(145px, 180px) minmax(145px, 180px) auto auto;
  gap: 10px;
  align-items: end;
}

.substitution-period-head h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.substitution-period-head label { min-width: 0; }
.substitution-period-head input { width: 100%; }

.substitution-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-top: 12px;
}

.substitution-group-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.substitution-group-row input { flex: none; width: 16px; height: 16px; margin-top: 3px; }
.substitution-group-row span { min-width: 0; }
.substitution-group-row strong { display: block; }
.substitution-group-row small { display: block; color: var(--muted); }

.substitution-occurrence-details {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.substitution-occurrence-details summary {
  cursor: pointer;
  font-weight: 600;
}

.substitution-occurrence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.substitution-grade-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7faf9;
}

.substitution-auto-note {
  color: var(--muted);
  line-height: 1.35;
}

.substitution-assignment-tools label {
  min-width: 0;
}

.substitution-assignment-tools .inline-status {
  align-self: center;
  border-radius: 6px;
}

.inline-status.error {
  color: var(--danger);
  border-color: #efb0aa;
  background: #fff2f0;
}

.substitution-table {
  min-width: 1040px;
}

.substitution-table td:first-child,
.substitution-table th:first-child {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.substitution-table td:nth-child(2) {
  width: 110px;
  min-width: 110px;
}

.substitution-table td:nth-child(3) {
  width: 130px;
  min-width: 130px;
}

.substitution-table td:nth-child(4),
.substitution-table td:nth-child(5) {
  min-width: 160px;
}

.substitution-table td:nth-child(6) {
  min-width: 220px;
}

.substitution-table td strong,
.substitution-table td small {
  display: block;
}

.substitution-table td small {
  margin-top: 3px;
  color: var(--muted);
}

.substitution-table .substitution-warning-row {
  background: #fff4d6;
}

.substitution-table .substitution-assigned-row {
  background: #e2f3ec;
}

.substitution-table .substitution-warning-row td:first-child {
  box-shadow: inset 4px 0 #c88700;
}

.substitution-table .substitution-subject {
  font-weight: 700;
  font-size: 14px;
}

.substitution-table .substitution-conflict-row {
  background: #fde9e7;
}

.status-pill.pending {
  background: #eef2f1;
  color: var(--muted);
}

@media (max-width: 640px) {
  .seed-validation-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .seed-validation-card {
    max-height: calc(100vh - 16px);
  }

  .seed-validation-head,
  .seed-validation-content,
  .seed-validation-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .substitution-date-grid,
  .substitution-grade-tools,
  .substitution-assignment-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .substitution-top-grid {
    grid-template-columns: 1fr;
  }

  .substitution-grade-tools {
    grid-template-columns: minmax(220px, 1fr) auto auto;
  }

  .substitution-assignment-tools {
    grid-template-columns: minmax(240px, 1fr) auto auto;
  }

  .substitution-assignment-tools .inline-status {
    grid-column: 1 / -1;
  }

  .substitution-period-head {
    grid-template-columns: minmax(0, 1fr) minmax(145px, 180px) minmax(145px, 180px);
  }

  .substitution-period-head h3 { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .substitution-assignment-tools,
  .substitution-period-head,
  .substitution-group-list {
    grid-template-columns: 1fr;
  }

  .substitution-period-head h3 { grid-column: auto; }
}

.environment-allocation {
  padding: 16px 0 24px;
  border-top: 1px solid var(--line, #d9e2df);
}

.environment-repair-message {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid #b87814;
  background: #fff8e8;
  color: var(--text);
}

.environment-repair-message[hidden] { display: none; }

.environment-repair-guidance {
  margin: 10px 0 14px;
  padding: 12px;
  border-left: 3px solid #0f766e;
  background: #edf7f4;
}

.environment-repair-guidance[hidden] { display: none; }
.environment-repair-guidance p { margin: 6px 0 10px; line-height: 1.45; white-space: pre-line; }

.environment-repair-dialog .entity-editor-card { width: min(720px, calc(100vw - 32px)); }
.environment-repair-preview { max-height: min(65vh, 600px); overflow: auto; }
.environment-repair-preview p { margin: 0 0 12px; }
.environment-repair-preview ul { margin: 0; padding-left: 22px; }
.environment-repair-preview li { margin: 8px 0; }

.environment-allocation .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.environment-allocation-rule {
  border-bottom: 1px solid #d9e2df;
  border-left: 4px solid var(--subject-color, #0b746d);
  background: color-mix(in srgb, var(--subject-color, #0b746d) 8%, white);
  padding: 10px 12px;
  margin: 4px 0;
}

.environment-allocation-rule.is-pending,
.environment-allocation-rule.is-unpaired {
  outline: 1px solid #c58a20;
}

.environment-allocation-rule summary {
  cursor: pointer;
  font-weight: 600;
}

.environment-allocation-rule summary span {
  font-weight: 400;
}

.environment-allocation-rule summary em {
  color: #79510d;
  font-style: normal;
  font-weight: 700;
}

.environment-allocation-suggestions {
  padding: 10px 0 2px;
  line-height: 2.2;
}

.environment-allocation-suggestions button {
  margin: 0 4px;
}

.environment-allocation-suggestions small {
  display: block;
  line-height: 1.5;
}

.environment-allocation-conflicts {
  padding-top: 12px;
}

.environment-allocation-conflicts ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.environment-allocation-conflicts li {
  margin: 5px 0;
  line-height: 1.5;
}

.environment-allocation-conflicts button {
  padding: 2px 6px;
  margin: 0 2px;
}

.environment-allocation-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 16px;
  padding: 12px 0;
}

.environment-allocation-slots label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.environment-allocation-slots .environment-allocation-choice {
  align-items: stretch;
  flex-direction: column;
}

.environment-allocation-choice select {
  width: 100%;
  min-width: 0;
}

.environment-allocation-actions,
.environment-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#btnOrganizarAmbientes { min-width: 174px; }

.environment-report {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.environment-report-actions {
  margin-bottom: 10px;
}

.environment-report-actions h3 {
  margin: 0 auto 0 0;
}

.environment-report-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.environment-report-actions select {
  width: auto;
  min-width: 110px;
}

.environment-report-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.environment-report-lesson {
  display: grid;
  gap: 1px;
  padding: 3px 5px;
  border-left: 3px solid var(--subject-color);
  background: color-mix(in srgb, var(--subject-color) 12%, white);
  text-align: left;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.2;
}

.environment-report-lesson + .environment-report-lesson {
  margin-top: 3px;
}

.environment-report-lesson strong,
.environment-report-lesson span,
.environment-report-lesson small {
  display: block;
}

@media print {
  body.print-ambientes #ambientes > :not(#ambienteRelatorio),
  body.print-ambientes .sidebar,
  body.print-ambientes .environment-report-actions {
    display: none !important;
  }

  body.print-ambientes #ambienteRelatorio {
    display: block !important;
    padding: 0;
    border: 0;
  }

  body.print-ambientes #ambienteRelatorioTabela {
    overflow: visible;
  }

  body.print-ambientes .environment-report-summary {
    font-size: 9px;
    color: #000;
    margin-bottom: 4px;
  }

  body.print-ambientes .environment-report-lesson {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 9px;
    padding: 1px 3px;
  }
}
