/* =========================
   TOKENS & THEME
   ========================= */
:root {
  --accent: #E18300;

  /* Light */
  --bg: #ffffff;
  --text: #0b0b0c;
  --muted: #6b7280;
  --card: rgba(255,255,255,0.78);
  --border: rgba(0,0,0,0.08);

  --ok: #059669;
  --warn: #f59e0b;
  --err: #e11d48;

  --shadow-1: 0 10px 30px rgba(0,0,0,.06);
  --shadow-2: 0 20px 60px rgba(0,0,0,.08);

  /* Tipografia fluida */
  --step--1: clamp(12px, 0.75rem + 0vw, 12px);
  --step-0: clamp(14px, 0.82rem + 0.2vw, 16px);
  --step-1: clamp(16px, 0.9rem + 0.45vw, 20px);
  --step-2: clamp(18px, 1rem + 0.8vw, 24px);
  --step-3: clamp(22px, 1.1rem + 1.2vw, 28px);
  --step-4: clamp(26px, 1.2rem + 1.6vw, 34px);

  /* Espaçamentos fluidos */
  --space-1: clamp(6px, 0.3rem + 0.3vw, 10px);
  --space-2: clamp(10px, 0.5rem + 0.5vw, 16px);
  --space-3: clamp(14px, 0.7rem + 0.8vw, 22px);
  --space-4: clamp(18px, 0.9rem + 1.1vw, 28px);
  --space-5: clamp(24px, 1.2rem + 1.4vw, 36px);
}

.theme-dark, .theme-auto.theme-dark, :root.theme-dark {
  /* Dark */
  --bg: #0b0b0c;
  --text: #f7f7f8;
  --muted: #9aa1ac;
  --card: rgba(22,22,24,0.74);
  --border: rgba(255,255,255,0.08);

  --shadow-1: 0 10px 30px rgba(0,0,0,.55);
  --shadow-2: 0 20px 60px rgba(0,0,0,.65);
}

/* iOS notch/safe-area */
:root { --safe-top: env(safe-area-inset-top); --safe-right: env(safe-area-inset-right); --safe-bottom: env(safe-area-inset-bottom); --safe-left: env(safe-area-inset-left); }

/* =========================
   BASE
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--step-0)/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  -webkit-tap-highlight-color: transparent;
  padding: calc(var(--safe-top) * 1) calc(var(--safe-right) * 1) calc(var(--safe-bottom) * 1) calc(var(--safe-left) * 1);
}

a, .link { color: var(--accent); text-decoration: none; }
a:hover, .link:hover { filter: brightness(1.05); }

.container { max-width: min(1200px, 100% - 2*var(--space-2)); margin: 0 auto; padding: var(--space-2); }

.muted { color: var(--muted); }
.right { display: flex; gap: var(--space-1); justify-content: flex-end; align-items: center; }
.center { display: grid; place-items: center; min-height: 100vh; }
.row { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.row.wrap.gap { display:flex; flex-wrap:wrap; gap:var(--space-1); }
.hr { height: 1px; background: var(--border); margin: var(--space-2) 0; }

.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Inputs & Buttons */
input, select, button { font: inherit; }
input, select, textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, var(--bg) 8%);
  color: var(--text);
  outline: none;
  min-height: 44px; /* alvo de toque */
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .badge:focus-visible, .icon-btn:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 2px;
  border-radius: 12px;
}
button {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #eef2ff;
  cursor: pointer;
  min-height: 44px; /* alvo de toque */
}
.btn { border-color: var(--border); color: var(--text); }
.btn.primary, .btn.soft { background: var(--card); border: 1px solid var(--border); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: var(--shadow-1); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.subtle { background: transparent; }
.btn.outline { background: transparent; border: 1px solid var(--border); }
.btn.danger { color: #b42318; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 95%, var(--card) 5%);
  font-size: var(--step--1);
  min-height: 36px;
}

/* Cards e grids utilitárias */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 25px -15px rgba(0,0,0,.2);
  padding: var(--space-2);
}
.card.fancy {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(8px);
}

