/* ============================================================
   KoraOne · Design System
   Luxo · Masculino · Clean · Azul Marinho
============================================================ */

:root {
  /* Navy */
  --color-navy-900: #0B2D4E;
  --color-navy-700: #1A4A72;
  --color-navy-500: #2B6CB0;
  --color-navy-100: #D6E8F7;
  --color-navy-50:  #EEF5FC;

  --color-primary:        var(--color-navy-700);
  --color-primary-hover:  var(--color-navy-900);
  --color-primary-light:  var(--color-navy-50);

  /* Acentos luxuosos */
  --color-gold:        #C9A961;
  --color-gold-light:  #E5D5A8;

  /* App shell */
  --app-bg:          #DCE0EE;
  --app-shell-pad:   16px;
  --app-radius:      28px;

  /* Brand */
  --brand-blue:        var(--color-navy-700);
  --brand-blue-hover:  var(--color-navy-900);
  --brand-blue-soft:   var(--color-navy-50);

  /* Backgrounds */
  --bg-page:         #E8EBF0;
  --bg-card:         #FFFFFF;
  --bg-sidebar:      #1A2535;
  --bg-sidebar-deep: #111920;
  --bg-table-header: #F1F4F8;
  --bg-row-hover:    #F7F9FC;

  /* Texto · contrastes ajustados para WCAG AA mínimo */
  --text-primary:   #1A2535;  /* 14:1 sobre branco */
  --text-secondary: #5A6A7E;  /* 5.4:1 sobre branco (era 4.4:1) */
  --text-muted:     #7A8696;  /* 4.5:1 sobre branco (era 2.8:1 — FAIL) */
  --text-on-dark:   #FFFFFF;
  --text-sidebar:   #C8D4E0;

  /* Bordas */
  --border:       #DDE3EC;
  --border-light: #EEF1F6;

  /* Raios */
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Espaçamento */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;

  /* Status */
  --color-success: #1D9E75;
  --color-warning: #E8A020;
  --color-danger:  #D84040;
  --color-info:    var(--color-navy-700);

  /* Tipografia */
  --font-base:    'Geist', system-ui, -apple-system, 'Inter', Arial, sans-serif;
  --font-display: 'IBM Plex Serif', Georgia, serif;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(11,45,78,.06), 0 1px 2px rgba(11,45,78,.04);
  --shadow-md: 0 4px 12px rgba(11,45,78,.08), 0 2px 4px rgba(11,45,78,.05);
  --shadow-lg: 0 12px 32px rgba(11,45,78,.12), 0 4px 8px rgba(11,45,78,.06);

  --sidebar-width: 240px;
  --topbar-height: 64px;
}

/* Dark mode — aplicado APENAS via classe .dark no <html> */
html.dark {
  --color-navy-900: #C8DFEF;
  --color-navy-700: #90BDD9;
  --color-navy-500: #5A9CC5;
  --color-navy-100: #1D3A52;
  --color-navy-50:  #152534;

  --color-primary:       var(--color-navy-500);
  --color-primary-hover: var(--color-navy-700);
  --color-primary-light: var(--color-navy-50);

  --bg-page:         #0F1620;
  --bg-card:         #1A2535;
  --bg-sidebar:      #111920;
  --bg-sidebar-deep: #0B1116;
  --bg-table-header: #1F2D3D;
  --bg-row-hover:    #1E2C3A;

  --text-primary:   #E8EEF5;
  --text-secondary: #8FA3B8;
  --text-muted:     #5A6E82;

  --border:       #1F1F1F;
  --border-light: #161616;

  --color-success: #2DC78F;
  --color-warning: #F0B83A;
  --color-danger:  #E86060;
}

/* ============================================================
   RESET + ACESSIBILIDADE GLOBAL
============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }

/* Focus visível em qualquer interativo (a11y essencial) */
:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

/* Respeita preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Imagens não causam CLS — mas SVGs com width/height explícitos preservam tamanho */
img, video { max-width: 100%; height: auto; display: block; }
svg { display: block; flex-shrink: 0; }
svg[width][height] { width: attr(width px); height: attr(height px); }

/* Anchor #id rola com folga (não fica colado na topbar) */
[id] { scroll-margin-top: 80px; }
html { scroll-behavior: smooth; }

/* Skip link (a11y) — só aparece quando focado via teclado */
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus-visible {
  position: fixed;
  top: 12px; left: 12px;
  width: auto; height: auto;
  padding: 10px 18px;
  margin: 0;
  clip: auto;
  background: var(--brand-blue);
  color: #fff;
  z-index: 200;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
body {
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-card);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html.dark body { background: var(--bg-card); }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ============================================================
   LAYOUT — App shell flutuante
============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-card);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

/* ============================================================
   SIDEBAR — interna ao shell
============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 10;
  border-top-right-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 8px 0 24px -8px rgba(15,27,45,.18),
              4px 0 8px -4px rgba(15,27,45,.08);
  transition: width 220ms ease;
}
.main {
  margin-left: var(--sidebar-width);
  transition: margin-left 220ms ease;
}

/* === Modo colapsado (rail 64px) === */
html.sidebar-collapsed { --sidebar-width: 72px; }
html.sidebar-collapsed .sidebar { overflow: visible; }

/* Logo: esconde "KoraOne", centraliza "K" */
html.sidebar-collapsed .sidebar-logo {
  padding: 0;
  justify-content: center;
  margin: 16px 8px;
  width: calc(100% - 16px);
}
html.sidebar-collapsed .logo-text { display: none; }
html.sidebar-collapsed .logo-mark { width: 38px; height: 38px; }

/* Nav: esconde texto */
html.sidebar-collapsed .nav { padding: 4px 8px; }
html.sidebar-collapsed .nav-item.solo {
  padding: 0;
  width: 44px; height: 44px;
  justify-content: center;
  margin: 0 auto 4px;
}
html.sidebar-collapsed .nav-item.solo span,
html.sidebar-collapsed .nav-item.solo > *:not(svg) { display: none; }
html.sidebar-collapsed .nav-item.solo {
  font-size: 0;
}
html.sidebar-collapsed .nav-item.solo svg { width: 20px; height: 20px; opacity: .9; }

/* Grupos colapsáveis: vira só ícone */
html.sidebar-collapsed .nav-group-head {
  width: 44px; height: 44px;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}
html.sidebar-collapsed .nav-group-head span,
html.sidebar-collapsed .nav-group-head .chevron { display: none; }
html.sidebar-collapsed .nav-group-head svg.icon { width: 20px; height: 20px; }
html.sidebar-collapsed .nav-group-body { display: none !important; }
html.sidebar-collapsed .nav-group { margin-bottom: 4px; }

/* Tooltip nativo via title attr aparece no hover */

/* User pill: só avatar */
html.sidebar-collapsed .sidebar-footer { padding: 8px; }
html.sidebar-collapsed .user-pill { padding: 0; justify-content: center; }
html.sidebar-collapsed .user-info { display: none; }
html.sidebar-collapsed .user-pill .avatar { width: 38px; height: 38px; }

/* Active item — barra azul indicadora */
html.sidebar-collapsed .nav-item.solo.active::before,
html.sidebar-collapsed .nav-group.open .nav-group-head::before {
  content: '';
  position: absolute;
  left: -2px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand-blue);
  border-radius: 0 3px 3px 0;
}
html.sidebar-collapsed .nav-item.solo,
html.sidebar-collapsed .nav-group-head { position: relative; }

/* Botão de collapse: muda ícone quando colapsado */
.sidebar-collapse-btn { display: inline-grid !important; }
html.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapse-btn svg { transition: transform 220ms ease; }

@media (max-width: 768px) {
  .sidebar-collapse-btn { display: none !important; }
  html.sidebar-collapsed { --sidebar-width: 0px; }
}
html.dark .sidebar {
  box-shadow: 8px 0 32px -4px rgba(0,0,0,.6),
              4px 0 12px -2px rgba(0,0,0,.4);
}

.sidebar-logo {
  margin: 18px 16px;
  padding: 0;
  height: auto;
  background: transparent;
  border-radius: 0;
  display: flex; align-items: center; justify-content: flex-start;
  flex-shrink: 0;
  box-shadow: none;
  border: none;
  cursor: pointer;
  width: calc(100% - 32px);
  font-family: inherit;
  transition: opacity 150ms ease, transform 150ms ease;
  position: relative;
}
.sidebar-logo:hover { opacity: .85; }
.sidebar-logo:active { transform: scale(0.97); }
.logo-img {
  max-height: 56px;
  width: auto;
  display: block;
}
.sidebar-logo .logo-icon { display: none; max-height: 44px; }
html.sidebar-collapsed .sidebar-logo .logo-full { display: none; }
html.sidebar-collapsed .sidebar-logo .logo-icon { display: block; margin: 0 auto; }

