* { box-sizing: border-box; }

body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f0eeeb; color: #333; line-height: 1.5; }

.app-body { margin: 0; min-height: 100vh; overflow-x: hidden; }
.app-wrap { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 240px;
  min-width: 240px;
  height: 100vh;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  transition: width 0.2s, min-width 0.2s;
  overflow: hidden;
}
.sidebar.collapsed {
  width: 72px;
  min-width: 72px;
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link-text,
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .sidebar-role { display: none; }
.sidebar.collapsed .sidebar-brand { padding: 0 0.75rem 1rem; justify-content: center; }
.sidebar.collapsed .sidebar-nav { padding: 0.5rem 0.5rem; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 0.75rem; }
.sidebar.collapsed .sidebar-footer { padding: 0.75rem 0.5rem; }
.sidebar.collapsed .sidebar-user { padding: 0.5rem; text-align: center; }
.sidebar.collapsed .sidebar-link-logout { justify-content: center; }

.sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #555;
  z-index: 1;
}
.sidebar-toggle:hover { background: #f5f5f5; color: #333; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  color: #5c4d7a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.sidebar-brand:hover { color: #4a3f62; }
.sidebar-brand-icon { font-size: 1.25rem; color: #7b6b9a; }
.sidebar-brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; min-height: 0; padding: 0.5rem 0.75rem; overflow-y: auto; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 12px;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.sidebar-link:hover { background: rgba(168, 197, 229, 0.18); color: #5c4d7a; }
.sidebar-link.active {
  background: rgba(92, 77, 122, 0.12);
  color: #5c4d7a;
  font-weight: 600;
}
.sidebar-link.active .sidebar-link-icon { color: #7b6b9a; }
.sidebar-link-icon { width: 1.25rem; text-align: center; font-size: 1rem; color: #888; flex-shrink: 0; }
.sidebar-link-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem; font-size: 0.7rem; font-weight: 600; background: #c75c5c; color: #fff; border-radius: 50%; margin-left: 0.25rem; }

.sidebar-footer { flex-shrink: 0; padding: 1rem 0.75rem 0; border-top: 1px solid rgba(0,0,0,0.06); }
.sidebar-user { padding: 0.5rem 1rem; margin-bottom: 0.5rem; }
.sidebar-user-name { display: block; font-size: 0.85rem; font-weight: 500; color: #333; }
.sidebar-role { font-size: 0.75rem; color: #888; }
.sidebar-user-icon { font-size: 0.9rem; color: #999; margin-right: 0.35rem; }
.sidebar-link-logout { color: #888; margin-top: 0.25rem; display: flex; align-items: center; gap: 0.75rem; }
.sidebar-link-logout:hover { background: rgba(199, 92, 92, 0.1); color: #b04a4a; }

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 240px;
  min-height: 100vh;
  transition: margin-left 0.2s;
}
.sidebar.collapsed ~ .main-wrap { margin-left: 72px; }
.topbar {
  flex-shrink: 0;
  background: #fff;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.topbar-title { font-size: 1.1rem; font-weight: 600; color: #333; }
.topbar-date { font-size: 0.85rem; color: #888; }

.container { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }

.card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 1rem; font-size: 1.05rem; color: #333; font-weight: 600; }
.card h2 i, .card h3 i, h1 i { margin-right: 0.4rem; color: #7b6b9a; opacity: 0.95; }
.card.highlight { border-left: 4px solid #a8c5e5; }
.card.success { border-left: 4px solid #7bc9a3; }

h1 { font-size: 1.35rem; margin: 0 0 1rem; font-weight: 600; color: #333; }
h1 i { color: #7b6b9a; }

.prototype-notice { color: #c4a0a0; font-size: 0.8rem; text-align: center; margin: 0.5rem 0 0; padding: 0.4rem; background: rgba(180, 120, 120, 0.08); border-radius: 10px; }
.login-page .container { max-width: 420px; }
.login-footer { margin-top: 1rem; text-align: center; }
.login-footer a { color: #5c4d7a; text-decoration: none; font-size: 0.95rem; }
.login-footer a:hover { text-decoration: underline; }

.badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 10px; font-size: 0.8rem; font-weight: 500; }
.badge-pending { background: #fef3e2; color: #b45309; }
.badge-approved { background: #e8f5ee; color: #2d7a4e; }
.badge-ativo { color: #2d7a4e; font-size: 0.85rem; }
.badge-inativo { color: #888; font-size: 0.85rem; }

form label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-weight: 500; color: #444; font-size: 0.9rem; }
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="date"],
form input[type="tel"],
form select,
form textarea {
  padding: 0.55rem 0.85rem;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  font-size: 0.95rem;
  width: 100%;
  max-width: 100%;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: #a8c5e5;
  box-shadow: 0 0 0 3px rgba(168, 197, 229, 0.15);
}
form button, .btn {
  padding: 0.55rem 1.1rem;
  background: #5c4d7a;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-top: 0.75rem;
  font-weight: 500;
  transition: background 0.2s;
}
form button:hover, .btn:hover { background: #4a3f62; }
.btn-secondary { background: #a8c5e5; color: #333; }
.btn-secondary:hover { background: #94b5dc; }
.btn-danger { background: #c75c5c; }
.btn-danger:hover { background: #b04a4a; }
.btn-success { background: #5c9e6b; color: #fff; }
.btn-success:hover { background: #4a8a58; }
.btn-link { background: none; border: none; padding: 0; color: #333; cursor: pointer; font-size: inherit; text-decoration: none; }
.btn-link:hover { color: #5c4d7a; background: transparent; }
.icon-small { font-size: 0.85em; opacity: 0.9; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; margin-top: 0; border-radius: 8px; }

.inline { display: inline; }
form.inline { display: inline-block; margin-right: 0.5rem; margin-bottom: 0.25rem; }
form.inline input, form.inline select, form.inline button { margin-right: 0.25rem; margin-top: 0; }

table { width: 100%; border-collapse: collapse; margin-top: 1rem; border-radius: 12px; overflow: hidden; }
th, td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid #f0f0f0; }
th { background: #fafafa; font-weight: 600; color: #444; font-size: 0.85rem; }
tr:hover td { background: #fafafa; }
tr:last-child td { border-bottom: none; }

.error { color: #b04a4a; padding: 0.6rem 1rem; background: #fce8e8; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.msg { color: #2d7a4e; padding: 0.6rem 1rem; background: #e8f5ee; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.muted { color: #888; font-size: 0.9rem; }

.navbar { background: #fff; padding: 1rem 1.5rem; border-radius: 0 0 16px 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); margin-bottom: 1.5rem; }
.navbar .brand { color: #5c4d7a; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 0.5rem; }
.navbar .brand:hover { color: #4a3f62; }

.login-form { max-width: 380px; margin: 2rem auto; padding: 1.5rem; background: #fff; border-radius: 16px; box-shadow: 0 2px 16px rgba(0,0,0,0.06); }
.login-form h1 { margin-top: 0; color: #333; }

.toolbar-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search-label { margin-left: auto; }
.search-input { padding: 0.5rem 0.75rem; border: 1px solid #e0e0e0; border-radius: 10px; min-width: 200px; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.checkbox-label input[type="checkbox"] { margin: 0; }
.filter-form { margin-bottom: 1rem; }
.filter-form label { display: inline; margin-right: 0.5rem; }
.filter-form select { width: auto; max-width: none; border-radius: 10px; }

.pagination { margin-top: 1rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pagination a { padding: 0.35rem 0.6rem; border-radius: 8px; text-decoration: none; color: #5c4d7a; background: #f0eeeb; font-size: 0.9rem; }
.pagination a:hover { background: rgba(168, 197, 229, 0.3); }
.pagination a.active { background: rgba(92, 77, 122, 0.15); font-weight: 600; }
.events-table { width: 100%; }

.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-cards .card { margin-bottom: 0; }
.dashboard-cards .big-number { font-size: 2rem; font-weight: 700; margin: 0; color: #5c4d7a; }

.classification { padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.85rem; font-weight: 500; }
.classification-very-low, .classification-muito-baixo { background: #e8f5ee; color: #2d7a4e; }
.classification-low, .classification-baixo { background: #e3f2fd; color: #1565c0; }
.classification-moderate, .classification-moderado { background: #fff8e1; color: #f9a825; }
.classification-high, .classification-alto { background: #ffebee; color: #c62828; }
.classification-critical, .classification-crítico { background: #fce4ec; color: #ad1457; }

.question-block { margin-bottom: 1.5rem; padding: 1.1rem; background: #fafafa; border-radius: 12px; border: 1px solid #eee; }
.question-block label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.scale-info { font-weight: normal; color: #888; }
.scale-options { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.scale-label { display: flex; align-items: center; gap: 0.25rem; cursor: pointer; }
.scale-label input { width: auto; }
.scale-label span { padding: 0.3rem 0.6rem; background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; }

.full-width { width: 100%; max-width: none; }
.invite-detail-fields label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-weight: 500; color: #444; font-size: 0.9rem; }
.invite-detail-fields label:first-of-type { margin-top: 0; }
.invite-detail-fields input[type="text"] { padding: 0.55rem 0.85rem; border: 1px solid #e5e5e5; border-radius: 10px; font-size: 0.95rem; width: 100%; max-width: 100%; background: #fff; box-sizing: border-box; }
.invite-detail-fields input:focus { outline: none; border-color: #a8c5e5; box-shadow: 0 0 0 3px rgba(168, 197, 229, 0.15); }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.4rem; font-weight: normal; margin-top: 0; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: auto; max-width: none; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay[aria-hidden="false"] { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}
.modal-title { margin: 0; font-size: 1.1rem; color: #333; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0.25rem;
  border-radius: 8px;
}
.modal-close:hover { background: #eee; color: #333; }
.modal-body { padding: 1.25rem; overflow-y: auto; max-height: calc(90vh - 60px); }

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.65);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.loading-overlay[aria-hidden="false"] { display: flex; }
.loading-box {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  text-align: center;
  max-width: 520px;
  width: 100%;
}
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(168, 197, 229, 0.35);
  border-top-color: #5c4d7a;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 0.75rem auto;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .sidebar { width: 72px; min-width: 72px; padding: 0.75rem 0; }
  .sidebar-brand-text, .sidebar-link-text, .sidebar-user-name, .sidebar-role { display: none; }
  .sidebar-brand { padding: 0 0.75rem 1rem; justify-content: center; }
  .sidebar-brand-icon { margin: 0; }
  .sidebar-nav { padding: 0.5rem 0.5rem; }
  .sidebar-link { justify-content: center; padding: 0.75rem; }
  .sidebar-link-icon { margin: 0; }
  .sidebar-footer { padding: 0.75rem 0.5rem; }
  .sidebar-user { padding: 0.5rem; text-align: center; }
  .sidebar-link-logout { justify-content: center; }
  .main-wrap { margin-left: 72px; }
}

@media (max-width: 600px) {
  .app-wrap { flex-direction: column; }
  .sidebar { position: relative; width: 100%; min-width: 100%; height: auto; border-radius: 0; flex-direction: row; flex-wrap: wrap; padding: 0.75rem; gap: 0.5rem; }
  .sidebar-brand { margin-bottom: 0; padding: 0 0.5rem; border: none; flex: 1; }
  .sidebar-nav { flex: 1 1 100%; order: 3; display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.5rem 0; border-top: 1px solid rgba(0,0,0,0.06); overflow-y: visible; }
  .sidebar-link { margin-bottom: 0; }
  .sidebar-footer { flex: 1 1 100%; order: 2; border-top: none; display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; }
  .sidebar-user-name, .sidebar-role { display: inline; }
  .main-wrap { margin-left: 0; }
  form.inline { display: block; }
}

@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .pagination, .btn, .btn-link, .sidebar-toggle, .sidebar-footer { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .container { max-width: none !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
