:root {
  --navy: #172554;
  --navy-2: #1e3a8a;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --text: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --green: #087443;
  --green-bg: #ecfdf3;
  --red: #b42318;
  --red-bg: #fef3f2;
  --amber: #b54708;
  --amber-bg: #fffaeb;
  --purple: #6941c6;
  --purple-bg: #f4f3ff;
  --shadow: 0 16px 40px rgba(23, 32, 51, .08);
  --shadow-soft: 0 7px 22px rgba(23, 32, 51, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #f4f6fa; color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 10px max(20px, calc((100vw - 1440px) / 2)); border-bottom: 1px solid rgba(228,231,236,.9); background: rgba(255,255,255,.94); backdrop-filter: blur(18px); }
.topbar nav { display: flex; align-items: center; gap: 12px; }
.header-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.header-status.is-ready { color: var(--green); }
.header-status.is-error { color: var(--red); }
.app-switcher { display: flex; align-items: stretch; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.app-switcher::-webkit-scrollbar { display: none; }
.app-switch-card { display: flex; align-items: center; gap: 9px; min-width: 145px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); transition: .16s ease; }
.app-switch-card:hover { border-color: #a9bdeb; transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.app-switch-card.active { border-color: #84adff; background: #f4f7ff; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.app-switch-mark { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 900; }
.app-switch-card strong, .app-switch-card small { display: block; line-height: 1.15; }
.app-switch-card strong { font-size: 13px; }
.app-switch-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.page-shell { width: min(1440px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.page-heading h1 { margin: 4px 0 7px; font-size: clamp(34px, 5vw, 58px); line-height: .98; letter-spacing: -.045em; }
.page-heading p { max-width: 850px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.marketing-hero { position: relative; overflow: hidden; padding: 32px; border-radius: 25px; color: #fff; background: radial-gradient(circle at 80% 0, rgba(59,130,246,.7), transparent 40%), linear-gradient(135deg, #111d43 0%, #172554 50%, #1e3a8a 100%); box-shadow: 0 24px 60px rgba(23,37,84,.22); }
.marketing-hero::after { content: ""; position: absolute; right: -70px; bottom: -130px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,255,255,.03), 0 0 0 90px rgba(255,255,255,.025); }
.marketing-hero .eyebrow { color: #bfdbfe; }
.marketing-hero p { color: #dbeafe; }
.hero-side { position: relative; z-index: 1; display: grid; min-width: 260px; justify-items: end; gap: 5px; text-align: right; }
.hero-side strong { font-size: 21px; }
.hero-side small { color: #bfdbfe; }
.mode-pill { padding: 6px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.1); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.panel { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow-soft); }
.filter-panel { position: sticky; top: 82px; z-index: 80; padding: 16px 18px 12px; box-shadow: 0 12px 32px rgba(23,32,51,.11); }
.filter-row { display: flex; align-items: end; gap: 12px; }
.primary-filters { display: grid; grid-template-columns: 190px minmax(300px, 1fr) 150px 150px; }
.secondary-filters { margin-top: 11px; }
.filter-panel label { display: grid; gap: 6px; min-width: 0; }
.filter-panel label > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
input, select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d0d5dd; border-radius: 10px; outline: none; background: #fff; color: var(--text); transition: .15s ease; }
input:focus, select:focus { border-color: #84adff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.search-box { position: relative; }
.search-box span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.search-box input { padding-left: 37px; }
.quick-periods { display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.quick-periods button { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.quick-periods button.active, .quick-periods button:hover { background: #fff; color: var(--blue); box-shadow: 0 2px 9px rgba(23,32,51,.08); }
.secondary-filters > label { min-width: 150px; }
.secondary-filters > label:nth-of-type(2) { min-width: 135px; }
.secondary-filters > label:nth-of-type(3) { width: 125px; min-width: 110px; }
.secondary-filters .button { margin-left: auto; }
.filter-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #f0f1f3; color: var(--muted); font-size: 11px; }
.inline-edit { padding: 0; border: 0; border-bottom: 1px dashed var(--blue); background: transparent; color: var(--blue); font-weight: 800; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 780; transition: .16s ease; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.22); }
.button-primary:hover { background: #1d4ed8; }
.button-ghost { border-color: var(--line); background: #fff; color: var(--text); }
.button-small { min-height: 36px; padding: 0 12px; font-size: 12px; }
.loading-shell { display: grid; justify-items: center; gap: 8px; margin-top: 18px; padding: 70px 20px; border: 1px solid var(--line); border-radius: 19px; background: #fff; color: var(--muted); }
.loading-shell strong { color: var(--text); }
.spinner { width: 28px; height: 28px; border: 3px solid #dbeafe; border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.kpi-grid { display: grid; gap: 12px; margin-top: 18px; }
.kpi-grid-six { grid-template-columns: repeat(6, 1fr); }
.kpi-card { position: relative; overflow: hidden; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-soft); }
.kpi-card > span, .kpi-card > strong, .kpi-card > small { display: block; }
.kpi-card > span { color: var(--muted); font-size: 11px; font-weight: 780; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card > strong { overflow: hidden; margin: 8px 0 5px; font-size: clamp(21px, 2vw, 30px); letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.kpi-card > small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.kpi-primary { border-color: #bfdbfe; background: linear-gradient(145deg, #fff, #eff6ff); }
.kpi-primary::after { content: ""; position: absolute; right: -30px; top: -45px; width: 100px; height: 100px; border-radius: 50%; background: rgba(37,99,235,.08); }
.kpi-danger { border-color: #fecdca; background: linear-gradient(145deg, #fff, #fff4f2); }
.insight-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.insight-card { padding: 15px 16px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 13px; background: #fff; }
.insight-card > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.insight-card > strong { display: block; margin: 5px 0 3px; font-size: 23px; }
.insight-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.tone-danger { border-left-color: var(--red); }
.tone-success { border-left-color: var(--green); }
.tone-warning { border-left-color: var(--amber); }
.tone-neutral { border-left-color: var(--blue); }
.analytics-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, .8fr); gap: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.panel-heading h2 { margin: 3px 0 3px; font-size: 21px; letter-spacing: -.025em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.chart-legend { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.legend-spend { background: #f79009; }
.legend-gmv { background: #2563eb; }
.performance-chart { min-height: 290px; }
.performance-chart svg { display: block; width: 100%; height: 290px; overflow: visible; }
.chart-empty { display: grid; place-items: center; height: 260px; color: var(--muted); text-align: center; }
.chart-tooltip { position: fixed; z-index: 600; min-width: 165px; padding: 10px; border-radius: 10px; background: #101828; color: #fff; pointer-events: none; box-shadow: var(--shadow); font-size: 11px; transform: translate(10px, 10px); }
.chart-tooltip strong, .chart-tooltip span { display: block; }
.chart-tooltip strong { margin-bottom: 5px; }
.chart-tooltip span { color: #d0d5dd; line-height: 1.55; }
.decision-list { display: grid; gap: 8px; }
.decision-list a { display: grid; grid-template-columns: 37px 1fr auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; transition: .16s ease; }
.decision-list a:hover { border-color: #a9bdeb; background: #f8faff; }
.decision-list strong, .decision-list small { display: block; }
.decision-list strong { font-size: 13px; }
.decision-list small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.decision-list b { color: var(--blue); font-size: 11px; }
.decision-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; font-weight: 900; }
.decision-icon.success { background: var(--green-bg); color: var(--green); }
.decision-icon.danger { background: var(--red-bg); color: var(--red); }
.decision-icon.warning { background: var(--amber-bg); color: var(--amber); }
.credential-card { margin-top: 13px; padding: 13px; border-radius: 12px; background: var(--surface-2); }
.credential-card span, .credential-card strong, .credential-card small { display: block; }
.credential-card span { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.credential-card strong { margin: 3px 0; }
.credential-card small { color: var(--muted); font-size: 10px; }
.state-pronto { background: var(--green-bg); color: var(--green); }
.state-expirado, .state-ausente { background: var(--red-bg); color: var(--red); }
.state-expirando { background: var(--amber-bg); color: var(--amber); }
.product-heading { align-items: center; }
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; background: #f8fafc; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 12px; }
tbody tr:hover { background: #fafcff; }
.num { text-align: right; white-space: nowrap; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.product-cell { min-width: 290px; }
.product-cell strong { max-width: 450px; font-size: 13px; }
.diagnostic { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 820; white-space: nowrap; }
.diagnostic-scale { background: var(--green-bg); color: var(--green); }
.diagnostic-waste { background: var(--red-bg); color: var(--red); }
.diagnostic-attention, .diagnostic-conversion { background: var(--amber-bg); color: var(--amber); }
.diagnostic-stable { background: #f2f4f7; color: #475467; }
.target-note { margin-left: 7px; display: inline !important; }
.roas-value { font-size: 16px; }
.roas-value.good { color: var(--green); }
.roas-value.bad { color: var(--red); }
.sync-run-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sync-run-grid article { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.sync-run-grid strong, .sync-run-grid small { display: block; }
.sync-run-grid strong { margin: 7px 0 3px; font-size: 12px; }
.sync-run-grid small { color: var(--muted); font-size: 10px; }
.run-status { padding: 3px 6px; border-radius: 999px; font-size: 9px; font-weight: 850; }
.run-sucesso { background: var(--green-bg); color: var(--green); }
.run-parcial { background: var(--amber-bg); color: var(--amber); }
.run-erro { background: var(--red-bg); color: var(--red); }
details { margin-top: 8px; font-size: 10px; color: var(--red); }
details pre { max-height: 130px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }
.empty-state.small { padding: 20px; }
.empty-state strong { color: var(--text); }
.empty-state p { margin: 4px 0 0; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 700; max-width: min(420px, calc(100vw - 44px)); transform: translateY(20px); opacity: 0; padding: 12px 16px; border-radius: 11px; background: #101828; color: white; box-shadow: var(--shadow); pointer-events: none; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast[data-tone="danger"] { background: #7a271a; }
.toast[data-tone="success"] { background: #054f31; }
@media (max-width: 1220px) {
  .kpi-grid-six { grid-template-columns: repeat(3, 1fr); }
  .primary-filters { grid-template-columns: 170px minmax(250px, 1fr) 145px 145px; }
  .sync-run-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar nav { width: 100%; justify-content: flex-end; }
  .filter-panel { position: static; }
  .primary-filters { grid-template-columns: 1fr 1fr; }
  .search-label { grid-column: 1 / -1; grid-row: 1; }
  .secondary-filters { flex-wrap: wrap; }
  .secondary-filters .button { margin-left: 0; }
  .analytics-layout { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .page-shell { width: min(100% - 20px, 1440px); padding-top: 20px; }
  .marketing-hero { align-items: flex-start; flex-direction: column; padding: 23px; }
  .hero-side { min-width: 0; justify-items: start; text-align: left; }
  .primary-filters { grid-template-columns: 1fr; }
  .search-label { grid-column: auto; grid-row: auto; }
  .filter-row { align-items: stretch; }
  .secondary-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-periods { grid-column: 1 / -1; overflow-x: auto; }
  .secondary-filters .button { grid-column: 1 / -1; }
  .filter-foot { flex-direction: column; gap: 5px; }
  .kpi-grid-six { grid-template-columns: 1fr 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .sync-run-grid { grid-template-columns: 1fr; }
  .panel { padding: 17px; }
  .table-wrap { margin: 0 -17px -17px; }
  .header-status { display: none; }
}
@media (max-width: 480px) {
  .kpi-grid-six { grid-template-columns: 1fr; }
  .secondary-filters { grid-template-columns: 1fr; }
  .quick-periods, .secondary-filters .button { grid-column: auto; }
  .page-heading h1 { font-size: 38px; }
  .app-switch-card { min-width: 132px; }
}