@media (max-width: 768px) { .sidebar-logo { cursor: default; } }

/* Logo nas telas de auth (login, forgot, reset) */
.auth-logo {
  max-width: 180px;
  max-height: 60px;
  width: auto;
  margin: 0 auto 12px;
  display: block;
}
.logo-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--brand-blue);
  background: #fff;
  border-radius: 10px;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3) var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }

.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: none;
}

/* Cabeçalho do grupo (colapsável) */
.nav-group-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease;
  text-align: left;
}
.nav-group-head:hover { background: rgba(255,255,255,.04); }
.nav-group-head svg.icon { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-group-head .chevron {
  width: 14px; height: 14px;
  margin-left: auto;
  opacity: .6;
  transition: transform 200ms ease;
}
.nav-group.open .nav-group-head { background: rgba(255,255,255,.04); color: #fff; }
.nav-group.open .nav-group-head .chevron { transform: rotate(180deg); }

.nav-group-body {
  display: none;
  padding: 4px 0 8px;
  background: rgba(0,0,0,.18);
  border-radius: 10px;
  margin-top: 2px;
}
.nav-group.open .nav-group-body { display: block; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 40px;
  padding: 0 14px 0 46px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 400;
  position: relative;
  transition: color 150ms ease;
}
.nav-item:hover { color: #fff; }
.nav-item.active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 600;
  margin: 2px 8px;
  padding-left: 38px;
  border-radius: 10px;
  height: 40px;
  box-shadow: 0 4px 12px -2px rgba(59,111,242,.4);
}

/* Item de nav top-level (sem grupo) */
.nav-item.solo {
  padding-left: 14px;
  height: 42px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.nav-item.solo svg { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-item.solo:hover { background: rgba(255,255,255,.04); }
.nav-item.solo.active {
  background: var(--brand-blue);
  color: #fff;
  margin: 0 0 4px;
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.user-pill {
  display: flex; align-items: center; gap: 12px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background 150ms ease;
}
.user-pill:hover { background: rgba(255,255,255,.06); }
.user-role { color: rgba(255,255,255,.5) !important; }
.avatar {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--color-navy-500), var(--color-navy-700));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--color-gold); font-size: 11px; letter-spacing: .5px; }

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  padding: 0 var(--space-6);
  display: flex; align-items: center; gap: var(--space-4);
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border-light);
}
.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.menu-toggle svg { width: 20px; height: 20px; }

.topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: var(--bg-page);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  transition: border-color 150ms ease, background 150ms ease;
}
.topbar-search:focus-within {
  background: var(--bg-card);
  border-color: var(--brand-blue);
}
.topbar-search svg { width: 16px; height: 16px; color: var(--text-muted); }
.topbar-search input {
  flex: 1;
  border: none; outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
}
.topbar-actions { display: flex; gap: var(--space-2); margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bg-page);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}
.icon-btn:hover { background: var(--brand-blue-soft); color: var(--brand-blue); }
.icon-btn svg { width: 18px; height: 18px; }

#themeToggle .icon-moon { display: none; }
html.dark #themeToggle .icon-sun  { display: none; }
html.dark #themeToggle .icon-moon { display: block; }

/* Sino + dropdown de notificações */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: grid; place-items: center;
  border: 2px solid var(--bg-card);
}
.notif-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 50;
}
.notif-pop.open { display: block; }
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.notif-clear { font-size: 12px; color: var(--brand-blue); }
.notif-clear:hover { text-decoration: underline; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: flex; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 150ms ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-page); }
.notif-item.unread { background: var(--brand-blue-soft); }
html.dark .notif-item.unread { background: rgba(59,111,242,.12); }
.notif-icon {
  margin-top: 2px; flex-shrink: 0;
  color: var(--brand-blue);
}
.notif-icon svg { width: 16px; height: 16px; }
.notif-icon.clr-success { color: var(--color-success); }
.notif-icon.clr-warning { color: var(--color-warning); }
.notif-icon.clr-danger  { color: var(--color-danger); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-msg   { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.notif-time  { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   PAGE HEAD
============================================================ */
.page-head {
  padding: var(--space-8) var(--space-6) 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .page-head { padding: var(--space-5) var(--space-4) 0; }
}
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.3px;
  color: var(--text-primary);
}
.page-sub {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.content {
  flex: 1;
  min-width: 0;
  padding: var(--space-8) var(--space-6) var(--space-12);
  overflow-x: hidden;
}
.content > * { max-width: 100%; }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.card + .card { margin-top: var(--space-4); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.card-title {
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.2px;
  margin: 0;
  color: var(--text-primary);
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease;
}
.stat-card:hover { border-color: var(--text-muted); }

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.5px;
}
.stat-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-meta::before {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}
.stat-up   { color: var(--color-success); }
.stat-down { color: var(--color-danger); }
.stat-meta.stat-up::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D9E75' stroke-width='2.5'%3E%3Cpath d='M3 17l6-6 4 4 8-8M21 7h-5M21 7v5'/%3E%3C/svg%3E");
}
.stat-meta.stat-down::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D84040' stroke-width='2.5'%3E%3Cpath d='M3 7l6 6 4-4 8 8M21 17h-5M21 17v-5'/%3E%3C/svg%3E");
}

/* === Loading skeleton (placeholder) === */
.skel {
  background: linear-gradient(90deg, var(--bg-page) 25%, var(--border-light) 50%, var(--bg-page) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.5s infinite;
  border-radius: 6px;
  min-height: 14px;
}
@keyframes skelShimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* === Aria/visually-hidden === */
.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;
}

/* Modo escuro — cards com fundo levemente acima do preto para destacar do bg */
html.dark .stat-card {
  background: #0F0F0F;
  border-color: #1F1F1F;
}
html.dark .stat-card:hover {
  border-color: #3A3A3A;
}

/* Card destacado — azul brand */
.stat-card.featured {
  background: linear-gradient(135deg, #3B6FF2 0%, #2348B8 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(59,111,242,.45),
              inset 0 1px 0 rgba(255,255,255,.12);
}
/* No dark, garante o azul brand (sobrepõe html.dark .stat-card que estava deixando preto) */
html.dark .stat-card.featured {
  background: linear-gradient(135deg, #3B6FF2 0%, #2348B8 100%);
  border-color: transparent;
  box-shadow: 0 8px 32px -6px rgba(59,111,242,.6),
              inset 0 1px 0 rgba(255,255,255,.12);
}
html.dark .stat-card.featured:hover {
  border-color: transparent;
}
.stat-card.featured .stat-label,
.stat-card.featured .stat-value { color: #fff; }
.stat-card.featured .stat-label { color: rgba(255,255,255,.85); }
.stat-card.featured .stat-meta  { color: rgba(255,255,255,.75); }
.stat-card.featured .stat-meta.stat-up   { color: #B8FFE0; }
.stat-card.featured .stat-meta.stat-down { color: #FFC2C2; }
.stat-card.featured .stat-meta.stat-up::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8FFE0' stroke-width='2.5'%3E%3Cpath d='M3 17l6-6 4 4 8-8M21 7h-5M21 7v5'/%3E%3C/svg%3E");
}
.stat-card.featured .stat-meta.stat-down::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFC2C2' stroke-width='2.5'%3E%3Cpath d='M3 7l6 6 4-4 8 8M21 17h-5M21 17v-5'/%3E%3C/svg%3E");
}

/* Card padrão pode ter cards sem destaque */

/* ============================================================
   BOTÕES
============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
  box-shadow: 0 6px 14px -4px rgba(59,111,242,.45);
}
.btn-primary:hover { background: var(--brand-blue-hover); border-color: var(--brand-blue-hover); }

.btn-gold {
  background: var(--color-gold);
  color: var(--color-navy-900);
  border-color: var(--color-gold);
}
.btn-gold:hover { background: var(--color-gold-light); }

.btn-outline {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}
.btn-outline:hover { background: var(--brand-blue-soft); }

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

.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }

/* ============================================================
   FORMULÁRIOS
============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--text-secondary);
}
.input, .select, .textarea {
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}
.textarea { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px var(--brand-blue-soft);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* ============================================================
   TABELAS
============================================================ */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow-x: auto;       /* scroll horizontal contido só na tabela */
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--bg-table-header);
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 150ms ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-row-hover); }
.data-table tbody td {
  padding: 16px 18px;
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table .col-actions { text-align: right; white-space: nowrap; }

/* Empty state */
.empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-secondary);
}
.empty-icon {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-navy-700);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty h3 { margin: 0 0 8px; font-family: var(--font-base); font-weight: 600; font-size: 16px; letter-spacing: -.2px; }
.empty p  { margin: 0; font-size: 13px; }

