
/* ==========================================================================
   v6.6.3 — Dashboard Pilot UI
   Primeiro módulo realmente redesenhado no padrão Apple/SaaS aprovado.
   ========================================================================== */

body.ip-dashboard-pilot,
.ip-dashboard-pilot-page {
  background:
    radial-gradient(circle at 18% 0%, rgba(99,102,241,.08), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(37,99,235,.07), transparent 34%),
    linear-gradient(180deg,#f8fbff 0%, #f5f7fb 100%) !important;
  color:#0f172a !important;
}

.ip-dash-pilot {
  --d-bg:#f5f7fb;
  --d-card:#ffffff;
  --d-text:#0f172a;
  --d-muted:#64748b;
  --d-border:#e5eaf2;
  --d-blue:#2563eb;
  --d-purple:#7c3aed;
  --d-green:#16a34a;
  --d-orange:#f97316;
  --d-pink:#ec4899;
  --d-shadow:0 14px 38px rgba(15,23,42,.07);
  --d-shadow-lg:0 24px 70px rgba(15,23,42,.12);
  padding: 0 0 28px;
}

.ip-dash-hero {
  min-height: 190px;
  border-radius: 28px;
  padding: 28px 34px;
  margin: 0 0 26px;
  background:
    radial-gradient(circle at 70% -10%, rgba(255,255,255,.20), transparent 38%),
    linear-gradient(135deg, #4338ca 0%, #2563eb 48%, #7c3aed 100%);
  color:#fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(37,99,235,.20);
}

.ip-dash-hero::before {
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,.10) 45%, transparent 46%),
    linear-gradient(120deg, transparent 40%, rgba(255,255,255,.07) 60%, transparent 61%);
  pointer-events:none;
}

.ip-dash-hero::after {
  content:"";
  position:absolute;
  right:70px;
  top:42px;
  width:170px;
  height:120px;
  border-radius:32px;
  background:rgba(255,255,255,.14);
  transform:rotate(-14deg);
  pointer-events:none;
}

.ip-dash-hero-top {
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}

.ip-dash-title-wrap {
  display:flex;
  align-items:center;
  gap:18px;
}

.ip-dash-icon {
  width:72px;
  height:72px;
  border-radius:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:38px;
  background:rgba(255,255,255,.16);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18);
}

.ip-dash-title {
  margin:0 !important;
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
  font-size:clamp(30px,3.5vw,46px) !important;
  letter-spacing:-.06em !important;
  line-height:1 !important;
}

.ip-dash-actions {
  display:flex;
  gap:12px;
  align-items:center;
  position:relative;
  z-index:1;
}

.ip-dash-pill {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:44px;
  padding:0 16px;
  border-radius:14px;
  background:rgba(255,255,255,.14);
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
  font-weight:850;
  border:1px solid rgba(255,255,255,.12);
}

.ip-dash-tabs {
  position:absolute;
  left:28px;
  right:28px;
  bottom:0;
  z-index:2;
  min-height:62px;
  display:flex;
  align-items:end;
  gap:22px;
  padding:0 0 0;
  border-top:1px solid rgba(255,255,255,.13);
}

.ip-dash-tab {
  min-height:62px;
  display:flex;
  align-items:center;
  gap:9px;
  color:rgba(255,255,255,.78) !important;
  -webkit-text-fill-color:rgba(255,255,255,.78) !important;
  font-weight:850;
  text-decoration:none !important;
  padding:0 8px;
  position:relative;
}

.ip-dash-tab.active {
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
}

.ip-dash-tab.active::after {
  content:"";
  position:absolute;
  left:6px;
  right:6px;
  bottom:0;
  height:4px;
  border-radius:999px 999px 0 0;
  background:#fff;
}

.ip-dash-grid-kpis {
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:18px;
  margin-bottom:20px;
}

.ip-dash-kpi {
  background:#fff;
  border:1px solid var(--d-border);
  border-radius:22px;
  padding:22px;
  box-shadow:var(--d-shadow);
  position:relative;
  overflow:hidden;
}

.ip-dash-kpi-top {
  display:flex;
  align-items:center;
  gap:16px;
}

.ip-dash-kpi-icon {
  width:54px;
  height:54px;
  border-radius:15px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:26px;
  background:#eff6ff;
}

