/* ============================================================
   PRIMETOUR — Components CSS
   Reusable UI Components
   ============================================================ */

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-ui);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 10px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.btn-icon.btn-sm {
  padding: 8px;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
}

/* Botão só de ícone dos editores (✕ que remove, ▲▼ que reordena, lápis da
   biblioteca de modelos). Até a 4.99.2207 a classe não tinha regra nenhuma e
   o botão saía com a cara nativa do navegador (cinza, borda em relevo) — na
   dica anexada, nos viajantes, nas linhas de preço e na ordem das seções. */
.re-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.re-btn-icon:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-default);
}
.re-btn-icon[data-action^="remove"]:hover:not(:disabled) {
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.re-btn-icon:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}

/* Primary - Gold (DS v2 §5.1 — texto navy obrigatório, WCAG AAA 10,5:1) */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-gold-dark), var(--brand-gold));
  color: var(--on-gold);
  border-color: transparent;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px var(--gold-border);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

/* Secondary */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Danger (DS v2 §4.4 — sempre filled, comunica perigo claramente) */
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  filter: brightness(1.08);
}

/* Success */
.btn-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(34,197,94,0.25);
}

.btn-success:hover {
  background: var(--color-success);
  color: white;
}

/* Loading state */
.btn.loading {
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  /* v4.81.15 — spin-centered preserva o translate(-50%,-50%) de centragem
     (keyframe em auth.css). O `spin` global virou rotação pura; este ::after é
     absoluto/centralizado, então precisa do keyframe com translate. */
  animation: spin-centered 0.7s linear infinite;
}

.btn-primary.loading::after {
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #0A1628;
}

/* ─── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.1);
}

/* Stat Card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-gold-dark), var(--brand-gold));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover { border-color: var(--border-accent); }
.stat-card:hover::before { opacity: 1; }

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-card-trend {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up   { color: var(--color-success); }
.trend-down { color: var(--color-danger); }
.trend-flat { color: var(--text-muted); }

.stat-card-icon {
  position: absolute;
  right: var(--space-5);
  top: var(--space-5);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* ─── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-admin   { background: rgba(167,139,250,0.15); color: var(--role-admin); border: 1px solid rgba(167,139,250,0.25); }
.badge-manager { background: rgba(56,189,248,0.15);  color: var(--role-manager); border: 1px solid rgba(56,189,248,0.25); }
.badge-member  { background: rgba(52,211,153,0.15);  color: var(--role-member); border: 1px solid rgba(52,211,153,0.25); }

.badge-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid rgba(34,197,94,0.25); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid rgba(245,158,11,0.25); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger);  border: 1px solid rgba(239,68,68,0.25); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info);    border: 1px solid rgba(56,189,248,0.25); }
.badge-neutral { background: rgba(255,255,255,0.06);  color: var(--text-secondary); border: 1px solid var(--border-subtle); }

/* ─── AVATAR ──────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  font-size: 0.8125rem;
  position: relative;       /* 4.34+ pra que <img> com position:absolute funcione */
  overflow: hidden;          /* 4.34+ pra que crop circular respeite o border-radius */
}

/* 4.34+ Foto do user (Microsoft Graph) cobre o background color quando carrega.
 * Se onerror dispara, o img é hidden e o conteúdo de texto (iniciais) volta a aparecer. */
.avatar > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-sm  { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar-md  { width: 36px; height: 36px; font-size: 0.8125rem; }
.avatar-lg  { width: 44px; height: 44px; font-size: 1rem; }
.avatar-xl  { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar-xxl { width: 72px; height: 72px; font-size: 1.5rem; }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}

.avatar-group .avatar:first-child { margin-left: 0; }

/* ─── DATA TABLE ──────────────────────────────────────────── */
.data-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--bg-surface);
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.data-table thead th:hover { color: var(--text-primary); }
.data-table thead th .sort-icon { margin-left: 4px; opacity: 0.5; }
.data-table thead th.sorted { color: var(--brand-gold); }
.data-table thead th.sorted .sort-icon { opacity: 1; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table tbody td {
  padding: 14px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table .col-actions {
  width: 100px;
  text-align: right;
}

.data-table .actions-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.data-table tbody tr:hover .actions-group { opacity: 1; }

/* ─── SEARCH & FILTER BAR ─────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.toolbar-search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.toolbar-search-input:focus {
  border-color: var(--brand-gold);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.08);
}

.toolbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.toolbar-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-family: var(--font-ui);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--brand-gold);
  color: var(--text-primary);
}

/* Inputs and textareas don't need the dropdown arrow */
input.filter-select,
textarea.filter-select {
  background-image: none;
  padding-right: 12px;
  cursor: text;
  color: var(--text-primary);
}

/* Portal editor field style — same look as filter-select but no arrow */
.portal-field {
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-ui);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.portal-field:focus { border-color: var(--brand-gold); }
textarea.portal-field { resize: vertical; }

/* Portal area picker */
.portal-area-cat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 10px 8px; border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md); background: transparent; cursor: pointer;
  transition: all 0.15s; min-height: 68px; width: 100%;
  font-size: 0.8125rem; color: var(--text-secondary);
}
.portal-area-cat:hover { border-color: var(--brand-gold); color: var(--text-primary); }
.portal-area-cat.selected { border-color: var(--brand-gold); background: rgba(212,168,67,0.10); color: var(--brand-gold); }
.portal-area-cat .cat-chevron { font-size: 0.625rem; color: var(--text-muted); }

