/*
 * design-system.css — tokens e componentes base do Portal Colmeia.
 * ---------------------------------------------------------------------------
 * Identidade: dark #0F0F0F, destaque amarelo #FFD02A (com parcimônia, nunca fundo).
 * Títulos em IBM Plex Sans (ajuste aprovado em 09/07/2026; o design-guide ainda
 * cita Sora e está desatualizado nesse ponto). Corpo em Roboto.
 * As fontes são carregadas via <link> no index.html; fallback local-first abaixo.
 *
 * Componentes cobertos (classe .c-*): botão, card, tabela, modal, campo de
 * formulário, toast, abas, badge de status. Cada brief 01–07 reusa estas classes.
 * ---------------------------------------------------------------------------
 */

:root {
  /* cores */
  --bg: #0F0F0F;
  --bg-2: #141414;
  --panel: #181818;
  --panel-2: #1E1E1E;
  --line: #2C2C2C;
  --line-2: #383838;
  --yellow: #FFD02A;
  --yellow-2: #F7CE2E;
  --yellow-soft: rgba(255, 208, 42, 0.14);
  --yellow-border: rgba(255, 208, 42, 0.28);
  --text: #FFFFFF;
  --muted: #9AA0A6;
  --muted-2: #D5D8DC;
  --red: #FF6B62;
  --green: #5ED69B;
  --blue: #88B7FF;

  /* status semânticos (reusados por badges nos módulos) */
  --st-ativo-bg: #173B31;      --st-ativo-fg: #9EE4C4;
  --st-pausado-bg: #4B401E;    --st-pausado-fg: #FFE187;
  --st-prospect-bg: #23364D;   --st-prospect-fg: #B9D8FF;

  /* tipografia */
  --font-titulo: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
  --font-corpo: 'Roboto', Arial, Helvetica, sans-serif;

  /* espaçamento */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  /* raios e sombras */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px var(--yellow-border), 0 6px 24px rgba(255, 208, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-corpo);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .titulo {
  font-family: var(--font-titulo);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-2);
  line-height: 1.2;
}
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--yellow); }
.destaque { color: var(--yellow); }
.sub { color: var(--muted); margin: 0 0 var(--sp-5); }
.muted { color: var(--muted); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

/* ---------- Botão ---------- */
.c-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 10px 16px; font-weight: 600; font-family: var(--font-corpo);
  background: var(--panel-2); color: var(--text); transition: .15s;
}
.c-btn:hover { border-color: var(--line-2); background: #262626; }
.c-btn--primario { background: var(--yellow); color: #151515; font-weight: 700; }
.c-btn--primario:hover { background: var(--yellow-2); border-color: transparent; }
.c-btn--fantasma { background: transparent; color: var(--muted-2); }
.c-btn--fantasma:hover { color: var(--yellow); background: var(--yellow-soft); }
.c-btn--perigo { background: transparent; color: var(--red); }
.c-btn--perigo:hover { background: rgba(255, 107, 98, 0.12); }
.c-btn[disabled] { opacity: .45; cursor: not-allowed; }
.c-btn--bloco { width: 100%; justify-content: center; }

/* ---------- Card ---------- */
.c-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5);
}
.c-card--destaque { border-color: var(--yellow-border); box-shadow: var(--glow); }
.c-card__cabecalho { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.c-card__cabecalho h2, .c-card__cabecalho h3 { margin: 0; }

/* ---------- Tabela ---------- */
.c-tabela-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.c-tabela { width: 100%; border-collapse: collapse; min-width: 620px; }
.c-tabela th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 12px 14px; background: var(--bg-2); font-weight: 600;
}
.c-tabela td { padding: 14px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.c-tabela tbody tr:hover, .c-tabela tr[data-click]:hover { background: #1c1c1c; cursor: pointer; }

/* ---------- Campo de formulário ---------- */
.c-campo { display: grid; gap: 6px; margin-bottom: var(--sp-4); }
.c-campo > label, .c-label { font-size: 12px; color: var(--muted-2); font-weight: 500; }
.c-input, .c-select, .c-textarea {
  width: 100%; background: #1C1C1C; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 10px 12px; min-height: 42px; color: var(--text);
}
.c-input:focus, .c-select:focus, .c-textarea:focus { border-color: var(--yellow); outline: none; }
.c-textarea { min-height: 84px; resize: vertical; }
.c-input--erro, .c-select--erro { border-color: var(--red); }
.c-erro { color: var(--red); font-size: 12px; }
.c-ajuda { color: var(--muted); font-size: 12px; }
.c-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.c-form-grid .c-wide { grid-column: 1 / -1; }

/* ---------- Modal ---------- */
.c-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.68);
  display: grid; place-items: center; padding: var(--sp-4); z-index: 60;
  animation: fadeIn .12s ease;
}
.c-modal {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  width: min(680px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow);
  animation: pop .14s ease;
}
.c-modal__cabecalho { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.c-modal__cabecalho h2 { margin: 0; }
.c-modal__corpo { padding: 0 var(--sp-5) var(--sp-3); }
.c-modal__rodape { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.c-modal__fechar { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px; }
.c-modal__fechar:hover { color: var(--text); }

/* ---------- Toast ---------- */
.c-toast-zona { position: fixed; bottom: 22px; right: 22px; display: grid; gap: 10px; z-index: 90; max-width: 340px; }
.c-toast {
  background: #202020; border: 1px solid var(--line-2); border-left: 3px solid var(--yellow);
  border-radius: var(--r-sm); padding: 12px 14px; box-shadow: var(--shadow);
  font-size: 14px; animation: slideIn .18s ease;
}
.c-toast--sucesso { border-left-color: var(--green); }
.c-toast--erro { border-left-color: var(--red); }

/* ---------- Abas ---------- */
.c-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; }
.c-abas button {
  border: 0; background: none; color: var(--muted); padding: 12px 14px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.c-abas button.ativa { color: var(--yellow); border-bottom-color: var(--yellow); font-weight: 600; }

/* ---------- Badge de status ---------- */
.c-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-pill); background: #2A2A2A; color: #DDD; white-space: nowrap;
}
.c-badge--ativo { background: var(--st-ativo-bg); color: var(--st-ativo-fg); }
.c-badge--pausado { background: var(--st-pausado-bg); color: var(--st-pausado-fg); }
.c-badge--prospect { background: var(--st-prospect-bg); color: var(--st-prospect-fg); }

/* ---------- Utilitários ---------- */
.c-vazio { text-align: center; color: var(--muted); padding: var(--sp-7) var(--sp-4); }
.c-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 10px; border-radius: var(--r-pill); background: #242424; border: 1px solid var(--line); color: var(--muted-2); }
.c-swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,.15); display: inline-block; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .c-form-grid { grid-template-columns: 1fr; }
  .c-form-grid .c-wide { grid-column: auto; }
  h1 { font-size: 25px; }
}
