/* =============================================
   UAIPAY — Design System Completo
   Paleta baseada na logo UaiPay
   Navy #08205b | Azul #0367b0 | Ciano #00b4dc
   ============================================= */

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

/* === TOKENS DE DESIGN === */
:root {
  /* Cores da Logo UaiPay */
  --navy: #08205b;
  --navy-escuro: #050f2e;
  --navy-mid: #0d2d7a;
  --azul: #0367b0;
  --azul-hover: #0255917;
  --azul-claro: #e8f4fd;
  --azul-mid: #b3d9f5;
  --ciano: #00b4dc;
  --ciano-claro: #e0f7fc;
  --ciano-mid: #80daee;

  /* Semânticos */
  --primary: #0367b0;
  --primary-hover: #025490;
  --primary-light: #e8f4fd;
  --primary-mid: #b3d9f5;

  --sidebar-bg: #08205b;
  --sidebar-text: #c8dff5;
  --sidebar-muted: #7aafd4;
  --sidebar-active-bg: #0367b0;
  --sidebar-active-text: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-width: 260px;

  /* Feedback */
  --verde: #16a34a;
  --verde-claro: #dcfce7;
  --verde-mid: #bbf7d0;
  --verde-suave: #f0fdf4;

  --vermelho: #dc2626;
  --vermelho-claro: #fef2f2;
  --vermelho-mid: #fecaca;

  --amarelo: #d97706;
  --amarelo-claro: #fffbeb;
  --amarelo-mid: #fde68a;

  --laranja: #ea580c;
  --laranja-claro: #fff7ed;
  --laranja-mid: #fed7aa;

  /* Neutros */
  --cinza-50: #f8fafc;
  --cinza-100: #f1f5f9;
  --cinza-200: #e2e8f0;
  --cinza-300: #cbd5e1;
  --cinza-400: #94a3b8;
  --cinza-500: #64748b;
  --cinza-600: #475569;
  --cinza-700: #334155;
  --cinza-800: #1e293b;
  --cinza-900: #0f172a;

  /* Aliases */
  --bg: #f0f5fc;
  --bg-secondary: #ffffff;
  --surface: #ffffff;
  --border: #dde5f0;
  --border-focus: #0367b0;
  --text: #0f172a;
  --text-muted: #5a6e8c;
  --text-subtle: #94a3b8;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(3,103,176,0.05);
  --shadow-sm: 0 2px 8px rgba(3,103,176,0.08);
  --shadow-md: 0 4px 20px rgba(3,103,176,0.12);
  --shadow-lg: 0 8px 40px rgba(3,103,176,0.15);
  --shadow-xl: 0 20px 60px rgba(8,32,91,0.18);

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

  /* Tipografia */
  --font-base: 'Nunito Sans', system-ui, sans-serif;
  --font-display: 'Nunito', system-ui, sans-serif;

  /* Transições */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.2s var(--ease);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font: inherit; }

/* === TIPOGRAFIA === */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: clamp(22px, 4vw, 32px); }
h2 { font-size: clamp(18px, 3vw, 24px); }
h3 { font-size: 18px; }
h4 { font-size: 16px; font-weight: 700; }
p  { color: var(--text-muted); line-height: 1.7; }

/* === LAYOUT PRINCIPAL === */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-wrapper {
  flex: 1;
  padding: 28px 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* === SIDEBAR === */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.sidebar__logo {
  height: 36px;
  object-fit: contain;
  display: block;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar__brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.sidebar__brand-tagline {
  font-size: 10px;
  color: var(--sidebar-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar__store {
  padding: 10px 12px;
  margin: 0 12px 8px;
  background: rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.1);
}

.sidebar__store-label {
  font-size: 10px;
  color: var(--sidebar-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar__store-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__nav {
  flex: 1;
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-muted);
  padding: 12px 8px 6px;
  margin-top: 4px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sidebar__link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar__link.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: 0 2px 8px rgba(3,103,176,0.4);
}

.sidebar__footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.sidebar__user:hover { background: var(--sidebar-hover); }

.sidebar__avatar {
  width: 36px;
  height: 36px;
  background: var(--azul);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.sidebar__user-info { flex: 1; min-width: 0; }

.sidebar__user-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--sidebar-muted);
  font-weight: 600;
}

/* === TOPBAR MOBILE === */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__logo {
  height: 28px;
  object-fit: contain;
}

.topbar__menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1);
}

.topbar__menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: var(--transition);
}

/* === DRAWER MOBILE === */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  backdrop-filter: blur(4px);
}

.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--sidebar-bg);
  z-index: 400;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer.is-open { transform: translateX(0); }
.drawer-backdrop.is-visible { display: block; }

.drawer__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