.grid { display: grid; gap: var(--space-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-1); }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-1); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.toolbar input, .toolbar select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.toolbar button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--accent); color: #fff; cursor: pointer; }

/* Toasts / modal */
#toasts { position: fixed; top: calc(16px + var(--safe-top)); right: calc(16px + var(--safe-right)); display: grid; gap: 8px; z-index: 9999; }
.toast { padding: 10px 12px; border-radius: 10px; color: #fff; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
.toast.warn { background: var(--warn); color: #111; }
.modal { min-width: 320px; max-width: 520px; padding: var(--space-2); border: 1px solid var(--border); border-radius: 16px; background: #fff; }
dialog::backdrop { background: rgba(0,0,0,.2); }

/* =========================
   HERO & DASHBOARD
   ========================= */
.hero { position: relative; overflow: clip; padding: var(--space-5) var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero .blob { position: absolute; filter: blur(70px); opacity: .35; }
.hero .b1 { width: 32vw; max-width: 420px; aspect-ratio: 1; background: color-mix(in srgb, var(--accent) 35%, transparent); top: -20vw; left: -12vw; border-radius: 50%; }
.hero .b2 { width: 36vw; max-width: 520px; aspect-ratio: 1; background: color-mix(in srgb, var(--accent) 25%, transparent); top: -22vw; right: -14vw; border-radius: 50%; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px),
                    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
  mask: radial-gradient(70% 60% at 50% 0%, rgba(0,0,0,.65), transparent 80%);
  opacity: .22;
}

.hero-inner { position: relative; z-index: 1; max-width: min(1200px, 100% - 2*var(--space-2)); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); justify-content: space-between; }
.title-hero { font-size: var(--step-3); margin: 0; }
.hero .user { display: flex; gap: var(--space-1); align-items: center; }
.avatar {
  width: clamp(48px, 5vw, 64px); height: clamp(48px, 5vw, 64px);
  border-radius: 16px;
  display: grid; place-items: center; font-weight: 800; font-size: var(--step-2);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bg) 10%, #000), color-mix(in srgb, var(--bg) 0%, #000));
  color: #fff; box-shadow: var(--shadow-1);
}
.hero .meta h1 { margin: 0; font-size: var(--step-2); }
.hero .meta .muted { margin: 2px 0 0; color: var(--muted); }

.quick-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.btn.soft { box-shadow: var(--shadow-1); }

/* Conteúdo do dashboard */
.container { max-width: min(1200px, 100% - 2*var(--space-2)); margin: 0 auto; padding: var(--space-2); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: var(--space-2); }

.card-header, .card-footer { padding: var(--space-2); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { margin: 0; font-size: var(--step-1); }
.card-body { padding: 0 var(--space-2) var(--space-2); }

/* Detalhes de conta */
.details { display: grid; gap: var(--space-1); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.details .label { font-size: var(--step--1); color: var(--muted); }
.details .value { font-weight: 600; }
.value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Chips */
.chip { padding: 6px 10px; border-radius: 999px; font-size: var(--step--1); border: 1px solid transparent; }
.chip.success { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); border-color: var(--border); }
.chip.warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: var(--text); border-color: var(--border); }

/* Stats */
.stats-grid { display: grid; gap: var(--space-1); grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 var(--space-2) var(--space-2); }
.stat {
  background: color-mix(in srgb, var(--card) 88%, var(--bg) 12%);
  border: 1px solid var(--border);
  border-radius: 12px; padding: var(--space-2); text-align: center;
}
.stat-kpi { font-size: var(--step-3); font-weight: 800; line-height: 1.2; }
.stat-label { font-size: var(--step--1); color: var(--muted); }

/* Timeline */
.timeline { padding: var(--space-1) var(--space-2) var(--space-2); }
.tl-item { display: grid; grid-template-columns: 18px 1fr; gap: var(--space-1); align-items: start; padding: 8px 0; }
.tl-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); margin-top: 6px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.tl-title { font-weight: 600; }
.tl-sub { font-size: var(--step--1); color: var(--muted); }

