/* =====================================================
   Bella Furia ERP — tema claro quente (sobre Pico.css v2)
   Paleta extraida da logo: creme, cobre/rose e cacau
   ===================================================== */

/* Forca tema claro mesmo se o navegador estiver em dark mode */
:root,
[data-theme="light"],
:root:not([data-theme="dark"]) {
  color-scheme: light;
  /* Tipografia confortavel */
  --pico-font-family: "Inter", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --pico-font-size: 17px;
  --pico-line-height: 1.55;
  --pico-typography-spacing-vertical: 1.25rem;
  --pico-border-radius: 0.6rem;

  /* Fundo creme suave (nao branco) */
  --pico-background-color: #f1e3c9;
  --pico-color: #2a1a10;
  --pico-muted-color: #6b4a36;
  --pico-muted-border-color: #d8c0a0;
  --pico-border-color: #d8c0a0;

  /* Headings em cacau profundo */
  --pico-h1-color: #1a0e08;
  --pico-h2-color: #1a0e08;
  --pico-h3-color: #2a1810;
  --pico-h4-color: #2a1810;
  --pico-h5-color: #2a1810;
  --pico-h6-color: #2a1810;

  /* Acento cobre (rose) */
  --pico-primary: #b56b4b;
  --pico-primary-background: #b56b4b;
  --pico-primary-border: #b56b4b;
  --pico-primary-hover: #9a5538;
  --pico-primary-hover-background: #9a5538;
  --pico-primary-hover-border: #9a5538;
  --pico-primary-focus: rgba(181, 107, 75, 0.28);
  --pico-primary-inverse: #fdf7eb;

  /* Secundario cacau */
  --pico-secondary: #5a3a2a;
  --pico-secondary-background: #5a3a2a;
  --pico-secondary-border: #5a3a2a;
  --pico-secondary-hover: #2a1810;
  --pico-secondary-hover-background: #2a1810;
  --pico-secondary-inverse: #fdf7eb;

  /* Contraste (links/destaques fortes) */
  --pico-contrast: #1a0e08;
  --pico-contrast-background: #1a0e08;
  --pico-contrast-hover: #000;
  --pico-contrast-inverse: #fdf7eb;

  /* Cards e formularios */
  --pico-card-background-color: #fdf7eb;
  --pico-card-sectioning-background-color: #f6e8cd;
  --pico-card-border-color: #e0c8a8;
  --pico-card-box-shadow: 0 6px 22px -10px rgba(74, 38, 18, 0.18),
                          0 2px 6px rgba(74, 38, 18, 0.08);

  --pico-form-element-background-color: #fffcf5;
  --pico-form-element-border-color: #cfb38e;
  --pico-form-element-color: #2a1a10;
  --pico-form-element-placeholder-color: #a08363;
  --pico-form-element-focus-color: rgba(181, 107, 75, 0.32);
  --pico-form-element-active-border-color: #b56b4b;
  --pico-form-element-active-background-color: #fff;

  /* Tabelas */
  --pico-table-row-stripped-background-color: rgba(181, 107, 75, 0.08);
  --pico-table-border-color: #e0c8a8;
}

/* ----------------- Base ----------------- */
html { background: var(--pico-background-color); }
body {
  background: linear-gradient(180deg, #f3e6cd 0%, #ecdcbe 100%) fixed;
  color: var(--pico-color);
  padding-bottom: 3rem;
}

h1, h2, h3 { letter-spacing: -0.01em; }
h1 { font-weight: 800; }
h2 { font-weight: 700; }
h3 { font-weight: 600; }
hgroup p { color: var(--pico-muted-color); }

a { color: var(--pico-primary); }
a:hover { color: var(--pico-primary-hover); }

::selection { background: rgba(181,107,75,0.35); }

/* ----------------- Header / navbar ----------------- */
body > header.container {
  background: rgba(253, 247, 235, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  box-shadow: 0 4px 16px -10px rgba(74, 38, 18, 0.18);
}
body > header.container nav { padding: 0; }

.brand {
  display: inline-flex; align-items: center; gap: 0.85rem;
  text-decoration: none; color: inherit;
}
.brand-logo {
  height: 56px; width: auto; display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.08));
}
.brand-text {
  font-weight: 700; letter-spacing: .18em; font-size: .8rem;
  color: #8a4d33; text-transform: uppercase;
  border-left: 1px solid var(--pico-card-border-color);
  padding-left: .75rem;
}
@media (max-width: 600px) {
  .brand-logo { height: 40px; }
  .brand-text { display: none; }
  body > header.container { padding: 0.4rem 0.6rem; }
}