/* ============================================================
   BADGES
============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.badge-neutral { background: var(--bg-table-header); color: var(--text-secondary); }
.badge-success { background: rgba(29,158,117,.12); color: var(--color-success); }
.badge-warning { background: rgba(232,160,32,.12); color: var(--color-warning); }
.badge-danger  { background: rgba(216,64,64,.12);  color: var(--color-danger); }
.badge-info    { background: var(--color-primary-light); color: var(--color-navy-700); }
.badge-gold    { background: rgba(201,169,97,.15); color: var(--color-gold); }

/* ============================================================
   TABS
============================================================ */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: var(--space-5);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs { scrollbar-width: none; }
.tab {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
  white-space: nowrap;
}
.tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.tab:hover { color: var(--text-primary); background: rgba(0,0,0,.02); }
.tab.active {
  background: var(--bg-card);
  color: var(--brand-blue);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 0 0 1px rgba(59,111,242,.08);
}
html.dark .tab:hover { background: rgba(255,255,255,.04); }

/* ============================================================
   MODAL
============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,27,45,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh var(--space-4);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 180ms ease;
}
html.dark .modal-backdrop { background: rgba(0,0,0,.7); }
.modal-backdrop.open {
  display: flex;
  opacity: 1;
}
.modal {
  background: var(--bg-card);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,.25);
  border: 1px solid var(--border);
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  margin-bottom: 5vh;
}
.modal-backdrop.open .modal {
  transform: translateY(0);
  opacity: 1;
}
.modal.modal-lg { max-width: 760px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-family: var(--font-base);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.2px;
  margin: 0;
  color: var(--text-primary);
}
.modal-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.modal-close:hover { background: var(--bg-page); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .modal-backdrop { padding: var(--space-3); align-items: flex-end; }
  .modal { margin-bottom: 0; border-radius: 18px 18px 0 0; }
  .modal-header { padding: 16px 18px 12px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px 18px; }
}

body.modal-open { overflow: hidden; }

/* ============================================================
   AGENDA v2 — Estilo brand (azul KoraOne)
============================================================ */
:root {
  --gold:        var(--brand-blue);
  --gold-hover:  var(--brand-blue-hover);
  --gold-soft:   var(--brand-blue-soft);
  --gold-line:   #C9D8FB;
}
html.dark {
  --gold-soft:   rgba(59,111,242,.14);
  --gold-line:   rgba(59,111,242,.28);
}

/* ações topo */
.agenda-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.btn-gold {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
  box-shadow: 0 6px 16px -4px rgba(59,111,242,.45);
}
.btn-gold:hover { background: var(--brand-blue-hover); border-color: var(--brand-blue-hover); }
.btn-outline-gold {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--gold-line);
}
.btn-outline-gold:hover { background: var(--brand-blue-soft); border-color: var(--brand-blue); }

/* toolbar v2 */
.agenda-toolbar.v2 {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.agenda-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  transition: all 150ms ease;
}
.nav-btn:hover { color: var(--gold); border-color: var(--gold-line); }
.nav-btn svg { width: 16px; height: 16px; }
.nav-date {
  height: 38px;
  padding: 0 18px;
  display: inline-flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}
.nav-date:hover { border-color: var(--gold-line); }

.agenda-toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.user-select .select {
  height: 38px;
  border-radius: 10px;
  padding-right: 36px;
  min-width: 180px;
}

.view-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.view-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 150ms ease;
}
.view-tab:hover { color: var(--text-primary); }
.view-tab svg { width: 14px; height: 14px; }
.view-tab.active {
  background: var(--gold-soft);
  color: var(--gold-hover);
  font-weight: 600;
}
html.dark .view-tab.active { color: var(--gold); }

/* moldura geral */
.agenda-frame {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  overflow: hidden;
}

/* === SEMANA === */
.cal-week {
  max-height: 75vh;
  overflow-y: auto;
}
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day-col {
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column;
}
.cal-day-col:last-child { border-right: none; }
.cal-day-head {
  padding: 14px 12px;
  background: var(--gold);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 5;
}
.cal-day-col.is-today .cal-day-head { background: var(--gold-hover); }

