/* Paleta inspirada no cartão Libbs/Matrion: lilás + róseo + branco */
:root {
  --c-lilas-50:  #faf6ff;
  --c-lilas-100: #f1e9fb;
  --c-lilas-200: #e3d2f6;
  --c-lilas-300: #cdb1ee;
  --c-lilas-400: #b389e2;
  --c-lilas-500: #9a64d4;
  --c-lilas-600: #7e48b8;
  --c-lilas-700: #633790;
  --c-lilas-800: #4b2a6e;

  --c-rosa-50:   #fff5f9;
  --c-rosa-100:  #ffe3ee;
  --c-rosa-200:  #ffc6dc;
  --c-rosa-300:  #ff9cc1;
  --c-rosa-400:  #f06ea0;
  --c-rosa-500:  #db4b85;
  --c-rosa-600:  #b9356b;

  --c-ink-900:   #2a1d3d;
  --c-ink-700:   #4a3a5e;
  --c-ink-500:   #6f6280;
  --c-ink-300:   #b6acc4;

  --c-bg:        #fbf8ff;
  --c-card:      #ffffff;
  --c-border:    #ece3f6;

  --c-ok:        #1f9d6b;
  --c-warn:      #d98a14;
  --c-alert:     #d6325a;
  --c-info:      #4361ee;
}

html, body {
  background: var(--c-bg);
  color: var(--c-ink-900);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Cores chapadas (sem degradê) inspiradas na paleta do cartão */
.bg-cartao {
  background: var(--c-lilas-600);
  color: white;
}
.bg-cartao-soft {
  background: var(--c-lilas-50);
}

/* Caligrafia decorativa para títulos hero (lookalike do cartão) */
.font-script {
  font-family: "Brush Script MT", "Lucida Handwriting", cursive;
  font-style: italic;
}

/* Card padrão */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(74, 58, 94, 0.04), 0 4px 12px rgba(126, 72, 184, 0.04);
}

/* Badges de severidade */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}
.badge-ok    { background: #def7ec; color: #046c4e; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-alert { background: #fde2e7; color: #9b1c3b; }
.badge-info  { background: #e0e7ff; color: #3730a3; }
.badge-lilas { background: var(--c-lilas-100); color: var(--c-lilas-700); }

/* Tabela do cartão (consultas) */
.tab-cartao {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}
.tab-cartao th {
  background: var(--c-lilas-500);
  color: white;
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.tab-cartao th:first-child { border-top-left-radius: 8px; }
.tab-cartao th:last-child  { border-top-right-radius: 8px; }
.tab-cartao td {
  padding: 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
  white-space: nowrap;
}
.tab-cartao tr:nth-child(even) td { background: var(--c-lilas-50); }
.tab-cartao tr:last-child td { border-bottom: none; }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--c-border);
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  font-size: 11px;
  color: var(--c-ink-500);
  text-decoration: none;
}
.bottom-nav a.active {
  color: var(--c-lilas-700);
  font-weight: 600;
}
.bottom-nav a.active svg { color: var(--c-lilas-600); }

/* Tabs (Alpine) */
.tab-btn {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-500);
  background: transparent;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tab-btn.active {
  background: var(--c-lilas-100);
  color: var(--c-lilas-700);
  border-color: var(--c-lilas-200);
}

/* Inputs */
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: white;
  font-size: 14px;
  color: var(--c-ink-900);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--c-lilas-400);
  box-shadow: 0 0 0 3px var(--c-lilas-100);
}
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-ink-700);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Buttons */
.btn-primary {
  background: var(--c-lilas-600);
  color: white;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 14px -8px rgba(99, 55, 144, 0.5);
  transition: background-color .12s, box-shadow .12s;
}
.btn-primary:hover { background: var(--c-lilas-700); box-shadow: 0 10px 18px -8px rgba(99, 55, 144, 0.55); }
.btn-secondary {
  background: white;
  color: var(--c-lilas-700);
  border: 1px solid var(--c-lilas-200);
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost {
  color: var(--c-ink-500);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
}
.btn-ghost:hover { background: var(--c-lilas-50); color: var(--c-lilas-700); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--c-ink-900);
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

/* Paddings to avoid bottom nav overlap on mobile */
.with-bottom-nav { padding-bottom: 88px; }

/* Sparkline / chart */
.chart-grid line { stroke: var(--c-border); stroke-width: 1; }
.chart-axis text { fill: var(--c-ink-500); font-size: 10px; }
.chart-line { fill: none; stroke: var(--c-lilas-500); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.alt { stroke: var(--c-rosa-500); }
.chart-band { fill: var(--c-lilas-100); opacity: .55; }
.chart-dot { fill: white; stroke: var(--c-lilas-600); stroke-width: 2; }
.chart-dot.alert { stroke: var(--c-alert); }

/* Utilities */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--c-lilas-200); border-radius: 999px; }

/* Avatar circle */
.avatar {
  width: 40px; height: 40px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-lilas-200);
  color: var(--c-lilas-800);
  font-weight: 700;
  font-size: 14px;
}
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* Section title */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-lilas-700);
  margin-bottom: 8px;
}

/* Hide scrollbar in tab strip */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Ícones Lucide — controlados por currentColor + width inline.
   Tamanho default. Use classes 'i-sm', 'i-md', 'i-lg', 'i-xl' para variar. */
[data-lucide],
svg.lucide {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke-width: 2;
}
.i-sm svg, svg.lucide.i-sm { width: 14px; height: 14px; }
.i-md svg, svg.lucide.i-md { width: 18px; height: 18px; }
.i-lg svg, svg.lucide.i-lg { width: 22px; height: 22px; }
.i-xl svg, svg.lucide.i-xl { width: 28px; height: 28px; }
.i-2xl svg, svg.lucide.i-2xl { width: 36px; height: 36px; }
.i-3xl svg, svg.lucide.i-3xl { width: 56px; height: 56px; }

/* Ícone num "tile" colorido reutilizável */
.icon-tile {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-tile-lg { width: 48px; height: 48px; border-radius: 14px; }
.icon-tile-xl { width: 56px; height: 56px; border-radius: 16px; }

/* Quebra de palavras longas em mobile (nomes etc) */
.wrap-word { overflow-wrap: anywhere; word-break: break-word; }