/* Quick actions cards */
.quick-grid { padding: var(--space-1) var(--space-2) var(--space-2); display: grid; gap: var(--space-1); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quick-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--card) 94%, var(--bg) 6%), color-mix(in srgb, var(--card) 88%, var(--bg) 12%));
  border-radius: 12px; padding: var(--space-2); text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-1); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  min-height: 84px;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.qc-icon { font-size: var(--step-2); margin-bottom: 6px; color: var(--accent); }
.qc-title { font-weight: 700; }
.qc-sub { font-size: var(--step--1); color: var(--muted); }

/* =========================
   LOGIN / AUTH PAGE
   ========================= */
.auth-page .auth-hero { padding: var(--space-5) var(--space-2) var(--space-2); position: relative; overflow: clip; border-bottom: 1px solid var(--border); }
.auth-hero .hero-bg { position:absolute; inset:0; pointer-events:none; }
.auth-hero .blob { position:absolute; filter: blur(70px); opacity:.35; }
.auth-hero .b1 { width: 40vw; max-width: 420px; aspect-ratio: 1; background: color-mix(in srgb, var(--accent) 35%, transparent); top:-18vw; left:-12vw; border-radius:50%; }
.auth-hero .b2 { width: 46vw; max-width: 520px; aspect-ratio: 1; background: color-mix(in srgb, var(--accent) 25%, transparent); top:-20vw; right:-14vw; border-radius:50%; }
.auth-hero .grid-overlay {
  position:absolute; inset:0;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px),
                    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size:24px 24px; mask: radial-gradient(70% 60% at 50% 0%, rgba(0,0,0,.65), transparent 80%);
  opacity:.20;
}
.hero-inner.narrow { max-width: min(720px, 100% - 2*var(--space-2)); margin: 0 auto; position: relative; z-index: 1; }
.brand { display:flex; gap: var(--space-1); align-items:center; }
.brand-mark {
  width: clamp(36px, 6vw, 48px); height: clamp(36px, 6vw, 48px);
  border-radius: 10px; display:grid; place-items:center; font-weight:800; font-size: var(--step-1);
  background: linear-gradient(135deg, #111827, #1f2937); color:#fff; box-shadow: var(--shadow-1);
}
.brand-text h1 { margin:0; font-size: var(--step-2); }
.brand-text .muted { margin:2px 0 0; color: var(--muted); }

.auth-container { display:grid; place-items:center; padding: var(--space-3) var(--space-2) var(--space-4); }
.card.fancy.auth {
  width: 100%; max-width: clamp(340px, 82vw, 560px);
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-2); backdrop-filter: blur(8px); padding: var(--space-2);
}
.auth-title { margin: 4px 0 6px; font-size: var(--step-2); }

.form { display: grid; gap: var(--space-2); }
.field .label { display:block; font-size: var(--step--1); color: var(--muted); margin-bottom: 6px; }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 48px; }
.icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 1px solid var(--border); background: color-mix(in srgb, var(--card) 92%, var(--bg) 8%);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow-1); color: var(--text);
  min-height: 40px;
}

.form-row.between { display:flex; align-items:center; justify-content:space-between; gap: var(--space-1); }
.remember-wrap { display:flex; align-items:center; gap: 8px; }

.auth-foot { text-align:center; padding: 6px 0 calc(var(--space-3) + var(--safe-bottom)); }
.auth-foot small { color: var(--muted); }

/* =========================
   RESPONSIVE BREAKPOINTS
   ========================= */

/* >= 1200px (desktop grande) */
@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(12, minmax(0,1fr)); }
}