.portal-area-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; transition: all 0.15s; width: 100%;
  font-size: 0.8125rem; color: var(--text-secondary);
}
.portal-area-item:hover { border-color: var(--brand-gold); color: var(--text-primary); background: var(--bg-surface); }
.portal-area-item.selected { border-color: var(--brand-gold); background: rgba(212,168,67,0.10); color: var(--brand-gold); font-weight: 600; }

/* ─── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s ease;
  box-shadow: var(--shadow-xl);
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 38px;
  height: 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(239,68,68,0.25);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ─── TOAST NOTIFICATIONS ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 400px;
  pointer-events: all;
  animation: slideInRight 0.3s ease;
  transition: all 0.3s ease;
}

.toast.removing {
  opacity: 0;
  transform: translateX(20px);
}

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--text-primary); }

.toast-success .toast-icon { background: var(--color-success-bg); color: var(--color-success); }
.toast-error   .toast-icon { background: var(--color-danger-bg);  color: var(--color-danger); }
.toast-warning .toast-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.toast-info    .toast-icon { background: var(--color-info-bg);    color: var(--color-info); }

/* ─── PROGRESS BAR ────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand-gold-dark), var(--brand-gold));
  transition: width var(--transition-slow);
}

.progress-bar.success { background: var(--color-success); }
.progress-bar.warning { background: var(--color-warning); }
.progress-bar.danger  { background: var(--color-danger); }

/* ─── DROPDOWN MENU ───────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: fixed;
  top: auto;
  right: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 1000;
  animation: scaleIn 0.15s ease;
  transform-origin: top right;
  overflow: hidden;
}

.dropdown-menu.left {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--color-danger);
}

.dropdown-item.danger:hover {
  background: var(--color-danger-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* ─── TOGGLE SWITCH ───────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(212,168,67,0.2);
  border-color: var(--brand-gold);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--brand-gold);
}

/* ─── FORM SELECT ─────────────────────────────────────────── */
/* Texto dos CAMPOS em 12px (0.75rem) — pedido do Tiago 31/08/2026: "mais
   refinado e harmônico". Vale para input/select/textarea. Em TOUCH o
   responsive.css sobrepõe com 16px !important de propósito (abaixo de 16px o
   Safari do iOS dá zoom ao focar), então esta redução é de mouse/desktop. As
   entrelinhas são relativas (1.6), logo acompanham sozinhas. */
.form-select {
  width: 100%;
  padding: 0 36px 0 14px;
  height: var(--field-height);   /* D-0: a mesma altura do .form-input */
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-family: var(--font-ui);
  outline: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--transition-fast);
}

.form-select:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.12);
}

/* ─── TEXTAREA ────────────────────────────────────────────── */
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-base);   /* D-0 */
  font-family: var(--font-ui);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: all var(--transition-fast);
  line-height: 1.6;
}

.form-textarea:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.12);
}

/* ─── DATE/TIME INPUTS ────────────────────────────────────────────────────
   O ícone do calendário segue o `color-scheme`, que é HERDADO da paleta
   (declarado em base.css junto dos tokens). Não há lista de paletas aqui de
   propósito: a que existia nomeava `platinum` e `sand`, removidas em
   v4.99.815, e deixava a paleta Claro de fora — ícone branco sobre campo
   branco, invisível (Renê, 13/08/2026). */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"] {
  cursor: pointer;
}

