/* Design tokens live in tokens.css (shared across the hub). */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(120% 80% at 100% -10%, oklch(24% 0.03 78 / 0.35), transparent 60%),
    radial-gradient(90% 70% at -10% 0%, oklch(24% 0.03 195 / 0.22), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  font-feature-settings: "ss01", "cv01";
}

.wrap { max-width: 1320px; margin: 0 auto; padding: var(--space-page); }

/* ---- Header ---- */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.mark-link { display: inline-flex; text-decoration: none; transition: transform 0.15s var(--ease); }
.mark-link:hover { transform: translateY(-2px); }
.crumb { color: var(--accent); text-decoration: none; font-weight: 600; }
.crumb:hover { text-decoration: underline; }
.mark {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), oklch(70% 0.15 55));
  color: oklch(20% 0.04 60);
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em;
  box-shadow: 0 8px 20px -8px var(--accent-soft);
}
.brand h1 {
  margin: 0; font-size: 2rem; font-weight: 750;
  letter-spacing: -0.045em; line-height: 1;
}
.brand .sub {
  margin: 0.3rem 0 0; color: var(--text-faint);
  font-size: 0.82rem; letter-spacing: 0.01em;
}
.top-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.updated { text-align: right; font-size: 0.74rem; color: var(--text-faint); }
.updated b { color: var(--text-dim); font-weight: 600; }
.updated .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--won); margin-right: 5px; vertical-align: middle;
  box-shadow: 0 0 0 3px oklch(78% 0.16 155 / 0.18);
}
.updated .dot.stale { background: var(--lost); box-shadow: 0 0 0 3px oklch(68% 0.19 25 / 0.18); }

.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.83rem; font-weight: 600;
  padding: 0.6rem 1rem; border-radius: 11px;
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s;
}
.btn:hover { border-color: var(--accent); background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn svg { width: 15px; height: 15px; transition: transform 0.5s var(--ease); }
.btn.loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Filters ---- */
.filters {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.filters .label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); margin-right: 0.4rem;
}
.pill {
  appearance: none; cursor: pointer; font: inherit;
  font-size: 0.8rem; font-weight: 600;
  padding: 0.42rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  transition: all 0.18s var(--ease);
}
.pill:hover { border-color: var(--text-faint); color: var(--text); }
.pill[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent);
  color: oklch(22% 0.04 60);
}
.pill-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.range { display: inline-flex; align-items: center; gap: 0.5rem; margin-left: 0.25rem; }
.range-sep { font-size: 0.78rem; color: var(--text-faint); }
.date-input {
  font: inherit; font-size: 0.8rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 0.38rem 0.6rem;
  color-scheme: dark; cursor: pointer;
  transition: border-color 0.18s var(--ease);
}
.date-input:hover { border-color: var(--text-faint); }
.date-input:focus-visible { outline: none; border-color: var(--accent); }
.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7); cursor: pointer;
}

/* ---- KPI row ---- */
.kpis {
  display: grid; gap: 1rem; margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent); opacity: 0.85;
}
.kpi.teal::before { background: var(--teal); }
.kpi.won::before { background: var(--won); }
.kpi.lost::before { background: var(--lost); }
.kpi .k-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 600;
}
.kpi .k-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.5rem); font-weight: 600;
  letter-spacing: -0.03em; margin: 0.35rem 0 0.1rem; line-height: 1;
}
.kpi .k-foot { font-size: 0.76rem; color: var(--text-dim); }

/* ---- Grid + cards ---- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(12, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: var(--shadow); min-width: 0;
  display: flex; flex-direction: column;
}
.card h3 {
  margin: 0 0 0.15rem; font-size: 0.98rem; font-weight: 700;
  letter-spacing: -0.01em;
}
.card .hint { margin: 0 0 1rem; font-size: 0.77rem; color: var(--text-faint); }
.chart-box { position: relative; flex: 1; min-height: 240px; }
.chart-box.tall { min-height: 320px; }
.chart-box.short { min-height: 170px; }

/* Survey (onboarding) sub-cards */
.card h4 { margin: 0 0 0.85rem; font-size: 0.9rem; font-weight: 700; letter-spacing: -0.01em; }
.survey-head { background: transparent; border: none; box-shadow: none; padding: 0.5rem 0 0; }
.survey-empty { display: none; text-align: center; color: var(--text-faint); font-size: 0.82rem; padding: 1.5rem 0; }
.survey-card.empty .chart-box { display: none; }
.survey-card.empty .survey-empty { display: block; }
.col-3 { grid-column: span 3; }

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* ---- Funnel ---- */
.funnel { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.3rem; }
.f-stage { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.9rem; }
.f-col { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.f-label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); letter-spacing: -0.005em; }
.f-bar-wrap { position: relative; height: 20px; border-radius: 7px; background: var(--bg-2); overflow: hidden; }
.f-bar {
  height: 100%; border-radius: 7px; width: 0;
  transition: width 0.9s var(--ease);
}
.f-meta { text-align: right; min-width: 96px; }
.f-meta .n { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem; }
.f-meta .p { font-size: 0.72rem; color: var(--text-faint); }

/* ---- Table ---- */
.table-scroll { overflow-x: auto; margin: -0.2rem -0.4rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 560px; }
th {
  text-align: left; font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-faint); font-weight: 600;
  padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface);
}
td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line-soft); color: var(--text-dim); }
tr:hover td { background: var(--surface-2); color: var(--text); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 999px;
  border: 1px solid transparent;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.won { color: var(--won); background: oklch(78% 0.16 155 / 0.12); }
.tag.proposal { color: var(--proposal); background: oklch(82% 0.15 80 / 0.12); }
.tag.lost { color: var(--lost); background: oklch(68% 0.19 25 / 0.12); }
.tag.noresp { color: var(--text-dim); background: oklch(60% 0.02 265 / 0.14); }
.tag.none { color: var(--text-faint); background: oklch(60% 0.02 265 / 0.08); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- States ---- */
.loading-screen, .error-screen {
  display: none; place-items: center; min-height: 55vh; text-align: center;
}
body.is-loading .loading-screen { display: grid; }
body.is-error .error-screen { display: grid; }
body.is-loading main, body.is-error main { display: none; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}
.error-screen p { color: var(--text-dim); max-width: 420px; }

.footer {
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  font-size: 0.74rem; color: var(--text-faint);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.footer a { color: var(--text-dim); }

/* Table header row with title + filters (shared by patrocínios e imersão) */
.table-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem;
}
.table-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
  .col-3 { grid-column: span 6; }
}
@media (max-width: 560px) {
  .col-3 { grid-column: span 12; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
