/* ============================================================
   Termipest Core System (TCS) — Home v4
   Estilos da página inicial modularizada por perfil.

   Convive com os estilos .home-* legados do <style> inline em
   public/index.html. Sempre que houver conflito, .home-v4-*
   tem precedência por especificidade da classe.
   ============================================================ */

/* ─── Layout principal ─────────────────────────────────────── */
.home-v4-cards{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:14px;
  margin-bottom:22px;
}
.home-v4-main{
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(0, 1fr);
  gap:18px;
  margin-bottom:22px;
}
.home-v4-bottom{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-bottom:22px;
}
@media(max-width:1100px){
  .home-v4-cards{grid-template-columns:repeat(2, 1fr);}
  .home-v4-main{grid-template-columns:1fr;}
  .home-v4-bottom{grid-template-columns:1fr;}
}

/* ─── Cards estratégicos ──────────────────────────────────── */
.home-v4-card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px 18px;
  display:flex;
  flex-direction:column;
  gap:6px;
  position:relative;
  overflow:hidden;
}
.home-v4-card .v4-card-label{
  font-size:11px;
  font-weight:600;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--text-soft);
}
.home-v4-card .v4-card-value{
  font-size:26px;
  font-weight:700;
  color:var(--text);
  line-height:1.1;
  letter-spacing:-.01em;
  font-feature-settings:"tnum";
}
.home-v4-card .v4-card-trend{
  font-size:11.5px;
  font-weight:500;
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.home-v4-card .v4-card-trend.up   { color:var(--c-aprov, #6b7a2a); }
.home-v4-card .v4-card-trend.down { color:var(--c-cancel, #b14a4a); }
.home-v4-card .v4-card-trend.flat { color:var(--text-soft); }
.home-v4-card .v4-card-sub{
  font-size:11px;
  color:var(--text-soft);
}

/* ─── Painéis (gráficos / ranking) ────────────────────────── */
.home-v4-panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  padding:18px 20px;
}
.home-v4-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
}
.home-v4-panel-title{
  font-size:13px;
  font-weight:700;
  color:var(--text);
  letter-spacing:-.01em;
}
.home-v4-panel-sub{
  font-size:11px;
  color:var(--text-soft);
}

/* ─── Gráfico de barras (SVG) ─────────────────────────────── */
.v4-chart{ width:100%; }
.v4-chart .v4-axis{
  stroke:var(--line);
  stroke-width:1;
}
.v4-chart .v4-grid{
  stroke:var(--line);
  stroke-width:1;
  stroke-dasharray:3 3;
  opacity:.5;
}
.v4-chart .v4-bar{
  fill:var(--primary, #6b7a2a);
  transition:opacity .15s;
}
.v4-chart .v4-bar.alt{ fill:#b48a00; }
.v4-chart .v4-bar:hover{ opacity:.85; }
.v4-chart .v4-line{
  fill:none;
  stroke-width:2;
  stroke-linejoin:round;
  stroke-linecap:round;
}
.v4-chart .v4-line.curr{ stroke:var(--primary, #6b7a2a); }
.v4-chart .v4-line.prev{ stroke:var(--text-soft); stroke-dasharray:4 3; }
.v4-chart .v4-dot{
  fill:var(--card);
  stroke:var(--primary, #6b7a2a);
  stroke-width:2;
}
.v4-chart .v4-label{
  font-size:10px;
  fill:var(--text-soft);
  font-family:inherit;
}
.v4-chart .v4-value{
  font-size:10px;
  font-weight:600;
  fill:var(--text);
  font-family:inherit;
}
.v4-chart-legend{
  display:flex;
  gap:14px;
  font-size:11px;
  color:var(--text-soft);
  margin-top:8px;
}
.v4-chart-legend .leg-dot{
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:2px;
  margin-right:6px;
  vertical-align:middle;
}

/* ─── Ranking / Pipeline (lista lateral) ──────────────────── */
.v4-rank-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 0;
  border-bottom:1px solid var(--line);
}
.v4-rank-item:last-child{ border-bottom:none; }
.v4-rank-pos{
  width:22px;
  height:22px;
  border-radius:6px;
  background:var(--section-bg);
  color:var(--text-soft);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:700;
  flex-shrink:0;
}
.v4-rank-item:nth-child(1) .v4-rank-pos{ background:rgba(107,122,42,.15); color:#6b7a2a; }
.v4-rank-name{
  flex:1;
  font-size:12.5px;
  font-weight:500;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.v4-rank-bar{
  flex:1;
  height:4px;
  background:var(--line);
  border-radius:2px;
  overflow:hidden;
  max-width:90px;
}
.v4-rank-bar > div{
  height:100%;
  background:var(--primary, #6b7a2a);
  border-radius:2px;
}
.v4-rank-qtd{
  font-size:12px;
  font-weight:700;
  color:var(--text);
  min-width:28px;
  text-align:right;
  font-feature-settings:"tnum";
}

/* ─── Pipeline blocks ─────────────────────────────────────── */
.v4-pipe-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 0;
  border-bottom:1px solid var(--line);
}
.v4-pipe-row:last-child{ border-bottom:none; }
.v4-pipe-row .v4-pipe-label{
  font-size:12.5px;
  color:var(--text);
}
.v4-pipe-row .v4-pipe-num{
  font-size:18px;
  font-weight:700;
  color:var(--text);
  font-feature-settings:"tnum";
}

/* ─── Alertas inteligentes ────────────────────────────────── */
.v4-alert{
  display:flex;
  gap:10px;
  padding:10px 12px;
  border-radius:8px;
  margin-bottom:8px;
  font-size:12px;
  line-height:1.45;
  border:1px solid;
}
.v4-alert:last-child{ margin-bottom:0; }
.v4-alert .v4-alert-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  margin-top:6px;
  flex-shrink:0;
}
.v4-alert .v4-alert-title{ font-weight:600; color:var(--text); }
.v4-alert .v4-alert-detail{ color:var(--text-soft); margin-top:2px; }
.v4-alert.warn{ background:rgba(180,138,0,.06); border-color:rgba(180,138,0,.25); }
.v4-alert.warn .v4-alert-dot{ background:#b48a00; }
.v4-alert.info{ background:rgba(67,90,140,.06); border-color:rgba(67,90,140,.2); }
.v4-alert.info .v4-alert-dot{ background:#5e7cb3; }
.v4-alert.good{ background:rgba(107,122,42,.06); border-color:rgba(107,122,42,.25); }
.v4-alert.good .v4-alert-dot{ background:#6b7a2a; }

/* ─── Atalhos rápidos (reaproveita .home-shortcut) ────────── */
.home-v4-shortcuts-grid{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:10px;
}
@media(max-width:1100px){ .home-v4-shortcuts-grid{ grid-template-columns:repeat(2, 1fr); } }

/* ─── Feed inteligente ────────────────────────────────────── */
.v4-feed-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 0;
  border-bottom:1px solid var(--line);
}
.v4-feed-row:last-child{ border-bottom:none; }
.v4-feed-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  flex-shrink:0;
}
.v4-feed-dot.aprov{ background:var(--c-aprov, #6b7a2a); }
.v4-feed-dot.aguard{ background:var(--c-aguard, #b48a00); }
.v4-feed-dot.cancel{ background:var(--c-cancel, #b14a4a); }
.v4-feed-info{ flex:1; min-width:0; }
.v4-feed-name{
  font-size:12.5px;
  font-weight:500;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.v4-feed-meta{
  font-size:10.5px;
  color:var(--text-soft);
  margin-top:1px;
}
.v4-feed-status{
  font-size:11px;
  font-weight:500;
  padding:3px 8px;
  border-radius:var(--radius-lg, 999px);
  white-space:nowrap;
}

/* ─── Estado de loading ───────────────────────────────────── */
.v4-empty{
  text-align:center;
  padding:24px 0;
  color:var(--text-soft);
  font-size:12px;
}