/* A máscara "dd/mm/aaaa" do campo VAZIO é ruído — o rótulo acima já diz o que
   é. Ela volta ao focar, para guiar quem digita. Quem marca o campo como vazio
   é o render (atributo `data-vazio`), porque CSS não enxerga valor de input. */
input[type="date"][data-vazio]:not(:focus)::-webkit-datetime-edit {
  opacity: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* ─── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
  margin-top: var(--space-5);
}

.pagination-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  transition: all var(--transition-fast);
  font-family: var(--font-ui);
}

.pagination-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: rgba(212,168,67,0.15);
  color: var(--brand-gold);
  border-color: rgba(212,168,67,0.3);
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── TABS ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0;
  margin-bottom: var(--space-6);
}

.tab-btn {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-ui);
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
  color: var(--brand-gold);
  border-bottom-color: var(--brand-gold);
}

/* ─── CONFIRMATION DIALOG ─────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: var(--space-4);
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .modal-overlay .modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
    margin: 5vh auto;
  }

  .modal-footer {
    flex-direction: column;
    gap: var(--space-2);
  }

  .modal-footer .btn { width: 100%; }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .filter-select,
  .filter-bar .filter-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .btn { padding: 8px 14px; font-size: 0.8125rem; }
  .badge { font-size: 0.625rem; padding: 2px 6px; }
  .tab-btn { padding: 8px 12px; font-size: 0.8125rem; }
}

.confirm-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.confirm-message {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Role badges ─────────────────────────────────────────── */
.badge-role-admin   { background: rgba(167,139,250,0.12); color: var(--role-admin);   border: 1px solid rgba(167,139,250,0.25); }
.badge-role-manager { background: rgba(56,189,248,0.12);  color: var(--role-manager); border: 1px solid rgba(56,189,248,0.25);  }
.badge-role-member  { background: rgba(34,197,94,0.12);   color: var(--role-member);  border: 1px solid rgba(34,197,94,0.25);   }

/* ─── Section headers com accent ─────────────────────────── */
.section-accent {
  position: relative;
  padding-left: 14px;
}
.section-accent::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand-gold);
}
.section-accent.accent-success::before { background: var(--color-success); }
.section-accent.accent-info::before    { background: var(--color-info); }
.section-accent.accent-warning::before { background: var(--color-warning); }
.section-accent.accent-danger::before  { background: var(--color-danger); }

/* ─── Cards com borda colorida lateral ───────────────────── */
.card-accent-left {
  border-left: 3px solid var(--brand-gold);
}
.card-accent-left.accent-success { border-left-color: var(--color-success); }
.card-accent-left.accent-info    { border-left-color: var(--color-info); }
.card-accent-left.accent-warning { border-left-color: var(--color-warning); }
.card-accent-left.accent-danger  { border-left-color: var(--color-danger); }

/* ─── Elevated surface (mais destaque que card) ──────────── */
.surface-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

/* ─── Glass-style surface ────────────────────────────────── */
.surface-glass {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
}

/* Spinner inline genérico (B2 — feedback de adicionar membro) */
@keyframes spin-inline {
  to { transform: rotate(360deg); }
}
.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-default);
  border-top-color: var(--brand-gold);
  border-radius: 50%;
  animation: spin-inline 0.7s linear infinite;
  vertical-align: middle;
}

/* ─── TOOLTIP (DS Fase 2 · v4.99.215) ───────────────────────────────────
   Primitiva reutilizável (antes só existia o ::after da sidebar colapsada).
   Uso: <button class="has-tooltip" data-tooltip="Texto">…</button>
   Posição opcional: data-tooltip-pos="bottom". Tokenizado; some no hover. */
.has-tooltip { position: relative; }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: var(--z-toast);
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px 10px;
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.has-tooltip[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}
.has-tooltip[data-tooltip-pos="bottom"]:hover::after,
.has-tooltip[data-tooltip-pos="bottom"]:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

/* ─── FORM PRIMITIVES (SSOT) ──────────────────────────────────
   v4.99.x (DS Fase 2b) — movidas de auth.css pra cá: são primitivas
   GENÉRICAS de formulário (não auth-específicas), usadas no app todo.
   Só o index.html carrega auth.css + components.css → mover é seguro
   (mesma página, sem competição). Ver DESIGN-SYSTEM.md §3. */
