:root {
  --bg: #f4efe6;
  --panel: rgba(255, 250, 243, 0.88);
  --panel-strong: #fffaf2;
  --ink: #16211d;
  --muted: #5d6a62;
  --line: rgba(22, 33, 29, 0.12);
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d6f0eb;
  --glow: #ffcf99;
  --danger: #994c38;
  --shadow: 0 24px 80px rgba(34, 34, 34, 0.08);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --toast-offset-x: 24px;
  --toast-offset-y: 24px;
  --toast-max-width: 360px;
  --toast-gap: 12px;
  --font-base: 1.15rem;
  --font-helper: 1rem;
  --font-helper-sm: 0.92rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  font-size: var(--font-base);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 207, 153, 0.75), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 24%),
    linear-gradient(145deg, #efe3d3 0%, #f7f4ee 56%, #edf5f3 100%);
}

body.is-booting .page-shell,
body.is-booting .app-dialog,
body.is-booting .toast-region {
  visibility: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: var(--font-base);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 24px;
  padding: 24px;
}

body.is-authenticated .page-shell {
  grid-template-columns: 1fr;
}

body.is-authenticated .hero-panel {
  display: none;
}

.hero-panel,
.workspace {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  padding: 32px;
  position: sticky;
  top: 24px;
  align-self: start;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -100px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.2), transparent 70%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: var(--font-helper);
  font-weight: 700;
  color: var(--accent-strong);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 1.05;
}

h1 {
  font-size: 3rem;
  margin-top: 18px;
}

h2 {
  font-size: 3rem;
}

h3 {
  font-size: 3rem;
}

h4 {
  font-size: 3rem;
}

[hidden] {
  display: none !important;
}

.hero-copy,
.section-head p,
.section-head-wide p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-card,
.saved-summary,
.toolbar,
.table-wrapper,
.card-grid,
.program-meta {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.hero-card {
  margin-top: 28px;
  padding: 22px;
}

.hero-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.workspace {
  padding: 24px;
  /* Item de grid: sem isso, tabelas largas alargam a página em vez de rolar no próprio contêiner. */
  min-width: 0;
}

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

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

.session-chip {
  border: 1px solid rgba(17, 94, 89, 0.2);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.user-menu {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdf9;
  box-shadow: var(--shadow);
  z-index: 20;
}

.user-menu-panel .ghost-action {
  width: 100%;
  justify-content: flex-start;
}

.user-menu-panel[hidden] {
  display: none;
}

.ghost-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.ghost-action.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(17, 94, 89, 0.24);
}

.danger-action {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--danger);
  color: #fff7f3;
  cursor: pointer;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 28px 0 22px;
}

.tabs-quick-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab,
.toolbar button,
.import-button,
.primary-action,
.export-menu summary {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.tab,
.toolbar button,
.import-button,
.export-menu summary {
  background: #ece7dc;
  color: var(--ink);
}

.tab:hover,
.toolbar button:hover,
.import-button:hover,
.primary-action:hover,
.export-menu summary:hover {
  transform: translateY(-1px);
}

.tab.is-active,
.primary-action,
#edit-program.is-active,
#edit-contacts-button.is-active {
  background: var(--accent);
  color: #f5fffd;
}

.tab.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.panel {
  display: none;
  animation: fade-up 260ms ease;
}

.panel.is-active {
  display: block;
}

.section-head,
.section-head-wide {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head-wide {
  align-items: start;
}

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

.section-actions p {
  margin: 0;
}

.section-actions-buttons,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#share-program-url {
  min-width: 320px;
  flex: 1;
}

#share-student-signup-url {
  width: min(100%, 360px);
  min-width: 220px;
  flex: 0 1 360px;
}

.student-signup-link-row {
  flex-wrap: nowrap;
  align-items: center;
}

.student-signup-link-row .ghost-action {
  white-space: nowrap;
}

#open-share-program-link {
  text-decoration: none;
}

#program-class-number {
  max-width: 140px;
}

body.is-public-share-mode .hero-panel,
body.is-public-share-mode .topbar-actions,
body.is-public-share-mode .panel[data-tab-panel="login"],
body.is-public-share-mode .panel[data-tab-panel="cadastro"],
body.is-public-share-mode .panel[data-tab-panel="turmas"],
body.is-public-share-mode .panel[data-tab-panel="aprovacoes"] {
  display: none !important;
}

