/* Voa Entregador — Página de estatísticas e toast
   Carregado da estrutura de componentes */

.stats {
    position: absolute;
    inset: 0;
    bottom: var(--bottom-nav-h);
    background: var(--bg);
    z-index: 20;
    overflow-y: auto;
    display: none;
  }
  .stats.show { display: flex; flex-direction: column; }

  /* Header igual o do cadastro */
  .stats-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--ink-200);
    flex-shrink: 0;
  }
  .stats-topbar h1 {
    margin: 0;
    font-size: 17px; font-weight: 700; letter-spacing: -0.015em;
    flex: 1;
  }

  .stats-body {
    padding: 16px;
    display: flex; flex-direction: column; gap: 16px;
    overflow-y: auto;
    flex: 1;
  }

  /* Grid de 4 KPIs (2x2) */
  .kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .kpi-card {
    background: var(--surface);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 14px 14px 16px;
    display: flex; flex-direction: column;
    gap: 10px;
    position: relative;
    min-width: 0;
  }
  .kpi-card .kpi-top {
    display: flex; align-items: center; justify-content: space-between;
  }
  .kpi-card .kpi-ic {
    width: 32px; height: 32px; border-radius: 10px;
    background: var(--ink-100);
    color: var(--ink-700);
    display: grid; place-items: center;
    flex-shrink: 0;
  }
  .kpi-card .kpi-pill {
    font-size: 11px; font-weight: 600;
    color: var(--ink-500);
    padding: 2px 8px;
    background: var(--ink-100);
    border-radius: 999px;
    line-height: 1.4;
  }
  .kpi-card .kpi-pill.brand {
    color: var(--brand);
    background: var(--brand-soft);
  }
  .kpi-card .kpi-value {
    font-size: 30px; font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--ink-900);
  }
  .kpi-card .kpi-label {
    font-size: 10.5px; font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-400);
    margin-top: -4px;
  }

  /* Card total (hero minimalista no topo) */
  .stat-total {
    background: var(--surface);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 22px 18px 20px;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .stat-total .stat-total-value {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--brand);
  }
  .stat-total .stat-total-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-400);
  }

  /* Cards de seção (dist. por status / gráfico) */
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 16px;
  }
  .stat-card h3 {
    margin: 0;
    font-size: 14px; font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink-900);
  }
  .stat-card .stat-sub {
    margin: 2px 0 0;
    font-size: 12px; color: var(--ink-500); font-weight: 500;
  }

  /* Header dos cards (título/subtítulo à esquerda, ícone à direita) */
  .stat-card .stat-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }
  .stat-card .stat-header .stat-ic-right {
    width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--ink-100);
    color: var(--ink-500);
    flex-shrink: 0;
  }
  /* Column chart "Horários de pico" */
  .stats-peak-chart-wrap {
    position: relative;
    margin-top: 10px;
  }
  .stats-peak-chart {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
    height: 180px;
    align-items: end;
    padding: 4px 0;
  }
  .stats-peak-chart .col {
    position: relative;
    height: 100%;
    display: flex; align-items: flex-end;
    cursor: pointer;
  }
  .stats-peak-chart .col .col-bar {
    width: 100%;
    height: 0;
    background: var(--brand-soft);
    border-radius: 4px 4px 2px 2px;
    transition: height 0.5s cubic-bezier(0.22, 0.9, 0.28, 1), background 0.15s;
  }
  .stats-peak-chart .col:hover .col-bar { background: rgba(11,59,97,0.35); }
  .stats-peak-chart .col.now .col-bar { background: var(--brand); }
  .stats-peak-chart .col.now:hover .col-bar { background: #08304f; }
  .stats-peak-tooltip {
    position: absolute;
    display: none;
    background: var(--ink-900);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  }
  .stats-peak-tooltip::after {
    content: '';
    position: absolute;
    left: 50%; top: 100%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--ink-900);
  }
  .stats-peak-tooltip .t-label { color: rgba(255,255,255,0.7); margin-right: 6px; }
  .stats-peak-chart-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 8px;
  }
  .stats-peak-chart-labels span {
    font-size: 10px; font-weight: 500;
    color: var(--ink-400);
    text-align: center;
  }

  /* Bar chart horizontal "Distribuição por cidade" */
  .bars-wrap {
    display: flex; flex-direction: column;
    gap: 14px;
    margin-top: 4px;
  }
  .bar-row {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 12px;
    align-items: center;
  }
  .bar-row .bar-label {
    font-size: 13px; font-weight: 500;
    color: var(--ink-900);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .bar-row .bar-track {
    position: relative;
    height: 10px;
    background: var(--ink-100);
    border-radius: 999px;
    overflow: hidden;
  }
  .bar-row .bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 999px;
    width: 0;
    transition: width 0.6s cubic-bezier(0.22, 0.9, 0.28, 1);
  }
  .bar-row .bar-value {
    font-size: 12px; font-weight: 600;
    color: var(--ink-700);
    min-width: 32px;
    text-align: right;
  }

  /* Toast de sucesso */
  .toast {
    position: absolute;
    left: 16px; right: 16px;
    bottom: calc(var(--bottom-nav-h) + 20px);
    transform: translateY(20px);
    background: var(--ink-900); color: white;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 13px; font-weight: 500;
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.2s, transform 0.25s;
    z-index: 100;
    pointer-events: none;
    display: flex; align-items: flex-start; gap: 10px;
    max-width: 420px;
    margin: 0 auto;
  }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast .toast-ic {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--open); color: white;
    display: grid; place-items: center;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .toast .toast-text strong {
    display: block;
    font-weight: 700;
    margin-bottom: 2px;
  }