.cal-day-body {
  position: relative;
}
.cal-day-body .cal-slot {
  height: var(--slot-h);
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.slot-time {
  position: absolute;
  top: 4px; left: 6px;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.cal-event {
  position: absolute;
  left: 4px; right: 4px;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  overflow: hidden;
  transition: all 150ms ease;
}
.cal-event:hover {
  background: var(--gold);
  color: #fff;
  z-index: 2;
}
.ev-line { line-height: 1.3; }
.ev-icon { font-size: 10px; opacity: .7; margin-left: 2px; }
.ev-sub  { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.cal-event:hover .ev-sub { color: rgba(255,255,255,.85); }

/* === DIA === */
.cal-day-grid {
  display: grid;
  grid-template-columns: 80px 1fr 12px;
  position: relative;
  max-height: 75vh;
  overflow-y: auto;
}
.cal-day-time { background: var(--gold-soft); }
.cal-day-time .time-row {
  height: var(--slot-h);
  display: flex; align-items: flex-start;
  padding: 14px 14px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-hover);
  border-bottom: 1px solid var(--gold-line);
}
.cal-day-area {
  position: relative;
  background: var(--bg-card);
}
.day-slot {
  height: var(--slot-h);
  border-bottom: 1px solid var(--border-light);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 150ms ease;
}
.day-slot:hover { background: var(--gold-soft); }
.slot-add {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 16px;
  opacity: 0;
  transition: all 150ms ease;
  cursor: pointer;
}
.day-slot:hover .slot-add {
  opacity: 1;
  background: var(--gold-soft);
  color: var(--gold-hover);
}
.cal-day-rail { background: var(--gold); }
.day-ev { padding: 12px 16px; font-size: 14px; }

/* === MÊS === */
.cal-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-month-dow {
  padding: 14px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-hover);
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gold-line);
  background: var(--bg-card);
}
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--border-light);
  gap: 1px;
}
.cal-month-cell {
  background: var(--bg-card);
  min-height: 130px;
  padding: 12px;
  display: flex; flex-direction: column;
  gap: 6px;
}
.cal-month-cell.out { opacity: .35; background: var(--bg-page); }
.cell-num {
  display: inline-block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.cal-month-cell.out .cell-num { color: var(--text-muted); }
.cal-month-cell.is-today .cell-num { color: var(--gold-hover); }
a.cell-num { transition: color 150ms ease; }
a.cell-num:hover { color: var(--gold); }

.cell-pill {
  display: inline-block;
  padding: 5px 10px;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  align-self: stretch;
  text-align: center;
}
.cell-list { display: flex; flex-direction: column; gap: 2px; }
.cell-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === VISÃO GERAL === */
.cal-overview { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.ov-day-head {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gold-line);
  margin-bottom: 12px;
}
.ov-num {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -1px;
}
.ov-dow { font-size: 12px; font-weight: 600; color: var(--gold-hover); text-transform: uppercase; letter-spacing: 1px; }
.ov-date { font-size: 13px; color: var(--text-secondary); text-transform: capitalize; }
.ov-events { display: flex; flex-direction: column; gap: 8px; padding-left: 4px; }
.ov-event {
  display: flex; gap: 16px;
  padding: 12px 16px;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
}
.ov-time { font-weight: 700; color: var(--gold-hover); min-width: 60px; }
.ov-title { font-weight: 600; }
.ov-resp { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Responsivo */
@media (max-width: 900px) {
  .agenda-toolbar.v2 { flex-direction: column; align-items: stretch; }
  .agenda-toolbar-right { justify-content: space-between; }
  .view-tab { padding: 0 10px; }
  .view-tab span { display: none; }
}
@media (max-width: 768px) {
  .cal-week-grid { grid-template-columns: 1fr; }
  .cal-day-col { border-right: none; border-bottom: 1px solid var(--border-light); }
  .cal-day-body { max-height: 50vh; }
  .cal-month-cell { min-height: 90px; padding: 6px; }
  .cell-pill { font-size: 10px; padding: 3px 6px; }
}
@media (max-width: 600px) {
  .view-tab { font-size: 12px; padding: 0 8px; }
  .view-tab svg { display: none; }
  .nav-date { padding: 0 10px; font-size: 12px; }
}

/* (CSS antigo da agenda removido — substituído pela v2 acima) */

/* ============================================================
   RESPONSIVIDADE GLOBAL — Tablet, Mobile, Small Phone
============================================================ */

/* === iPad / Tablet (≤1024px) === */
@media (max-width: 1024px) {
  .content { padding: var(--space-6) var(--space-4) var(--space-10); }
  .page-head { padding: var(--space-6) var(--space-4) 0; }
  .page-actions { gap: 8px; flex-wrap: wrap; }
  .topbar { padding: 0 var(--space-4); }
  .stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .filtros-bar { padding: 8px; }
  .filtros-bar .input,
  .filtros-bar .select { min-width: 140px; }
  .card { padding: var(--space-5); }
  .card-header { flex-wrap: wrap; gap: 12px; }

  /* Grids genéricos viram 1 coluna */
  .dashboard-grid[style*="grid-template-columns:1fr 320px"],
  .dashboard-grid[style*="minmax(0, 3fr) minmax(0, 1fr)"],
  .dashboard-grid[style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .dash-col-3 { grid-column: span 1 !important; }
  .dash-col-2 { grid-column: span 1 !important; }
  .phone-stick { position: static; }
}

/* === iPad portrait + Mobile grande (≤768px) === */
@media (max-width: 768px) {
  .topbar { height: 56px; }
  .topbar-actions { gap: 4px; }
  .page-head { padding: var(--space-5) var(--space-4) 0; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .btn { flex: 1 1 auto; }

  /* Stats: 2 colunas */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 22px; }
  .stat-card.featured { grid-column: 1 / -1; }
  .fin-grid { grid-template-columns: 1fr 1fr !important; }
  .fin-grid-2 { grid-template-columns: 1fr !important; }
  .fin-stat { min-height: 130px; padding: 14px 16px; }
  .fin-stat-value { font-size: 22px; }

  /* Cards e seções */
  .card { padding: 16px; border-radius: 12px; }
  .card-title { font-size: 15px; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-header form { width: 100%; }
  .card-header form .input { width: 100% !important; max-width: none !important; }

  /* Forms */
  .field-row { grid-template-columns: 1fr; gap: 12px; }
  .filtros-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filtros-bar > * { width: 100% !important; min-width: 0 !important; }

  /* Modal: full bottom-sheet */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: 100% !important; max-height: 92vh; border-radius: 18px 18px 0 0; margin: 0; }
  .modal-body { max-height: calc(92vh - 130px); overflow-y: auto; }

  /* Tabs com scroll horizontal */
  .tabs { width: 100%; max-width: 100%; }

  /* Hero da agenda + WA */
  .wa-hero { padding: 14px; }
  .wa-icon-big { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .wa-title { font-size: 20px; }
  .agenda-toolbar.v2 { gap: 8px; }
  .agenda-toolbar-right { width: 100%; justify-content: flex-start; }
  .view-tabs { width: 100%; }
  .nav-date { flex: 1; justify-content: center; }

  /* Embaixadora hero */
  .emb-hero { padding: 16px; gap: 16px; flex-direction: column; align-items: stretch; }
  .emb-avatar { width: 64px; height: 64px; font-size: 26px; }
  .emb-stats { grid-template-columns: 1fr 1fr; }

  /* Phone preview some no editor (ocupa muito espaço) */
  .phone-frame { transform: scale(.85); transform-origin: top center; }

  /* Kanban: cards mais compactos */
  .kanban-col { flex: 0 0 280px; }
  .kanban-card { padding: 10px 12px; }

  /* Tabela responsiva (já vira card) — garantir */
  .data-table { display: block; }
  .data-table thead { display: none; }
  .data-table tbody { display: block; }
  .data-table tr { display: block; padding: 12px; margin-bottom: 8px; background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-light); }
  .data-table td { display: flex; justify-content: space-between; padding: 6px 0; border: none !important; }
  .data-table td::before { content: attr(data-label); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
  .data-table td.col-actions { justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border-light) !important; margin-top: 6px; }
  .table-wrap { background: transparent; box-shadow: none; border: none; padding: 0; }

  /* Calendário semana — empilha em colunas vertical */
  .cal-week { max-height: none; }
  .cal-week-grid { grid-template-columns: 1fr; }
  .cal-day-col { border-right: none; border-bottom: 1px solid var(--border-light); }
  .cal-day-body { max-height: 350px; overflow-y: auto; }

  /* Calendário dia — coluna de horas mais estreita */
  .cal-day-grid { grid-template-columns: 60px 1fr 8px; }
  .cal-day-time .time-row { padding: 10px; font-size: 12px; }

  /* Mês */
  .cal-month-cell { min-height: 80px; padding: 6px; }
  .cell-num { font-size: 13px; }
  .cell-pill { font-size: 9px; padding: 2px 6px; }
  .cell-name { font-size: 10px; }

  /* Permissões table — força horizontal scroll na própria */
  .table-wrap table[style*="font-size:12px"] {
    display: table;
    min-width: 100%;
  }
  .table-wrap table[style*="font-size:12px"] thead { display: table-header-group; }
  .table-wrap table[style*="font-size:12px"] tr { display: table-row; padding: 0; background: transparent; border-radius: 0; margin: 0; }
  .table-wrap table[style*="font-size:12px"] td { display: table-cell; padding: 8px; }
  .table-wrap table[style*="font-size:12px"] td::before { display: none; }
}

/* === Mobile pequeno (≤480px) === */
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .stat-card.featured { grid-column: auto; }
  .fin-grid { grid-template-columns: 1fr !important; }
  .stat-value, .fin-stat-value { font-size: 20px; }
  .agenda-actions { flex-direction: column; }
  .agenda-actions .btn { width: 100%; justify-content: center; }
  .page-actions .btn { font-size: 12px; padding: 0 14px; }
  .nav-date { padding: 0 10px; font-size: 12px; }
  .view-tab { padding: 0 10px; font-size: 11px; }
  .view-tab svg { display: none; }
  .topbar-actions .icon-btn { width: 38px; height: 38px; }
  .notif-pop { width: 100vw; max-width: 100vw; right: -16px; border-radius: 0 0 12px 12px; }
  .pwa-banner { left: 8px; right: 8px; bottom: 8px; }
  .modal-header { padding: 14px 16px 10px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 10px 16px 14px; }
  .modal-footer .btn { flex: 1; }
  .emb-stats { grid-template-columns: 1fr; }
  .emb-stat { padding: 10px; }
  .timeline { gap: 10px; }
  .tl-icon { width: 30px; height: 30px; font-size: 14px; }
}

/* === Telas curtas (paisagem em phones) === */
@media (max-height: 500px) and (max-width: 900px) {
  .modal-body { max-height: 60vh; }
  .phone-frame { display: none; } /* economiza espaço crítico */
}
.agenda-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}
.agenda-stat {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}
.agenda-stat-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.agenda-stat-icon svg { width: 20px; height: 20px; }
.stat-blue   { background: #E5EEFE; color: #3B6FF2; }
.stat-amber  { background: #FFF3E0; color: #E8A020; }
.stat-green  { background: #E1F5EC; color: #1D9E75; }
.stat-purple { background: #EFEAFD; color: #7C5CE0; }
html.dark .stat-blue   { background: rgba(59,111,242,.15); color: #6FA0FF; }
html.dark .stat-amber  { background: rgba(232,160,32,.15); color: #F0B83A; }
html.dark .stat-green  { background: rgba(29,158,117,.15); color: #2DC78F; }
html.dark .stat-purple { background: rgba(124,92,224,.18); color: #A085F0; }

.agenda-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.agenda-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* Mini calendar */
.agenda-mini {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}
.agenda-mini-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}
.mini-nav {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}
.mini-nav:hover { background: var(--bg-page); color: var(--brand-blue); }
.agenda-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.mini-dow { font-size: 10px; color: var(--text-muted); padding: 4px 0; font-weight: 600; }
.mini-day {
  font-size: 12px;
  padding: 6px 0;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
}
.mini-day:hover { background: var(--bg-page); color: var(--text-primary); }
.mini-today { font-weight: 700; color: var(--brand-blue); }
.mini-current {
  background: var(--brand-blue) !important;
  color: #fff !important;
}

/* Toolbar */
.agenda-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.agenda-nav { display: flex; align-items: center; gap: 8px; }
.agenda-range {
  font-family: var(--font-base);
  font-size: 15px;
  margin: 0 0 0 12px;
  font-weight: 600;
  letter-spacing: -.2px;
  text-transform: capitalize;
}

/* Layout 2 colunas */
.agenda-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-4);
  align-items: flex-start;
}
.agenda-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  position: sticky;
  top: calc(var(--topbar-height) + 12px);
}
.filters-title {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--text-primary);
}
.filter-section { margin-bottom: 18px; }
.filter-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.filter-check {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  padding: 6px 0;
  cursor: pointer;
}
.filter-check input { accent-color: var(--brand-blue); width: 16px; height: 16px; }
.filter-dot { width: 10px; height: 10px; border-radius: var(--radius-full); }
.dot-blue   { background: #3B6FF2; }
.dot-red    { background: #D84040; }
.dot-green  { background: #1D9E75; }
.dot-purple { background: #7C5CE0; }

.agenda-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

/* === Week / Day grid === */
.cal-week { display: flex; flex-direction: column; }
.cal-week-head {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}
.cal-time-col {
  width: 64px;
  flex-shrink: 0;
}
.cal-day-head {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-left: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 2px;
}
.cal-day-head .dow { font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); }
.cal-day-head .dnum { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.cal-day-head.is-today .dnum {
  color: #fff;
  background: var(--brand-blue);
  border-radius: var(--radius-full);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  margin: 0 auto;
}

.cal-week-body {
  display: flex;
  position: relative;
  max-height: 70vh;
  overflow-y: auto;
}
.cal-week-body .cal-time-col {
  background: var(--bg-card);
  position: sticky; left: 0;
}
.cal-time-row {
  height: var(--slot-h);
  position: relative;
  border-bottom: 1px solid var(--border-light);
}
.cal-time-row span {
  position: absolute;
  top: -8px; right: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.cal-day-col {
  flex: 1;
  border-left: 1px solid var(--border-light);
  position: relative;
}
.cal-slot { height: var(--slot-h); border-bottom: 1px solid var(--border-light); }

.cal-event {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  overflow: hidden;
  border-left: 3px solid;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.cal-event:hover { transform: translateX(1px); box-shadow: var(--shadow-sm); z-index: 2; }
.ev-title { font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time  { font-size: 10px; opacity: .85; margin-top: 2px; }
.ev-desc  { font-size: 11px; opacity: .8; margin-top: 4px; }

.ev-blue   { background: #E5EEFE; color: #1F4FC9; border-color: #3B6FF2; }
.ev-red    { background: #FCE5E5; color: #A11B1B; border-color: #D84040; }
.ev-green  { background: #DEF5E9; color: #0F6E4E; border-color: #1D9E75; }
.ev-purple { background: #EBE3FB; color: #4C2EAE; border-color: #7C5CE0; }
html.dark .ev-blue   { background: rgba(59,111,242,.18);  color: #B5CCFF; }
html.dark .ev-red    { background: rgba(216,64,64,.18);   color: #FFB5B5; }
html.dark .ev-green  { background: rgba(29,158,117,.18);  color: #B5F0D8; }
html.dark .ev-purple { background: rgba(124,92,224,.22);  color: #D5C3FF; }

/* === Month grid === */
.cal-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}
.cal-month-dow {
  padding: 12px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-month-cell {
  min-height: 110px;
  padding: 6px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.cal-month-cell.empty { background: var(--bg-page); opacity: .4; }
.cell-num {
  display: inline-block;
  width: 26px; height: 26px;
  text-align: center;
  line-height: 26px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}
.cell-num:hover { background: var(--bg-page); color: var(--brand-blue); }
.cal-month-cell.is-today .cell-num {
  background: var(--brand-blue);
  color: #fff;
}
.cell-events { display: flex; flex-direction: column; gap: 2px; }
.cell-ev {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  border-left: 3px solid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex; gap: 4px;
}
.cell-ev-time { font-weight: 600; }
.cell-more { font-size: 10px; color: var(--text-muted); padding: 2px 6px; }

/* Responsivo agenda */
@media (max-width: 1100px) {
  .agenda-top { grid-template-columns: 1fr; }
  .agenda-mini { max-width: 360px; }
}
@media (max-width: 900px) {
  .agenda-layout { grid-template-columns: 1fr; }
  .agenda-filters { position: static; }
}
@media (max-width: 640px) {
  .agenda-stats { grid-template-columns: 1fr 1fr; }
  .cal-month-cell { min-height: 80px; }
  .cell-ev { font-size: 10px; padding: 2px 4px; }
  .cal-day-head .dnum { font-size: 14px; }
  .cal-day-head { padding: 8px 4px; }
  .cal-time-col { width: 44px; }
  .agenda-range { font-size: 14px; margin-left: 6px; }
}

/* ============================================================
   FLASH
============================================================ */
.flash {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: rgba(29,158,117,.08); color: var(--color-success); border-color: rgba(29,158,117,.2); }
.flash-error   { background: rgba(216,64,64,.08);  color: var(--color-danger);  border-color: rgba(216,64,64,.2); }
.flash-info    { background: var(--color-primary-light); color: var(--color-navy-700); border-color: rgba(43,108,176,.15); }

/* ============================================================
   LOGIN · split layout
============================================================ */
.login-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #DCEAFF 0%, #F5F8FF 50%, #DCEAFF 100%);
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  font-family: var(--font-base);
}
html.dark .login-body { background: linear-gradient(135deg, #050B14 0%, #0A1422 100%); }

.login-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}
.login-bg-blob-1 { width: 360px; height: 360px; background: #B0CCFF; top: -100px; left: -120px; }
.login-bg-blob-2 { width: 280px; height: 280px; background: #7FA8FF; bottom: -80px; right: -80px; opacity: .4; }
.login-bg-blob-3 { width: 180px; height: 180px; background: #5188F5; top: 40%; right: 8%; opacity: .25; }
html.dark .login-bg-blob-1 { background: #1E3A8A; opacity: .3; }
html.dark .login-bg-blob-2 { background: #3B6FF2; opacity: .15; }
html.dark .login-bg-blob-3 { background: #2348B8; opacity: .12; }

/* Shell */
.login-shell {
  width: 100%;
  max-width: 1100px;
  background: var(--bg-card);
  border-radius: 28px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(15,27,45,.25), 0 8px 16px -8px rgba(15,27,45,.1);
  position: relative;
  z-index: 2;
  min-height: 640px;
}

/* === LADO ESQUERDO · branding === */
.login-side {
  background: linear-gradient(135deg, #3B6FF2 0%, #2348B8 100%);
  color: #fff;
  padding: 52px 48px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.login-side::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
  top: -180px; right: -180px;
  border-radius: 50%;
}
.login-side::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%);
  bottom: -80px; left: -60px;
  border-radius: 50%;
}

/* Padrão de pontinhos (decoração tipo a referência) */
.login-side-pattern {
  position: absolute;
  top: 32px; left: 32px;
  display: grid;
  grid-template-columns: repeat(8, 4px);
  gap: 6px;
  opacity: .35;
}
.login-side-pattern span {
  width: 4px; height: 4px;
  background: rgba(255,255,255,.6);
  border-radius: 50%;
}

.login-side-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.login-side-logo {
  max-height: 44px;
  width: auto;
  margin-bottom: auto;
  align-self: flex-start;
}
.login-side-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.15;
  margin: 80px 0 14px;
  letter-spacing: -.5px;
}
.login-side-sub {
  font-size: 15px;
  color: rgba(255,255,255,.85);
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 380px;
}
.login-features {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: rgba(255,255,255,.92);
}
.lf-ic {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.lf-ic svg { width: 18px; height: 18px; color: #fff; }
.login-side-footer {
  margin-top: auto;
  font-size: 12px;
  color: rgba(255,255,255,.6);
}

/* === LADO DIREITO · form === */
.login-main {
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}
.login-main-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: auto;
}
.login-main-logo {
  max-height: 32px;
  width: auto;
}
html.dark .login-main-logo { filter: brightness(0) invert(1); } /* logo dark vira branca em dark mode */

.login-form-wrap { padding: 40px 0; }
.login-h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.login-h2-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 32px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-input {
  height: 50px !important;
  font-size: 14px !important;
  border-radius: 12px !important;
  background: var(--bg-page) !important;
  border-color: transparent !important;
}
.login-input:focus {
  background: var(--bg-card) !important;
  border-color: var(--brand-blue) !important;
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: -4px;
}
.login-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.login-check input { accent-color: var(--brand-blue); width: 16px; height: 16px; }
.login-forgot {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue);
}
.login-forgot:hover { text-decoration: underline; }

.login-submit {
  margin-top: 6px;
  width: 100%;
  height: 52px !important;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #3B6FF2 0%, #2348B8 100%) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 24px -8px rgba(59,111,242,.5) !important;
  justify-content: center;
}
.login-submit:hover {
  background: linear-gradient(135deg, #2D5DE0 0%, #1A3A99 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -8px rgba(59,111,242,.6) !important;
}

.login-tos {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 24px 0 0;
}
.login-tos a { color: var(--brand-blue); }

/* === Responsivo === */
@media (max-width: 880px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 480px;
    min-height: auto;
  }
  .login-side {
    padding: 36px 32px;
    min-height: 280px;
  }
  .login-side-title { font-size: 28px; margin-top: 40px; }
  .login-side-sub { font-size: 14px; }
  .login-features { display: none; } /* economiza espaço no mobile */
  .login-side-footer { display: none; }
  .login-main { padding: 32px 28px; }
  .login-h2 { font-size: 26px; }
}
@media (max-width: 480px) {
  .login-body { padding: 0; }
  .login-shell { border-radius: 0; min-height: 100vh; min-height: 100dvh; box-shadow: none; }
  .login-side { min-height: 200px; padding: 28px 24px; }
  .login-side-title { font-size: 24px; margin-top: 24px; }
  .login-main { padding: 28px 24px; }
}

/* ============================================================
   KANBAN
============================================================ */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4);
  scroll-snap-type: x proximity;
}
.kanban-col { scroll-snap-align: start; }
.kanban-col {
  flex: 0 0 300px;
  background: var(--bg-table-header);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}
.kanban-col-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--space-2) var(--space-3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-secondary);
}
.kanban-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  cursor: grab;
}
.kanban-card-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.kanban-card-meta { font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kanban-card.kanban-task:hover { border-color: var(--brand-blue); }

/* Etiquetas no card */
.task-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 6px;
}
.task-tag {
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2px;
}

/* Checklist progress no card */
.task-subs {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin: 6px 0;
}
.task-subs svg { color: var(--color-success); flex-shrink: 0; }
.task-sub-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-page);
  border-radius: 2px;
  overflow: hidden;
}
.task-sub-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #4DC79A);
  border-radius: 2px;
  transition: width 250ms ease;
}

/* Prazo visual (borda esquerda colorida) */
.kanban-card.prazo-atrasada { border-left: 3px solid var(--color-danger); }
.kanban-card.prazo-hoje     { border-left: 3px solid var(--color-warning); }
.kanban-card.prazo-breve    { border-left: 3px solid var(--brand-blue); }
.kanban-card.prazo-concluida { opacity: .65; }
.kanban-card.prazo-concluida .kanban-card-title { text-decoration: line-through; }

.task-prazo { font-weight: 600; }
.prazo-text-atrasada { color: var(--color-danger); }
.prazo-text-hoje     { color: var(--color-warning); }
.prazo-text-breve    { color: var(--brand-blue); }

/* Linha de subtarefa no modal */
.tk-sub-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.tk-sub-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--brand-blue);
  flex-shrink: 0;
}
.tk-sub-row .input {
  flex: 1;
  height: 36px;
  font-size: 13px;
}
.tk-sub-del {
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.tk-sub-del:hover { background: var(--bg-page); color: var(--color-danger); }


/* Próxima ação no card do funil */
.op-acao {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--brand-blue-soft);
  border-radius: 6px;
  font-size: 11px;
  color: var(--brand-blue);
}
.op-acao small { font-size: 10px; opacity: .8; white-space: nowrap; }
.op-acao-atrasada { background: rgba(216,64,64,.1); color: var(--color-danger); }

/* Probabilidade abaixo do head da coluna */
.funil-prob {
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 var(--space-2) var(--space-2);
  font-weight: 500;
  letter-spacing: .3px;
}
.kanban-add {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: all 150ms ease;
}
.kanban-add:hover { background: var(--brand-blue-soft); color: var(--brand-blue); }
.kanban-empty {
  padding: 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  border: 2px dashed var(--border-light);
  border-radius: 8px;
  margin-top: 4px;
}

/* DnD */
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.dragging { opacity: .4; cursor: grabbing; }
.kanban-col[data-dropzone] { transition: background 150ms ease; }
.kanban-col.drop-over {
  background: var(--brand-blue-soft);
  outline: 2px dashed var(--brand-blue);
  outline-offset: -4px;
}
.kanban-card-list, .funil-card-list {
  min-height: 40px;
  display: flex; flex-direction: column; gap: 6px;
}

/* Relatórios + impressão */
.report-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--brand-blue);
  margin-bottom: 4px;
  margin-top: 20px;
}

@media print {
  .sidebar, .topbar, .page-head, .no-print, .modal-backdrop, #notifPop, .sidebar-overlay { display: none !important; }
  body { background: #fff !important; padding: 0 !important; }
  .layout { display: block; }
  .main { margin: 0; }
  .content { padding: 20px !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .stat-card.featured { background: #f0f4ff !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .stat-card.featured * { color: #000 !important; }
  .data-table thead th { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; }
  .report-head { border-color: #000 !important; }
  a { color: #000 !important; text-decoration: none !important; }
}

/* WhatsApp module */
.wa-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 24px;
  margin-bottom: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  flex-wrap: wrap;
}
.wa-icon-big {
  width: 56px; height: 56px;
  min-width: 56px; min-height: 56px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 8px 20px -6px rgba(37,211,102,.4);
  overflow: hidden;
}
.wa-icon-big svg { width: 28px !important; height: 28px !important; max-width: 28px !important; max-height: 28px !important; }
.wa-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -.5px; }
.wa-sub { color: var(--text-secondary); margin: 4px 0 0; font-size: 13px; }

/* Stat com ícone à esquerda */
.wa-stat { display: flex; gap: 14px; align-items: flex-start; }
.wa-stat::before { display: none; } /* esconde top border */
.wa-stat-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
}
.wa-stat-icon svg { width: 20px; height: 20px; }
.wa-stat .stat-label { font-size: 12px; }
.wa-stat .stat-value { font-size: 24px; }
.wa-stat .stat-meta { margin-top: 6px; font-size: 11px; }

/* Tabela de templates */
.wa-table { table-layout: fixed; width: 100%; }
.wa-table th, .wa-table td { word-break: break-word; }
.wa-table .wa-prod { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wa-table .wa-prod strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wa-prod-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  letter-spacing: .5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.wa-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Switch toggle */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: .25s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch-slider { background: #25D366; }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }
.switch-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Ícones de ação */
.icon-act {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
  margin-left: 4px;
}
.icon-act:hover { background: var(--brand-blue-soft); color: var(--brand-blue); border-color: var(--brand-blue); }
.icon-act svg { width: 14px; height: 14px; }

/* Cabeçalho de seção do editor */
.wa-section-head { display: flex; align-items: center; gap: 12px; }
.wa-step-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: #25D366;
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}
.wa-step-mark svg { width: 16px; height: 16px; }
.wa-step-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px;
  margin-top: 4px;
}

.wa-textarea { font-size: 14px; line-height: 1.6; min-height: 180px; }

.wa-tags-bar {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
}
.wa-tags-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.wa-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}
.wa-tag:hover { border-color: var(--brand-blue); color: var(--brand-blue); background: var(--brand-blue-soft); }
.wa-tag svg { width: 14px; height: 14px; }

/* Phone preview · sticky no editor */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: stretch;
  margin-top: var(--space-4);
}
.dash-col-3 { grid-column: span 3; }
.dash-col-2 { grid-column: span 2; }
.dashboard-grid > .card { display: flex; flex-direction: column; margin-top: 0; }
.dashboard-grid > .card .dash-list,
.dashboard-grid > .card .dash-feed { flex: 1; }
.card + .dashboard-grid,
.dashboard-grid + .card { margin-top: var(--space-4); }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr !important; } }
.phone-stick {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
  align-self: start;
}
@media (max-width: 1024px) {
  .phone-stick { position: static; margin-top: 18px; }
}

.phone-frame {
  width: 280px;
  margin: 0 auto;
  background: #1F1F1F;
  border-radius: 36px;
  padding: 12px;
  box-shadow: 0 18px 36px -12px rgba(0,0,0,.3);
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 18px; left: 50%; transform: translateX(-50%);
  width: 72px; height: 18px;
  background: #000;
  border-radius: 12px;
  z-index: 2;
}
.phone-screen {
  background: #ECE5DD; /* fundo do WhatsApp */
  border-radius: 28px;
  overflow: hidden;
  height: 480px;
  display: flex;
  flex-direction: column;
}
.phone-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 32px 12px 10px;
  background: #075E54;
  color: #fff;
}
.phone-back { background: transparent; border: none; color: #fff; font-size: 24px; cursor: default; padding: 0 4px; }
.phone-avatar {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
}
.phone-name { font-weight: 600; font-size: 14px; line-height: 1.1; }
.phone-status { font-size: 10px; opacity: .8; }
.phone-body {
  flex: 1;
  padding: 14px 12px;
  background: #ECE5DD url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="1" fill="rgba(0,0,0,.04)"/></svg>');
  overflow-y: auto;
}
.phone-msg {
  background: #DCF8C6;
  border-radius: 8px;
  padding: 8px 10px 4px;
  max-width: 80%;
  margin-left: auto;
  font-size: 13px;
  color: #000;
  box-shadow: 0 1px 1px rgba(0,0,0,.1);
  position: relative;
}
.phone-msg::after {
  content: '';
  position: absolute;
  top: 0; right: -6px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent #DCF8C6;
}
.phone-msg-text { line-height: 1.4; word-break: break-word; }
.phone-msg-time { font-size: 10px; color: #667781; text-align: right; margin-top: 2px; }
.phone-input {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #fff;
  font-size: 13px;
  color: #999;
}
.phone-mic { font-size: 16px; }

/* PWA banners */
.pwa-banner {
  position: fixed;
  bottom: 16px; left: 16px; right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--brand-blue);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 12px 32px rgba(15,27,45,.18);
  display: flex; gap: 14px; align-items: center;
  font-size: 13px;
  z-index: 70;
  flex-wrap: wrap;
  animation: slideUp 280ms ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.pwa-banner > span { flex: 1; min-width: 200px; }

.pwa-offline {
  position: fixed;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  background: var(--color-warning);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  z-index: 80;
}

/* Quando rodando como app instalado, oculta banner de instalação */
@media (display-mode: standalone) {
  .pwa-banner { display: none !important; }
}

/* Padding extra para safe-area no iOS standalone */
@supports (padding: max(0px)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding-top: env(safe-area-inset-top); }
}

/* Busca global */
.topbar-search-wrap { position: relative; flex: 1; max-width: 480px; }
.topbar-search-wrap .topbar-search { max-width: none; }
.search-results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 460px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}
.search-results.open { display: block; }
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  transition: background 150ms ease;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-page); }
.search-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.search-body { flex: 1; min-width: 0; }
.search-title { font-weight: 600; font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.search-tipo {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.search-empty { padding: 20px 14px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Paginação */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap; gap: 10px;
}
.pag-info { font-size: 12px; color: var(--text-muted); }
.pag-btns { display: flex; gap: 4px; }
.pag-btn {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 150ms ease;
}
.pag-btn:hover { background: var(--brand-blue-soft); color: var(--brand-blue); border-color: var(--brand-blue); }
.pag-btn.active { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); font-weight: 600; }

/* Segmentações rápidas (CRM) */
.seg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.seg-tab {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 150ms ease;
}
.seg-tab:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.seg-tab.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}

/* Tags em chips */
.cli-tag {
  display: inline-block;
  padding: 1px 8px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 2px;
}

/* Filtros bar */
.filtros-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-page);
  border-radius: 10px;
  border: 1px solid var(--border-light);
}
.filtros-bar .input, .filtros-bar .select { height: 36px; font-size: 13px; }

/* Discussão (comentários + anexos) */
.discussao {
  margin-top: 18px;
  border-top: 1px solid var(--border-light);
  padding-top: 18px;
}
.disc-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.disc-tab {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}
.disc-tab:hover { color: var(--text-primary); }
.disc-tab.active { background: var(--brand-blue-soft); color: var(--brand-blue); border-color: var(--brand-blue); font-weight: 600; }
.disc-pane { display: none; }
.disc-pane.active { display: block; }

.coment-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.coment-item { display: flex; gap: 10px; }
.coment-avatar {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-blue), #6FA0FF);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.coment-body {
  flex: 1; min-width: 0;
  background: var(--bg-page);
  border-radius: 10px;
  padding: 10px 14px;
}
.coment-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 12px; }
.coment-text { font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.coment-del {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0 4px;
}
.coment-del:hover { color: var(--color-danger); }
.coment-form { padding-top: 6px; }

.anexo-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.anexo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-page);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}
.anexo-icon { font-size: 20px; }
.anexo-body { flex: 1; min-width: 0; }
.anexo-name { font-weight: 600; color: var(--brand-blue); font-size: 13px; }
.anexo-name:hover { text-decoration: underline; }
.anexo-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.anexo-del { padding: 0 8px; min-width: 28px; }

/* === Embaixadoras lista === */
.emb-list-card { padding: 0; overflow: hidden; }
.emb-list-card .table-wrap { border: none; box-shadow: none; }

.emb-table thead th {
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 16px 14px;
  background: var(--bg-page);
}
.emb-table tbody td { padding: 16px 14px; vertical-align: middle; }
.emb-table tbody tr { transition: background 150ms ease; }
.emb-table tbody tr:hover { background: var(--brand-blue-soft); }
.emb-row-leader {
  background: linear-gradient(90deg, rgba(232,160,32,.06), transparent 60%);
  border-left: 3px solid #E8A020;
}

/* Rank coluna */
.emb-rank {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
}
.emb-rank.rank-1 { color: #E8A020; }
.emb-rank.rank-2 { color: #94A3B8; }
.emb-rank.rank-3 { color: #C2785A; }
.rank-num {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Avatar + nome */
.emb-row-link {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none;
  color: inherit;
}
.emb-row-avatar {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: visible;
}
.emb-row-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.emb-crown {
  position: absolute;
  top: -4px; right: -4px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: #E8A020;
  color: #fff;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(232,160,32,.4);
}
.emb-crown.rank-2 { background: #94A3B8; box-shadow: 0 2px 6px rgba(148,163,184,.4); }
.emb-crown.rank-3 { background: #C2785A; box-shadow: 0 2px 6px rgba(194,120,90,.4); }

.emb-row-info { min-width: 0; }
.emb-row-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.emb-row-link:hover .emb-row-name { color: var(--brand-blue); }
.emb-row-handle {
  font-size: 11px;
  color: var(--text-muted);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.emb-row-since {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-page);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.emb-table .cell-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dropdown de ações */
.emb-actions { display: inline-block; }
.emb-actions-trigger { width: 32px; height: 32px; }
.emb-actions-menu {
  position: fixed;
  min-width: 170px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  display: none;
  animation: emaIn 150ms ease;
}
.emb-actions.open .emb-actions-menu { display: block; }
@keyframes emaIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ema-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
}
.ema-item:hover { background: var(--bg-page); }
.ema-item svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .7; }
.ema-danger { color: var(--color-danger); }
.ema-form { margin: 0; }

/* Card de convite */
.emb-invite {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, var(--brand-blue-soft), transparent);
  border: 1px dashed var(--brand-blue);
  margin-top: 14px;
}
.emb-invite-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--brand-blue);
  color: #fff;
  border-radius: 14px;
  flex-shrink: 0;
}
.emb-invite-body { flex: 1; }
.emb-invite-body strong { display: block; font-size: 15px; margin-bottom: 4px; }
.emb-invite-body p { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }

/* === Embaixadoras · MOBILE refinements === */
@media (max-width: 768px) {
  /* Botões de ação: flex-wrap padrão com estiramento amigável para mobile */
  .page-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
    justify-content: stretch;
  }
  .page-actions .btn {
    flex: 1 1 auto !important;
    justify-content: center !important;
    height: 42px !important;
    font-size: 13px !important;
    padding: 0 14px !important;
  }
  .page-actions > .btn-primary,
  .page-actions > a.btn-primary,
  .page-actions > button.btn-primary {
    flex-basis: 100% !important; /* Força o botão primário a ocupar 100% no mobile (embaixadoras, novo cliente) */
  }
  .page-actions .btn svg { width: 14px !important; height: 14px !important; }

  /* Stats em 2 colunas no mobile (mais compacto) */
  .fin-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .fin-stat {
    min-height: auto;
    padding: 12px;
  }
  .fin-stat-icon { width: 32px; height: 32px; }
  .fin-stat-icon svg { width: 16px; height: 16px; }
  .fin-stat-head { margin-bottom: 6px; gap: 8px; }
  .fin-stat-label { font-size: 11px; }
  .fin-stat-value { font-size: 18px; margin-bottom: 4px; }
  .fin-stat-meta { margin-top: 0; font-size: 10px; flex-wrap: wrap; gap: 4px; }
}

/* Phone bem pequeno: volta para 1 coluna */
@media (max-width: 380px) {
  .fin-grid { grid-template-columns: 1fr !important; }
}

/* Toggle desktop/mobile */
.emb-mobile-list { display: none; }
.emb-desktop-only { display: block; }
@media (max-width: 768px) {
  .emb-mobile-list { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
  .emb-desktop-only { display: none; }
}

/* === MOBILE CARD da embaixadora === */
.emc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.emc-leader { border-left: 4px solid #E8A020; }

/* Header: avatar + nome + status */
.emc-header { display: flex; gap: 14px; align-items: flex-start; }

.emc-avatar-wrap {
  position: relative;
  width: 56px; height: 56px;
  flex-shrink: 0;
}
.emc-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.5px;
}
.emc-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.emc-crown {
  position: absolute;
  top: -4px; right: -4px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: #E8A020;
  color: #fff;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(232,160,32,.4);
}
.emc-crown.rank-2 { background: #94A3B8; }
.emc-crown.rank-3 { background: #C2785A; }

.emc-info { flex: 1; min-width: 0; }
.emc-name {
  margin: 0 0 2px;
  font-family: var(--font-base);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
}
.emc-handle {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.emc-since {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emc-since svg { opacity: .6; flex-shrink: 0; }

.emc-top-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.emc-status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
}
.emc-dot {
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
}

/* Stats grid 2x2 */
.emc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (min-width: 540px) {
  .emc-stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.emc-stat {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
}
.emc-stat-featured {
  background: rgba(232,160,32,.05);
  border: 1.5px solid rgba(232,160,32,.4);
}
.emc-stat-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emc-stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.5px;
  word-break: break-word;
}
.emc-stat-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  margin-top: auto;
  align-self: flex-start;
}

/* Atividade */
.emc-activity {
  display: flex; gap: 12px; align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.emc-activity-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--bg-page);
  border-radius: 10px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.emc-activity-body { flex: 1; min-width: 0; }
.emc-activity-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.emc-activity-body strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}
.emc-activity-body small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Ações */
.emc-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 8px;
}
.emc-actions form { margin: 0; }
.emc-actions form button { width: 100%; }
.emc-btn-primary {
  background: linear-gradient(135deg, #E8A020 0%, #C2785A 100%) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  height: 48px;
  justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(232,160,32,.4);
}
.emc-btn-primary:hover { filter: brightness(1.08); }
.emc-btn-danger {
  background: transparent;
  border: 1.5px solid var(--color-danger);
  color: var(--color-danger);
  height: 48px;
  font-weight: 600;
  justify-content: center;
}
.emc-btn-danger:hover { background: rgba(216,64,64,.08); }

/* Atalhos de teclado */
.kbd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.kbd-section h4 {
  font-family: var(--font-display);
  font-size: 13px;
  margin: 0 0 12px;
  color: var(--brand-blue);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.kbd-section div {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
@media (max-width: 700px) { .kbd-grid { grid-template-columns: 1fr; } }

/* Rich text editor */
.rt-toolbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-top: 14px;
}
.rt-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 150ms ease;
}
.rt-btn:hover { background: var(--bg-card); color: var(--brand-blue); border-color: var(--border); }
.rt-sep { width: 1px; background: var(--border); margin: 4px 4px; }
.rt-editor {
  min-height: 320px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  background: var(--bg-card);
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  color: var(--text-primary);
}
.rt-editor:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px var(--brand-blue-soft); }
.rt-editor h1, .rt-editor h2, .rt-editor h3 { font-family: var(--font-display); margin: 16px 0 8px; }
.rt-editor h2 { font-size: 22px; }
.rt-editor h3 { font-size: 18px; }
.rt-editor p { margin: 8px 0; }
.rt-editor ul, .rt-editor ol { margin: 8px 0; padding-left: 24px; }
.rt-editor blockquote { border-left: 3px solid var(--brand-blue); padding: 4px 14px; color: var(--text-secondary); margin: 12px 0; background: var(--brand-blue-soft); }
.rt-editor pre {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 12px 0;
}
.rt-editor a { color: var(--brand-blue); text-decoration: underline; }

/* === Financeiro === */
.fin-period {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.fin-period-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text-primary);
}
.fin-period-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.fin-period-form { display: flex; gap: 8px; flex-wrap: wrap; }
.fin-period-form .select { width: 160px; }

.fin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.fin-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .fin-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .fin-grid, .fin-grid-2 { grid-template-columns: 1fr; } }

.fin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; flex-direction: column;
  min-height: 150px;
  transition: border-color 150ms ease, transform 150ms ease;
  position: relative;
}
.fin-stat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fin-stat-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.fin-stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1; min-width: 0;
}
.fin-stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: auto;
}
.fin-stat-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex; justify-content: space-between; gap: 8px;
}