body.is-public-share-mode .page-shell {
  display: block;
}

body.is-public-student-signup-mode .program-meta,
body.is-public-student-signup-mode .tabs,
body.is-public-student-signup-mode .panel[data-tab-panel="programa"] .section-head-wide,
body.is-public-student-signup-mode #program-import-card,
body.is-public-student-signup-mode #share-program-card,
body.is-public-student-signup-mode .table-wrapper {
  display: none !important;
}

.form-inline-actions {
  align-items: center;
}

.stack-card {
  margin-top: 18px;
}

.card-grid {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.form-card-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.form-card-head h4 {
  margin: 0;
}

.form-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.panel[data-tab-panel="login"] .card-grid + .card-grid {
  margin-top: 18px;
}

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

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

.full-row-field {
  grid-column: 1 / -1;
}

#change-password-form .full-row-field input {
  width: 25vw;
  max-width: 360px;
  min-width: 220px;
}

.schedule-fields-row {
  grid-column: 1 / -1;
  padding: 0;
  border: 0;
  background: transparent;
}

.rich-editor-field {
  display: grid;
  gap: 8px;
}

.rich-editor-content {
  min-height: 180px;
  border: 1px solid rgba(22, 33, 29, 0.14);
  border-radius: var(--radius-md);
  background: #fffdf9;
  padding: 0;
  color: var(--ink);
  line-height: 1.45;
  overflow: hidden;
}

#turma-rich-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid rgba(22, 33, 29, 0.14);
  background: #f8f4ec;
}

#turma-rich-editor .ql-container.ql-snow {
  border: 0;
  min-height: 128px;
}

#turma-rich-editor .ql-editor {
  min-height: 128px;
  font-size: 1rem;
}

#turma-location-fields {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.1fr) minmax(84px, 0.55fr);
}

#turma-location-fields input[name="estado"] {
  text-align: center;
  width: 4.8ch;
  min-width: 4.8ch;
  max-width: 4.8ch;
  justify-self: start;
}

#turma-form select[name="modalidade"],
#turma-form select[name="status"],
#turma-form select[name="tipo"] {
  width: fit-content;
  min-width: 18ch;
  max-width: 100%;
  justify-self: start;
  padding-right: 34px;
}

#turma-form .turma-primary-row {
  grid-template-columns: minmax(10ch, 0.8fr) minmax(14ch, auto);
  column-gap: 8px;
  align-items: end;
  justify-content: start;
}

#turma-form input[name="nome"] {
  width: 11ch;
  min-width: 11ch;
  max-width: 11ch;
  justify-self: start;
}

#turma-form .turma-type-row {
  grid-template-columns: minmax(18ch, auto) minmax(18ch, auto);
  column-gap: 8px;
  justify-content: start;
}

#turma-online-room-fields {
  --turma-link-field-width: min(64ch, 100%);
  grid-template-columns: max-content var(--turma-link-field-width);
  column-gap: 4px;
  align-items: end;
  justify-content: start;
}

#turma-form select[name="salaOnlineTipo"] {
  width: fit-content;
  min-width: 14ch;
  max-width: 100%;
  justify-self: start;
}

#turma-form input[name="salaOnlineLink"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#turma-form .turma-mensageiro-grupo-row {
  --turma-link-field-width: min(64ch, 100%);
  grid-template-columns: max-content var(--turma-link-field-width);
  column-gap: 4px;
  align-items: end;
  justify-content: start;
}

#turma-form select[name="mensageiroGrupoTipo"] {
  width: auto;
  min-width: 0;
  max-width: max-content;
  justify-self: start;
}

#turma-form input[name="mensageiroGrupoLink"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.field-inline-note {
  font-size: 0.74em;
  font-weight: 400;
  color: color-mix(in srgb, var(--muted) 72%, white 28%);
  letter-spacing: 0.01em;
}

#turma-form input[name="inicio"] {
  justify-self: start;
  width: 16.5ch;
  min-width: 16.5ch;
  max-width: 16.5ch;
}

#turma-form input[name="diaSemana"] {
  justify-self: start;
  width: 13.5ch;
  min-width: 13.5ch;
  max-width: 13.5ch;
}