/* === BOTÕES === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 44px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: var(--font-base);
}

.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--azul);
  color: white;
  box-shadow: 0 4px 16px rgba(3,103,176,0.35);
}

.btn--primary:hover {
  background: #025490;
  box-shadow: 0 6px 20px rgba(3,103,176,0.45);
  transform: translateY(-1px);
}

.btn--ghost {
  background: white;
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.btn--ghost:hover {
  background: var(--cinza-50);
  border-color: var(--cinza-300);
}

.btn--danger {
  background: var(--vermelho);
  color: white;
  box-shadow: 0 4px 16px rgba(220,38,38,0.3);
}

.btn--danger:hover { background: #b91c1c; }

.btn--warning { background: var(--laranja); color: white; }

.btn--navy {
  background: var(--navy);
  color: white;
  box-shadow: 0 4px 16px rgba(8,32,91,0.3);
}

.btn--navy:hover { background: var(--navy-escuro); }

.btn--lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn--icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-md); flex-shrink: 0; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* === CARDS / PAINÉIS === */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.card--hover { transition: var(--transition); cursor: pointer; }
.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--azul-mid);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card__title { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.card__subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

/* === FORMULÁRIOS === */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-grid { display: grid; gap: 16px; }
.form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }

label { font-size: 14px; font-weight: 700; color: var(--cinza-700); }

.input,
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-base);
  transition: var(--transition);
  outline: none;
}

textarea { min-height: 100px; padding: 12px 16px; resize: vertical; }

.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 4px rgba(3,103,176,0.1);
}

.input--error, input.is-error, select.is-error {
  border-color: var(--vermelho) !important;
  background: var(--vermelho-claro);
}

.form-error { font-size: 13px; font-weight: 600; color: var(--vermelho); }
.form-hint { font-size: 12px; color: var(--text-subtle); font-weight: 600; }

.form-section {
  padding: 28px;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.form-section__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section__desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* === ALERTAS === */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  border: 1px solid transparent;
  animation: slideDown 0.3s var(--ease);
}

.alert__icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert__content { flex: 1; }
.alert__title { font-weight: 800; margin-bottom: 2px; }