/* ----------------- Cards ----------------- */
article {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  box-shadow: var(--pico-card-box-shadow);
  padding: 1.5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
article > header, article > footer {
  background: var(--pico-card-sectioning-background-color);
  border-color: var(--pico-card-border-color);
}
article > header { font-weight: 600; color: #2a1810; }

/* ----------------- Botoes ----------------- */
button, [role="button"] {
  font-weight: 600; letter-spacing: 0.02em;
  border-radius: var(--pico-border-radius);
  box-shadow: 0 2px 6px -2px rgba(74, 38, 18, 0.25);
  transition: transform .08s ease, box-shadow .15s ease;
}
button:hover, [role="button"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -4px rgba(74, 38, 18, 0.35);
}
[role="button"].secondary {
  background: transparent; color: var(--pico-secondary);
  border-color: var(--pico-secondary);
}

/* ----------------- Formularios ----------------- */
input, select, textarea {
  font-size: 1rem !important;
}
label { color: #2a1810; font-weight: 500; }
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px var(--pico-form-element-focus-color);
}

/* ----------------- Tabelas ----------------- */
table.list, table.striped {
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  overflow: hidden;
  box-shadow: var(--pico-card-box-shadow);
  margin-top: 1rem;
}
table th {
  background: var(--pico-card-sectioning-background-color);
  color: #1a0e08;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--pico-card-border-color) !important;
}
table td { color: var(--pico-color); }
table tbody tr:hover {
  background: rgba(181,107,75,0.06);
}

/* ----------------- Mensagens (alerts) ----------------- */
article.success, article.error, article.warning, article.info {
  padding: 0.85rem 1rem;
  border-left-width: 4px;
  border-left-style: solid;
  margin: 0.75rem 0;
}
article.success { border-left-color: #4f7a3a; background: #ecf3e3; color: #2a4317; }
article.error,
article.danger  { border-left-color: #b13b2a; background: #f8e1dc; color: #5a1810; }
article.warning { border-left-color: #c98a2f; background: #f8ebd0; color: #5a3a10; }
article.info    { border-left-color: #3a6a8f; background: #dde9f3; color: #1a3450; }

/* ----------------- Badges ----------------- */
.badge {
  display: inline-block; padding: .2rem .65rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.urgente  { background: #b13b2a; color: #fff; }
.badge.normal   { background: #5a3a2a; color: #fdf7eb; }
.badge.agendado { background: #3a6a8f; color: #fff; }

/* ----------------- Acoes em tabela ----------------- */
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.actions a {
  font-size: 0.88rem; font-weight: 600;
  padding: 0.2rem 0.55rem; border-radius: 0.4rem;
  background: rgba(181, 107, 75, 0.1);
  color: var(--pico-primary-hover);
  text-decoration: none;
}
.actions a:hover { background: rgba(181, 107, 75, 0.2); }
.actions a.contrast { background: rgba(177, 59, 42, 0.12); color: #8a2415; }
.actions a.contrast:hover { background: rgba(177, 59, 42, 0.22); }

/* ----------------- Dashboard hero & cards ----------------- */
.hero {
  background: linear-gradient(135deg, #fdf7eb 0%, #f1e3c9 100%);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  padding: 2rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--pico-card-box-shadow);
  display: flex; align-items: center; gap: 1.5rem;
}
.hero img { height: 80px; width: auto; }
.hero h2 { margin: 0 0 .25rem; color: #1a0e08; }
.hero p { margin: 0; color: var(--pico-muted-color); }

.module-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.module-card {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  padding: 1.25rem;
  box-shadow: var(--pico-card-box-shadow);
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px -10px rgba(74, 38, 18, 0.28);
  border-color: var(--pico-primary);
}
.module-card .icon {
  font-size: 1.75rem; line-height: 1;
}
.module-card h3 { margin: 0; font-size: 1.05rem; color: #1a0e08; }
.module-card p { margin: 0; color: var(--pico-muted-color); font-size: .9rem; }
.module-card.disabled { opacity: 0.6; }
.module-card.disabled .badge {
  background: var(--pico-muted-border-color); color: #5a3a2a;
  font-size: .7rem; align-self: flex-start;
}
.module-card a[role="button"] {
  align-self: flex-start; margin-top: .5rem;
  padding: 0.4rem 0.9rem; font-size: 0.9rem;
}

/* ----------------- Stat cards (totais em /cadastros) ----------------- */
.stat-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.stat-card {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  padding: 1.25rem;
  box-shadow: var(--pico-card-box-shadow);
}
.stat-card .num {
  font-size: 2.4rem; font-weight: 800; color: #b56b4b; line-height: 1;
  display: block;
}
.stat-card .label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--pico-muted-color); font-weight: 600;
  margin-top: .25rem; display: block;
}

/* ----------------- Footer ----------------- */
body > footer.container {
  margin-top: 3rem;
  text-align: center;
  color: var(--pico-muted-color);
}
body > footer.container small {
  background: rgba(253, 247, 235, 0.7);
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--pico-card-border-color);
  display: inline-block;
}

/* ----------------- Search/filter row ----------------- */
form[role="search"], .filter-row {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  margin: 1rem 0;
}
form[role="search"] input,
form[role="search"] select,
.filter-row input, .filter-row select {
  flex: 1; min-width: 220px;
}

/* ----------------- WhatsApp / caixa de entrada ----------------- */
.wa-layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 1rem;
  align-items: start;
}
@media (max-width: 800px) {
  .wa-layout { grid-template-columns: 1fr; }
  .wa-list.tem-ativo { display: none; }
}
.wa-list {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  box-shadow: var(--pico-card-box-shadow);
  overflow: hidden; max-height: 72vh; overflow-y: auto;
}
.wa-conv-item {
  display: block; padding: .75rem 1rem; text-decoration: none;
  color: var(--pico-color); border-bottom: 1px solid var(--pico-card-border-color);
}
.wa-conv-item:hover { background: rgba(181,107,75,0.07); color: var(--pico-color); }
.wa-conv-item.ativa { background: rgba(181,107,75,0.14); }
.wa-conv-item .nome { font-weight: 600; display: flex; justify-content: space-between; gap:.5rem; }
.wa-conv-item .previa { color: var(--pico-muted-color); font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-badge {
  background: #4f7a3a; color: #fff; border-radius: 999px;
  font-size: .7rem; font-weight: 700; padding: .05rem .5rem; min-width: 1.4rem;
  text-align: center;
}
.wa-thread {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: var(--pico-border-radius);
  box-shadow: var(--pico-card-box-shadow);
  display: flex; flex-direction: column; max-height: 72vh;
}
.wa-thread-head { padding: .85rem 1rem; border-bottom: 1px solid var(--pico-card-border-color);
  background: var(--pico-card-sectioning-background-color); }
.wa-messages { flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  background: linear-gradient(180deg, #f6ecd8 0%, #f1e3c9 100%); }
.wa-bubble {
  max-width: 75%; padding: .5rem .8rem; border-radius: .9rem;
  box-shadow: 0 1px 2px rgba(74,38,18,.12); font-size: .95rem;
  word-wrap: break-word; white-space: pre-wrap;
}
.wa-bubble .meta { display:block; font-size: .68rem; color: var(--pico-muted-color); margin-top:.2rem; text-align:right; }
.wa-in  { align-self: flex-start; background: #fffcf5; border-bottom-left-radius: .2rem; }
.wa-out { align-self: flex-end; background: #dcefc8; border-bottom-right-radius: .2rem; }
.wa-out.falha { background: #f8e1dc; }
.wa-out.simulado { background: #f8ebd0; }
.wa-reply { padding: .75rem; border-top: 1px solid var(--pico-card-border-color);
  display: flex; gap: .5rem; }
.wa-reply textarea { flex: 1; margin: 0; resize: vertical; min-height: 2.6rem; }
.wa-empty { padding: 3rem 1rem; text-align: center; color: var(--pico-muted-color); }

/* ----------------- Login card ----------------- */
.login-card {
  max-width: 460px; margin: 3rem auto;
}
.login-card .logo-wrap {
  text-align: center; padding: 1.5rem 0 .5rem;
}
.login-card .logo-wrap img {
  max-width: 280px; width: 100%; height: auto;
  filter: drop-shadow(0 4px 12px rgba(74, 38, 18, 0.2));
}
.login-card h3 {
  text-align: center; margin: .5rem 0 1.5rem; color: #1a0e08;
}