#turma-form input[name="horarioInicio"] {
  justify-self: start;
  width: 8.8ch;
  min-width: 8.8ch;
  max-width: 8.8ch;
}

#turma-form .turma-schedule-row {
  grid-template-columns: minmax(16.5ch, auto) minmax(13.5ch, auto) minmax(8.8ch, auto);
  column-gap: 4px;
  align-items: end;
  justify-content: start;
}

#program-start-date,
#program-end-date {
  width: 13.5ch;
  min-width: 13.5ch;
  max-width: 13.5ch;
  box-sizing: border-box;
  justify-self: start;
  padding-right: 12px;
  font-variant-numeric: tabular-nums;
}

.program-date-field {
  position: relative;
}

.program-end-date-field {
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--muted);
  font-weight: 600;
}

.program-end-date-field > label {
  display: block;
}

.program-end-date-field .program-end-date-auto {
  /* Fica abaixo do campo sem aumentar a altura da linha, mantendo os campos alinhados. */
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8em;
  font-weight: 500;
  cursor: pointer;
}

.program-end-date-auto input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--accent, #0f766e);
}

.secretaries-field {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.field-support-copy {
  margin: 0;
  font-size: var(--font-helper);
  font-weight: 500;
  color: var(--muted);
}

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

.secretaries-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.secretary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.secretary-row-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.55fr) minmax(160px, 0.85fr) minmax(220px, 1.35fr) auto;
  gap: 10px;
  align-items: end;
}

.secretary-row-pending {
  border: 1px solid rgba(22, 33, 29, 0.14);
  border-radius: var(--radius-md);
  background: #fffdf9;
  padding: 10px 12px;
}

.secretary-row-pending-fields {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
}

.secretary-pending-meta {
  font-size: var(--font-helper);
  color: var(--ink);
  font-weight: 600;
}

.secretary-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(160, 106, 0, 0.28);
  background: rgba(246, 176, 51, 0.16);
  color: #7a4a00;
  font-size: var(--font-helper-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.secretary-pending-badge.is-accepted {
  border-color: rgba(24, 118, 54, 0.32);
  background: rgba(76, 175, 80, 0.2);
  color: #1f6f34;
}

.secretary-input-group {
  min-width: 0;
}

.remove-secretary-button {
  white-space: nowrap;
}

.add-secretary-button {
  min-width: 40px;
  padding-inline: 12px;
}

.students-template-button {
  align-self: center;
}

.program-template-button {
  align-self: center;
}

@media (max-width: 820px) {
  .secretary-row-fields {
    grid-template-columns: 1fr;
  }

  .secretary-row-pending-fields {
    grid-template-columns: 1fr;
  }
}

#contacts-form.is-readonly #add-secretary-button,
#contacts-form.is-readonly .remove-secretary-button {
  display: none;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(22, 33, 29, 0.14);
  border-radius: var(--radius-md);
  background: #fffdf9;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.saved-summary {
  margin-top: 18px;
  padding: 18px 20px;
  color: var(--muted);
}

.section-head-compact {
  margin-bottom: 16px;
}

.admin-users-section {
  display: grid;
  gap: 14px;
}

.admin-users-list {
  display: grid;
  gap: 12px;
}

.approvals-subtabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.approvals-subtabs .ghost-action.is-active {
  border-color: rgba(17, 94, 89, 0.36);
  background: rgba(214, 240, 235, 0.7);
  color: var(--ink);
}

.admin-user-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.85);
}

.admin-user-item strong,
.admin-user-item span {
  display: block;
}

.admin-user-item strong {
  color: var(--ink);
}

.admin-user-meta {
  min-width: 0;
}

.admin-user-meta span {
  margin-top: 4px;
  word-break: break-word;
}

.admin-user-role {
  min-width: 170px;
}

.invite-status {
  font-size: var(--font-helper-sm);
  color: #7b4a30;
}

.turma-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
}

.turma-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.turma-archived-warning {
  margin: 0;
  color: #7b4a30;
  font-weight: 700;
  font-size: var(--font-helper);
  line-height: 1.25;
}

.turma-shortcuts {
  margin: 0 0 10px;
  justify-content: flex-start;
  gap: 10px;
}

.turma-shortcuts[hidden] {
  display: none !important;
}

.turma-card-actions .ghost-action {
  white-space: nowrap;
}

