/* ============================================================
   Novos Alunos Uélicon — app.css
   ============================================================
   Light mode. Inter + tabular-nums.
   Importa tokens.css; só estilos próprios do produto aqui.
   v1.0 — 2026-05-11
   ============================================================ */

@import url('./tokens.css');

/* ============================================================
   F4 — x-cloak: esconder elementos Alpine antes de hidratar
   ============================================================ */
[x-cloak] { display: none !important; }

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }
body {
  margin: 0;
  padding: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html, body { overflow-x: hidden; }
body { min-height: 100vh; min-height: 100svh; }

h1, h2, h3, h4 { margin: 0; }

img, svg { display: block; max-width: 100%; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

a {
  color: var(--accent-soft-text);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ============================================================
   LAYOUT — container + header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.app-header__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-size: var(--text-md);
}
.brand__mark {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--neutral-200);
  color: var(--text-primary);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}
.brand__name { letter-spacing: -0.005em; }

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.app-nav__link {
  position: relative;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-body);
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--motion-fast) var(--ease-out);
}
.app-nav__link:hover { color: var(--text-primary); text-decoration: none; }
.app-nav__link.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}
.app-nav__link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.app-header__spacer { flex: 1; }

.bell {
  position: relative;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-body);
}
.bell:hover { background: var(--surface-subtle); color: var(--text-primary); }
.bell:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.bell__count {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--red-500);
  color: #fff;
  font-size: 11px;
  font-weight: var(--weight-bold);
  border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.bell__count--zero { display: none; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-base);
}
.user-chip:hover { background: var(--surface-subtle); }
.user-chip__avatar {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--neutral-200);
  color: var(--text-body);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  border-radius: var(--radius-pill);
}
.user-chip__caret { transition: transform var(--motion-fast) var(--ease-out); }
.user-chip__caret.is-open { transform: rotate(180deg); }
.user-chip-wrap { position: relative; }
.user-chip__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: var(--space-1);
  z-index: var(--z-dropdown);
}
.user-chip__menuitem {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text-body);
  font-size: var(--text-base);
}
.user-chip__menuitem:hover { background: var(--surface-subtle); color: var(--text-primary); }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6);
}

.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  border: 1px solid transparent;
  transition: background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus);
}
.btn--primary {
  background: var(--green-700);
  color: var(--text-on-accent);
  font-weight: var(--weight-semibold);
}
.btn--primary:hover { background: var(--green-800, oklch(38% 0.13 145)); }
.btn--primary:disabled,
.btn--primary[aria-disabled="true"] {
  background: var(--neutral-200);
  color: var(--text-disabled);
  cursor: not-allowed;
}
.btn--ghost {
  background: transparent;
  color: var(--text-body);
  border-color: var(--border-default);
}
.btn--ghost:hover { background: var(--surface-subtle); color: var(--text-primary); }
.btn--danger {
  background: var(--red-600);
  color: #fff;
}
.btn--danger:hover { background: var(--red-700); }
.btn--small { height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn--full { width: 100%; }
.btn--icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--radius);
  color: var(--text-body);
}
.btn--icon:hover { background: var(--surface-subtle); color: var(--text-primary); }

/* ============================================================
   INPUTS
   ============================================================ */
.field { display: block; margin-bottom: var(--space-4); }
.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-body);
  margin-bottom: var(--space-1);
}
.field__hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}
.field__error {
  display: block;
  font-size: var(--text-sm);
  color: var(--red-700);
  margin-top: var(--space-1);
}

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-base);
  transition: border-color var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.textarea { height: auto; min-height: 80px; padding: var(--space-2) var(--space-3); resize: vertical; line-height: var(--leading-normal); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.input--error, .select--error, .textarea--error {
  border-color: var(--red-500);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-inset);
  cursor: not-allowed;
}