.form-group {
  margin-bottom: var(--space-5);
}
.form-group:last-child { margin-bottom: 0; }   /* veio do portal.css (D-0c) */

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 0 14px;
  /* ⚠ 14px E 40px, NÃO 12px (D-0 da revisão de Cotações, 22/09/2026). O campo
     canônico tinha `font-size: 0.75rem` — o menor corpo do sistema, justamente
     onde se digita — e cada módulo compensava com um campo próprio (o editor de
     Cotações tem três). Uma altura fixa dá a régua que faz campos de origens
     diferentes alinharem na mesma linha. Textarea, checkbox e afins ficam de
     fora da altura (regras abaixo). */
  height: var(--field-height);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-family: var(--font-ui);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
/* Um <textarea class="form-input"> existe em seis telas: cresce, não tem 40px. */
textarea.form-input { height: auto; min-height: 100px; padding: 10px 14px; resize: vertical; }
/* Caixa de marcação e afins com a classe: a altura fixa deformaria o controle. */
.form-input[type="checkbox"], .form-input[type="radio"], .form-input[type="range"],
.form-input[type="color"], .form-input[type="file"] { height: auto; width: auto; padding: 0; }
/* A versão compacta, para barras de filtro e tabelas — opt-in, nunca o padrão. */
.form-input-sm, .form-select-sm { height: 34px; font-size: var(--fs-sm); padding: 0 12px; }

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.12);
}

.form-input.has-icon { padding-left: 44px; }
.form-input.has-icon-right { padding-right: 44px; }

.form-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-danger-bg);
}

.form-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

.form-input-icon-right {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.form-input-icon-right:hover { color: var(--text-primary); }

.form-error-msg {
  display: block;
  font-size: 0.75rem;
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* "Acesso a cotações", no cadastro do usuário */
.cot-acesso-bloco { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-3); }
.cot-acesso-barra { display: flex; flex-wrap: wrap; gap: 6px; }
.cot-acesso-barra > * { flex: 1 1 200px; min-width: 0; }
.cot-acesso-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; }
.cot-acesso-chip, .chip-escolha { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.8125rem; cursor: pointer;
  border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); transition: all 0.15s; font-family: inherit; line-height: 1.4; }
.cot-acesso-chip[hidden], .chip-escolha[hidden] { display: none; }
.cot-acesso-chip.is-marcado, .chip-escolha.is-marcado { border-color: var(--brand-gold); color: var(--brand-gold); font-weight: 600; }
.cot-acesso-chip input, .chip-escolha input { position: absolute; opacity: 0; width: 0; height: 0; }
.cot-acesso-chip:has(input:focus-visible), .chip-escolha:has(input:focus-visible), .chip-escolha:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 1px; }
.chip-ponto { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Cadastro do usuário em abas (11/11/2026): quem é · Cadastro · Acesso · Conta */
/* Altura fixa: trocar de aba não redimensiona o modal (o cabeçalho pularia de lugar). */
.modal:has(.usuario-form) { height: 90vh; }
.usuario-cabecalho { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-4); }
.usuario-cabecalho .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.usuario-cabecalho-texto { flex: 1; min-width: 0; }
.usuario-cabecalho-nome { font-weight: 600; color: var(--text-primary); }
.usuario-cabecalho-meta { font-size: 0.8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-abas { position: sticky; top: calc(-1 * var(--space-6)); z-index: 2; background: var(--bg-card); margin: 0 calc(-1 * var(--space-6)) var(--space-5); padding: 0 var(--space-6); }
.usuario-aba[hidden] { display: none; }
.usuario-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
@media (max-width: 640px) { .usuario-grade { grid-template-columns: minmax(0, 1fr); } }
.usuario-secao { border-top: 1px solid var(--border-subtle); padding-top: var(--space-4); margin-top: var(--space-4); }
.usuario-secao:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.usuario-secao-titulo { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-2); }
.usuario-alerta { color: var(--color-warning); }
.usuario-acoes { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.usuario-aviso-sso { margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--color-success-bg); border: 1px solid var(--border-subtle); font-size: 0.8125rem; color: var(--text-primary); }
.usuario-aviso-sso p { margin: 6px 0 0; color: var(--text-secondary); font-size: 0.75rem; line-height: 1.4; }
.usuario-form .cot-acesso-chips { margin-top: 6px; }