.turma-link-requests {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: rgba(255, 253, 249, 0.85);
}

.turma-link-request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.toast-region {
  position: fixed;
  top: var(--toast-offset-y);
  right: var(--toast-offset-x);
  z-index: 1000;
  display: grid;
  gap: var(--toast-gap);
  width: min(var(--toast-max-width), calc(100vw - (var(--toast-offset-x) * 2)));
}

.toast {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  color: var(--ink);
  animation: fade-up 220ms ease;
}

.toast.is-success {
  border-color: rgba(17, 94, 89, 0.22);
  background: rgba(214, 240, 235, 0.96);
}

.toast.is-error {
  border-color: rgba(153, 76, 56, 0.24);
  background: rgba(247, 237, 231, 0.97);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
  font-family: "Fraunces", serif;
}

.toast p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.app-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(22, 33, 29, 0.42);
  backdrop-filter: blur(3px);
}

.app-dialog-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--panel-strong);
}

.app-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.app-dialog-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.app-dialog-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.file-import-field small {
  color: var(--muted);
  font-weight: 500;
}

.students-import-field {
  min-width: min(100%, 280px);
}

.program-import-field {
  min-width: min(100%, 280px);
}

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

.students-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.students-panel-head p {
  margin: 0;
}

.students-table-wrapper {
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.students-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: auto;
}

.students-table th,
.students-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.students-table th {
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-size: 1rem;
  text-align: center;
}

.students-table tbody tr:last-child td {
  border-bottom: none;
}

.students-table th:nth-child(4),
.students-table td:nth-child(4) {
  text-align: center;
}

.students-actions-cell .ghost-action {
  min-width: 92px;
}

.access-summary h4 {
  margin-bottom: 12px;
}

.access-grid {
  display: grid;
  gap: 12px;
}

.access-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdf9;
}

.access-item strong {
  color: var(--ink);
}

.access-item code {
  padding: 2px 8px;
  border-radius: 999px;
  background: #ece7dc;
  color: var(--ink);
}

.inline-title {
  display: grid;
  gap: 6px;
}

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

.turma-list {
  display: grid;
  gap: 10px;
  width: min(100%, 1120px);
  margin-inline: auto;
}

.turma-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #fffdf9;
  color: var(--ink);
  cursor: pointer;
}

.turma-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(17, 94, 89, 0.24);
}

.turma-item.is-active-status {
  border-left: 6px solid var(--accent);
}

.turma-item.is-archived {
  background: #f7ede7;
  border-color: rgba(153, 76, 56, 0.22);
  border-left: 6px solid var(--danger);
}

.turma-item span {
  color: var(--muted);
  font-size: var(--font-helper);
  line-height: 1.25;
}

.turma-item strong {
  font-size: 1rem;
}

.list-empty {
  margin: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.program-meta {
  margin-bottom: 16px;
  grid-template-columns: minmax(120px, 160px) minmax(200px, 1fr) auto auto auto;
  align-items: end;
  justify-content: start;
  gap: 12px;
}

#program-title {
  justify-self: stretch;
  min-width: 200px;
}

.program-meta-toolbar {
  grid-column: 5;
  justify-self: end;
  align-self: end;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  justify-content: flex-end;
  box-shadow: none;
  align-items: end;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu summary::after {
  content: "▾";
  font-size: var(--font-helper-sm);
}

.export-menu[open] summary::after {
  content: "▴";
}

.export-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 132px;
  padding: 8px;
  display: grid;
  gap: 8px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 20;
}

.export-menu-list button {
  width: 100%;
  justify-content: center;
}

.export-menu.is-disabled {
  pointer-events: none;
  opacity: 0.68;
}

.table-wrapper {
  overflow: auto;
  padding: 14px;
  display: flex;
  justify-content: center;
}

table {
  width: max-content;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  border: 1px solid var(--line);
  padding: 0;
  vertical-align: middle;
  background: #fffdfa;
}

th {
  background: #fffdfa;
  vertical-align: middle;
}

th input,
.table-text-cell {
  border: none;
  border-radius: var(--radius-md);
  background: #fffdf9;
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

th input {
  width: auto;
  min-width: 0;
}

.aulas-text-cell,
.date-text-cell {
  text-align: center;
}

.date-column-cell {
  vertical-align: middle;
}

.tema-column-cell {
  vertical-align: middle;
}

#program-table {
  table-layout: fixed;
  /* Margens automáticas centralizam sem cortar o lado esquerdo quando a tabela rola. */
  margin-inline: auto;
}

