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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

/* === LOADING === */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

.loading-content h1 {
  font-size: 2rem;
  color: #4a90d9;
  margin-bottom: 0.5rem;
}

.loading-content p {
  color: #666;
  margin-bottom: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Spinner pequeno para botões */
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Estado de loading em botões */
.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}

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

/* === LOGIN === */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: #f0f4f9;
}

.login-box {
  display: flex;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 860px;
  min-height: 520px;
  overflow: hidden;
}

.login-banner {
  flex: 1 1 50%;
  max-width: 50%;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.login-banner.banner-fallback {
  background: linear-gradient(135deg, #4a90d9 0%, #2ecc71 100%);
}

.login-banner.banner-fallback img {
  display: none;
}

.login-card {
  flex: 1 1 50%;
  max-width: 50%;
  background: #fff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card h1 {
  text-align: center;
  color: #4a90d9;
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .login-box {
    flex-direction: column;
    max-width: 440px;
    min-height: auto;
  }

  .login-banner {
    max-width: 100%;
    height: 200px;
  }

  .login-card {
    max-width: 100%;
    padding: 2rem 1.5rem;
  }
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.375rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #4a90d9;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.error-message.show {
  display: block;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary {
  background: #4a90d9;
  color: #fff;
}

.btn-primary:hover {
  background: #357abd;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f0f2f5;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-warning {
  background: #f39c12;
  color: #fff;
}

.btn-warning:hover {
  background: #d68910;
}

.btn-remover {
  background: #e67e22;
  color: #fff;
}

.btn-remover:hover {
  background: #d35400;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  width: auto;
}

/* Botão voltar padrão — mesma pílula do app mobile (.btn-back-categories):
   fundo cinza-claro, texto/ícone no azul da marca e chevron SVG (no lugar do "←") */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  width: auto;
  padding: 0.625rem 1rem;
  margin-bottom: 0.75rem;
  border: none;
  border-radius: 10px;
  background: #f0f2f5;
  color: #4a90d9;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-back:hover,
.btn-back:active {
  background: #e0e0e0;
}

.btn-back svg {
  width: 18px;
  height: 18px;
}

/* === PAGINAÇÃO DAS LISTAS === */
.paginacao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.25rem 0.25rem;
  border-top: 1px solid #f0f2f5;
  margin-top: 0.5rem;
}

.paginacao-info {
  font-size: 0.8rem;
  color: #666;
}

.paginacao-controles {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.paginacao-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4a90d9;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.paginacao-btn:hover:not(:disabled) {
  background: #eef6ff;
  border-color: #4a90d9;
}

.paginacao-btn:disabled {
  color: #b9c2cc;
  cursor: default;
  background: #f7f9fb;
}

.paginacao-pagina {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a1a2e;
  padding: 0 0.25rem;
}

/* === DASHBOARD === */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #1a1a2e;
  color: #fff;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.5rem;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  color: #4a90d9;
}

.sidebar-user {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.5rem;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(74,144,217,0.15);
  color: #4a90d9;
}

.sidebar-footer {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
  display: block;
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
}

.btn-logout:hover {
  background: rgba(255,68,68,0.1);
  border-color: rgba(255,68,68,0.3);
  color: #ff6b6b;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: #666;
  font-size: 0.9rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.card h3 {
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.card .value {
  font-size: 2rem;
  font-weight: 700;
  color: #4a90d9;
  margin-bottom: 0.25rem;
}

.card .label {
  font-size: 0.85rem;
  color: #888;
}

/* Tables */
.table-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.table-header h2 {
  font-size: 1.1rem;
  color: #333;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

th {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #fafafa;
}

td {
  font-size: 0.9rem;
  color: #333;
}

/* Buttons in table cells - vertical spacing only (horizontal via flex gap) */
td .btn {
  margin: 0.125rem 0;
}

/* Action column: flex para alinhamento e espaçamento uniforme */
td:has(.btn):last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  min-width: 280px;
}

tr:last-child td {
  border-bottom: none;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: #333;
}

.modal .btn {
  margin-right: 0.75rem;
}

.modal .btn:last-child {
  margin-right: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Badge roles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-direcao {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-professor {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-aluno {
  background: #fff3e0;
  color: #e65100;
}

/* Search bar */
.search-bar {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.search-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  background: #fafafa;
}

.search-input:focus {
  outline: none;
  border-color: #4a90d9;
  background: #fff;
}

.search-input::placeholder {
  color: #aaa;
}

.search-no-results {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-size: 0.9rem;
  display: none;
}

/* Confirmation dialog */
.confirm-content {
  margin-bottom: 1.5rem;
}

.confirm-content p {
  color: #555;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.confirm-user {
  font-size: 1.1rem;
  color: #333;
  text-align: center;
  padding: 0.75rem;
  background: #f8f9ff;
  border-radius: 8px;
  border: 1px solid #e8ecf4;
}

.confirm-warning {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #888;
}

.empty-state p {
  font-size: 1rem;
}

/* Form messages */
.form-message {
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  display: none;
}

.form-message.error {
  display: block;
  background: #fee;
  color: #c33;
}

.form-message.success {
  display: block;
  background: #e8f5e9;
  color: #2e7d32;
}

/* === DISCIPLINA CARD === */
.disciplina-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.disciplina-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.disciplina-icon {
  margin-bottom: 0.75rem;
}

.disciplina-icon svg {
  width: 40px;
  height: 40px;
  stroke: #4a90d9;
}

.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: #fff;
  cursor: pointer;
}

.form-group select:focus {
  outline: none;
  border-color: #4a90d9;
}

/* === CHARTS === */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 1.25rem;
  transition: box-shadow 0.2s;
}

.chart-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.chart-card h3 {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 1rem;
  font-weight: 600;
}

.chart-svg {
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart-svg svg {
  max-height: 220px;
}

/* Progress Bars */
.progress-bar-container {
  position: relative;
  width: 100%;
  height: 24px;
  background: #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.progress-bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: #333;
  text-shadow: 0 0 4px rgba(255,255,255,0.8);
}

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

/* === TOASTS === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: auto;
  width: 100%;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.hide {
  opacity: 0;
  transform: translateY(-10px);
}

.toast-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.toast-error {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #f8bbd0;
}

.toast-info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

.toast-msg {
  flex: 1;
}

/* ============================================================
   SAEB EDITOR — tela cheia, disposição de gerenciador de arquivos
   ------------------------------------------------------------
   Barra superior (breadcrumb + ações) e duas colunas independentes:
   à esquerda as propriedades da missão, à direita a lista de slides.
   Cada slide é listado como um arquivo (slide-01.txt, slide-02.img...).
   ============================================================ */
.saeb-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: flex;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.saeb-drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.saeb-drawer-overlay.hide {
  opacity: 0;
}

.saeb-drawer {
  width: 100%;
  height: 100%;
  background: #eef1f6;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.985);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.saeb-drawer-overlay.show .saeb-drawer {
  opacity: 1;
  transform: scale(1);
}

.saeb-drawer-overlay.hide .saeb-drawer {
  opacity: 0;
  transform: scale(0.985);
}

/* --- Barra superior --- */
.saeb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.85rem;
  height: 52px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #dfe3ea;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.saeb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #7c8798;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saeb-breadcrumb strong {
  color: #1f2937;
  font-weight: 600;
}

.saeb-breadcrumb-sep {
  color: #c3cad6;
}

.saeb-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.saeb-toolbar-count {
  font-size: 0.76rem;
  color: #8a97a8;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.saeb-toolbar-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 0.9rem;
  border-radius: 7px;
  border: 1px solid #d5dbe5;
  background: #fff;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.saeb-toolbar-btn:hover {
  background: #f4f6fa;
  border-color: #b9c2d0;
}

.saeb-toolbar-btn-primary {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

.saeb-toolbar-btn-primary:hover {
  background: #3d7fc4;
  border-color: #3d7fc4;
  color: #fff;
}

.saeb-toolbar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.saeb-toolbar-close:hover {
  background: #fdecea;
  color: #c0392b;
}

.saeb-toolbar-close svg {
  width: 15px;
  height: 15px;
}

.saeb-drawer-body {
  flex: 1;
  min-height: 0;
  padding: 0.9rem;
}

.saeb-drawer-body form {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- Duas colunas --- */
.saeb-editor-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0.75rem;
}

.saeb-col {
  background: #fff;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.saeb-col-meta {
  overflow-y: auto;
  padding: 1rem;
}

.saeb-col-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #7c8798;
}

.saeb-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e7eaf0;
  flex-shrink: 0;
}

.saeb-col-hint {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: #8a97a8;
}

/* --- Cabeçalho e lista no formato de arquivos --- */
.saeb-filelist-head {
  display: grid;
  grid-template-columns: 1fr 92px 84px;
  gap: 1rem;
  /* borda transparente para as colunas casarem com a borda colorida das linhas */
  border-left: 3px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #98a2b3;
  border-bottom: 1px solid #e7eaf0;
  background: #fafbfd;
  flex-shrink: 0;
}

.saeb-filelist-head span:last-child {
  justify-self: end;
}

.saeb-filelist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.saeb-col-conteudo .saeb-add-bloco {
  border-radius: 7px;
}

.saeb-col-meta .saeb-fields-grid {
  grid-template-columns: 1fr;
}

.saeb-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
  padding: 0.6rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafbfd;
}

.saeb-check input {
  width: auto;
  height: auto;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.saeb-check strong {
  display: block;
  font-size: 0.85rem;
  color: #1f2937;
}

.saeb-check small {
  display: block;
  color: #94a3b8;
  font-weight: 400;
  line-height: 1.4;
  margin-top: 0.15rem;
}

/* Documento único (ex.: provas): uma coluna rolável */
.saeb-col-single {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

/* Botões de fechar com ícone SVG em vez de glifo de texto */
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close svg,
.saeb-toolbar-close svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 900px) {
  .saeb-editor-grid {
    grid-template-columns: 1fr;
  }

  .saeb-col-meta {
    max-height: 42vh;
  }
}

/* Campos do formulário dentro do drawer */
.saeb-drawer .form-group input,
.saeb-drawer .form-group select,
.saeb-drawer .form-group textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid #dde2ea;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.saeb-drawer .form-group textarea {
  resize: vertical;
  min-height: 44px;
}

.saeb-drawer .form-group input:focus,
.saeb-drawer .form-group select:focus,
.saeb-drawer .form-group textarea:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.14);
}

.saeb-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.saeb-blocos-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.saeb-add-bloco {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid #d5dbe5;
  background: #fff;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.saeb-add-bloco:hover {
  border-color: #4a90d9;
  color: #4a90d9;
  background: #f0f6ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(74, 144, 217, 0.18);
}

.saeb-add-bloco:active {
  transform: translateY(0);
}

/* Bloco = uma linha da lista de arquivos (um slide por linha) */
.saeb-bloco {
  background: #fff;
  border-bottom: 1px solid #eef1f5;
  border-left: 3px solid #4a90d9;
  border-radius: 0;
  padding: 0.8rem 1rem;
  margin: 0;
  transition: background 0.15s;
}

.saeb-bloco:last-child {
  border-bottom: none;
}

/* Apenas a linha recém-adicionada recebe a animação de entrada */
.saeb-bloco.saeb-bloco-novo {
  animation: saebRowIn 0.22s ease;
}

.saeb-bloco:hover {
  background: #f7f9fc;
}

.saeb-bloco[data-tipo='imagem'] {
  border-left-color: #2ecc71;
}

.saeb-bloco[data-tipo='pergunta'] {
  border-left-color: #f39c12;
}

@keyframes saebRowIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Colunas alinhadas com o cabeçalho da lista: nome · tipo · ações */
.saeb-bloco-header {
  display: grid;
  grid-template-columns: 1fr 92px 84px;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.saeb-bloco-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saeb-bloco-tipo {
  justify-self: start;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: #e3f2fd;
  color: #1565c0;
}

.saeb-bloco[data-tipo='imagem'] .saeb-bloco-tipo {
  background: #e8f5e9;
  color: #2e7d32;
}

.saeb-bloco[data-tipo='pergunta'] .saeb-bloco-tipo {
  background: #fff3e0;
  color: #e65100;
}

.saeb-bloco-remover {
  justify-self: end;
  background: transparent;
  border: 1px solid transparent;
  color: #9aa5b1;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.saeb-bloco-remover:hover {
  background: #fdecea;
  color: #c0392b;
  border-color: #f5c6c2;
}

.saeb-bloco textarea,
.saeb-bloco input[type='text'] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #e0e5ec;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s;
  margin-bottom: 0.5rem;
}

.saeb-bloco textarea:focus,
.saeb-bloco input[type='text']:focus {
  outline: none;
  border-color: #4a90d9;
}

.saeb-bloco .saeb-alternativas {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.saeb-alternativa-linha {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.saeb-alternativa-linha input {
  margin-bottom: 0 !important;
}

.saeb-alt-remover {
  background: transparent;
  border: none;
  color: #c0392b;
  font-size: 1.05rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.saeb-alt-remover:hover {
  background: #fdecea;
}

.saeb-correta-label {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: #6b7280;
}

.saeb-correta-label select {
  margin-left: 6px;
  padding: 0.25rem 0.5rem;
  border: 1.5px solid #dde2ea;
  border-radius: 6px;
  font-size: 0.85rem;
}

.saeb-add-alternativa {
  margin-top: 0.4rem;
}

/* --- Editor por questão: MISSÃO → QUESTÕES → ELEMENTOS --- */
.saeb-questoes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f6f8fb;
}

.saeb-questao-card {
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  overflow: hidden;
}

.saeb-questao-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.9rem;
  background: #eef5ff;
  border-bottom: 1px solid #dbe7f7;
}

.saeb-questao-titulo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.saeb-questao-num {
  background: #4a90d9;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
}

.saeb-questao-resumo {
  font-size: 0.74rem;
  color: #64748b;
}

.saeb-questao-acoes {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.saeb-estrutura-btn {
  background: #fff;
  border: 1px solid #d5dbe5;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.saeb-estrutura-btn:hover:not(:disabled) {
  border-color: #4a90d9;
  color: #2f6fb3;
  background: #f0f6ff;
}

.saeb-estrutura-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.saeb-questao-secao {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 700;
  color: #8792a4;
  padding: 0.65rem 0.9rem 0.35rem;
}

.saeb-elementos {
  padding: 0 0.9rem 0.25rem;
}

.saeb-elemento {
  border: 1px solid #e6ebf2;
  border-left: 3px solid #4a90d9;
  border-radius: 9px;
  margin-bottom: 0.55rem;
}

.saeb-elemento[data-tipo='imagem'] {
  border-left-color: #2ecc71;
}

.saeb-elemento-header {
  margin-bottom: 0.45rem;
}

.saeb-elemento-acoes {
  justify-self: end;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.saeb-questao-vazio {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
}

.saeb-elementos-add {
  padding: 0 0.9rem 0.75rem;
}

.saeb-questao-card .saeb-alternativas {
  display: grid;
  gap: 0.45rem;
  padding: 0 0.9rem 1rem;
}

.saeb-questao-card .saeb-add-alternativa {
  justify-self: start;
  margin-top: 0.15rem;
}

.saeb-alt-radio {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.saeb-alt-radio input {
  width: auto;
  height: auto;
  margin: 0;
  cursor: pointer;
}

.saeb-alt-letra {
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: #4a90d9;
}

.saeb-elemento-upload {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.saeb-elemento-file {
  max-width: 240px;
  font-size: 0.8rem;
}

.saeb-elemento-status {
  font-size: 0.76rem;
  color: #6b7280;
}

.saeb-elemento-preview {
  display: block;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fafbfd;
  margin-bottom: 0.5rem;
}

.saeb-elemento-preview[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .saeb-fields-grid {
    grid-template-columns: 1fr;
  }
}

/* === CONFIRM DIALOG === */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 1rem;
}

.confirm-overlay.show {
  opacity: 1;
}

.confirm-overlay.hide {
  opacity: 0;
}

.confirm-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.confirm-overlay.show .confirm-dialog {
  transform: scale(1);
}

.confirm-overlay.hide .confirm-dialog {
  transform: scale(0.9);
}

.confirm-message {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 1.25rem;
  text-align: center;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
}

.confirm-actions .btn {
  flex: 1;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    padding: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SAEB — Análise da Direção (widgets)
   Donut de faixas, evolução semanal, barras,
   ranking de alunos e lista de inativos.
   ============================================ */
.saeb-anal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.saeb-anal-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.5rem;
}

.saeb-anal-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: #2c3e50;
}

.saeb-anal-sub {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 1rem;
}

.saeb-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.saeb-donut {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.saeb-donut-center {
  position: absolute;
  inset: 20px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.saeb-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: #555;
  padding: 5px 0;
}

.saeb-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.saeb-week-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 130px;
  padding-top: 6px;
}

.saeb-week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  height: 100%;
}

.saeb-week-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 6px 6px 0 0;
  transition: height 0.3s;
}

.saeb-week-label {
  font-size: 0.62rem;
  color: #8a94a6;
  white-space: nowrap;
}

.saeb-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.saeb-bar-track {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: #eef2f8;
  overflow: hidden;
  min-width: 40px;
}

.saeb-bar-fill {
  height: 100%;
  border-radius: 5px;
  min-width: 0;
}

.saeb-aluno-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed #eef2f8;
  font-size: 0.88rem;
}

.saeb-aluno-item:last-child {
  border-bottom: none;
}

@media (max-width: 720px) {
  .saeb-donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* === Provas SAEB (admin) === */
.list-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.list-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}
.tipo-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
  vertical-align: middle;
}
.tipo-tag.tipo-pdf {
  background: #fce4ec;
  color: #c62828;
}

