/* ── PATCH 2026-05-15: Últimas Vendas ── */
#statsView .st-uv-head{
  display:grid;
  grid-template-columns:90px 1fr 100px 110px 80px;
  gap:6px;
  padding:6px 10px;
  font-size:11px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
  border-bottom:1px solid var(--border);
}
#statsView .st-uv-list{ display:flex; flex-direction:column; }
#statsView .st-uv-row{
  display:grid;
  grid-template-columns:90px 1fr 100px 110px 80px;
  gap:6px;
  padding:7px 10px;
  border-bottom:1px solid var(--border);
  font-size:12px;
  align-items:center;
  transition:background .15s;
}
#statsView .st-uv-row:last-child{ border-bottom:none; }
#statsView .st-uv-row:hover{ background:var(--surface2,#f5f5f7); }
#statsView .st-uv-num{ font-family:monospace; font-size:11px; color:var(--muted); }
#statsView .st-uv-cli{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#statsView .st-uv-prod{ color:var(--muted); font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#statsView .st-uv-time{ display:flex; flex-direction:column; gap:1px; }
#statsView .st-uv-date{ font-size:11px; }
#statsView .st-uv-hora{ font-size:11px; font-weight:700; color:var(--accent,#1a73e8); }
#statsView .st-uv-hora-nd{ font-weight:400; color:var(--muted); font-style:italic; }
#statsView .st-uv-val{ text-align:right; font-weight:700; }
body:not([data-theme="light"]) #statsView .st-uv-row:hover{ background:rgba(255,255,255,.04); }


/* ── PATCH 2026-05-15: Botão copiar título no histórico ── */
.hp-copy-title-btn{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:2px 7px;
  border-radius:6px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--muted);
  font-size:10px;
  font-weight:600;
  cursor:pointer;
  transition:all .15s;
  white-space:nowrap;
  user-select:none;
  flex-shrink:0;
}
.hp-copy-title-btn:hover{
  background:var(--accent-dim,#e8f0fe);
  border-color:var(--accent-border,#c5d8fc);
  color:var(--accent,#1a73e8);
}
.hp-copy-title-btn.copied{
  background:#e6f4ea;
  border-color:#a8d5b5;
  color:#137333;
}


/* ── PATCH 2026-05-15: Número do pedido editável no histórico ── */
.hp-card-num-wrap{
  display:inline-flex;
  align-items:center;
  gap:4px;
  position:relative;
}
.hp-num-input{
  font-size:10px;
  font-weight:800;
  color:var(--faint);
  font-family:'Inter',monospace;
  letter-spacing:.06em;
  background:var(--surface3);
  border:1px solid var(--border);
  border-radius:var(--r-sm);
  padding:3px 7px;
  white-space:nowrap;
  width:auto;
  min-width:80px;
  max-width:130px;
  text-align:center;
  cursor:text;
  outline:none;
  transition:border-color .15s, box-shadow .15s;
}
.hp-num-input:focus{
  border-color:var(--accent,#1a73e8);
  box-shadow:0 0 0 2px var(--accent-glow,rgba(26,115,232,.15));
  color:var(--fg);
  background:var(--surface);
}
.hp-num-input.saving{
  border-color:#fbbc04;
  color:#ea8600;
}
.hp-num-input.saved{
  border-color:#34a853;
  color:#137333;
  background:#e6f4ea;
}
.hp-num-input.error{
  border-color:#ea4335;
  color:#c5221f;
}

/* Estatísticas — refinamento visual: menos peso, mais respiro e leitura mais SaaS */
#statsView.stats-view{
  padding:18px 20px 26px !important;
  background:
    radial-gradient(circle at 8% 0%, rgba(26,115,232,.055), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 96%, #fff), var(--bg)) !important;
}
#statsView .stats-wrap{
  max-width:1320px !important;
  gap:14px !important;
}

/* Header mais compacto */
#statsView .stats-hero{
  min-height:unset !important;
  padding:16px 18px !important;
  border-radius:20px !important;
  box-shadow:0 1px 2px rgba(60,64,67,.045), 0 8px 22px rgba(60,64,67,.045) !important;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface)) !important;
}
#statsView .stats-title{
  font-size:20px !important;
  letter-spacing:-.045em !important;
}
#statsView .stats-sub{
  font-size:12px !important;
  margin-top:4px !important;
  line-height:1.45 !important;
  max-width:68ch !important;
}
#statsView .stats-sync-chip{
  min-height:30px !important;
  padding:6px 10px !important;
  font-size:11px !important;
}

/* Filtros mais discretos */
#statsView .stats-filters{
  padding:11px 12px !important;
  border-radius:18px !important;
  gap:9px !important;
  box-shadow:0 1px 2px rgba(60,64,67,.035) !important;
}
#statsView .st-filter-row{
  gap:7px !important;
}
#statsView .st-filter-label{
  font-size:9px !important;
  min-width:52px !important;
}
#statsView .st-pill,
#statsView .st-select,
#statsView .st-date{
  min-height:30px !important;
  padding:6px 11px !important;
  font-size:11px !important;
  border-radius:999px !important;
  box-shadow:none !important;
}
#statsView .st-pill:hover{
  transform:none !important;
}

