/* saasMonitor — UI 3.0 dark
   Cinza escuro + bordas sutis (radius 4-8px).
   Tipografia: Inter (fallback system-ui). */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta dark - tons de cinza-azulado */
  --bg:           #0b0d12;
  --bg-grad:      radial-gradient(1200px 600px at 20% -10%, rgba(99, 102, 241, .08) 0%, transparent 55%),
                  radial-gradient(900px 400px at 100% 0%, rgba(244, 63, 94, .04) 0%, transparent 60%),
                  #0b0d12;
  --surface:      #14171f;
  /* --surface-1: usado em ~40 lugares (features, settings, quota_alerts,
     tenants, search_stats) mas nunca foi definido — superfícies ficavam
     transparentes. Alias da superfície-base dos cards. */
  --surface-1:    var(--surface);
  --surface-2:    #1a1e28;
  --surface-3:    #232834;
  --sidebar:      #0f1218;
  --border:       #262b38;
  --border-soft:  #1d2129;
  --text:         #e4e6ed;
  --text-soft:    #aab0c0;
  --text-muted:   #6b7388;

  --primary:      #818cf8;
  --primary-h:    #a5b1ff;
  --primary-2:    #6366f1;
  --primary-soft: rgba(129, 140, 248, .12);
  --primary-glow: rgba(129, 140, 248, .35);

  --ok:           #34d399;
  --ok-soft:      rgba(52, 211, 153, .14);
  --warn:         #fbbf24;
  --warn-soft:    rgba(251, 191, 36, .14);
  --danger:       #f87171;
  --danger-soft:  rgba(248, 113, 113, .14);
  --info:         #38bdf8;
  --info-soft:    rgba(56, 189, 248, .14);

  --shadow-xs:    0 1px 0 rgba(0, 0, 0, .35);
  --shadow-sm:    0 1px 0 rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
  --shadow:       0 1px 0 rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg:    0 1px 0 rgba(0, 0, 0, .35), 0 24px 48px rgba(0, 0, 0, .45);

  /* Bordas menos arredondadas (era 6-16px) */
  --radius-xs:    3px;
  --radius-sm:    4px;
  --radius:       6px;
  --radius-lg:    8px;

  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;

  --duration:     .15s;
  --ease:         cubic-bezier(.4, 0, .2, 1);
  --topbar-h:     56px;
}

/* ─── Tema LIGHT (toggle no topbar; persistido em localStorage) ───────── */
:root[data-theme="light"] {
  --bg:           #f4f6fb;
  --bg-grad:      radial-gradient(1200px 600px at 20% -10%, rgba(99, 102, 241, .06) 0%, transparent 55%),
                  radial-gradient(900px 400px at 100% 0%, rgba(244, 63, 94, .03) 0%, transparent 60%),
                  #f4f6fb;
  --surface:      #ffffff;
  --surface-1:    var(--surface);
  --surface-2:    #f3f5fa;
  --surface-3:    #e9edf5;
  --sidebar:      #ffffff;
  --border:       #dde2ec;
  --border-soft:  #eaeef5;
  --text:         #1b2230;
  --text-soft:    #4b5568;
  --text-muted:   #8994a8;

  --primary:      #5b5cf0;
  --primary-h:    #4646d8;
  --primary-2:    #4f46e5;
  --primary-soft: rgba(91, 92, 240, .10);
  --primary-glow: rgba(91, 92, 240, .22);

  --ok:           #059669;
  --ok-soft:      rgba(5, 150, 105, .12);
  --warn:         #d97706;
  --warn-soft:    rgba(217, 119, 6, .12);
  --danger:       #dc2626;
  --danger-soft:  rgba(220, 38, 38, .10);
  --info:         #0284c7;
  --info-soft:    rgba(2, 132, 199, .12);

  --shadow-xs:    0 1px 0 rgba(16, 24, 40, .04);
  --shadow-sm:    0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow:       0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg:    0 1px 2px rgba(16, 24, 40, .06), 0 24px 48px rgba(16, 24, 40, .12);
}

::selection { background: var(--primary-soft); color: var(--text); }

/* Scrollbar dark */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-xs);
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--border); }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--primary-h); text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--text-muted); }
.small { font-size: .85em; }
.text-center { text-align: center; }
.inline { display: inline; margin: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ─── Layout ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: var(--topbar-h);                 /* começa logo abaixo da topbar */
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  z-index: 50;
  transition: transform var(--duration) var(--ease);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 .25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.brand__dot {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-2), var(--info));
  box-shadow: 0 0 0 1px var(--border), 0 8px 16px rgba(99, 102, 241, .25);
  position: relative;
  flex-shrink: 0;
}
.brand__dot::after {
  content: "▲";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.brand__name { font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; line-height: 1.1; }
.brand__sub  { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

.sidebar__tenant {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: .65rem .75rem;
  margin-bottom: .85rem;
}
.sidebar__tenant-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
}
.sidebar__tenant-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 1px;
  line-height: 1.2;
}
.sidebar__tenant-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .35rem;
  gap: .35rem;
}
.sidebar__tenant-meta code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .72em;
  color: var(--text-soft);
}
.sidebar__tenant-meta .btn-link { font-size: .75rem; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; padding-bottom: .5rem; }
.sidebar__nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
  position: relative;
}
.sidebar__nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar__nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.sidebar__nav a.is-active::before {
  content: "";
  position: absolute;
  left: -1rem; top: 50%;
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
}
.nav__icon { width: 18px; opacity: .85; font-size: .95rem; display: inline-flex; justify-content: center; flex-shrink: 0; }

/* ── Banner global: sessão WhatsApp do painel caiu ─────────────────── */
.wa-down-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, #dc2626, #b91c1c);
  color: #fff; text-decoration: none;
  padding: 10px 18px; font-size: .88rem; font-weight: 600; line-height: 1.35;
  position: sticky; top: 0; z-index: 60;
  box-shadow: 0 3px 10px rgba(220,38,38,.35);
}
.wa-down-banner:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.wa-down-banner u { text-underline-offset: 2px; }
.wa-down-banner code {
  margin-left: auto; background: rgba(255,255,255,.2); color: #fff;
  padding: 2px 8px; border-radius: 6px; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .04em; flex-shrink: 0;
}
.wa-down-banner__dot {
  width: 9px; height: 9px; border-radius: 50%; background: #fff; flex-shrink: 0;
  animation: waPulse 1.6s infinite;
}
@keyframes waPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ── Grupos colapsáveis da sidebar (droplists) ─────────────────────── */
.nav-group { display: flex; flex-direction: column; }
.nav-group__toggle {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--text); font-size: .9rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
  width: 100%; text-align: left; font-family: inherit;
  transition: background var(--duration) var(--ease);
}
.nav-group__toggle:hover { background: var(--surface-2); }
.nav-group__chev {
  margin-left: auto; font-size: .72rem; opacity: .55;
  transition: transform var(--duration) var(--ease);
}
.nav-group.is-open > .nav-group__toggle .nav-group__chev { transform: rotate(90deg); }
/* itens: colapso via max-height (grupos têm no máx. ~7 itens) */
.nav-group__items {
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden; max-height: 0;
  transition: max-height var(--duration) var(--ease);
}
.nav-group.is-open > .nav-group__items { max-height: 32rem; }
/* leve indent sob o rótulo do grupo (hierarquia visual) */
.nav-group__items a { padding-left: 2.15rem; font-size: .875rem; }
/* badge de cota espelhado no cabeçalho do grupo — só aparece quando COLAPSADO */
.nav-group__badge {
  font-size: .68rem; padding: 1px 7px; border-radius: 999px;
  background: rgba(220,38,38,.18); color: #dc2626; font-weight: 700;
  margin-left: auto;
}
.nav-group.is-open > .nav-group__toggle .nav-group__badge { display: none !important; }
.nav-group.is-open > .nav-group__toggle .nav-group__badge + .nav-group__chev { margin-left: auto; }

/* Bloco "caminho de conexão" (settings de scraper). 3 caminhos por marketplace. */
.connect-method {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem 0;
}
.connect-method--primary {
  border-color: var(--ok);
  border-left: 3px solid var(--ok);
  background: rgba(52, 211, 153, .04);
}
.connect-method h3 {
  margin: 0 0 .5rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.connect-method > .form {
  margin-top: .75rem;
}
details.connect-method > summary {
  cursor: pointer;
  padding: .5rem 0;
  color: var(--text-soft);
  font-weight: 500;
  list-style: none;
}
details.connect-method > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform var(--duration) var(--ease);
}
details.connect-method[open] > summary::before {
  transform: rotate(90deg);
}

/* Bloco "como conectar" das telas de scraper */
.connect-steps {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 0 0 1.25rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.connect-steps > .btn {
  flex-shrink: 0;
}
.steps-list {
  margin: 0;
  padding-left: 1.25rem;
  flex: 1;
  min-width: 280px;
  color: var(--text-soft);
  font-size: .88rem;
  line-height: 1.6;
}
.steps-list li { margin-bottom: .2rem; }
.steps-list li strong { color: var(--text); }
.steps-list code {
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: .85em;
  color: var(--text);
}
.steps-list kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: .8em;
  color: var(--text);
  font-weight: 600;
}