/* Featured (Receita) — gradient azul */
.fin-featured {
  background: linear-gradient(135deg, #3B6FF2 0%, #2348B8 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(59,111,242,.45),
              inset 0 1px 0 rgba(255,255,255,.12);
}
.fin-featured .fin-stat-label { color: rgba(255,255,255,.85); }
.fin-featured .fin-stat-value { color: #fff; }
.fin-featured .fin-stat-meta  { color: rgba(255,255,255,.85); }

/* Editable cards */
.fin-editable { cursor: pointer; }
.fin-editable:hover { border-color: var(--brand-blue); transform: translateY(-1px); }
.fin-editable .fin-edit-mark {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--bg-page);
  border-radius: 50%;
  color: var(--text-muted);
  margin-left: auto;
  transition: all 150ms ease;
}
.fin-editable:hover .fin-edit-mark { background: var(--brand-blue); color: #fff; }

/* Progress bar */
.fin-progress {
  height: 6px;
  background: var(--bg-page);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.fin-featured .fin-progress { background: rgba(255,255,255,.2); }
.fin-progress-bar {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 3px;
  transition: width 400ms ease;
}

/* Dark mode adjustments */
html.dark .fin-stat { background: #0F0F0F; border-color: #1F1F1F; }
html.dark .fin-stat:hover { border-color: #3A3A3A; }
html.dark .fin-editable:hover { border-color: var(--brand-blue); }

/* Legenda gráfico */
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ============================================================
   SIDEBAR OVERLAY (mobile)
============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,45,78,.6);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   RESPONSIVO
============================================================ */
@media (max-width: 768px) {
  body { padding: 0; }
  .layout { border-radius: 0; box-shadow: none; min-height: 100vh; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    height: 100vh; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 250ms ease;
    z-index: 60;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
}

/* === Touch targets ≥44px em dispositivos sensíveis ao toque === */
@media (pointer: coarse), (max-width: 768px) {
  .btn { min-height: 44px; padding: 0 18px; }
  .btn-sm { min-height: 40px; padding: 0 14px; font-size: 13px; }
  .icon-btn, .menu-toggle, .nav-btn { min-width: 44px; min-height: 44px; }
  .icon-act { min-width: 40px; min-height: 40px; }
  .modal-close { width: 40px; height: 40px; }
  .input, .select { height: 44px; font-size: 16px; /* evita zoom no iOS */ }
  .pag-btn { min-width: 40px; min-height: 40px; }
  .nav-item { min-height: 44px; }
  .switch { width: 44px; height: 26px; }
  .switch-slider::before { width: 20px; height: 20px; }
  .switch input:checked + .switch-slider::before { transform: translateX(18px); }
  .data-table tbody td { padding: 14px 12px; }
  .page-actions { gap: 10px; }
  .filtros-bar { gap: 10px; }
  .tab { min-height: 40px; padding: 0 14px; }
  .view-tab { min-height: 40px; padding: 0 12px; }
  .field-label { font-size: 13px; margin-bottom: 2px; }

  /* Hover não funciona em touch — ativa estados em :active */
  .btn:active { transform: scale(0.98); }
}

@media (max-width: 640px) {
  .topbar { padding: 0 var(--space-4); gap: var(--space-2); height: 56px; }
  .topbar-search-wrap, .topbar-search { display: none; }
  .page-head { padding: 0 var(--space-4); }
  .page-title { font-size: 22px; }
  .content { padding: var(--space-5) var(--space-4) var(--space-8); }
  .card { padding: var(--space-4); border-radius: var(--radius-lg); }
  .stat-value { font-size: 22px; }
  .stats { grid-template-columns: 1fr; gap: var(--space-3); }
  .stat-card { padding: 16px; border-radius: 12px; }
  .stat-card.featured { grid-column: 1 / -1; }
  .modal { max-width: 100% !important; }
  .field-row { grid-template-columns: 1fr; gap: var(--space-3); }
  .wa-hero { padding: 16px; }
  .wa-title { font-size: 22px; }
  .phone-frame { transform: scale(.92); }

  /* Tabela responsiva — vira cards */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: var(--bg-card);
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    border: 1px solid var(--border-light);
  }
  .data-table td {
    padding: 6px 0;
    border: none !important;
    display: flex; justify-content: space-between; gap: var(--space-3);
  }
  .data-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
  }
  .table-wrap { background: transparent; box-shadow: none; border: none; }

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