.checkbox, .radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  color: var(--text-body);
  cursor: pointer;
  user-select: none;
}
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.toggle {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--space-2);
  cursor: pointer; user-select: none;
}
.toggle__input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 36px; height: 20px;
  background: var(--neutral-300);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background var(--motion-fast) var(--ease-out);
}
.toggle__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: var(--radius-pill);
  transition: transform var(--motion-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.toggle__input:checked + .toggle__track { background: var(--accent); }
.toggle__input:checked + .toggle__track .toggle__thumb { transform: translateX(16px); }
.toggle__input:focus-visible + .toggle__track {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ============================================================
   CARDS / KPIs
   ============================================================ */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card__head {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.card__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}
.card__body { padding: var(--space-4) var(--space-6); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
@media (max-width: 1023px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: var(--kpi-neutral-bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out);
  text-align: left;
  width: 100%;
}
.kpi:hover { border-color: var(--border-strong); }
.kpi:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus);
}
.kpi__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}
.kpi__number {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
}
.kpi__unit {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}
.kpi__warn {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--amber-700);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   BADGES (status + chips neutros)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  background: var(--status-neutral-bg);
  color: var(--status-neutral-fg);
  line-height: 1.4;
  white-space: nowrap;
}
.badge--success { background: var(--status-success-bg); color: var(--status-success-fg); }
.badge--danger  { background: var(--status-danger-bg);  color: var(--status-danger-fg); }
.badge--warning { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.badge--info    { background: var(--status-info-bg);    color: var(--status-info-fg); }
.badge svg { width: 12px; height: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-default);
  white-space: nowrap;
}

/* ============================================================
   DOTS DE ETAPA (componente central)
   ============================================================ */
.etapa-dots {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.etapa-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-pill);
  background: var(--status-neutral-dot);
  flex-shrink: 0;
}
.etapa-dot--feito { background: var(--status-success-dot); }
.etapa-dot--parado { background: var(--status-warning-dot); }
.etapa-dot--bloqueado { background: var(--status-danger-dot); }
.etapa-connector {
  width: 12px; height: 1px;
  background: var(--border-subtle);
  flex-shrink: 0;
}
.etapa-connector--feito { background: var(--status-success-dot); }
.etapa-labels {
  margin-top: var(--space-1);
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.etapa-labels span { width: 22px; text-align: center; }
@media (max-width: 1023px) { .etapa-labels { display: none; } }

/* ============================================================
   TABELA
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-card);
}
.table thead th {
  /* sticky removido — causava sobreposição da 1a row em algumas larguras (bug visto no audit r1).
     .table-wrap tem overflow:hidden, então sticky aqui também não estava cumprindo seu papel.
     Em listas muito longas, o usuário rola a página inteira (header já é sticky). */
  background: var(--surface-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}
.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-base);
  color: var(--text-body);
  vertical-align: middle;
}
.table tbody tr {
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}
.table tbody tr:hover { background: var(--surface-subtle); }
.table tbody tr:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}
.table tbody tr .row-chevron { opacity: 0; }
.table tbody tr:hover .row-chevron { opacity: 1; color: var(--text-tertiary); }
.table .col-tab { font-variant-numeric: tabular-nums; }

.table-wrap {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* nome do aluno + email empilhados */
.cell-aluno__nome { color: var(--text-primary); font-weight: var(--weight-medium); }
.cell-aluno__email { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

/* paginação */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.pagination__pages { display: flex; gap: var(--space-1); align-items: center; }
.pagination__btn {
  min-width: 32px; height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-body);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.pagination__btn:hover { background: var(--surface-subtle); }
.pagination__btn.is-active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); font-weight: var(--weight-semibold); }
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   FILTROS CHIP-BAR
   ============================================================ */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-body);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  height: 36px;
}
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-color: var(--accent);
}
.filter-chip svg { width: 12px; height: 12px; }
.search {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3) 0 36px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--surface-card);
  font-size: var(--text-sm);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.search svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-tertiary);
}
.filterbar__right { margin-left: auto; display: flex; gap: var(--space-2); }

/* ============================================================
   DROPDOWN GENÉRICO
   ============================================================ */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-1);
  z-index: var(--z-dropdown);
}
.dropdown__item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-body);
  border-radius: var(--radius-sm);
  text-align: left;
}
.dropdown__item:hover { background: var(--surface-subtle); }
.dropdown__item.is-active { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: var(--weight-medium); }

/* ============================================================
   DRAWER + OVERLAY + MODAL
   ============================================================ */
.overlay {
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / 0.4);
  z-index: var(--z-overlay);
  animation: fade-in var(--motion-base) var(--ease-out);
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--drawer-width);
  max-width: 100vw;
  background: var(--surface-card);
  box-shadow: var(--shadow-drawer);
  z-index: var(--z-drawer);
  display: flex; flex-direction: column;
  animation: slide-in-right var(--motion-slow) var(--ease-out);
}
.drawer--wide { width: 560px; }
@media (max-width: 640px) {
  .drawer { width: 100vw; }
  .drawer--wide { width: 100vw; }
}
.drawer__head {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  flex-shrink: 0;
}
.drawer__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); }
.drawer__sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--space-6); }
.drawer__foot {
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-card);
  display: flex; justify-content: flex-end; gap: var(--space-3);
  flex-shrink: 0;
}
.drawer__foot--between { justify-content: space-between; align-items: center; }
.drawer__close {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-body);
}
.drawer__close:hover { background: var(--surface-subtle); color: var(--text-primary); }