/* KPIs mais baixos e menos pesados */
#statsView .stats-kpis{
  grid-template-columns:repeat(6,minmax(0,1fr)) !important;
  gap:10px !important;
}
#statsView .st-kpi{
  min-height:86px !important;
  padding:12px 13px 11px !important;
  border-radius:17px !important;
  gap:5px !important;
  box-shadow:0 1px 2px rgba(60,64,67,.04), 0 6px 18px rgba(60,64,67,.04) !important;
}
#statsView .st-kpi:before{
  height:3px !important;
  opacity:.72 !important;
}
#statsView .st-kpi-label{
  font-size:9px !important;
  letter-spacing:.095em !important;
}
#statsView .st-kpi-value{
  font-size:21px !important;
  letter-spacing:-.05em !important;
}
#statsView .st-kpi-sub{
  font-size:10.5px !important;
  line-height:1.25 !important;
}

/* Cards e gráficos com menos volume */
#statsView .stats-grid{
  gap:12px !important;
}
#statsView .st-card{
  border-radius:18px !important;
  box-shadow:0 1px 2px rgba(60,64,67,.035), 0 8px 22px rgba(60,64,67,.04) !important;
}
#statsView .st-card-head{
  padding:12px 14px !important;
  min-height:56px !important;
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, var(--accent) 3%), var(--surface)) !important;
}
#statsView .st-card-title{
  font-size:12.5px !important;
}
#statsView .st-card-sub{
  font-size:10.5px !important;
  line-height:1.35 !important;
}
#statsView .st-card-badge{
  padding:3px 8px !important;
  font-size:9px !important;
}
#statsView .st-card-body{
  padding:11px 13px !important;
}

/* primeira linha: deixa gráficos mais horizontais e leves */
#statsView .st-card.span-6{
  grid-column:span 6;
}
#statsView .st-chart-bars{
  gap:8px !important;
}
#statsView .st-bar-row{
  grid-template-columns:92px minmax(0,1fr) 82px !important;
  gap:8px !important;
}
#statsView .st-bar-label,
#statsView .st-bar-val{
  font-size:10.5px !important;
}
#statsView .st-bar-track,
#statsView .st-progress{
  height:7px !important;
}

/* Tabelas mais densas, sem cara pesada */
#statsView .st-table th{
  padding:8px 10px !important;
  font-size:9px !important;
  background:color-mix(in srgb, var(--surface) 96%, var(--bg) 4%) !important;
}
#statsView .st-table td{
  padding:8px 10px !important;
  font-size:11.5px !important;
}
#statsView .st-name-main{
  font-size:11.5px !important;
}
#statsView .st-name-sub{
  font-size:9.5px !important;
}
#statsView .st-table tbody tr:hover td{
  background:color-mix(in srgb, var(--accent) 4%, transparent);
}

/* Mini cards e blocos complementares */
#statsView .st-wind-grid{
  gap:8px !important;
}
#statsView .st-mini{
  padding:10px 11px !important;
  border-radius:14px !important;
}
#statsView .st-mini-label{
  font-size:9px !important;
}
#statsView .st-mini-value{
  font-size:16px !important;
}
#statsView .st-abc-row{
  padding:9px 10px !important;
  border-radius:14px !important;
}
#statsView .st-abc-class{
  width:34px !important;
  height:34px !important;
  border-radius:12px !important;
  font-size:15px !important;
}
#statsView .st-empty{
  padding:18px !important;
  font-size:12px !important;
}
#statsView .st-note{
  font-size:10.5px !important;
  padding:9px 10px !important;
}

/* Reposicionamento: Produtos ocupa bem, blocos auxiliares não parecem "paredes" */
#statsView .st-card.span-12 .st-card-body{
  padding-top:8px !important;
}
#statsView .st-card.span-12{
  border-radius:20px !important;
}

/* Light mode com contraste suave */
body[data-theme="light"] #statsView.stats-view{
  background:
    radial-gradient(circle at 10% 0%, rgba(26,115,232,.06), transparent 30%),
    #f6f8fc !important;
}
body[data-theme="light"] #statsView .stats-hero,
body[data-theme="light"] #statsView .stats-filters,
body[data-theme="light"] #statsView .st-kpi,
body[data-theme="light"] #statsView .st-card{
  border-color:#e7ecf4 !important;
}
body[data-theme="light"] #statsView .st-mini,
body[data-theme="light"] #statsView .st-abc-row{
  background:#f7f9fd !important;
  border-color:#e9eef6 !important;
}

/* Responsivo desktop menor */
@media(max-width:1320px){
  #statsView .stats-kpis{grid-template-columns:repeat(3,minmax(0,1fr)) !important}
}
@media(max-width:980px){
  #statsView .stats-kpis{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
  #statsView .st-card.span-4,
  #statsView .st-card.span-5,
  #statsView .st-card.span-6,
  #statsView .st-card.span-7,
  #statsView .st-card.span-8{grid-column:1/-1 !important}
}
