/* ==========================================================================
   KEMU — Escolas e Turmas
   ========================================================================== */

.screen--schools {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.sch-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.sch-head h1 {
  margin: var(--sp-1) 0 0;
  color: var(--text);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
}

.sch-head p,
.sch-empty {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

.sch-ai-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--info-b);
  border-radius: var(--r-lg);
  background: var(--info-b);
  color: var(--info);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
}

.sch-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--brand-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
}

.sch-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: var(--sp-3);
}

.sch-metrics--compact {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.sch-metric {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-1) var(--sp-2);
  align-items: center;
  min-width: 0;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-xs);
}

.sch-metric__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  grid-row: span 2;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  color: var(--text-2);
}

.sch-metric[data-tone="brand"] .sch-metric__icon,
.sch-metric[data-tone="xp"] .sch-metric__icon {
  background: var(--brand-50);
  color: var(--brand-600);
}

.sch-metric[data-tone="success"] .sch-metric__icon {
  background: var(--success-b);
  color: var(--success);
}

.sch-metric[data-tone="info"] .sch-metric__icon {
  background: var(--info-b);
  color: var(--info);
}

.sch-metric strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
}

.sch-metric span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.sch-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.sch-card__head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.sch-card__title {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
}

.sch-card__sub {
  margin: var(--sp-1) 0 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.sch-card__tools,
.sch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.sch-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.sch-formgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}

.sch-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.sch-field span {
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
}

.sch-input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
}

.sch-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.sch-textarea {
  min-height: 96px;
  padding: var(--sp-3);
  resize: vertical;
  line-height: var(--lh-snug);
}

.sch-divider {
  height: 1px;
  background: var(--border);
}

.sch-class-tabs {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-1);
}

.sch-class-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 180px;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-xs);
}

.sch-class-tab strong {
  color: var(--text);
  font-size: var(--fs-sm);
}

.sch-class-tab span {
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.sch-class-tab small {
  color: var(--brand-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}

.sch-class-tab.is-active {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.sch-codebox {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.sch-codebox > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sch-codebox span {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
}

.sch-codebox strong {
  color: var(--text);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: 0;
}

.sch-table {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  overflow-x: auto;
}

.sch-table__head,
.sch-table__row {
  display: grid;
  grid-template-columns: minmax(210px, 1.6fr) minmax(70px, .5fr) minmax(120px, .8fr) minmax(120px, .8fr) minmax(52px, .3fr);
  gap: var(--sp-3);
  align-items: center;
  min-width: 720px;
  padding: var(--sp-3);
  border-radius: var(--r-lg);
}

.sch-table__head {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
}

.sch-table__row {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.sch-table__name {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.sch-table__name > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sch-table__name strong,
.sch-table__name small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-table__name strong {
  color: var(--text);
}

.sch-table__name small {
  color: var(--text-3);
}

@media (min-width: 720px) {
  .sch-head,
  .sch-card__head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .sch-head h1 { font-size: var(--fs-2xl); }
  .sch-formgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sch-codebox {
    flex-direction: row;
    align-items: center;
  }
  .sch-codebox > div:first-child { flex: 1 1 auto; }
}
