/* ─── Botões ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r);
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.1s var(--ease), opacity 0.14s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy='true'] { opacity: 0.55; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: rgba(239, 90, 111, 0.4); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Formulários ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--r);
  transition: border-color 0.14s, box-shadow 0.14s;
}
.textarea { height: auto; min-height: 96px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 11px) 16px; background-size: 4px 4px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid='true'], .textarea[aria-invalid='true'], .select[aria-invalid='true'] { border-color: var(--danger); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { margin: 2px 0 0; width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.input-group { position: relative; }
.input-group > .prefix { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 34px; }
.form-alert { padding: 10px 12px; border-radius: var(--r); background: var(--danger-soft); color: #ffb3bd; font-size: 13px; }

/* ─── Superfícies ────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-body { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px;
  border-radius: var(--r-sm); font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-accent { background: var(--accent-soft); color: var(--electric); }
.badge-info { background: var(--info-soft); color: #8cc6ff; }
.badge-success { background: var(--success-soft); color: #6fdbb4; }
.badge-warning { background: var(--warning-soft); color: #f0c677; }
.badge-danger { background: var(--danger-soft); color: #ff9dab; }

/* ─── Tabelas ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.table .right { text-align: right; }
.thumb { width: 40px; height: 40px; border-radius: var(--r); object-fit: cover; background: var(--surface-3); flex: none; }

/* ─── Estado vazio e skeleton ────────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 44px 20px; color: var(--text-2); }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.empty h3 { color: var(--text); font-size: 14.5px; }
.empty p { max-width: 380px; font-size: 13px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r); }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-title { height: 22px; width: 45%; margin-bottom: 12px; }

/* ─── Toasts, modais, menus ──────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-2); font-size: 13px;
}
.toast .icon-wrap { margin-top: 1px; }
.toast-success .icon-wrap { color: var(--success); }
.toast-error .icon-wrap { color: var(--danger); }
.toast-info .icon-wrap { color: var(--info); }

.modal-backdrop { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(5, 6, 10, 0.72); overflow-y: auto; }
.modal { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.modal-lg { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.menu {
  position: absolute; z-index: 80; width: max-content; min-width: 220px; max-width: min(320px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--header-h) - 20px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
}
.menu[hidden] { display: none; }
.menu-head { padding: 8px 10px 10px; min-width: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 9px 10px; border-radius: 10px; font-size: 13.5px; color: var(--text-2); text-align: left; }
.menu-item > span:not(.count-dot) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item svg { width: 16px; height: 16px; flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); color: var(--text); outline: 0; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-line); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: 22px; }
.tab { padding: 9px 12px; font-weight: 500; font-size: 13px; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color 0.14s; }
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 22px; color: var(--text-2); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .select, .filters .input { width: auto; min-width: 150px; flex: 0 1 auto; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-3); display: inline-grid; place-items: center; color: var(--text-2); font-weight: 600; flex: none; overflow: hidden; }

.stat { padding: 15px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .label { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.stat .value { font-family: var(--mono); font-size: 21px; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .foot { font-size: 12px; color: var(--text-3); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r); font-size: 13px; background: var(--info-soft); color: #bfe0ff; }
.notice-warning { background: var(--warning-soft); color: #f4d596; }
.notice-danger { background: var(--danger-soft); color: #ffb3bd; }
.notice-success { background: var(--success-soft); color: #9fe6cc; }

/* ─── Gráfico de barras simples ──────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars .bar { flex: 1; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.85; transition: opacity 0.12s; }
.bars .bar:hover { opacity: 1; }
.bars .bar.zero { background: var(--surface-3); opacity: 1; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-family: var(--mono); }

/* ─── Estrelas ───────────────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 1px; color: var(--warning); }
.stars svg { width: 13px; height: 13px; }
.stars .off { color: var(--surface-3); }
.rating-input { display: inline-flex; gap: 4px; }
.rating-input button { color: var(--surface-3); transition: color 0.1s, transform 0.1s; }
.rating-input button.on { color: var(--warning); }
.rating-input button:hover { transform: scale(1.12); }
.rating-input svg { width: 22px; height: 22px; }
.stars .fill, .rating-input .on svg { fill: currentColor; }

/* ─── Badges oficiais (componente único: js/lib/badges.js) ───────────────── */
.ubadges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; vertical-align: middle; }
.ubadge { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px 0 5px; border-radius: 999px; border: 1px solid var(--ub-line); background: var(--ub-bg); color: var(--ub-fg); font: 500 11px/1 var(--font); white-space: nowrap; }
.ubadge svg { width: 13px; height: 13px; flex: none; }
.ubadge:focus-visible { outline: 2px solid var(--ub-fg); outline-offset: 2px; }
.ubadge-verified { --ub-fg: #6ea0ff; --ub-bg: rgba(37, 99, 235, 0.14); --ub-line: rgba(37, 99, 235, 0.45); }
.ubadge-employee { --ub-fg: #b79cff; --ub-bg: rgba(139, 92, 246, 0.15); --ub-line: rgba(139, 92, 246, 0.5); }
.ubadge-official { --ub-fg: #fbbf3a; --ub-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08)); --ub-line: rgba(245, 158, 11, 0.6); box-shadow: 0 0 14px -4px rgba(245, 158, 11, 0.55); }
/* Compacto: só o ícone. O nome continua no aria-label e no tooltip. */
.ubadges-compact .ubadge { padding: 0; width: 20px; justify-content: center; }
.ubadges-compact .ubadge-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 520px) {
  .ubadge { padding: 0; width: 20px; justify-content: center; }
  .ubadge .ubadge-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
/* Tooltip por CSS: aparece no hover e no foco de teclado. */
.ubadge[data-tip]:hover::after, .ubadge[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; z-index: 80; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); padding: 6px 9px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); font: 400 12px/1.3 var(--font); box-shadow: var(--shadow-2); white-space: nowrap; pointer-events: none; }
@media (max-width: 520px) { .ubadge[data-tip]:hover::after, .ubadge[data-tip]:focus-visible::after { white-space: normal; width: max-content; max-width: 200px; } }
.badge-manage-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; }
.badge-manage-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.badge-manage-row.changed { border-color: var(--accent-line); background: var(--accent-soft); }
.badge-manage-row small { display: block; color: var(--text-3); font-size: 12px; }/* No gerenciamento o nome fica sempre visível, mesmo em telas pequenas. */
.badge-manage-row .ubadge { width: auto; padding: 0 9px 0 6px; height: 22px; }
.badge-manage-row .ubadge .ubadge-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }