/*
 * Styles do portal /parceiro.
 *
 * Paleta sóbria — diferencia do laranja vibrante de /admin e do roxo de
 * /comercial usando teal-petróleo (#0F766E) como cor de marca. O laranja
 * Kidspot (#FF6B35) continua presente apenas como CTA principal,
 * preservando o DNA visual.
 *
 * Sem emojis. Ícones via SVG inline (lucide) injetados pelo core.js
 * em qualquer elemento com `data-lucide-slot="<icon-name>"`.
 *
 * Hover sutil: nav-item recebe leve escala (1.02) ao passar o mouse.
 */

:root {
  --primary: #FF6B35;
  --primary-dark: #E55A28;
  --brand-parceiro: #0F766E;
  --brand-parceiro-soft: rgba(15, 118, 110, 0.08);
  --brand-parceiro-soft-strong: rgba(15, 118, 110, 0.14);
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-muted: #F1F5F9;
  --text: #0F172A;
  --text-soft: #334155;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --blue: #2563EB;
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, 0.08);
  --yellow: #F59E0B;
  --yellow-soft: rgba(245, 158, 11, 0.12);
  --sidebar-w: 252px;
  --header-h: 64px;
  /* Safe-area (notch/Dynamic Island) — 0 em desktop e devices sem inset.
   * Mesmo padrão do /campo (hunter PWA). Usado só no mobile. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

button { font-family: inherit; }

#app-shell { display: flex; min-height: 100vh; }

/* ──────────────── Sidebar ──────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-icon img { width: 30px; height: 30px; border-radius: 7px; }
.sidebar-brand-name { font-weight: 700; font-size: 15px; color: var(--text); }
.sidebar-brand-sub { font-size: 11px; color: var(--brand-parceiro); font-weight: 600; letter-spacing: 0.04em; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
}
.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 16px 10px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 9px 10px;
  font-size: 13.5px;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 500;
  border-radius: 8px;
  transform-origin: left center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: var(--brand-parceiro-soft);
  color: var(--brand-parceiro);
  transform: scale(1.02);
}
.nav-item:focus-visible {
  outline: 2px solid var(--brand-parceiro);
  outline-offset: 1px;
}
.nav-item.active {
  background: var(--brand-parceiro-soft-strong);
  color: var(--brand-parceiro);
  font-weight: 600;
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { flex: 1; }
.nav-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--yellow);
  background: var(--yellow-soft);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
/* Ícone de cadeado — só aparece quando o item está esmaecido por falta de plano. */
.nav-lock { display: none; color: var(--text-muted); }
.nav-lock svg { width: 14px; height: 14px; }
.nav-item.nav-locked,
.nav-item.nav-soon {
  opacity: 0.5;
  cursor: default;
  color: var(--text-muted);
}
.nav-item.nav-locked:hover,
.nav-item.nav-soon:hover {
  background: transparent;
  color: var(--text-muted);
  transform: none;
}
.nav-item.nav-locked .nav-lock { display: inline-flex; align-items: center; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 6px; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-align: left; transition: background 0.12s, border-color 0.12s; }
.user-info:hover { background: var(--surface-2, rgba(0,0,0,0.03)); border-color: var(--border); }
.user-info-caret { margin-left: auto; flex-shrink: 0; color: var(--text-muted); display: inline-flex; }
.user-info-caret svg { width: 14px; height: 14px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-parceiro);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.user-info-text { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.btn-logout svg { width: 14px; height: 14px; }
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ──────────────── Main ──────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
/* Hamburger e overlay só existem no mobile (media query no fim do arquivo). */
.topbar-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  margin-left: -6px;
}
.topbar-menu-btn:hover { background: var(--bg-muted); color: var(--text); }
.topbar-menu-btn svg { width: 22px; height: 22px; }
.sidebar-overlay { display: none; }
.topbar-place { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-place-name { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.topbar-place-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-muted); }
.topbar-place-contract { white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-kidspoints {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 14px;
  background: var(--brand-parceiro-soft);
  border: 1px solid var(--brand-parceiro-soft-strong);
  border-radius: 999px;
  font-weight: 700;
  color: var(--brand-parceiro);
  font-size: 14px;
}
.topbar-kidspoints-value { font-variant-numeric: tabular-nums; }
.topbar-kidspoints-icon img { width: 22px; height: 22px; border-radius: 6px; }

.content { flex: 1; padding: 24px 28px 40px; overflow-y: auto; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }

/* ──────────────── Cards & components ──────────────── */
.spinner-wrap { display: flex; justify-content: center; padding: 60px 0; }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--brand-parceiro-soft-strong);
  border-top-color: var(--brand-parceiro);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0; color: var(--text); }
.card-subtitle { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-card-value { font-size: 24px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card-trend { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.stat-card-trend.up { color: var(--green); }
.stat-card-trend.down { color: var(--red); }
.stat-card-trend.neutral { color: var(--text-muted); }
.stat-card-trend.cta { color: var(--brand-parceiro); font-weight: 600; }
.stat-card-spark { margin-top: 4px; height: 36px; }
.stat-card-label [data-lucide-slot] { vertical-align: -2px; margin-right: 3px; }
.stat-card-unit { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.stat-card-value.text { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Cards de ação clicáveis no painel */
.stat-card.action { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.stat-card.action:hover { border-color: var(--brand-parceiro); box-shadow: 0 6px 18px var(--brand-parceiro-soft-strong); transform: translateY(-2px); }
.stat-card.action:focus-visible { outline: 2px solid var(--brand-parceiro); outline-offset: 2px; }
/* Saldo KidsPoints esmaecido (inativo por enquanto) */
.stat-card.dimmed { opacity: 0.55; }
.section-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 22px 0 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--yellow-soft); color: #B45309; }
.badge-err { background: var(--red-soft); color: var(--red); }
.badge-brand { background: var(--brand-parceiro-soft); color: var(--brand-parceiro); }

/* ──────────────── Forms ──────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: white;
  color: var(--text);
  font-family: inherit;
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-parceiro);
  box-shadow: 0 0 0 3px var(--brand-parceiro-soft);
}
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.form-error { font-size: 11.5px; color: var(--red); margin-top: 3px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ──────────────── Buttons ──────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
  font-family: inherit;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand-parceiro); color: white; border-color: var(--brand-parceiro); }
.btn-primary:hover:not(:disabled) { background: #0B5C56; }
.btn-cta { background: var(--primary); color: white; border-color: var(--primary); }
.btn-cta:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: white; color: var(--text-soft); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--bg-muted); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-muted); }
.btn-danger { background: white; color: var(--red); border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ──────────────── 3-dot menu ──────────────── */
.kebab {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.kebab:hover { background: var(--bg-muted); color: var(--text); }
.kebab svg { width: 18px; height: 18px; }

.kebab-menu {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 180px;
}
.kebab-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
}
.kebab-menu-item:hover { background: var(--bg-muted); color: var(--text); }
.kebab-menu-item.danger { color: var(--red); }
.kebab-menu-item svg { width: 14px; height: 14px; }

/* ──────────────── Tabs ──────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--text-soft); }
.tab.active { color: var(--brand-parceiro); border-bottom-color: var(--brand-parceiro); }

/* ──────────────── Tables ──────────────── */
.kstable { width: 100%; border-collapse: collapse; font-size: 13px; }
.kstable th { text-align: left; padding: 9px 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.kstable td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.kstable tr:last-child td { border-bottom: none; }
.kstable tr:hover td { background: var(--bg-muted); }
.kstable .text-right { text-align: right; }
.kstable .actions-cell { width: 40px; position: relative; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; }

/* ──────────────── Modal ──────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
}
#modal-box {
  background: white;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px 24px 20px;
  position: relative;
}
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
}
.modal-close-btn:hover { background: var(--bg-muted); color: var(--text); }
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; padding-right: 32px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ──────────────── Toast ──────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  max-width: 360px;
  animation: toastIn 0.2s ease;
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-warn { background: #B45309; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ──────────────── Login page ──────────────── */
#login-page {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #F8FAFC 0%, #ECFDF5 100%);
}
.login-card {
  background: white;
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-logo-icon img { width: 40px; height: 40px; border-radius: 9px; }
.login-logo-text { font-size: 20px; font-weight: 800; color: var(--text); display: block; }
.login-logo-badge { font-size: 11px; color: var(--brand-parceiro); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; display: block; }
.login-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.login-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.login-ok { background: var(--green-soft); color: var(--green); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 4px; font-weight: 500; }
.login-submit { width: 100%; margin-top: 6px; padding: 11px 16px; }
.login-forgot { margin-top: 12px; text-align: center; font-size: 12.5px; }
.login-footer { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
.login-footer-text { margin-right: 4px; }
.login-alt-link { color: var(--brand-parceiro); text-decoration: none; font-weight: 600; }
.login-alt-link:hover { text-decoration: underline; }

/* ──────────────── Claim shell ──────────────── */
#claim-shell { display: none; flex-direction: column; min-height: 100vh; background: var(--bg); }
.claim-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: white; border-bottom: 1px solid var(--border); }
.claim-header-brand { display: flex; align-items: center; gap: 10px; }
.claim-header-brand img { width: 28px; height: 28px; border-radius: 6px; }
.claim-header-name { font-weight: 700; font-size: 14px; }
.claim-header-sub { font-size: 11px; color: var(--brand-parceiro); font-weight: 600; }
.claim-main { flex: 1; padding: 32px 24px; max-width: 720px; margin: 0 auto; width: 100%; }

.banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
}
.banner svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.banner-info { background: var(--brand-parceiro-soft); color: var(--brand-parceiro); }
.banner-warn { background: var(--yellow-soft); color: #B45309; }
.banner-err { background: var(--red-soft); color: var(--red); }
.banner-ok { background: var(--green-soft); color: var(--green); }
.banner-title { font-weight: 700; }
.banner-body { color: var(--text-soft); }

/* ──────────────── Micrográficos (SVG sparklines) ──────────────── */
.sparkline { width: 100%; height: 36px; display: block; }
.sparkline path.line { fill: none; stroke: var(--brand-parceiro); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sparkline path.area { fill: var(--brand-parceiro-soft); stroke: none; }
.sparkline.up path.line { stroke: var(--green); }
.sparkline.up path.area { fill: var(--green-soft); }
.sparkline.down path.line { stroke: var(--red); }
.sparkline.down path.area { fill: var(--red-soft); }

.minibar { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.minibar-col { flex: 1; min-width: 4px; background: var(--brand-parceiro); border-radius: 3px 3px 0 0; opacity: 0.85; }
.minibar-col.dim { background: var(--bg-muted); }

/* ──────────────── Utilities ──────────────── */
.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.tooltip-host { position: relative; display: inline-flex; }
.tooltip-host:hover .tooltip-body { opacity: 1; pointer-events: auto; }
.tooltip-body {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}

/* ──────────────── Topbar: botão Upgrade ──────────────── */
.topbar-upgrade-btn { margin-left: 4px; flex-shrink: 0; }
.topbar-upgrade-btn svg { width: 13px; height: 13px; }

/* ──────────────── Tela de Planos (Upgrade) ──────────────── */
.plan-soon-banner { align-items: center; }
.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--plan-accent, var(--brand-parceiro));
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card-current { box-shadow: 0 0 0 2px var(--plan-accent, var(--brand-parceiro)); }
.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.plan-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.plan-card-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.plan-card-pricing { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.plan-card-price { font-size: 22px; font-weight: 800; color: var(--plan-accent, var(--brand-parceiro)); }
.plan-card-period { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.plan-card-desc { font-size: 13px; color: var(--text-soft); margin: 0; }
.plan-card-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}
.plan-card-benefits li { display: flex; align-items: flex-start; gap: 6px; }
.plan-card-check { color: var(--plan-accent, var(--brand-parceiro)); flex-shrink: 0; margin-top: 1px; }
.plan-card-check svg { width: 14px; height: 14px; }
.plan-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.plan-card-cta { margin-top: auto; }

/* ════════════════ Mobile (≤ 860px) ════════════════
 * Tudo abaixo só vale no celular/tablet estreito. Acima de 860px o layout
 * desktop (sidebar fixa) fica intacto — nenhuma regra aqui se aplica.
 */
@media (max-width: 860px) {
  /* Trava de segurança: nenhum filho pode gerar scroll horizontal no celular.
   * Escopada ao mobile — no desktop a sidebar usa position:sticky, que
   * overflow-x:hidden no root quebraria. */
  html, body { overflow-x: hidden; max-width: 100%; }

  /* ── Sidebar vira gaveta deslizante ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(86vw, var(--sidebar-w));
    z-index: 9500;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  #app-shell.drawer-open .sidebar { transform: translateX(0); }

  /* ── Overlay do drawer ── */
  #app-shell.drawer-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9400;
    background: rgba(15, 23, 42, 0.45);
  }

  /* ── Hamburger visível ── */
  .topbar-menu-btn { display: inline-flex; }

  /* ── Topbar compacto + respeita a status bar (viewport-fit=cover) ── */
  .topbar {
    padding: var(--safe-top) 12px 0;
    height: calc(var(--header-h) + var(--safe-top));
    gap: 10px;
  }
  .topbar-place-name { font-size: 15px; max-width: 46vw; }
  .topbar-place-contract { display: none; }
  /* Botão Upgrade vira só-ícone (font-size:0 some com o nó de texto " Upgrade";
   * o SVG tem tamanho fixo em px, então permanece visível). */
  .topbar-upgrade-btn { padding: 6px 8px; font-size: 0; }
  .topbar-kidspoints { padding: 5px 10px 5px 12px; font-size: 13px; }
  .topbar-kidspoints-icon img { width: 18px; height: 18px; }

  /* ── Conteúdo e cards ── */
  .content { padding: 16px 14px 32px; }
  .card { padding: 14px 16px; }
  .page-title { font-size: 18px; }

  /* ── Tabelas: scroll horizontal isolado em vez de estourar a página ── */
  .kstable {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Tabs largas: rolam na horizontal (senão a trava overflow-x as corta) ── */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  /* ── Modais full-width ── */
  #modal-overlay { padding: 12px; }
  #modal-box { padding: 18px 16px 16px; }

  /* ── Grids: stat-cards em 2 colunas (2×2), planos empilhados ── */
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .plan-cards { grid-template-columns: 1fr; }

  /* ── Claim/login: paddings menores + safe-area no header ── */
  .claim-main { padding: 24px 16px; }
  .claim-header { padding: calc(12px + var(--safe-top)) 16px 12px; }
}