.sidebar__divider {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .8rem 0 .3rem 0;
  padding: 0 .5rem;
}
.sidebar__divider::before,
.sidebar__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.sidebar__divider span {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar__footer {
  border-top: 1px solid var(--border);
  padding-top: .85rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.sidebar__user {
  font-size: .8rem;
  background: var(--surface-2);
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.user__name { font-weight: 600; color: var(--text); font-size: .85rem; }
.user__email { color: var(--text-muted); font-size: .72rem; word-break: break-all; }

.main {
  padding: 1.5rem 2rem 4rem;
  max-width: 100%;
  overflow-x: hidden;
}
.main--no-sidebar { grid-column: 1 / -1; display: grid; place-items: center; }

/* ─── Hamburger / mobile sidebar ─────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-xs);
}
.mobile-topbar__title { font-weight: 700; font-size: 1rem; color: var(--text); }
.btn-hamburger {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
}
.btn-hamburger:hover { background: var(--surface-3); }

/* ─── Topbar (header full-width, unido à sidebar) ─────────────────────── */
.topbar {
  grid-column: 1 / -1;                  /* atravessa sidebar + conteúdo */
  position: sticky;
  top: 0;
  z-index: 60;                          /* acima da sidebar (z-50) */
  height: var(--topbar-h);
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* Bloco de marca no topo-esquerdo: mesmo fundo/borda da sidebar → parecem 1 só */
.topbar__brand {
  flex: 0 0 256px;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0 1rem;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.topbar__brand .brand__dot { width: 32px; height: 32px; }
.topbar__brand .brand__name { font-size: 1rem; }
.topbar__brand .btn-hamburger { display: none; margin-right: .1rem; }
.topbar__spacer { flex: 1 1 auto; }
.topbar__actions { display: flex; align-items: center; gap: .3rem; padding: 0 1rem 0 .5rem; }

.tb-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: transparent; border: 1px solid transparent;
  color: var(--text-soft); cursor: pointer; font-size: 1.1rem;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.tb-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-soft); }
.tb-btn__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: var(--primary-2); color: #fff;
}

.tb-badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .62rem; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); display: none;
}

/* Contador de tasks pendentes (topbar) — nunca "marca como lido":
   âmbar enquanto houver pendência; vermelho pulsando se alguma estourou o prazo. */
.tb-badge--tasks { background: #f59e0b; }
.tb-badge--tasks.is-late { background: var(--danger); animation: tb-tasks-pulse 1.6s ease-in-out infinite; }
@keyframes tb-tasks-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.tb-taskrows { padding: .35rem 0; border-bottom: 1px solid var(--border-soft); }
.tb-taskrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: .42rem .9rem; font-size: .82rem; color: var(--text-soft);
}
.tb-taskrow b {
  font-size: .78rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); padding: 0 9px; border-radius: 999px; min-width: 28px; text-align: center;
}
.tb-taskrow.is-zero { opacity: .45; }
.tb-taskrow--late { color: #dc2626; font-weight: 700; }
.tb-taskrow--late b { background: rgba(220, 38, 38, .14); color: #dc2626; border-color: rgba(220, 38, 38, .35); }

.tb-pop { position: relative; }
.tb-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 340px; max-width: 88vw;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 60; overflow: hidden; display: none;
}
.tb-menu.is-open { display: block; }
.tb-menu--sm { width: 250px; }
.tb-menu__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .9rem; border-bottom: 1px solid var(--border-soft);
  font-weight: 700; font-size: .85rem; color: var(--text);
}
.tb-menu__mark { font-size: .72rem; color: var(--primary); background: none; border: 0; cursor: pointer; font-weight: 700; }
.tb-menu__link {
  display: flex; align-items: center; gap: .55rem;
  padding: .62rem .9rem; font-size: .85rem; color: var(--text-soft);
  text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
}
.tb-menu__link:hover { background: var(--surface-2); color: var(--text); }
.tb-user { padding: .8rem .9rem; border-bottom: 1px solid var(--border-soft); }
.tb-user__name { font-weight: 700; font-size: .9rem; color: var(--text); }
.tb-user__email { font-size: .78rem; color: var(--text-muted); margin-top: 1px; word-break: break-all; }