/* === Conteúdo KUAU (admin) === */
.kuau-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-bottom: 0.5rem;
}

.kuau-tab {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.kuau-tab:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.kuau-tab.active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

/* ============================================================
   PAINEL DO PSICÓLOGO — agenda, sessões e sala de atendimento
   ============================================================ */

.psi-app {
  min-height: 100vh;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
}

.psi-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e4e8ef;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}

.psi-brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.psi-brand h1 {
  font-size: 1.15rem;
  color: #4a90d9;
}

.psi-brand-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a90d9;
  background: #eaf2fc;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.psi-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.psi-user-name {
  font-weight: 600;
  color: #334155;
}

.psi-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.psi-icon-btn svg {
  width: 18px;
  height: 18px;
}

.psi-icon-btn:hover {
  background: #f8fafc;
}

.psi-notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.psi-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.psi-loading {
  padding: 3rem 0;
  text-align: center;
  color: #64748b;
}

.psi-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

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

.psi-card {
  background: #fff;
  border: 1px solid #e4e8ef;
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.psi-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.psi-card-head h2 {
  font-size: 1.05rem;
  color: #1e293b;
}

.psi-muted {
  color: #94a3b8;
  font-size: 0.82rem;
}

.psi-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.psi-empty--sm {
  padding: 1.25rem 0.5rem;
}

/* ---- Calendário (flatpickr compartilhado com a frequência) ---- */

.psi-calendar-card .flatpickr-calendar.inline {
  width: 100%;
  max-width: 100%;
  box-shadow: none;
}

.psi-calendar-card .flatpickr-days,
.psi-calendar-card .dayContainer {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.psi-calendar-card .flatpickr-day {
  position: relative;
  max-width: none;
}

.psi-calendar-card .flatpickr-day.psi-dia-livre::after,
.psi-calendar-card .flatpickr-day.psi-dia-lotado::after,
.psi-calendar-card .flatpickr-day.psi-dia-vazio::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.psi-calendar-card .flatpickr-day.psi-dia-livre::after {
  background: #2ecc71;
}

.psi-calendar-card .flatpickr-day.psi-dia-lotado::after {
  background: #f39c12;
}

.psi-calendar-card .flatpickr-day.psi-dia-vazio::after {
  background: #cbd5e1;
}

.psi-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.75rem;
  color: #64748b;
  font-size: 0.78rem;
}

.psi-legenda span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.psi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.psi-dot--livre { background: #2ecc71; }
.psi-dot--lotado { background: #f39c12; }
.psi-dot--vazio { background: #cbd5e1; }

/* ---- Horários ---- */

.psi-slot {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.psi-slot:last-child {
  border-bottom: 0;
}

.psi-slot-hora {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.psi-slot-hora strong {
  color: #1e293b;
  white-space: nowrap;
}

.psi-slot-info {
  color: #64748b;
  font-size: 0.85rem;
}

.psi-slot-acoes {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 620px) {
  .psi-slot {
    grid-template-columns: 1fr;
  }
  .psi-slot-acoes {
    justify-content: flex-start;
  }
}

.psi-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef2f7;
  color: #475569;
}

.psi-badge--livre { background: #e8f9ef; color: #15803d; }
.psi-badge--reservada { background: #fef4e2; color: #b45309; }
.psi-badge--encerrada { background: #eef2f7; color: #64748b; }
.psi-badge--agendada { background: #eaf2fc; color: #1d4ed8; }
.psi-badge--em_andamento { background: #e8f9ef; color: #15803d; }
.psi-badge--concluida { background: #eef2f7; color: #475569; }
.psi-badge--cancelada { background: #fdeaea; color: #b91c1c; }

/* ---- Formulário de disponibilidade ---- */

.psi-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #e2e8f0;
}

.psi-form h3 {
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
  color: #334155;
}

.psi-form-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.psi-form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  flex: 1 1 120px;
}

.psi-form-row input {
  border: 1px solid #d7dee8;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  color: #1e293b;
  background: #fff;
}

/* ---- Sessões ---- */

.psi-sessao {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.psi-sessao:last-child {
  border-bottom: 0;
}

.psi-sessao-quando {
  display: flex;
  flex-direction: column;
  color: #1e293b;
}

.psi-sessao-quando span {
  color: #64748b;
  font-size: 0.82rem;
}

.psi-sessao-quem {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: #334155;
}

.psi-sessao-acoes {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .psi-sessao {
    grid-template-columns: 1fr;
  }
  .psi-sessao-acoes {
    justify-content: flex-start;
  }
}

.psi-historico {
  margin-top: 0.75rem;
}

.psi-historico summary {
  cursor: pointer;
  color: #4a90d9;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem 0;
}

/* ---- Notificações ---- */

.psi-notif-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.psi-notif {
  border: 1px solid #e8edf4;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  background: #fbfcfe;
}

.psi-notif:hover {
  background: #f4f8fd;
}

.psi-notif--nova {
  border-left: 3px solid #4a90d9;
  background: #f5f9fe;
}

.psi-notif-titulo {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9rem;
}

.psi-notif-corpo {
  color: #64748b;
  font-size: 0.83rem;
}

/* ---- Sala de atendimento ---- */

.psi-app--sala .psi-main {
  max-width: 1080px;
}

.psi-sala {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.psi-sala-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.psi-sala-head h2 {
  font-size: 1.15rem;
  color: #1e293b;
}

.psi-sala-status {
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2f7;
  color: #475569;
}

.psi-sala-status[data-estado="conectado"] { background: #e8f9ef; color: #15803d; }
.psi-sala-status[data-estado="conectando"],
.psi-sala-status[data-estado="iniciando"],
.psi-sala-status[data-estado="aguardando"],
.psi-sala-status[data-estado="reconectando"] { background: #fef4e2; color: #b45309; }
.psi-sala-status[data-estado="erro"] { background: #fdeaea; color: #b91c1c; }

.psi-video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 0.85rem;
}

@media (max-width: 800px) {
  .psi-video-grid {
    grid-template-columns: 1fr;
  }
}

.psi-video-wrap {
  position: relative;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.psi-video-wrap--local {
  aspect-ratio: 4 / 3;
}

.psi-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f172a;
}

.psi-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #cbd5e1;
  font-size: 0.9rem;
  background: #111c30;
}

.psi-video-placeholder--oculto {
  display: none;
}

.psi-video-label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.psi-sala-aviso {
  color: #64748b;
  font-size: 0.82rem;
}

.psi-controles {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* ============================================================
   Melhorias de UX do painel do psicólogo
   ============================================================ */

/* ---- Notificações (somente as 3 mais recentes) ---- */

.psi-notif-topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.psi-notif-quando {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.psi-notif-cta {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4a90d9;
}

.psi-notif:focus-visible {
  outline: 2px solid #4a90d9;
  outline-offset: 2px;
}

/* ---- Sessões: destaque por estado ---- */

.psi-sessao--em_andamento {
  border-left: 3px solid #15803d;
  border-radius: 8px;
  background: #f7fdf9;
  padding-left: 0.65rem;
}

.psi-sessao--cancelada {
  opacity: 0.7;
}

.psi-sessao-hint {
  color: #64748b;
  font-size: 0.78rem;
}

/* ---- Sala de atendimento em telas menores ---- */

@media (max-width: 520px) {
  .psi-topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .psi-user {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .psi-grid {
    gap: 0.75rem;
  }

  .psi-video-grid {
    gap: 0.6rem;
  }

  .psi-sala-head h2 {
    font-size: 1rem;
  }

  .psi-sala-status {
    font-size: 0.72rem;
  }

  .psi-controles .btn {
    flex: 1 1 42%;
  }
}