/* "O que esta pessoa pode hoje" — o topo da aba Acesso */
.resumo-acesso { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.resumo-acesso-linhas { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px var(--space-3); margin: 0 0 var(--space-2); font-size: 0.8125rem; }
.resumo-acesso-linhas dt { color: var(--text-muted); }
.resumo-acesso-linhas dd { margin: 0; color: var(--text-primary); }
.resumo-acesso-linhas dd.usuario-alerta { color: var(--color-warning); }

/* Exceções de permissão de uma pessoa (components/editorDeExcecoes.js) */
.excecoes-barra { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.excecoes-filtros { display: flex; gap: 4px; flex-wrap: wrap; }
.excecoes-busca { flex: 1 1 220px; min-width: 0; }
.excecoes-grupo { margin-bottom: var(--space-3); }
.excecoes-grupo-titulo { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px; margin-bottom: 4px; }
.excecoes-linha { display: flex; align-items: center; gap: var(--space-3); padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.excecoes-linha:last-child { border-bottom: 0; }
.excecoes-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.excecoes-rotulo { font-size: 0.8125rem; color: var(--text-primary); }
.excecoes-rotulo.is-negada { color: var(--text-muted); }
.excecoes-meta { font-size: 0.6875rem; color: var(--text-muted); }
.excecoes-aviso { font-size: 0.6875rem; color: var(--color-warning); }
.excecoes-aviso.is-ignorada { color: var(--color-danger); }
.excecoes-escolha { display: flex; gap: 4px; flex-shrink: 0; }
.excecoes-escolha .btn { padding: 3px 8px; font-size: 0.6875rem; }
.excecoes-vazio { padding: var(--space-3) 0; }

/* Cadastro › Histórico (audit_logs do cadastro, em frases) */
.historico-lista { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.historico-item { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.8125rem; }
.historico-item:last-child { border-bottom: 0; }
.historico-cabeca { display: flex; flex-wrap: wrap; gap: 4px var(--space-3); align-items: baseline; color: var(--text-primary); }
.historico-meta { font-size: 0.75rem; color: var(--text-muted); }
.historico-frases { margin: 4px 0 0; padding-left: 18px; color: var(--text-secondary); }
.resumo-acesso-ver { margin: var(--space-3) 0 0; padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }

/* Usuários › Acessos especiais (util/acessosEspeciais.js) */
.acessos-filtros { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-3); }
.acessos-pessoa { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); gap: 2px var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.acessos-pessoa[hidden] { display: none; }
.acessos-nome { justify-self: start; padding-left: 0; font-weight: 600; }
.acessos-papel { grid-column: 1; font-size: 0.75rem; color: var(--text-muted); }
.acessos-itens { grid-column: 2; grid-row: 1 / span 2; list-style: none; margin: 0; padding: 0; font-size: 0.8125rem; color: var(--text-primary); }
.acessos-item { padding: 2px 0; }
.acessos-item[hidden] { display: none; }
.acessos-item.is-sem-efeito { color: var(--text-muted); text-decoration: line-through; }
.acessos-item.is-restricao { color: var(--text-secondary); }
.acessos-tag { font-size: 0.6875rem; color: var(--color-warning); text-decoration: none; display: inline-block; margin-left: 4px; }
@media (max-width: 640px) { .acessos-pessoa { grid-template-columns: minmax(0, 1fr); } .acessos-itens { grid-column: 1; grid-row: auto; } }

/* Usuários › ⋮ Manutenção (as migrações pontuais) */
.uikit-overflow-item.usuarios-manutencao { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 12px;
  background: transparent; border: 0; cursor: pointer; font-size: 0.875rem; color: var(--text-primary); border-radius: var(--radius-sm); font-family: inherit; }
.uikit-overflow-item.usuarios-manutencao:hover { background: var(--bg-hover); }

/* Papéis › Permissões por usuário: atalho para o cadastro */
.rp-user-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); width: 100%; text-align: left; padding: 10px 16px;
  background: none; border: 0; border-bottom: 1px solid var(--border-subtle); cursor: pointer; font-family: inherit; }
.rp-user-item:last-child { border-bottom: 0; }
.rp-user-item:hover { background: var(--bg-hover); }
.rp-user-nome { font-size: 0.875rem; color: var(--text-primary); }
.rp-user-meta { grid-row: 2; font-size: 0.75rem; color: var(--text-muted); }
.rp-user-n { grid-row: 1 / span 2; align-self: center; font-size: 0.75rem; color: var(--text-muted); }
.rp-user-n.tem { color: var(--brand-gold); font-weight: 600; }