/* 992px–1199px (desktop padrão / iPad landscape) */
@media (max-width: 1199.98px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 768px–991px (iPad portrait / tablets) */
@media (max-width: 991.98px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* 600px–767px (telefones grandes / tablets pequenos) */
@media (max-width: 767.98px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .details { grid-template-columns: 1fr; }
}

/* <= 390px (iPhone menor) */
@media (max-width: 390.98px) {
  .brand { gap: 8px; }
  .auth-foot { padding-bottom: calc(var(--space-2) + var(--safe-bottom)); }
}

/* =========================
   MOTION SAFE
   ========================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ===== Tipografia fluida e ajustes (se já existentes, ignore) ===== */
.title-hero { font-size: clamp(22px, 1.2rem + 1.2vw, 32px); margin: 0; }
.small { font-size: clamp(12px, .75rem + .1vw, 13px); }

/* ===== Skeleton loader ===== */
.skeleton,
[data-skeleton] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.skeleton::after,
[data-skeleton]::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--card) 70%, var(--bg) 30%) 0%,
    color-mix(in srgb, var(--card) 85%, var(--bg) 15%) 50%,
    color-mix(in srgb, var(--card) 70%, var(--bg) 30%) 100%);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Skeleton de linhas da timeline */
.skeleton-line {
  height: 18px;
  margin: 8px 18px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 88%, var(--bg) 12%);
  position: relative;
  overflow: hidden;
}
.skeleton-line::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--card) 85%, var(--bg) 15%) 50%,
    transparent 100%);
  animation: shimmer 1.2s linear infinite;
}

/* ===== Empty state ===== */
.empty {
  padding: 12px 18px 18px;
  text-align: center;
}
.empty-icon { font-size: 28px; margin-bottom: 6px; }
.empty-title { font-weight: 700; margin-bottom: 4px; }
.empty-sub { font-size: .9rem; color: var(--muted); }

/* ===== Melhorias responsivas extras ===== */
@media (max-width: 991.98px) {
  .hero-inner { gap: 12px; }
}
@media (max-width: 767.98px) {
  .card-header, .card-footer { flex-wrap: wrap; gap: 8px; }
  .quick-actions { gap: 8px; }
}
@media (max-width: 390.98px) {
  .quick-actions .btn { padding: 10px 12px; }
  .details { grid-template-columns: 1fr; }
}

/* ====== FIX LAYOUT GRID DA HOME ====== */

/* 1) Padrão mobile-first: cada card ocupa a linha toda */
.grid > * {
  grid-column: 1 / -1;   /* span 12 */
  min-width: 0;          /* evita overflow que empurra e sobrepõe */
}

/* 2) Garantir que cards sejam blocos e respeitem o grid */
.card, .card.fancy, .stats, article {
  display: block;
}

/* 3) Espaçamento consistente (se o visual estiver “apertado”, ajuste aqui) */
.grid { gap: var(--space-2); }

/* 4) Breakpoint de desktop/tablet largo: distribuir os cards
      - "Sua conta" 6 col
      - "Resumo" (stats) 6 col
      - "Atividades recentes" 7 col
      - "Ações rápidas" 5 col
   Usei os ids do aria-labelledby e a classe .stats que já existem no seu HTML.
*/
@media (min-width: 900px) {
  .grid > [aria-labelledby="title-account"] { grid-column: span 6; }
  .grid > .stats                             { grid-column: span 6; }
  .grid > [aria-labelledby="title-activity"] { grid-column: span 7; }
  .grid > [aria-labelledby="title-quick"]    { grid-column: span 5; }
}

/* 5) iPad portrait (~768–899px): 2 colunas equilibradas */
@media (min-width: 768px) and (max-width: 899.98px) {
  .grid > [aria-labelledby="title-account"] { grid-column: span 12; } /* deixa conta inteira no topo */
  .grid > .stats, 
  .grid > [aria-labelledby="title-activity"],
  .grid > [aria-labelledby="title-quick"]   { grid-column: span 6; }
}

/* 6) Ajustes extras para garantir altura/respiração e evitar colapso visual */
.card.fancy { padding: var(--space-2); }
.card-header, .card-footer { padding: var(--space-2); }
.card-body { padding: 0 var(--space-2) var(--space-2); }

/* 7) Stats responsivos (evita que cada KPI fique minúsculo) */
.stats-grid {
  display: grid;
  gap: var(--space-1);
  grid-template-columns: repeat(2, minmax(0,1fr)); /* base */
}
@media (min-width: 600px) { .stats-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }

/* 8) Quick actions responsivo — cartões não amontoam */
.quick-grid {
  display: grid;
  gap: var(--space-1);
  grid-template-columns: repeat(2, minmax(0,1fr)); /* base */
}
@media (min-width: 900px) { .quick-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }

