:root {
  --primary: #111827;
  --primary-dark: #000000;
  --primary-light: #f3f4f6;
  --accent: #9befd7;
  --accent-dark: #6ddcbc;
  --accent-light: #edfdf8;
  --danger: #ffcdd4;
  --danger-dark: #e57373;
  --danger-text: #7f1d1d;
  --success: #9befd7;
  --success-text: #065f46;
  --warning: #fef3c7;
  --warning-text: #78350f;
  --gray-50: #fafafa;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #9ca3af;
  --gray-700: #4b5563;
  --gray-900: #111827;
  --sidebar-w: 220px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #111827;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid #1f2937;
}
.sidebar-logo h1 { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-logo p { font-size: 11px; color: #6b7280; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-section {
  padding: 12px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4b5563;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #9ca3af;
  text-decoration: none;
  border-radius: 0;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none;
  background: none;
  width: 100%;
  font-size: 14px;
}
.nav-item:hover { background: #1f2937; color: #fff; }
.nav-item.active { background: #1f2937; color: #fff; border-left: 3px solid var(--accent); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #1f2937;
  font-size: 12px;
  color: #6b7280;
}
.sidebar-footer strong { display: block; color: #d1d5db; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; flex: 1; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--gray-900); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: var(--danger-text); }
.btn-danger:hover { background: #f8a4ae; }
.btn-success { background: var(--accent); color: var(--success-text); }
.btn-success:hover { background: var(--accent-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: none; color: var(--gray-700); padding: 5px 8px; }
.btn-ghost:hover { background: var(--gray-100); }

/* ── Formulários ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--gray-700);
}
.form-label .required { color: var(--danger-dark); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--gray-900); box-shadow: 0 0 0 3px rgba(155,239,215,.3); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* Range (EVA) */
.range-wrapper { display: flex; align-items: center; gap: 12px; }
.range-wrapper input[type=range] { flex: 1; }
.range-value {
  min-width: 36px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--gray-900);
}

/* Checkbox e Radio group */
.check-group, .radio-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.check-option, .radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.check-option:has(input:checked), .radio-option:has(input:checked) {
  background: var(--accent-light);
  border-color: var(--accent-dark);
  color: var(--gray-900);
}
.check-option input, .radio-option input { display: none; }

/* ── Tabela ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:hover td { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-green  { background: var(--accent); color: var(--success-text); }
.badge-blue   { background: var(--gray-200); color: var(--gray-900); }
.badge-yellow { background: var(--warning); color: var(--warning-text); }
.badge-red    { background: var(--danger); color: var(--danger-text); }
.badge-gray   { background: var(--gray-100); color: var(--gray-500); }

/* ── Alertas ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-warning { background: var(--warning); border-left: 3px solid #d97706; color: var(--warning-text); }
.alert-danger   { background: var(--danger); border-left: 3px solid var(--danger-dark); color: var(--danger-text); }
.alert-success  { background: var(--accent-light); border-left: 3px solid var(--accent-dark); color: var(--success-text); }
.alert-info     { background: var(--gray-100); border-left: 3px solid var(--gray-900); color: var(--gray-900); }

/* ── Barra de progresso ── */
.progress { background: var(--gray-200); border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 10px; transition: width .3s; background: var(--accent); }
.progress-bar.warning { background: #fbbf24; }
.progress-bar.danger  { background: var(--danger-dark); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast-success { background: var(--accent); color: var(--success-text); }
.toast-error   { background: var(--danger); color: var(--danger-text); }
.toast-info    { background: var(--gray-900); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Sessões Restantes ── */
.sessoes-info { display: flex; align-items: center; gap: 10px; }
.sessoes-count { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.sessoes-count.warning { color: #d97706; }
.sessoes-count.danger  { color: var(--danger-dark); }

/* ── Filtros ── */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .form-group { margin-bottom: 0; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Stat Cards ── */
.stat-card { text-align: center; padding: 20px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Seções de formulário dinâmico ── */
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
}

/* ── Responsivo mobile ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
