/* ======================================================
   ADMIN — Usuários e Perfis de acesso
====================================================== */

.admin-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 4px 40px;
}

.admin-page .filter-label {
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}

.admin-page .filter-dropdown {
  width: 100%;
}

.admin-page .input-text {
  width: 100%;
}

.admin-page .page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-page .page-header-text {
  flex: 1;
  min-width: 0;
}

.admin-page .page-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.03);
}

.admin-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1 1 140px;
}

.admin-toolbar-field--grow {
  flex: 2 1 220px;
}

.admin-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.admin-panel {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.03);
  padding: 4px 0 8px;
  overflow: hidden;
}

.admin-panel-msg {
  padding: 0 16px 8px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

.admin-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
}

.admin-table tr:hover td {
  background: #f8fafc;
}

.admin-table tr.is-inactive td {
  color: #94a3b8;
}

.admin-empty {
  padding: 36px 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.admin-badge--ativo {
  background: #ecfdf5;
  color: #047857;
}

.admin-badge--inativo {
  background: #f1f5f9;
  color: #64748b;
}

.admin-badge--tipo {
  background: #eff6ff;
  color: #1d4ed8;
}

.admin-badge--sistema {
  background: #fff7ed;
  color: #c2410c;
}

.admin-badge--custom {
  background: #f1f5f9;
  color: #475569;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-link-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.admin-link-btn:hover {
  background: #f8fafc;
}

.admin-link-btn--danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.admin-link-btn--danger:hover {
  background: #fef2f2;
}

.admin-muted {
  color: #94a3b8;
  font-size: 12px;
}

.admin-perfil-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-perfil-meta strong {
  font-weight: 600;
  color: #0f172a;
}

/* ---- Modal admin (reusa linguagem do calendar-sidebar) ---- */

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.admin-modal-backdrop.is-hidden {
  display: none;
}

.admin-modal {
  width: min(640px, 96vw);
  max-height: min(86vh, 760px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal--wide {
  width: min(720px, 96vw);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
}

.admin-modal-title {
  flex: 1;
  font-weight: 800;
  font-size: 15px;
  color: #111827;
}

.admin-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 18px;
  cursor: pointer;
  color: #111827;
  line-height: 1;
}

.admin-modal-close:hover {
  background: #f3f4f6;
}

.admin-modal-body {
  padding: 16px 16px 8px;
  overflow: auto;
}

.admin-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid #eef2f7;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.admin-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-form-field--full {
  grid-column: 1 / -1;
}

.admin-form-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.admin-form-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.admin-note {
  margin: 0 0 10px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.admin-note--warn {
  color: #c2410c;
}

.admin-perm-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-perm-group {
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.admin-perm-group-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.admin-perm-checklist label {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px !important;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.35;
  cursor: pointer;
}

.admin-perm-checklist input[type="checkbox"] {
  margin-top: 2px;
}

.danger-button {
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  background-color: #dc2626;
  color: #ffffff;
  transition: 0.15s;
}

.danger-button:hover {
  background-color: #b91c1c;
}

.admin-modal-footer .mensagem-retorno {
  flex: 1;
  min-width: 140px;
}

@media (max-width: 720px) {
  .admin-page .page-header {
    flex-direction: column;
  }

  .admin-toolbar-actions {
    margin-left: 0;
    width: 100%;
  }

  .admin-toolbar-actions .primary-button {
    width: 100%;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-modal-backdrop {
    padding: 0;
    align-items: stretch;
  }

  .admin-modal,
  .admin-modal--wide {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}