/* 9) Linha do tempo — evita “achatamento” */
.timeline { padding: var(--space-1) var(--space-2) var(--space-2); }
.tl-item { min-height: 18px; }

/* 10) Segurança: nada do hero fica por cima do conteúdo (já está OK, mas garantimos) */
.hero { position: relative; z-index: 0; }

/* Medidor de senha (opcional) */
.pwd-meter { height: 6px; background: color-mix(in srgb, var(--card) 85%, var(--bg) 15%); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.pwd-meter .pwd-bar { height: 100%; width: 0%; background: var(--border); transition: width .25s ease; }
.pwd-meter .pwd-bar[data-lvl="0"] { width: 0%; }
.pwd-meter .pwd-bar[data-lvl="1"] { width: 20%; background: #ef4444; }
.pwd-meter .pwd-bar[data-lvl="2"] { width: 40%; background: #f59e0b; }
.pwd-meter .pwd-bar[data-lvl="3"] { width: 60%; background: #eab308; }
.pwd-meter .pwd-bar[data-lvl="4"] { width: 80%; background: #10b981; }
.pwd-meter .pwd-bar[data-lvl="5"] { width: 100%; background: #059669; }

/* =========================
   HOTFIX: CONTEÚDO ESCAPANDO DOS CARDS
   ========================= */

/* 1) Em grids, os filhos podem estourar a célula se min-width:auto.
      Força a encolher quando necessário. */
.grid > * { min-width: 0; }
.details > div { min-width: 0; }
.card-header, .card-body, .card-footer { min-width: 0; }

/* 2) Nos containers flex, permitir quebra certa. */
.hero-inner,
.quick-actions {
  min-width: 0;
  flex-wrap: wrap;
}

/* 3) Garante que o card seja “contenedor” (nada vaza visualmente). */
.card, .card.fancy {
  overflow: clip;           /* moderno; use 'hidden' se preferir compat total */
  /* overflow: hidden; */
}

/* 4) Texto muito longo (e.g. e-mail, id, token) — truncar/permitir quebra segura. */
.value, .stat-kpi, .qc-title, .qc-sub { min-width: 0; }
.value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;  /* quebra tokens longos (JWT/UUID) */
  word-break: break-word;
}
#email, #ownerId {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;      /* emails/ids ficam numa linha com reticências */
}

/* 5) Timeline: evitar achatamento e cortes. */
.timeline { min-width: 0; }
.tl-item { min-height: 18px; }
.tl-content { min-width: 0; }
.tl-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 6) Botões rápidos: não “forçar” largura e nem estourar em telas estreitas. */
.quick-grid { min-width: 0; }
.quick-card {
  display: grid;
  grid-template-rows: auto auto auto;
  min-width: 0;
}
.qc-title, .qc-sub { min-width: 0; }

/* 7) Quick-actions no header: permitir quebra sem empurrar layout. */
.quick-actions .btn {
  flex: 0 1 auto;   /* pode encolher e quebrar linha */
  min-width: 0;
}

/* 8) Imagens/mídia nunca excedem o card. */
img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

/* 9) Inputs sempre ocupam a largura do card (evita “sangrar” em iPhone). */
input, select, textarea {
  width: 100%;
}

/* 10) Se algum título for enorme, evitar salto de layout. */
.card-header h2, .title-hero {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 11) Opcional: limite visual para KPIs gigantes */
.stat-kpi { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Medidor de senha (opcional) */
.pwd-meter { height: 6px; background: color-mix(in srgb, var(--card) 85%, var(--bg) 15%); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.pwd-meter .pwd-bar { height: 100%; width: 0%; background: var(--border); transition: width .25s ease; }
.pwd-meter .pwd-bar[data-lvl="0"] { width: 0%; }
.pwd-meter .pwd-bar[data-lvl="1"] { width: 20%; background: #ef4444; }
.pwd-meter .pwd-bar[data-lvl="2"] { width: 40%; background: #f59e0b; }
.pwd-meter .pwd-bar[data-lvl="3"] { width: 60%; background: #eab308; }
.pwd-meter .pwd-bar[data-lvl="4"] { width: 80%; background: #10b981; }
.pwd-meter .pwd-bar[data-lvl="5"] { width: 100%; background: #059669; }

/* ===== USERS (ADMIN) ================================================== */

/* Card principal ocupa largura confortável e não vaza conteúdo */
.users-card { max-width: 1200px; margin-inline: auto; overflow: hidden; }

/* Toolbar */
.users-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-1); margin: var(--space-1) 0 var(--space-1);
}
.users-toolbar .search {
  width: min(360px, 100%);
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--card) 92%, var(--bg) 8%); color: var(--text);
}

/* Envoltório com rolagem vertical e cabeçalho sticky */
.table-wrap {
  overflow: auto;
  max-height: clamp(420px, 60vh, 70vh);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 96%, var(--bg) 4%);
}

/* Tabela base */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;           /* evita estourar colunas */
}
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: var(--step--1);
  vertical-align: middle;
  min-width: 0;
}
.table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  background: color-mix(in srgb, var(--bg) 95%, var(--card) 5%);
  border-bottom: 1px solid var(--border);
}

/* Listras e hover */
.table tbody tr:nth-child(odd)  { background: color-mix(in srgb, var(--card) 96%, var(--bg) 4%); }
.table tbody tr:hover           { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Colunas que precisam truncar */
.wrap {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.num  { text-align: right; }

/* Badges coerentes com tema */
.badge { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; border:1px solid var(--border); background: color-mix(in srgb, var(--bg) 95%, var(--card) 5%); font-size: var(--step--1); }
.badge.ok { background: color-mix(in srgb, #10b981 18%, transparent); }
.badge.no { background: color-mix(in srgb, #ef4444 18%, transparent); }

/* Célula vazia centralizada */
.center-cell { text-align: center; padding: 18px 12px; }

/* Skeleton rows */
.sk-row .sk-line {
  height: 16px; border-radius: 8px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--card) 86%, var(--bg) 14%);
}
.sk-row .sk-line::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--card) 90%, var(--bg) 10%) 50%,
    transparent 100%);
  animation: shimmer 1.2s linear infinite;
}

/* Responsivo: em telas menores, permitir scroll horizontal mais suave */
@media (max-width: 767.98px) {
  .users-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .users-toolbar .search { width: 100%; }
  .table-wrap { max-height: 60vh; }
}

/* Garantias anti-overflow em grid/flex ancestrais */
.users-card, .table-wrap, .users-table, .users-toolbar { min-width: 0; }

/* --- Tabela com scroll horizontal em telas pequenas --- */
.table-wrap {
  overflow-x: auto;                /* habilita scroll lateral */
  -webkit-overflow-scrolling: touch; /* scroll suave no iOS */
  overscroll-behavior-x: contain;  /* evita “voltar página” no iOS ao arrastar */
  border-radius: 12px;
  border: 1px solid var(--border, #e2e2e2);
  background: var(--card, #fff);
}

/* Faz a tabela expandir além da viewport, gerando o scroll */
.table.users-table {
  width: max-content;              /* cresce conforme o conteúdo */
  min-width: 960px;                /* largura mínima confortável; ajuste se precisar */
  border-collapse: collapse;
}

/* Cabeçalho “grudado” no topo do wrap durante o scroll horizontal/vertical */
.table.users-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card, #fff);   /* evita “vazar” conteúdo por baixo */
}

/* Células: evite quebrazinhas automáticas que espremem o conteúdo */
.table.users-table th,
.table.users-table td {
  white-space: nowrap;             /* não quebra linhas; força scroll lateral */
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #eee);
  text-align: left;
}

/* Para colunas que você QUER permitir quebra (ex.: nome ou e-mail longos),
   use a classe .wrap já existente: */
.table.users-table .wrap {
  white-space: normal;             /* esta coluna pode quebrar */
  word-break: break-word;
}

/* Centralização opcional em “nenhum usuário” */
.center-cell { text-align: center; }