/* ============================================================
   Command Center — Design System (tema LIGHT)
   Inspirado nas referências "wrthy" e "Sociafy".
   Todas as cores/tipografia centralizadas em variáveis.
   ============================================================ */

:root {
  /* Base / neutros */
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --text-primary: #1d1d20;
  --text-secondary: #7a7a82;
  --text-muted: #a3a3ad;
  --border: #ececef;
  --border-strong: #e0e0e4;

  /* Destaque (coral/laranja) */
  --accent: #ff6b4a;
  --accent-strong: #f1502c;
  --accent-soft: #fff0eb;
  --accent-gradient: linear-gradient(135deg, #ff7a59 0%, #ff5e8a 100%);

  /* Paleta secundária (gráficos / badges / status) */
  --c-orange: #ff7a59;
  --c-orange-soft: #fff0eb;
  --c-pink: #ff5e8a;
  --c-pink-soft: #ffeef3;
  --c-mint: #2bc4a0;
  --c-mint-soft: #e3f8f2;
  --c-blue: #4d9bff;
  --c-blue-soft: #eaf3ff;
  --c-purple: #8b7bff;
  --c-purple-soft: #efecff;
  --c-red: #f0616f;
  --c-red-soft: #fdedef;
  --c-yellow: #f5b73d;
  --c-yellow-soft: #fef5e3;

  /* Sombras suaves */
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.04), 0 1px 3px rgba(20, 20, 30, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 20, 30, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 20, 30, 0.10);

  /* Raios */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, #fff2ec 0%, var(--bg) 55%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.login-sub { color: var(--text-secondary); margin: 6px 0 22px; }
.login-error { color: var(--c-red); margin-top: 14px; font-weight: 500; }

/* ---------- Logo ---------- */
.logo-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--accent-gradient);
  color: #fff; font-size: 16px;
  box-shadow: 0 6px 16px rgba(255, 94, 138, 0.35);
}
.logo-text { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--r-md);
  color: var(--text-secondary); font-weight: 600; font-size: 14px;
  cursor: pointer; user-select: none; transition: all .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-ico { width: 18px; text-align: center; opacity: .9; }

.main { flex: 1; min-width: 0; }
.view { padding: 32px 40px 64px; max-width: 1240px; margin: 0 auto; }

/* ---------- Tipografia / headers ---------- */
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 4px; }
.page-sub { color: var(--text-secondary); margin: 0 0 26px; }
.section-title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--text-secondary); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card-pad-sm { padding: 16px; }
.grid { display: grid; gap: 18px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .view { padding: 24px 18px; } }

/* ---------- KPI ---------- */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--text-secondary); font-weight: 600; font-size: 13px; }
.kpi-ico {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 17px;
}
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.kpi-delta { font-size: 12px; font-weight: 700; }
.delta-up { color: var(--c-mint); }
.delta-down { color: var(--c-red); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 10px 18px; font-family: var(--font); font-weight: 700; font-size: 13.5px;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.btn-block { width: 100%; margin-top: 12px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(255, 107, 74, 0.28); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-gradient { background: var(--accent-gradient); color: #fff; box-shadow: 0 8px 20px rgba(255, 94, 138, 0.3); }
.btn-ghost { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--c-red-soft); color: var(--c-red); }
.btn-danger:hover { background: #fbdfe2; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-icon { padding: 8px 10px; }

/* ---------- Inputs ---------- */
.input, .select, textarea.input {
  width: 100%; font-family: var(--font); font-size: 14px;
  padding: 11px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--r-md); background: var(--surface); color: var(--text-primary);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 64px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

/* ---------- Badges / pílulas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
}
.badge-orange { background: var(--c-orange-soft); color: var(--accent-strong); }
.badge-pink { background: var(--c-pink-soft); color: #d83a68; }
.badge-mint { background: var(--c-mint-soft); color: #18987a; }
.badge-blue { background: var(--c-blue-soft); color: #2f74cc; }
.badge-purple { background: var(--c-purple-soft); color: #6655d6; }
.badge-gray { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 700; color: var(--text-secondary);
  padding: 12px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.tbl-total td { font-weight: 800; background: var(--surface-2); }
.cell-input {
  width: 100%; border: 1px solid transparent; background: transparent;
  font-family: var(--font); font-size: 13px; padding: 6px 8px; border-radius: 8px;
  color: var(--text-primary);
}
.cell-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tabela de campanha (heat) ---------- */
.heat { font-weight: 700; text-align: center; border-radius: 8px; }
.heat-5 { background: #1f9d6b; color: #fff; }       /* >=100% verde escuro */
.heat-4 { background: #b7e4c7; color: #1f6b46; }    /* 90-99 verde claro */
.heat-3 { background: #ffe39e; color: #8a6310; }    /* 70-89 amarelo */
.heat-2 { background: #ffc1b0; color: #a23a22; }    /* 50-69 vermelho claro */
.heat-1 { background: #e8556b; color: #fff; }       /* <50 vermelho escuro */
.ideal-row td { color: var(--text-secondary); font-weight: 700; background: var(--surface-2); }
.diag-row td { font-size: 11.5px; color: var(--text-muted); font-style: italic; }

/* ---------- Árvore de produto ---------- */
.tree { display: flex; flex-direction: column; gap: 8px; }
.tree-node {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.tree-child { margin-left: 26px; border-left: 2px solid var(--accent-soft); }
.tree-main { background: var(--accent-soft); border-color: #ffd9cd; }
.tree-label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.tree-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.node-actions { display: flex; gap: 6px; }

/* ---------- Calendário ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-weight: 700; color: var(--text-muted); font-size: 11px; padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1; border-radius: var(--r-md); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-weight: 700; position: relative; cursor: default;
}
.cal-cell.empty { border: none; background: transparent; }
.cal-done { background: var(--c-mint-soft); border-color: #bdeede; color: #18987a; }
.cal-today { box-shadow: 0 0 0 2px var(--accent); }
.cal-check { font-size: 11px; }

/* ---------- Upload / dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 26px; text-align: center; cursor: pointer; transition: all .15s ease;
  background: var(--surface-2); color: var(--text-secondary);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.dropzone img { max-height: 160px; border-radius: var(--r-md); box-shadow: var(--shadow-sm); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 20, 30, 0.38);
  display: grid; place-items: center; padding: 24px; z-index: 50;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 6px; }
.modal-body { padding: 14px 24px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 22px; }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 22px; line-height: 1; border: none; background: none; }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: #232329; color: #fff; padding: 12px 16px; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 10px; animation: toastIn .2s ease;
}
.toast.ok { border-left: 3px solid var(--c-mint); }
.toast.err { border-left: 3px solid var(--c-red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Utilidades ---------- */
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.wrap { flex-wrap: wrap; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
.spinner-dark { border-color: var(--border-strong); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; color: var(--text-secondary); padding: 40px 20px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 16px; cursor: pointer; font-weight: 700; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.pill-select { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.month-nav { display: inline-flex; align-items: center; gap: 8px; }