/* modal */
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 440px;
  width: calc(100vw - 32px);
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  padding: var(--space-6);
  animation: pop-in var(--motion-base) var(--ease-out);
}
.modal__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.modal__body { font-size: var(--text-base); color: var(--text-body); margin-bottom: var(--space-6); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--space-3); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-stack {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex; flex-direction: column-reverse; gap: var(--space-2);
  max-width: 380px;
}
.toast {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  color: var(--text-body);
  display: flex; gap: var(--space-2); align-items: flex-start;
  animation: slide-up var(--motion-base) var(--ease-out);
}
.toast--success { border-left-color: var(--accent); }
.toast--error { border-left-color: var(--red-500); }
.toast--info { border-left-color: var(--blue-500); }
.toast__close { margin-left: auto; color: var(--text-tertiary); }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SKELETON SHIMMER
   ============================================================ */
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--neutral-100) 0%, var(--neutral-200) 50%, var(--neutral-100) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: var(--radius-sm);
  height: 14px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--neutral-100); }
}

/* ============================================================
   EMPTY STATE / ERROR STATE
   ============================================================ */
.state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-secondary);
}
.state__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-secondary);
}
.state__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.state__sub { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: var(--space-4); max-width: 360px; margin-left: auto; margin-right: auto; }
.state--error .state__icon { background: var(--red-100); color: var(--red-700); }
.state--error .state__title { color: var(--red-700); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  padding: var(--space-8);
}
.login-brand { text-align: center; margin-bottom: var(--space-6); }
.login-brand__mark {
  display: inline-flex;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: var(--neutral-200);
  color: var(--text-primary);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}
.login-brand__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); }
.login-brand__sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-1); }
.login-foot { text-align: center; font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-6); }

/* ============================================================
   SEÇÃO INLINE (form drawer)
   ============================================================ */
.form-section {
  margin-bottom: var(--space-6);
}
.form-section__title {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-section__card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.radio-row { display: flex; flex-wrap: wrap; gap: var(--space-4); }

/* ============================================================
   CHECKLIST DAS 4 ETAPAS (drawer detalhe)
   ============================================================ */
.etapa-card {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.etapa-card:last-child { border-bottom: 0; }
.etapa-card__head {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.etapa-card__status {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.etapa-card__status--feito { color: var(--green-700); }
.etapa-card__status--parado { color: var(--amber-700); }
.etapa-card__status--pendente { color: var(--neutral-700); }
.etapa-card__nome { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--text-primary); }
.etapa-card__meta { font-size: var(--text-xs); color: var(--text-secondary); }
.etapa-card__obs { font-size: var(--text-xs); color: var(--text-secondary); font-style: italic; margin-top: 2px; }
.etapa-card__actions { margin-top: var(--space-2); display: flex; gap: var(--space-2); align-items: center; }

/* ============================================================
   ADMIN TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--space-6);
}
.tab {
  position: relative;
  padding: var(--space-3) 0;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-body);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}
.tab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ============================================================
   LISTAS COMPACTAS DO DASHBOARD
   ============================================================ */
.list-row {
  display: grid;
  grid-template-columns: 16px 1fr auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}
.list-row:last-child { border-bottom: 0; }
.list-row__main { color: var(--text-primary); font-weight: var(--weight-medium); }
.list-row__sub { color: var(--text-secondary); font-size: var(--text-xs); }
.list-row__meta { color: var(--text-secondary); font-size: var(--text-sm); }

.ranking-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-base);
}
.ranking-row:last-child { border-bottom: 0; }
.ranking-row__pos { font-weight: var(--weight-semibold); color: var(--text-primary); width: 20px; font-variant-numeric: tabular-nums; }
.ranking-row__name { color: var(--text-body); flex: 1; }
.ranking-row__count { font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); color: var(--text-primary); }

/* ============================================================
   ALUNO SELETOR (drawer nova turma)
   ============================================================ */
