/* ============================================================================
   Alltech · Calendário de Campanhas — tema dark p/ apresentação
   Paleta de marca: turquesa #0082a1 · cinza #414042 · azul claro #57c1e9
   Tipografia: SF Pro Display (fallback Segoe UI no Windows)
============================================================================ */
:root {
  --turq: #0082a1;
  --turq-light: #57c1e9;
  --orange: #f15a22;
  --gray: #414042;
  --bg: #0c1620;
  --bg-2: #11202c;
  --card: #14242f;
  --card-2: #1b2f3c;
  --line: #213642;
  --text: #e8f1f5;
  --muted: #8aa3b0;
  --plan: #57c1e9;
  --exec: #0082a1;
  --paused: #5b6b75;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16313f 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button { font-family: inherit; cursor: pointer; }

/* ---------- GATE ---------- */
.gate {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% 0%, #16313f, var(--bg));
}
.gate-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 40px; width: 360px; box-shadow: var(--shadow); text-align: center;
}
.gate-box h1 { font-size: 20px; margin: 18px 0 6px; }
.gate-box input {
  width: 100%; margin: 14px 0; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 15px;
}
.gate-box button, .primary-btn {
  background: var(--turq); color: #fff; border: none; border-radius: 10px;
  padding: 11px 18px; font-weight: 600; font-size: 14px;
}
.gate-box button { width: 100%; }
.primary-btn:hover { background: #0098bd; }
.brand-mark { display: flex; align-items: center; gap: 8px; justify-content: center; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--turq-light); }
.brand-name { font-weight: 800; letter-spacing: 2px; }
.brand-suffix { color: var(--muted); font-weight: 500; }
.error { color: #ff7b7b; font-size: 13px; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30; background: rgba(12,22,32,.82); backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 26px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.ghost-btn {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; font-size: 14px;
}
.ghost-btn:hover { border-color: var(--turq); }
.ghost-btn.busy { opacity: .6; pointer-events: none; }
.sync-badge {
  font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted);
}
.sync-badge.ok    { color: #6ee7a8; border-color: #1f5a3e; }
.sync-badge.warn  { color: #ffcf6b; border-color: #6a5320; }
.sync-badge.error { color: #ff8c8c; border-color: #6a2727; }

/* ---------- FILTROS ---------- */
.filters {
  display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start;
  padding: 22px 24px; border-bottom: 1px solid var(--line);
}
.filter-group { display: flex; flex-direction: column; gap: 12px; }
.filter-group label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-row button {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 15px; font-size: 13px; line-height: 1; white-space: nowrap;
}
.filter-row button:hover { border-color: var(--turq); }
.filter-row button.active { background: var(--turq); border-color: var(--turq); color: #fff; }
.filter-row.dates { gap: 10px; }
.filter-row input[type=date] {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; min-width: 140px;
}
.filter-row input[type=date]:focus { outline: none; border-color: var(--turq); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 600;
}
.chip.active { background: var(--turq); border-color: var(--turq); color: #fff; }

/* ---------- CARDS ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  margin: 18px 24px; padding: 18px 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 16px; font-weight: 700; }
.scope-pill {
  font-size: 12px; font-weight: 600; color: var(--turq-light);
  background: rgba(87,193,233,.12); border: 1px solid rgba(87,193,233,.3);
  padding: 2px 10px; border-radius: 999px; margin-left: 8px;
}
.scope-pill:empty { display: none; }

/* ---------- TABS (Executivo / Analista) ---------- */
.tabs { display: flex; gap: 4px; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tab { background: transparent; border: none; color: var(--muted); border-radius: 7px; padding: 8px 18px; font-size: 13px; font-weight: 600; }
.tab.active { background: var(--turq); color: #fff; }
.tab:hover:not(.active) { color: var(--text); }

/* ---------- ANALISTA: toolbar de campanha ---------- */
.an-toolbar { display: flex; align-items: center; gap: 10px; margin: 18px 24px 0; flex-wrap: wrap; }
.an-toolbar label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.an-toolbar select { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 9px 12px; font-size: 13px; min-width: 280px; max-width: 520px; }
.an-toolbar select:focus { outline: none; border-color: var(--turq); }

/* ---------- ANALISTA: grid / kpi / chart / ranking ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 24px; }
.grid-2 .card { margin: 0; }
.chart { width: 100%; height: 300px; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 18px 24px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--turq); }
.kpi.alt::before { background: var(--orange); }
.kpi .label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; }
.ranking { display: flex; flex-direction: column; gap: 2px; }
.ranking .row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ranking .rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .metric { color: var(--turq-light); font-weight: 700; font-variant-numeric: tabular-nums; }
.cre-table-wrap { overflow-x: auto; }
.cre-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cre-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cre-table td { padding: 8px 10px; border-bottom: 1px dashed var(--line); }
.cre-table th.r, .cre-table td.r { text-align: right; font-variant-numeric: tabular-nums; }
.cre-table td:first-child { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; gap: 8px; }
}

/* ---------- GANTT ---------- */
.gantt { width: 100%; min-height: 320px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.exec { background: var(--exec); }
.sw.plan { background: var(--plan); }
.sw.paused { background: var(--paused); }
.sw.manual { background: transparent; border: 1px dashed var(--turq-light); }

/* ---------- CRIATIVOS ---------- */
.creatives-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;
}
.creative-card {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: transform .12s, border-color .12s;
  display: flex; flex-direction: column;
}
.creative-card:hover { transform: translateY(-3px); border-color: var(--turq); }
.thumb-wrap { position: relative; }
.play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; font-size: 18px; padding-left: 3px;
  border: 2px solid rgba(255,255,255,.85); pointer-events: none;
}
.creative-card .thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #0a141c; display: block; }
.creative-card .thumb-placeholder {
  width: 100%; aspect-ratio: 1/1; display: grid; place-items: center;
  background: #0a141c; color: var(--muted); font-size: 12px;
}
.creative-card .body { padding: 12px; }
.creative-card .cc-bu {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: var(--turq-light); background: rgba(87,193,233,.12); padding: 2px 8px; border-radius: 6px; margin-bottom: 6px;
}
.creative-card .cc-camp { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.creative-card .cc-copy { font-size: 12.5px; line-height: 1.4; max-height: 4.2em; overflow: hidden; margin-bottom: 10px; }
.creative-card .metrics { display: flex; gap: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.creative-card .metrics .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.creative-card .metrics b { font-size: 14px; }

/* custos ocultos por padrão (olhinho ativo) */
.cost-hidden .cost { display: none !important; }
.cost-hidden .cost-only { display: none !important; }

/* ---------- MODAL ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,9,13,.72); backdrop-filter: blur(3px); }
.modal-box {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; max-width: 680px; width: calc(100% - 40px); max-height: 88vh; overflow: auto;
  padding: 26px; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; background: var(--card-2);
  border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 32px; height: 32px;
}
.cm-img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; background: #0a141c; margin-bottom: 16px; }
.cm-video { margin-bottom: 16px; }
.cm-fmt { display: flex; gap: 8px; margin-bottom: 12px; }
.cm-fmt button { background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 14px; font-size: 13px; }
.cm-fmt button.active { background: var(--turq); border-color: var(--turq); color: #fff; }
.cm-open { margin-left: auto; background: var(--orange); color: #fff; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.cm-open:hover { filter: brightness(1.08); }
.cm-iframe-wrap { display: grid; place-items: center; min-height: 420px; background: #0a141c; border-radius: 10px; overflow: hidden; }
.cm-iframe-wrap iframe { border: 0; max-width: 100%; }
.cm-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.cm-meta .b { font-size: 18px; font-weight: 700; }
.cm-meta .l { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.cm-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--turq-light); margin: 18px 0 8px; }
.cm-copy-best {
  background: var(--bg-2); border-left: 3px solid var(--turq); border-radius: 8px;
  padding: 14px 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap;
}
.cm-copy-alt { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 13px; line-height: 1.45; margin-top: 8px; white-space: pre-wrap; }
.cm-titles { display: flex; gap: 8px; flex-wrap: wrap; }
.cm-titles span { background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.cm-cta { display: inline-block; background: var(--orange); color: #fff; padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; }

/* ---------- FORM ADD ---------- */
.modal-form h3 { margin-top: 0; }
.modal-form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 5px; }
.modal-form input, .modal-form select {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.planned-list-wrap { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.planned-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.planned-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.planned-item .pi-del { background: transparent; border: none; color: #ff8c8c; font-size: 16px; }
.pi-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.pi-tag.planejamento { background: rgba(87,193,233,.16); color: var(--turq-light); }
.pi-tag.execucao { background: rgba(0,130,161,.22); color: #6fd6ef; }
.pi-tag.pausada, .pi-tag.encerrada { background: rgba(91,107,117,.25); color: #b6c6cf; }

/* ---------- FOOTER ---------- */
.footer { padding: 18px 24px 40px; text-align: center; }