.table-wrapper:has(#program-table) {
  justify-content: flex-start;
}

#program-table .wrap-column-cell .table-text-cell {
  justify-content: flex-start;
  padding-left: 1ch;
  text-align: left;
}

#program-table th,
#program-table td {
  overflow-wrap: anywhere;
}

.table-text-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  box-sizing: border-box;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: center;
}

.tema-text-cell {
  justify-content: flex-start;
  padding-left: 1ch;
  text-align: left;
}

.row-tools-col {
  width: 88px;
}

.aulas-column-cell {
  vertical-align: middle;
}

.row-tools-head,
.row-tools-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f7f3eb;
  vertical-align: middle;
}

.row-tools-head {
  z-index: 3;
  min-width: 88px;
  text-align: center;
}

.header-cell,
.row-tools {
  display: grid;
  gap: 8px;
  position: relative;
}

.header-cell {
  width: 100%;
  box-sizing: border-box;
  justify-items: center;
  align-content: center;
  align-items: center;
  min-height: 60px;
  padding: 6px;
}

.header-cell input {
  width: auto;
  max-width: 100%;
  font-weight: 700;
  text-align: center;
}

.table-text-cell:focus {
  outline: none;
  box-shadow: none;
  background: rgba(15, 118, 110, 0.06);
}

th input:focus {
  outline: none;
  box-shadow: none;
  background: transparent;
}

th input,
th {
  font-weight: 700;
}

.table-action-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border: none;
  border-radius: 10px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  color: #8b948c;
  cursor: pointer;
  font-size: var(--font-helper-sm);
  font-weight: 600;
  font-family: "Manrope", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-transform: none;
}

#program-table.is-readonly .table-action-button,
#program-table.is-readonly .column-resize-handle {
  display: none;
}

.table-add-button {
  left: 8px;
  right: auto;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  width: 12px;
  height: 100%;
  z-index: 2;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: col-resize;
}

.column-resize-handle::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 5px;
  width: 2px;
  border-radius: 999px;
  background: rgba(93, 106, 98, 0.28);
}

.column-resize-handle:hover::before,
.column-resize-handle:focus-visible::before {
  background: rgba(15, 118, 110, 0.55);
}

.row-tools {
  min-height: 60px;
  align-content: center;
  align-items: center;
  justify-items: center;
  padding: 6px;
}

.row-tools span {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.table-text-cell[contenteditable="false"] {
  cursor: text;
  opacity: 1;
  color: var(--ink);
}

.date-text-cell[contenteditable="false"] {
  color: var(--ink);
  opacity: 1;
}

.program-meta input:disabled {
  opacity: 1;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  cursor: text;
}

th input:disabled {
  cursor: text;
}

#program-table.is-readonly .table-text-cell,
#program-table.is-readonly th input,
.program-meta input:disabled {
  cursor: text !important;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    position: relative;
    top: 0;
  }

  .section-head,
  .section-head-wide,
  .topbar,
  .students-panel-head,
  .form-card-head {
    flex-direction: column;
    align-items: start;
  }

  .section-actions {
    flex-direction: column;
    align-items: start;
  }

  .section-actions-buttons,
  .inline-actions,
  .form-card-actions,
  .tabs-quick-actions {
    width: 100%;
  }

  .tabs-quick-actions {
    margin-left: 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .two-columns,
  .three-columns {
    grid-template-columns: 1fr;
  }

  .program-meta {
    grid-template-columns: 1fr;
  }

  .admin-user-item {
    grid-template-columns: 1fr;
  }

  .admin-user-role {
    min-width: 0;
  }

  .program-meta-toolbar {
    grid-column: auto;
    justify-self: start;
    justify-content: flex-start;
    width: 100%;
  }

  .export-menu-list {
    left: 0;
    right: auto;
  }

  .toast-region {
    top: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* Espaço para a opção "Calcular pela última aula", posicionada abaixo do campo de data final. */
.program-meta:has(.program-end-date-auto:not([hidden])) {
  padding-bottom: 34px;
}