.alert--success { background: var(--verde-claro); color: #14532d; border-color: var(--verde-mid); }
.alert--error   { background: var(--vermelho-claro); color: #7f1d1d; border-color: var(--vermelho-mid); }
.alert--warning { background: var(--amarelo-claro); color: #78350f; border-color: var(--amarelo-mid); }
.alert--info    { background: var(--azul-claro); color: #1e3a8a; border-color: var(--azul-mid); }

@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--blue   { background: var(--azul-claro); color: #1e3a8a; }
.badge--navy   { background: rgba(8,32,91,0.1); color: var(--navy); }
.badge--green  { background: var(--verde-claro); color: #14532d; }
.badge--red    { background: var(--vermelho-claro); color: #7f1d1d; }
.badge--yellow { background: var(--amarelo-claro); color: #78350f; }
.badge--gray   { background: var(--cinza-100); color: var(--cinza-700); }
.badge--orange { background: var(--laranja-claro); color: #7c2d12; }
.badge--ciano  { background: var(--ciano-claro); color: #007ea0; }

/* === STATUS PILLS === */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-pill--open    { background: var(--azul-claro); color: #1e40af; }
.status-pill--open::before { background: var(--azul); }

.status-pill--paid    { background: var(--verde-claro); color: #14532d; }
.status-pill--paid::before { background: var(--verde); }

.status-pill--overdue { background: var(--vermelho-claro); color: #7f1d1d; }
.status-pill--overdue::before { background: var(--vermelho); }

.status-pill--partial { background: var(--amarelo-claro); color: #78350f; }
.status-pill--partial::before { background: var(--amarelo); }

/* === RISK PILLS === */
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
}

.risk-pill--excellent { background: #dcfce7; color: #14532d; }
.risk-pill--good      { background: var(--azul-claro); color: var(--navy); }
.risk-pill--warning   { background: #fef9c3; color: #713f12; }
.risk-pill--high_risk { background: #fee2e2; color: #7f1d1d; }

/* === SCORE BAR === */
.score-bar { display: flex; flex-direction: column; gap: 6px; }

.score-bar__header { display: flex; justify-content: space-between; align-items: center; }
.score-bar__label  { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.score-bar__value  { font-size: 16px; font-weight: 900; color: var(--text); }

.score-bar__track {
  height: 8px;
  background: var(--cinza-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s var(--ease);
}

.score-bar__fill--excellent { background: linear-gradient(90deg,#16a34a,#4ade80); }
.score-bar__fill--good      { background: linear-gradient(90deg,var(--azul),var(--ciano)); }
.score-bar__fill--warning   { background: linear-gradient(90deg,#d97706,#fbbf24); }
.score-bar__fill--high_risk { background: linear-gradient(90deg,#dc2626,#f87171); }

/* === TABELA === */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table thead th {
  padding: 12px 16px;
  background: var(--cinza-50);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--cinza-100);
  color: var(--text);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--cinza-50); }

/* === STATS === */
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-card__icon--blue   { background: var(--azul-claro); }
.stat-card__icon--navy   { background: rgba(8,32,91,0.08); }
.stat-card__icon--ciano  { background: var(--ciano-claro); }
.stat-card__icon--green  { background: var(--verde-claro); }
.stat-card__icon--red    { background: var(--vermelho-claro); }
.stat-card__icon--yellow { background: var(--amarelo-claro); }
.stat-card__icon--orange { background: var(--laranja-claro); }

.stat-card__label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  display: block;
}

.stat-card__trend { font-size: 12px; color: var(--text-subtle); font-weight: 600; margin-top: 6px; display: block; }
.stat-card__trend--up   { color: var(--verde); }
.stat-card__trend--down { color: var(--vermelho); }

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-header__title { font-size: clamp(20px,3vw,28px); margin-bottom: 4px; }
.page-header__sub   { font-size: 14px; color: var(--text-muted); }
.page-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* === EMPTY STATE === */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state__icon { font-size: 52px; opacity: 0.6; margin-bottom: 8px; }
.empty-state__title { font-size: 20px; font-weight: 800; color: var(--text); }
.empty-state__desc { font-size: 15px; color: var(--text-muted); max-width: 360px; }

/* === AVATAR === */
.avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900; font-size: 15px;
  color: white;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.avatar--navy   { background: linear-gradient(135deg,var(--navy),var(--azul)); }
.avatar--azul   { background: linear-gradient(135deg,var(--azul),var(--ciano)); }
.avatar--ciano  { background: linear-gradient(135deg,var(--ciano),#00deff); }
.avatar--verde  { background: linear-gradient(135deg,#16a34a,#4ade80); }
.avatar--laranja{ background: linear-gradient(135deg,#ea580c,#fb923c); }
.avatar--roxo   { background: linear-gradient(135deg,#7c3aed,#a78bfa); }
.avatar--rosa   { background: linear-gradient(135deg,#db2777,#f472b6); }

.avatar--lg { width:56px; height:56px; font-size:20px; }
.avatar--xl { width:72px; height:72px; font-size:26px; }

/* === PAGINAÇÃO === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
  flex-wrap: wrap;
}

.pagination__btn {
  min-width: 40px; height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 700;
  color: var(--text-muted);
  background: white;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.pagination__btn:hover {
  background: var(--azul-claro);
  border-color: var(--azul);
  color: var(--azul);
}

.pagination__btn.is-active {
  background: var(--azul);
  border-color: var(--azul);
  color: white;
}

.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === MODAL === */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.is-open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s var(--ease);
}

@keyframes modalIn { from{opacity:0;transform:scale(.95) translateY(10px);} to{opacity:1;transform:scale(1) translateY(0);} }

.modal__header { padding: 24px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal__title  { font-size: 20px; font-weight: 900; }
.modal__close  {
  width:32px; height:32px;
  border-radius: var(--radius-full);
  background: var(--cinza-100);
  color: var(--text-muted);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal__close:hover { background: var(--cinza-200); }
.modal__body   { padding: 20px 24px; }
.modal__footer { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }

/* === TOOLBAR === */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}

.toolbar__search { flex: 1; min-width: 200px; position: relative; }
.toolbar__search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.toolbar__search input { padding-left: 42px; }

/* === TABS === */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--cinza-100);
  padding: 4px;
  border-radius: var(--radius-lg);
  width: fit-content;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn.is-active { background: white; color: var(--azul); box-shadow: var(--shadow-xs); }

/* === LOADING === */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--cinza-200);
  border-top-color: var(--azul);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === QUICK ACTION === */
.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  transition: var(--transition);
  cursor: pointer;
}

.quick-action:hover {
  border-color: var(--azul);
  box-shadow: 0 4px 16px rgba(3,103,176,0.15);
  transform: translateY(-2px);
}

.quick-action__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}

.quick-action__title { font-size: 15px; font-weight: 800; }
.quick-action__sub   { font-size: 13px; color: var(--text-muted); }

/* === TOKEN CHIP === */
.token-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--azul-claro);
  color: var(--azul);
  border: 1px solid var(--azul-mid);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.token-chip:hover {
  background: var(--azul);
  color: white;
  border-color: var(--azul);
  transform: translateY(-1px);
}

/* === TOAST === */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s var(--ease);
  pointer-events: all;
  max-width: 380px;
}

.toast--success { background: #14532d; color: white; }
.toast--error   { background: #7f1d1d; color: white; }
.toast--info    { background: var(--navy); color: white; }

@keyframes toastIn { from{opacity:0;transform:translateX(20px);} to{opacity:1;transform:translateX(0);} }

/* === WA PREVIEW === */
.wa-preview {
  background: #e5ddd5;
  border-radius: var(--radius-xl);
  padding: 20px;
}

.wa-bubble {
  background: white;
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 12px 16px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  position: relative;
}

.wa-bubble::before {
  content: '';
  position: absolute;
  top: 0; left: -8px;
  border: 8px solid transparent;
  border-right-color: white;
  border-top-color: white;
}

.wa-time { font-size: 11px; color: #8c9ab1; text-align: right; margin-top: 4px; }

/* === HERO DASHBOARD — paleta UaiPay === */
.dashboard-hero {
  background: linear-gradient(135deg, var(--navy-escuro) 0%, var(--navy) 50%, var(--navy-mid) 100%);
  border-radius: var(--radius-2xl);
  padding: 32px;
  margin-bottom: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(0,180,220,0.25), transparent 70%);
  pointer-events: none;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(3,103,176,0.3), transparent 70%);
  pointer-events: none;
}

.dashboard-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ciano);
  background: rgba(0,180,220,0.15);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.dashboard-hero__title {
  font-family: var(--font-display);
  font-size: clamp(24px,4vw,36px);
  font-weight: 900;
  color: white;
  margin-bottom: 8px;
  line-height: 1.1;
}

.dashboard-hero__sub {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
  max-width: 500px;
}

.dashboard-hero__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dashboard-hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 800;
  transition: var(--transition);
  cursor: pointer;
}

.dashboard-hero__btn--primary {
  background: var(--azul);
  color: white;
  box-shadow: 0 4px 20px rgba(3,103,176,0.45);
}

.dashboard-hero__btn--primary:hover {
  background: var(--ciano);
  color: var(--navy);
  transform: translateY(-2px);
}

.dashboard-hero__btn--ghost {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.dashboard-hero__btn--ghost:hover { background: rgba(255,255,255,0.2); }

.dashboard-hero__stats {
  display: flex;
  gap: 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
}

.dashboard-hero__stat { display: flex; flex-direction: column; }

.dashboard-hero__stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: white;
}

.dashboard-hero__stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}

/* === FOCUS ALERT === */
.focus-alert {
  background: linear-gradient(135deg,#fef3c7,#fde68a);
  border: 1px solid #fbbf24;
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.focus-alert__icon { font-size: 28px; }
.focus-alert__title { font-weight: 800; font-size: 16px; color: #78350f; }
.focus-alert__sub   { font-size: 13px; color: #92400e; margin-top: 2px; }
.focus-alert__action { margin-left: auto; flex-shrink: 0; }

/* === WA BTN === */
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #25d366;
  color: white;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 800;
  transition: var(--transition);
}

.wa-btn:hover { background: #128c7e; transform: translateY(-1px); }

/* === AUTH PAGES === */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: white;
}

.auth-left {
  background: linear-gradient(135deg, var(--navy-escuro) 0%, var(--navy) 60%, var(--azul) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,180,220,0.2), transparent);
  pointer-events: none;
}

.auth-left__logo {
  height: 60px;
  object-fit: contain;
  margin-bottom: 32px;
  filter: brightness(0) invert(1);
}

.auth-left__title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: white;
  text-align: center;
  line-height: 1.15;
  margin-bottom: 16px;
}

.auth-left__title span { color: var(--ciano); }

.auth-left__sub {
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  text-align: center;
  line-height: 1.7;
  max-width: 340px;
}

.auth-left__features { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }

.auth-left__feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  font-weight: 600;
}

.auth-left__feature-icon {
  width: 32px; height: 32px;
  background: rgba(0,180,220,0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 48px;
  background: #fafafa;
}

.auth-card { width: 100%; max-width: 440px; }
.auth-card__title { font-size: 28px; font-weight: 900; margin-bottom: 6px; }
.auth-card__sub   { font-size: 15px; color: var(--text-muted); margin-bottom: 32px; }

.auth-link { color: var(--azul); font-weight: 700; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 600;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* === RESPONSIVIDADE === */
@media (max-width: 1024px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 32px 24px; }
  .form-grid--3 { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
  .page-wrapper { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header__actions { width: 100%; }
  .page-header__actions .btn { flex: 1; justify-content: center; }
  .dashboard-hero { padding: 24px 20px; }
  .dashboard-hero__stats { gap: 16px; }
  .toolbar { flex-direction: column; }
  .toolbar__search { min-width: 100%; }
}

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

/* === PRINT === */
@media print {
  .sidebar, .topbar, .page-header__actions { display: none !important; }
  .main-content { margin-left: 0; }
}

/* === SCROLL CUSTOMIZADO === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cinza-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cinza-400); }

/* === FOCUS === */
:focus-visible { outline: 2px solid var(--azul); outline-offset: 3px; }

/* === SELEÇÃO === */
::selection { background: var(--azul-mid); color: var(--navy); }