.tb-notes { max-height: 60vh; overflow-y: auto; }
.tb-note {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .72rem .95rem; border-bottom: 1px solid var(--border-soft);
  color: var(--text); text-decoration: none; transition: background .12s ease;
}
.tb-note:last-child { border-bottom: 0; }
.tb-note:hover { background: var(--surface-2); }
.tb-note.is-new { background: var(--primary-soft); }
.tb-note__ico {
  font-size: 1.05rem; line-height: 1; flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border-soft);
}
.tb-note__body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.tb-note__row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.tb-note__title {
  font-size: .82rem; font-weight: 700; color: var(--text); line-height: 1.35;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-note__time { font-size: .68rem; color: var(--text-muted); font-weight: 600; flex: 0 0 auto; white-space: nowrap; }
.tb-note__sub {
  font-size: .78rem; color: var(--text-soft); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-notes__empty { padding: 2.2rem 1rem; text-align: center; color: var(--text-muted); font-size: .82rem; }
.tb-notes__more {
  padding: .6rem .9rem; text-align: center; font-size: .74rem;
  color: var(--text-muted); border-top: 1px solid var(--border-soft); background: var(--surface-2);
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.sidebar-overlay.is-open { display: block; opacity: 1; }

/* ─── Page head ───────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 .15rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text);
}
.page-head p { margin: 0; }
.page-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.tenant-head__meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }
.tenant-head__slug {
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: .82em;
  border: 1px solid var(--border);
}

/* ─── Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: .65rem 1.1rem;
  font-weight: 500;
  font-size: .9rem;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  margin-bottom: -1px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
  font-weight: 600;
}

/* ─── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  transition: box-shadow var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow); }
.card--flush { padding: 0; overflow: hidden; }
.card--flush .card__title { padding: 1.25rem 1.5rem 0; }
.card--flush .table thead th:first-child,
.card--flush .table tbody td:first-child { padding-left: 1.5rem; }
.card--flush .table thead th:last-child,
.card--flush .table tbody td:last-child { padding-right: 1.5rem; }

/* Cabeçalho de seção dentro de uma card--flush (ex: agrupamento por grupo na T3) */
.group-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
}
.group-section-head .muted.small { margin-left: .35rem; }
.card--accent {
  background: var(--surface);
  border-color: var(--warn);
  border-left: 3px solid var(--warn);
}
.card__title {
  margin: 0 0 .9rem 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card__action {
  display: inline-block;
  margin-top: .65rem;
  font-size: .85rem;
  color: var(--primary);
  font-weight: 600;
}
.card__action::after { content: " →"; transition: transform var(--duration) var(--ease); }
.card__action:hover::after { transform: translateX(2px); }
.card--span-2 { grid-column: 1 / -1; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ─── KPIs ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-grid--compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}
.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  opacity: .8;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi--alert::before { background: var(--danger); }
.kpi--alert { background: var(--surface); border-color: rgba(248, 113, 113, .25); }
.kpi--alert .kpi__value { color: var(--danger); }
.kpi--ok::before { background: var(--ok); }
.kpi--ok { background: var(--surface); border-color: rgba(52, 211, 153, .25); }
.kpi--ok .kpi__value { color: var(--ok); }
.kpi--warn::before { background: var(--warn); }
.kpi--warn { background: var(--surface); border-color: rgba(251, 191, 36, .25); }
.kpi--warn .kpi__value { color: var(--warn); }
.kpi--link { display: block; color: inherit; text-decoration: none; }
.kpi--link:hover { border-color: var(--primary); text-decoration: none; }
.kpi__label {
  color: var(--text-muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
.kpi__value {
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: .35rem;
  letter-spacing: -.025em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi__hint  { margin-top: .5rem; font-size: .8rem; display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }

/* ─── Tables ──────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .92rem;
}
.table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-2);
}
.table thead th:first-child { border-top-left-radius: var(--radius-xs); }
.table thead th:last-child  { border-top-right-radius: var(--radius-xs); }
.table tbody td {
  padding: .8rem .75rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table--hover tbody tr { transition: background var(--duration) var(--ease); }
.table--hover tbody tr:hover { background: var(--surface-2); }
.table--small { font-size: .85rem; }
.table--small td { padding: .5rem .75rem; }
.row-title { font-weight: 600; color: var(--text); }
.row-title:hover { color: var(--primary); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Badges & pills ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1.4;
}
.badge--sm { font-size: .65rem; padding: 2px 7px; }
.badge--ok      { background: var(--ok-soft);     color: var(--ok);      border: 1px solid rgba(52, 211, 153, .3); }
.badge--alert   { background: var(--danger-soft); color: var(--danger);  border: 1px solid rgba(248, 113, 113, .3); }
.badge--warn    { background: var(--warn-soft);   color: var(--warn);    border: 1px solid rgba(251, 191, 36, .3); }
.badge--err     { background: var(--danger-soft); color: var(--danger);  border: 1px solid rgba(248, 113, 113, .3); }
.badge--info    { background: var(--info-soft);   color: var(--info);    border: 1px solid rgba(56, 189, 248, .3); }
.badge--neutral { background: var(--surface-3);   color: var(--text-soft); border: 1px solid var(--border); }

/* Status com bolinha pulsante */
.badge--ok::before, .badge--info::before, .badge--warn::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.badge--info::before { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: .72rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid var(--border);
}
.pill--lite       { background: var(--info-soft);   color: var(--info);   border-color: rgba(56, 189, 248, .3); }
.pill--pro        { background: var(--warn-soft);   color: var(--warn);   border-color: rgba(251, 191, 36, .3); }
.pill--enterprise { background: var(--ok-soft);     color: var(--ok);     border-color: rgba(52, 211, 153, .3); }
.pill--role       { background: var(--primary-soft); color: var(--primary); border-color: rgba(129, 140, 248, .3); }

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .3rem .7rem;
  border-radius: var(--radius-xs);
  font-size: .82rem;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  font-weight: 500;
  color: var(--text-soft);
}
.chip strong { color: var(--primary); font-weight: 700; }
.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─── Forms ───────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.form__field { display: flex; flex-direction: column; gap: .3rem; }
.form__field > span:first-child { font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.form__section {
  margin: 1.25rem 0 .25rem 0;
  font-size: .92rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-weight: 700;
}
.form__actions { display: flex; gap: .5rem; margin-top: .75rem; align-items: center; flex-wrap: wrap; }

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=color], input[type=url], input[type=tel],
select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  padding: .6rem .8rem;
  font-size: .92rem;
  font-family: inherit;
  width: 100%;
  transition: all var(--duration) var(--ease);
}
input[type=color] { padding: .3rem; height: 38px; cursor: pointer; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  padding-right: 30px;
}
textarea.mono { font-family: var(--font-mono); font-size: .85rem; }
.input--inline { padding: .35rem .55rem; font-size: .85rem; }

.checkbox { display: inline-flex; gap: .5rem; align-items: center; cursor: pointer; }
.checkbox input { width: auto; }

/* Toggle de feature */
.toggle {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 0 .8rem;
  padding: 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  user-select: none;
  position: relative;
}
.toggle:hover { border-color: var(--primary); background: var(--surface-2); }
.toggle:has(input:checked) {
  border-color: var(--primary);
  background: var(--surface-2);
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__box {
  grid-row: 1 / 3;
  width: 36px; height: 20px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  transition: background var(--duration) var(--ease);
  align-self: center;
  border: 1px solid var(--border);
}
.toggle__box::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: var(--text-soft);
  border-radius: 50%;
  transition: left var(--duration) var(--ease), background var(--duration) var(--ease);
}
.toggle input:checked ~ .toggle__box { background: var(--primary); border-color: var(--primary); }
.toggle input:checked ~ .toggle__box::after { left: 17px; background: #fff; }
.toggle__label { font-weight: 600; font-size: .92rem; color: var(--text); }
.toggle__hint { font-size: .78rem; color: var(--text-muted); grid-column: 2; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: .65rem;
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--sm { padding: .35rem .7rem; font-size: .78rem; }
.btn--lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn--block { width: 100%; }

.btn--primary {
  background: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.btn--ok     { background: var(--ok-soft);     color: var(--ok);     border-color: rgba(52, 211, 153, .3); }
.btn--ok:hover { background: rgba(52, 211, 153, .2); border-color: var(--ok); }
.btn--warn   { background: var(--warn-soft);   color: var(--warn);   border-color: rgba(251, 191, 36, .3); }
.btn--warn:hover { background: rgba(251, 191, 36, .2); border-color: var(--warn); }
.btn--danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, .3); }
.btn--danger:hover { background: rgba(248, 113, 113, .2); border-color: var(--danger); }

.btn-link {
  color: var(--text-muted);
  font-size: .85rem;
  text-decoration: none;
  font-weight: 500;
}
.btn-link:hover { color: var(--primary); text-decoration: underline; }

/* ─── Filter bar ──────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  box-shadow: var(--shadow-xs);
}
.filter-bar input[type=search], .filter-bar select { width: auto; min-width: 200px; flex: 1 1 200px; }

/* ─── Flash ──────────────────────────────────────────── */
.flash-stack { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  border: 1px solid;
  font-weight: 500;
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  animation: flash-in .3s var(--ease);
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.flash--success { background: var(--ok-soft);     border-color: rgba(52, 211, 153, .35); color: var(--ok); }
.flash--error   { background: var(--danger-soft); border-color: rgba(248, 113, 113, .35); color: var(--danger); }
.flash--warning { background: var(--warn-soft);   border-color: rgba(251, 191, 36, .35); color: var(--warn); }
.flash--info    { background: var(--info-soft);   border-color: rgba(56, 189, 248, .3);  color: var(--info); }
.flash::before {
  content: "ℹ";
  font-weight: 700;
  flex-shrink: 0;
}
.flash--success::before { content: "✓"; }
.flash--error::before   { content: "✕"; }
.flash--warning::before { content: "⚠"; }

/* ─── Toast (notificações não-intrusivas, window.toast) ─────────────
   Empilha no canto inferior-direito; some sozinho. Mesma paleta da .flash.
   Container tem aria-live=polite (acessível). */
.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.toast--in { opacity: 1; transform: none; }
.toast::before { font-weight: 700; flex-shrink: 0; content: "ℹ"; }
.toast--success { background: var(--ok-soft);     border-color: rgba(52, 211, 153, .35); color: var(--ok); }
.toast--success::before { content: "✓"; }
.toast--error   { background: var(--danger-soft); border-color: rgba(248, 113, 113, .35); color: var(--danger); }
.toast--error::before { content: "✕"; }
.toast--warning { background: var(--warn-soft);   border-color: rgba(251, 191, 36, .35); color: var(--warn); }
.toast--warning::before { content: "⚠"; }
.toast--info    { background: var(--info-soft);   border-color: rgba(56, 189, 248, .3);  color: var(--info); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity var(--duration) var(--ease); transform: none; }
  .toast--in { transform: none; }
}

/* Spinner inline reutilizável (botões em submit, refresh). */
.spin {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: -.15em;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-submitting { cursor: progress; opacity: .85; }

/* ─── Command palette (Ctrl/Cmd+K) ─────────────────────────────────── */
.cmdk { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: flex-start; justify-content: center; }
.cmdk[hidden] { display: none; }
.cmdk__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.cmdk__panel {
  position: relative; margin-top: 12vh; width: min(620px, calc(100vw - 2rem));
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: cmdk-in .12s var(--ease);
}
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.cmdk__input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent;
  color: var(--text); font-size: 1rem; padding: 1rem 1.1rem; outline: none; font-family: var(--font-sans);
}
.cmdk__input::placeholder { color: var(--text-muted); }
.cmdk__results { max-height: 52vh; overflow-y: auto; padding: .4rem; position: relative; }
.cmdk__results.is-loading::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: cmdk-bar 1s linear infinite;
}
@keyframes cmdk-bar { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.cmdk__item {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-soft);
}
.cmdk__item.is-active { background: var(--primary-soft); color: var(--text); }
.cmdk__icon { width: 1.2rem; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.cmdk__item.is-active .cmdk__icon { color: var(--primary); }
.cmdk__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__sub { color: var(--text-muted); font-family: var(--font-mono); font-size: .78rem; flex-shrink: 0; }
.cmdk__tag {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  color: var(--info); background: var(--info-soft); padding: .1rem .4rem; border-radius: 999px; flex-shrink: 0;
}
.cmdk__empty { padding: 1.4rem; text-align: center; color: var(--text-muted); font-size: .9rem; }
.cmdk__foot { padding: .5rem .9rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .72rem; }
.cmdk__foot kbd {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px;
  padding: 0 .3rem; margin: 0 .1rem; font-family: var(--font-mono); font-size: .9em;
}

/* ─── Skeleton / shimmer (carregamento assíncrono) ─────────────────── */
.skeleton {
  position: relative; overflow: hidden; background: var(--surface-3);
  border-radius: var(--radius-xs); color: transparent !important;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
/* Estado sutil "atualizando" (auto-refresh em voo) */
.is-refreshing { animation: refresh-pulse 1s ease-in-out infinite; }
@keyframes refresh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton::after, .cmdk__results.is-loading::after, .is-refreshing { animation: none; }
}

/* ─── Login ───────────────────────────────────────────── */
.login-shell {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: min(440px, 100%);
  box-shadow: var(--shadow-lg);
}
.login-card__brand { display: flex; align-items: center; gap: .75rem; margin-bottom: .35rem; }
.login-card__brand h1 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.login-card__sub { color: var(--text-muted); font-size: .92rem; margin: 0 0 1.75rem 0; }
.login-card__note { font-size: .78rem; color: var(--text-muted); margin-top: 1.5rem; line-height: 1.5; }

/* ─── Wizard ─────────────────────────────────────────── */
.wizard { display: flex; flex-direction: column; gap: 1.25rem; }
.wizard__step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.5rem;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-2);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid var(--primary);
}
.step-body { padding-top: .15rem; }
.wizard__actions {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}
.url-preview {
  margin-top: .85rem;
  padding: .8rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  border: 1px solid var(--border);
}
.url-preview code { color: var(--primary); font-weight: 700; }

/* Plan radio cards */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
}
.plan-radio { cursor: pointer; }
.plan-radio input { display: none; }
.plan-radio__inner {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: var(--surface);
  transition: all var(--duration) var(--ease);
}
.plan-radio:hover .plan-radio__inner { border-color: var(--primary-2); background: var(--surface-2); }
.plan-radio input:checked + .plan-radio__inner {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 4px var(--primary-soft);
}
.plan-radio__name { font-weight: 700; font-size: 1rem; }
.plan-radio__price { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-top: .15rem; letter-spacing: -.02em; }
.plan-radio__code { margin-top: .25rem; }

/* ─── Big URL display ─────────────────────────────────── */
.big-url {
  display: flex;
  gap: .85rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.big-url--prod { background: var(--surface-2); border-color: var(--border); }
.big-url__label {
  font-size: .72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: .06em;
  min-width: 130px;
}
.big-url__value { font-size: 1.05rem; font-weight: 700; color: var(--text); flex: 1; word-break: break-all; }

.copyable {
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: .85em;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

/* ─── Sub summary ─────────────────────────────────────── */
.sub-summary {
  display: grid;
  gap: .35rem;
  padding: 1.25rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.sub-summary__plan { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.sub-summary__price { font-size: 1.6rem; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }

/* ─── Sticky save bar ─────────────────────────────────── */
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, rgba(11, 13, 18, .95) 30%);
  padding: 1.25rem 0;
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  z-index: 10;
}

/* ─── Bar list / event list ───────────────────────────── */
.hbar-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.hbar-list li {
  display: grid;
  grid-template-columns: 100px 1fr 50px;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
}
.hbar-list__value { text-align: right; font-weight: 700; }
.hbar { background: var(--surface-3); border-radius: var(--radius-xs); height: 7px; overflow: hidden; }
.hbar__fill { background: var(--primary); height: 100%; transition: width .5s var(--ease); }

.event-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.event-list li {
  display: grid;
  grid-template-columns: 130px 100px 1fr;
  gap: .65rem;
  align-items: center;
  font-size: .85rem;
  padding: .35rem .5rem;
  border-radius: var(--radius-xs);
  transition: background var(--duration) var(--ease);
}
.event-list li:hover { background: var(--surface-2); }
.event-list__when { color: var(--text-muted); font-size: .8rem; }
.event-list__actor { font-weight: 600; }
.event-list__action { font-size: .8em; }

/* ─── Misc ────────────────────────────────────────────── */
.meta { display: grid; grid-template-columns: 110px 1fr; gap: .5rem 1rem; margin-top: 1rem; font-size: .9rem; }
.meta dt { color: var(--text-muted); font-weight: 600; }
.meta dd { margin: 0; }

.pagination {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem; justify-content: center;
}

.error-shell { padding: 4rem 1rem; text-align: center; }
.error-shell h1 { font-size: 2rem; }
.error-pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-sm);
  text-align: left;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
}
.pre--small { font-size: .78rem; max-height: 320px; overflow: auto; background: var(--surface-2); padding: .65rem; border-radius: var(--radius-xs); border: 1px solid var(--border); font-family: var(--font-mono); }

details summary {
  cursor: pointer;
  user-select: none;
  color: var(--primary);
  font-weight: 600;
  font-size: .88rem;
}
details[open] summary { margin-bottom: .5rem; }

/* ─── Responsivo ────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 1.25rem 1rem 4rem; }
  .page-head h1 { font-size: 1.4rem; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }

  .mobile-topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }

  .main { padding: 1rem; }
  .topbar__brand { flex: 0 0 auto; }
  .topbar__brand .btn-hamburger { display: inline-grid; }
  .page-head h1 { font-size: 1.3rem; }
  .kpi__value { font-size: 1.5rem; }
  .wizard__step { grid-template-columns: 1fr; padding: 1.25rem; }
  .step-num { margin-bottom: .5rem; }
  .table { font-size: .85rem; }
  .table thead th, .table tbody td { padding: .55rem .65rem; }
  .filter-bar input[type=search], .filter-bar select { min-width: 140px; }
  .big-url { flex-direction: column; align-items: stretch; }
  .big-url__label { min-width: auto; }
  .meta { grid-template-columns: 1fr; gap: 0; }
  .meta dt { margin-top: .5rem; }
  .hbar-list li { grid-template-columns: 80px 1fr 50px; }
  .event-list li { grid-template-columns: 1fr; gap: .15rem; padding: .5rem .65rem; background: var(--surface-2); }
}

@media (max-width: 480px) {
  .login-card { padding: 1.5rem; }
  .page-head { gap: .65rem; }
  .form__row { grid-template-columns: 1fr; }
  .btn { padding: .55rem .85rem; font-size: .85rem; }
  .btn--lg { padding: .65rem 1.1rem; }
}

/* ─── Print: limpa o layout ─────────────────────────── */
@media print {
  .sidebar, .mobile-topbar, .filter-bar, .page-head__actions, .sticky-actions { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ─── Métricas v2 (dashboard) ─────────────────────────── */
.m-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-tenant-select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .6rem; font-size: .85rem; max-width: 220px;
}
.m-autorefresh { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--text-muted); cursor: pointer; }

.kpi__delta { font-size: .72rem; font-weight: 700; margin-top: 4px; color: var(--text-muted); letter-spacing: .02em; }
.kpi__delta.is-up { color: var(--ok); }
.kpi__delta.is-down { color: var(--danger); }

.m-charts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 16px 0;
}
.m-chart { margin: 0; }
.m-chart--wide { grid-column: 1 / -1; }
.m-chartbox { position: relative; height: 280px; }
.m-chartbox--donut { height: 240px; }
@media (max-width: 900px) { .m-charts { grid-template-columns: 1fr; } }

.m-queues { display: flex; gap: 14px; flex-wrap: wrap; }
.m-queue {
  display: flex; flex-direction: column; gap: 2px; min-width: 120px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
}
.m-queue__n { font-size: 1.6rem; font-weight: 800; color: var(--primary); }

.m-td-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.m-td-grid > div { display: flex; flex-direction: column; gap: 3px; }
.m-td-grid .muted { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 700px) { .m-td-grid { grid-template-columns: 1fr 1fr; } }

.hbar__fill--alert { background: var(--danger) !important; }

/* ════════════════════ CENTRO DE COMANDO (dashboard v2) ════════════════════ */

/* Entrada com stagger (controlado por --i + .is-in via JS) */
.dash-anim { opacity: 0; transform: translateY(16px); will-change: opacity, transform; }
.dash-anim.is-in {
  opacity: 1; transform: none;
  transition: opacity .55s cubic-bezier(.22,.61,.36,1), transform .55s cubic-bezier(.22,.61,.36,1);
}

/* Hero */
.dash-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 24px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.dash-hero__bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(760px 220px at 0% 0%, var(--primary-soft), transparent 62%),
    radial-gradient(620px 220px at 100% 120%, rgba(56,189,248,.10), transparent 60%);
}
.dash-hero__main, .dash-hero__actions { position: relative; z-index: 1; }
.dash-hero__title { display: flex; align-items: center; gap: 11px; }
.dash-hero__title h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.dash-hero__sub { margin: .4rem 0 0; color: var(--text-muted); font-size: .85rem; }
.dash-hero__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Ponto "ao vivo" pulsante */
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.55);
  animation: live-pulse 2.1s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.5); }
  70%  { box-shadow: 0 0 0 9px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* KPIs do dashboard */
.dash-kpis { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.kpi__sub { margin-top: 4px; }
.kpi__slash { color: var(--text-muted); font-weight: 600; font-size: .92rem; }
.kpi--accent::before { background: var(--primary); }
.kpi--accent { border-color: rgba(129,140,248,.28); }
.kpi--accent .kpi__value { color: var(--primary-h); }
.kpi--info::before { background: var(--info); }
.kpi--info { border-color: rgba(56,189,248,.25); }
.kpi--info .kpi__value { color: var(--info); }
.dash-kpis .kpi__value { font-variant-numeric: tabular-nums; }

/* Bento de gráficos (12 colunas) */
.dash-charts {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 16px; margin: 16px 0;
}
.dash-chart { margin: 0; min-width: 0; transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.dash-chart:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.m-chartbox--tall { height: 300px; }
@media (max-width: 1100px) {
  .dash-charts { grid-template-columns: 1fr; }
  .dash-charts > .dash-chart { grid-column: 1 / -1 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .dash-anim, .dash-anim.is-in { opacity: 1; transform: none; transition: none; }
  .dash-chart:hover { transform: none; }
  .live-dot { animation: none; }
}

/* Linha de tabela esmaecida (ex.: plano inativo) */
.table tr.is-dim td { opacity: .5; }
.table tr.is-dim:hover td { opacity: .8; }