.ip-dash-kpi-icon.green { background:#ecfdf5; }
.ip-dash-kpi-icon.orange { background:#fff7ed; }
.ip-dash-kpi-icon.pink { background:#fdf2f8; }

.ip-dash-kpi small {
  display:block;
  color:var(--d-muted) !important;
  -webkit-text-fill-color:var(--d-muted) !important;
  font-size:12px;
  font-weight:850;
  margin-bottom:6px;
}

.ip-dash-kpi strong {
  display:block;
  color:var(--d-text) !important;
  -webkit-text-fill-color:var(--d-text) !important;
  font-size:30px;
  line-height:1;
  letter-spacing:-.05em;
}

.ip-dash-trend {
  margin-top:16px;
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--d-green) !important;
  -webkit-text-fill-color:var(--d-green) !important;
  font-size:13px;
  font-weight:850;
}

.ip-dash-main-grid {
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap:20px;
  margin-bottom:20px;
}

.ip-dash-panel {
  background:#fff;
  border:1px solid var(--d-border);
  border-radius:22px;
  box-shadow:var(--d-shadow);
  padding:22px;
}

.ip-dash-panel-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:18px;
}

.ip-dash-panel h2 {
  margin:0 !important;
  color:var(--d-text) !important;
  -webkit-text-fill-color:var(--d-text) !important;
  font-size:20px !important;
  letter-spacing:-.035em;
}

.ip-dash-select,
.ip-dash-link {
  border:1px solid var(--d-border);
  background:#fff;
  color:#334155 !important;
  -webkit-text-fill-color:#334155 !important;
  border-radius:12px;
  padding:9px 13px;
  font-weight:800;
  text-decoration:none !important;
  font-size:13px;
}

.ip-dash-chart {
  height:255px;
  position:relative;
  border-left:1px solid #e5eaf2;
  border-bottom:1px solid #e5eaf2;
  margin:16px 8px 0;
  background:
    linear-gradient(to bottom, transparent 24%, rgba(226,232,240,.55) 25%, transparent 26%),
    linear-gradient(to bottom, transparent 49%, rgba(226,232,240,.55) 50%, transparent 51%),
    linear-gradient(to bottom, transparent 74%, rgba(226,232,240,.55) 75%, transparent 76%);
  border-radius:0 0 0 8px;
}

.ip-dash-line-svg {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  overflow:visible;
}

.ip-dash-chart-labels {
  display:flex;
  justify-content:space-between;
  margin:12px 0 0;
  padding-left:8px;
  color:#64748b;
  font-size:12px;
  font-weight:750;
}

.ip-dash-activity {
  display:flex;
  flex-direction:column;
  gap:0;
}

.ip-dash-activity-row {
  display:flex;
  align-items:center;
  gap:14px;
  padding:13px 0;
  border-bottom:1px solid #edf2f7;
}

.ip-dash-activity-row:last-child {
  border-bottom:0;
}

.ip-dash-activity-icon {
  width:42px;
  height:42px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#eff6ff;
  font-size:20px;
}

.ip-dash-activity-body {
  flex:1;
  min-width:0;
}

.ip-dash-activity-title {
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
  font-weight:900;
  line-height:1.2;
}

.ip-dash-activity-sub {
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
  font-size:13px;
  margin-top:2px;
}

.ip-dash-activity-time {
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
  font-size:12px;
  white-space:nowrap;
  font-weight:700;
}

.ip-dash-bottom-grid {
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:20px;
}

.ip-dash-donut-wrap {
  display:flex;
  align-items:center;
  gap:26px;
}

.ip-dash-donut {
  width:160px;
  height:160px;
  border-radius:50%;
  background:conic-gradient(#7c3aed 0 18%, #2563eb 18% 46%, #10b981 46% 78%, #f59e0b 78% 100%);
  position:relative;
  flex:0 0 auto;
}

.ip-dash-donut::after {
  content:"";
  position:absolute;
  inset:44px;
  border-radius:50%;
  background:#fff;
}

.ip-dash-legend {
  flex:1;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.ip-dash-legend-row {
  display:grid;
  grid-template-columns:auto 1fr auto auto;
  gap:10px;
  align-items:center;
  color:#334155;
  font-size:14px;
}

.ip-dash-dot {
  width:10px;
  height:10px;
  border-radius:50%;
}

.ip-dash-event {
  display:flex;
  align-items:center;
  gap:16px;
  padding:16px 0;
  border-bottom:1px solid #edf2f7;
}

.ip-dash-event:last-child { border-bottom:0; }

.ip-dash-datebox {
  width:58px;
  height:58px;
  border-radius:14px;
  background:#fdf2f8;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:#be185d !important;
  -webkit-text-fill-color:#be185d !important;
  line-height:1;
}

.ip-dash-datebox span {
  font-size:11px;
  margin-bottom:4px;
}

.ip-dash-event-body { flex:1; }

.ip-dash-event-title {
  font-weight:950;
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
}

.ip-dash-event-sub {
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
  font-size:13px;
  margin-top:3px;
}

.ip-dash-badge {
  border-radius:999px;
  padding:6px 10px;
  background:#dcfce7;
  color:#166534 !important;
  -webkit-text-fill-color:#166534 !important;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}

.ip-dash-original {
  margin-top:22px;
}

.ip-dash-original summary {
  cursor:pointer;
  color:#64748b;
  font-weight:850;
  margin-bottom:14px;
}

.ip-dash-original-content {
  opacity:.96;
}

/* Esconde hero/título antigo dentro do dashboard piloto */
.ip-dashboard-pilot-page > .ig-hero,
.ip-dashboard-pilot-page > .apple-premium-hero,
.ip-dashboard-pilot-page > .force-premium-hero,
.ip-dashboard-pilot-page > h1,
.ip-dashboard-pilot-page > h2 {
  display:none !important;
}

@media(max-width:1200px){
  .ip-dash-grid-kpis{ grid-template-columns:repeat(2,1fr); }
  .ip-dash-main-grid,.ip-dash-bottom-grid{ grid-template-columns:1fr; }
}
@media(max-width:760px){
  .ip-dash-hero{ padding:24px; border-radius:22px; min-height:165px; }
  .ip-dash-hero-top{ align-items:flex-start; flex-direction:column; }
  .ip-dash-actions{ width:100%; overflow:auto; }
  .ip-dash-tabs{ left:18px; right:18px; gap:14px; overflow:auto; }
  .ip-dash-grid-kpis{ grid-template-columns:1fr; }
  .ip-dash-donut-wrap{ flex-direction:column; align-items:flex-start; }
}


/* v6.6.4 — Dashboard UX Refinement */
.ip-dashboard-pilot-page > .ig-hero,
.ip-dashboard-pilot-page > .apple-premium-hero,
.ip-dashboard-pilot-page > .force-premium-hero,
.ip-dashboard-pilot-page > h1,
.ip-dashboard-pilot-page > h2,
.ip-dashboard-pilot-page .page-title,
.ip-dashboard-pilot-page .module-title,
.ip-dashboard-pilot-page .screen-title{display:none!important}

.ip-dash-hero{min-height:220px!important;padding:30px 34px 78px!important}
.ip-dash-title-wrap{display:flex!important;align-items:center!important;gap:18px!important}
.ip-dash-title{display:flex!important;align-items:center!important;margin:0!important}

.ip-dash-tab-panels{margin-top:6px}
.ip-dash-panel-screen{display:none}
.ip-dash-panel-screen.active{display:block}

@media(max-width:760px){
.ip-dash-hero{min-height:auto!important;padding:22px 20px 72px!important;border-radius:24px!important}
.ip-dash-hero-top{flex-direction:column!important;align-items:flex-start!important;gap:18px!important}
.ip-dash-title-wrap{width:100%!important}
.ip-dash-icon{width:58px!important;height:58px!important;font-size:30px!important;flex:0 0 auto!important}
.ip-dash-title{font-size:34px!important;line-height:1!important}
.ip-dash-actions{width:100%!important;overflow:auto!important;padding-bottom:4px!important}
.ip-dash-pill{white-space:nowrap!important;flex:0 0 auto!important}
.ip-dash-tabs{left:16px!important;right:16px!important;overflow:auto!important;gap:8px!important;scrollbar-width:none}
.ip-dash-tabs::-webkit-scrollbar{display:none}
.ip-dash-tab{min-height:54px!important;white-space:nowrap!important;flex:0 0 auto!important;font-size:13px!important}
.ip-dash-grid-kpis,.ip-dash-main-grid,.ip-dash-bottom-grid{grid-template-columns:1fr!important;gap:16px!important}
.ip-dash-panel{padding:18px!important;overflow:hidden!important}
.ip-dash-chart{height:210px!important}
.ip-dash-donut-wrap{flex-direction:column!important;align-items:flex-start!important}
}


/* v6.6.5 — Dashboard Real Data + Top Cleanup */
body.ip-dashboard-pilot .ig-hero:first-child,
body.ip-dashboard-pilot .apple-premium-hero:first-child,
body.ip-dashboard-pilot .force-premium-hero:first-child,
body.ip-dashboard-pilot main > h1:first-child,
body.ip-dashboard-pilot .main-content > h1:first-child,
body.ip-dashboard-pilot .ip-content > h1:first-child {
  display:none !important;
}

.ip-dashboard-pilot-page .ig-hero,
.ip-dashboard-pilot-page .apple-premium-hero,
.ip-dashboard-pilot-page .force-premium-hero,
.ip-dashboard-pilot-page > h1,
.ip-dashboard-pilot-page > h2 {
  display:none !important;
}

.ip-dash-grid-secondary {
  margin-top:-4px;
}

.ip-dash-grid-secondary .ip-dash-kpi {
  padding:18px;
}

.ip-dash-grid-secondary .ip-dash-kpi-icon {
  width:48px;
  height:48px;
  font-size:22px;
}

.ip-dash-grid-secondary .ip-dash-kpi strong {
  font-size:26px;
}


/* v6.6.6 — Hero Quick Actions + Desktop Grid Fix */
.ip-dash-hero .ip-dash-title,
.ip-dash-hero .ip-dash-title *,
.ip-dash-hero h1.ip-dash-title{color:#fff!important;-webkit-text-fill-color:#fff!important}

.ip-dash-hero{min-height:260px!important;padding:30px 34px 84px!important}
.ip-dash-hero-top{align-items:flex-start!important}

.ip-dash-actions-expanded{
  display:flex!important;align-items:flex-end!important;flex-direction:column!important;
  gap:12px!important;width:min(560px,46vw);max-width:560px;position:relative;z-index:4
}
.ip-dash-date{align-self:flex-end}
.ip-dash-quick-buttons{display:grid!important;grid-template-columns:repeat(2,minmax(190px,1fr));gap:10px;width:100%}
.ip-dash-quick-btn{
  min-height:42px;display:flex!important;align-items:center;justify-content:center;gap:8px;
  padding:0 14px;border-radius:13px;color:#fff!important;-webkit-text-fill-color:#fff!important;
  text-decoration:none!important;font-size:13px;font-weight:900;border:1px solid rgba(255,255,255,.16);
  box-shadow:0 10px 24px rgba(15,23,42,.14);white-space:nowrap
}
.ip-dash-quick-btn.green{background:linear-gradient(135deg,#16a34a,#059669)!important}
.ip-dash-quick-btn.blue{background:linear-gradient(135deg,#2563eb,#1d4ed8)!important}
.ip-dash-quick-btn.orange{background:linear-gradient(135deg,#f97316,#ea580c)!important}
.ip-dash-quick-btn.purple{background:linear-gradient(135deg,#7c3aed,#6d28d9)!important}

.ip-dash-grid-kpis{
  display:grid!important;grid-template-columns:repeat(4,minmax(220px,1fr))!important;
  gap:20px!important;align-items:stretch!important;width:100%!important
}
.ip-dash-kpi{min-width:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;justify-content:space-between!important}
.ip-dash-kpi-top{min-width:0!important}
.ip-dash-kpi small,.ip-dash-kpi strong,.ip-dash-trend{overflow-wrap:anywhere!important}
.ip-dash-main-grid{display:grid!important;grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr)!important;gap:22px!important;align-items:start!important}
.ip-dash-bottom-grid{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:22px!important;align-items:start!important}
.ip-dash-panel{min-width:0!important;overflow:hidden!important}

@media(max-width:1280px){
  .ip-dash-grid-kpis{grid-template-columns:repeat(2,minmax(260px,1fr))!important}
  .ip-dash-actions-expanded{width:min(520px,50vw)}
}
@media(max-width:980px){
  .ip-dash-hero-top{flex-direction:column!important;align-items:flex-start!important}
  .ip-dash-actions-expanded{width:100%!important;max-width:none!important;align-items:flex-start!important}
  .ip-dash-date{align-self:flex-start}
  .ip-dash-quick-buttons{grid-template-columns:repeat(4,minmax(150px,1fr));overflow:auto;padding-bottom:4px}
  .ip-dash-main-grid,.ip-dash-bottom-grid{grid-template-columns:1fr!important}
}
@media(max-width:760px){
  .ip-dash-hero{min-height:auto!important;padding:22px 20px 76px!important}
  .ip-dash-grid-kpis{grid-template-columns:1fr!important;gap:16px!important}
  .ip-dash-quick-buttons{grid-template-columns:1fr 1fr!important;width:100%!important}
  .ip-dash-quick-btn{min-height:40px;font-size:12px;padding:0 10px}
}
@media(max-width:430px){.ip-dash-quick-buttons{grid-template-columns:1fr!important}}


/* ==========================================================================
   v6.6.7 — Dashboard Grid Fix
   Corrige cards sobrepostos: dashboard volta a ter linhas fixas e previsíveis.
   ========================================================================== */

/* Remove qualquer comportamento antigo de painel/tabs escondendo conteúdo */
.ip-dash-tab-panels,
.ip-dash-panel-screen,
.ip-dash-panel-screen.active {
  display:block !important;
  width:100% !important;
}

/* Container principal do dashboard */
.ip-dash-pilot {
  width:100% !important;
  max-width:100% !important;
  overflow-x:hidden !important;
}

/* KPIs: 4 colunas reais no desktop, sem sobreposição */
.ip-dash-grid-kpis {
  display:grid !important;
  grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
  gap:20px !important;
  width:100% !important;
  margin:0 0 20px !important;
  align-items:stretch !important;
  clear:both !important;
}

.ip-dash-grid-secondary {
  display:grid !important;
  grid-template-columns:repeat(4, minmax(0, 1fr)) !important;
  gap:20px !important;
  width:100% !important;
  margin:0 0 20px !important;
  clear:both !important;
}

/* Cards não podem ultrapassar coluna */
.ip-dash-kpi,
.ip-dash-panel {
  min-width:0 !important;
  max-width:100% !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}

/* Linha de gráficos: 2 colunas */
.ip-dash-main-grid {
  display:grid !important;
  grid-template-columns:minmax(0, 1.4fr) minmax(360px, .85fr) !important;
  gap:22px !important;
  width:100% !important;
  margin:0 0 20px !important;
  align-items:stretch !important;
  clear:both !important;
}

/* Linha inferior: 2 colunas */
.ip-dash-bottom-grid {
  display:grid !important;
  grid-template-columns:minmax(0, 1fr) minmax(0, 1fr) !important;
  gap:22px !important;
  width:100% !important;
  margin:0 0 20px !important;
  align-items:stretch !important;
  clear:both !important;
}

/* Corrige o painel gráfico para não virar coluna estreita */
.ip-dash-main-grid > .ip-dash-panel,
.ip-dash-bottom-grid > .ip-dash-panel {
  width:100% !important;
}

/* Garante que o gráfico respeite largura do card */
.ip-dash-chart,
.ip-dash-line-svg {
  width:100% !important;
  max-width:100% !important;
}

/* Evita texto espremido quebrando layout */
.ip-dash-panel h2,
.ip-dash-activity-title,
.ip-dash-event-title {
  overflow-wrap:normal !important;
  word-break:normal !important;
}

/* Tira tabs "quebradas" como navegação real por enquanto: ficam como abas visuais do hero */
.ip-dash-tab {
  cursor:default !important;
}

.ip-dash-tab:not(.active) {
  opacity:.82;
}

/* Desktop menor */
@media(max-width:1280px){
  .ip-dash-grid-kpis,
  .ip-dash-grid-secondary {
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  }

  .ip-dash-main-grid,
  .ip-dash-bottom-grid {
    grid-template-columns:1fr !important;
  }
}

/* Tablet/mobile */
@media(max-width:760px){
  .ip-dash-grid-kpis,
  .ip-dash-grid-secondary,
  .ip-dash-main-grid,
  .ip-dash-bottom-grid {
    grid-template-columns:1fr !important;
    gap:16px !important;
  }

  .ip-dash-kpi,
  .ip-dash-panel {
    width:100% !important;
  }
}