.aluno-pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.aluno-pick:hover { background: var(--surface-subtle); }
.aluno-pick__nome { color: var(--text-primary); font-weight: var(--weight-medium); flex: 1; }
.aluno-pick__meta { color: var(--text-secondary); font-size: var(--text-xs); }

/* ============================================================
   ERROR BANNER (login form)
   ============================================================ */
.error-banner {
  display: flex; align-items: flex-start; gap: var(--space-2);
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid var(--red-100);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin: var(--space-2) 0;
}

/* ============================================================
   HEADER MOBILE — hambúrguer + drawer-nav (≤640px)
   ============================================================
   C2 do audit visual round 1 (2026-05-11): em ≤640px o header
   estoura porque a nav inline com 4 links + sino + user-chip
   não cabe em 360px. Aqui:
   - escondemos a nav inline e mostramos um botão hamburger 44×44
   - o botão abre um drawer-from-left de 280px com a nav vertical
   - o drawer reusa o componente .overlay (já existente)
   ============================================================ */
.app-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-body);
  background: transparent;
  border: 0;
  flex-shrink: 0;
}
.app-nav-toggle:hover { background: var(--surface-subtle); color: var(--text-primary); }
.app-nav-toggle:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* drawer-from-left que segura a nav vertical no mobile */
.nav-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--surface-card);
  box-shadow: var(--shadow-drawer);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  animation: slide-in-left var(--motion-base) var(--ease-out);
}
.nav-drawer__head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-shrink: 0;
}
.nav-drawer__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.nav-drawer__close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-body);
}
.nav-drawer__close:hover { background: var(--surface-subtle); color: var(--text-primary); }
.nav-drawer__list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) 0;
  display: flex;
  flex-direction: column;
}
.nav-drawer__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-body);
  border-left: 3px solid transparent;
}
.nav-drawer__link:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-drawer__link.is-active {
  color: var(--text-primary);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

@keyframes slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

@media (max-width: 640px) {
  .app-nav-toggle { display: inline-flex; }
  .app-nav { display: none !important; }
  .app-header__inner {
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }
  .brand__name {
    /* impede quebra em 2 linhas em 360px */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }
  /* user-chip mostra só inicial em mobile */
  .user-chip span:not(.user-chip__avatar):not(.user-chip__caret) {
    display: none;
  }
}

/* ============================================================
   DRAWER WIDE em telas menores (I7 do audit)
   ============================================================
   Em ≤900px o drawer wide (560) fica apertado sobre tabela.
   Em 768 cobre 100vw pra não competir com a tabela atrás.
   ============================================================ */
@media (max-width: 900px) {
  .drawer--wide { width: 100vw; max-width: 100vw; }
}

/* ============================================================
   ADMIN — header de tab (botão "+ Novo X")
   ============================================================
   C3 do audit visual round 1: o botão "+ Novo X" estava com
   `display:flex; justify-content:flex-end` direto, ficando
   acima da tabela mas via margem negativa por cima da row 1
   em algumas larguras. Solução: wrapper .admin-tab__head que
   reserva espaço próprio com h2 à esquerda + botão à direita,
   tudo em fluxo normal (sem absolute).
   ============================================================ */
.admin-tab__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.admin-tab__head h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.admin-tab__head p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 2px 0 0;
}
.admin-tab__head__left { display: flex; flex-direction: column; gap: 0; }
@media (max-width: 640px) {
  .admin-tab__head {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-tab__head .btn { width: 100%; }
}

/* ============================================================
   BOTÃO DANGER-SOFT (I4 do audit)
   ============================================================
   "Editar" deve ser ghost neutro (default), e botões de
   exclusão/desativação devem usar variante danger-soft:
   border + texto vermelho, fundo branco. Visual menos
   agressivo que .btn--danger (full vermelho).
   ============================================================ */
.btn--danger-soft {
  background: var(--surface-card);
  color: var(--red-700);
  border-color: var(--red-200);
}
.btn--danger-soft:hover {
  background: var(--red-50);
  border-color: var(--red-300);
  color: var(--red-700);
}
.btn--danger-soft:disabled,
.btn--danger-soft[aria-disabled="true"] {
  background: var(--neutral-100);
  color: var(--text-disabled);
  border-color: var(--border-default);
  cursor: not-allowed;
}

/* ============================================================
   BOTÃO :DISABLED genérico (I3 — role admin não editável)
   ============================================================ */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn--ghost:disabled,
.btn--ghost[aria-disabled="true"] {
  background: transparent;
  color: var(--text-disabled);
  border-color: var(--border-subtle);
}
