/* ══════════════════════════════════════════════════════════════
   FB · DESEMPENHO · Drawer "Performance do Motorista" · v1.0
   ──────────────────────────────────────────────────────────────
   Cromo (header/painel) = tokens da marca (var(--sidebar)/--accent)
   com fallback hardcoded → roxo/teal no Perito, teal/navy no FB.
   Cor do DADO = semântica fixa (definida inline pelo JS).
   Tipografia: Barlow / Barlow Condensed (já carregadas pela casca).
   ══════════════════════════════════════════════════════════════ */

/* ── Shell do drawer (global) ──────────────────────────────── */
.dd-drawer { position: fixed; inset: 0; z-index: 1400; font-family: 'Barlow', system-ui, sans-serif; }
.dd-drawer .dd-overlay {
  position: absolute; inset: 0; background: rgba(20, 14, 32, .46);
  opacity: 0; transition: opacity .3s ease; backdrop-filter: blur(2px);
}
.dd-drawer.is-open .dd-overlay { opacity: 1; }
.dd-drawer .dd-panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(900px, 94vw); background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(20, 14, 32, .28);
  transform: translateX(40px); opacity: 0;
  transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .32s ease;
}
.dd-drawer.is-open .dd-panel { transform: translateX(0); opacity: 1; }

/* Header — gradiente da sidebar (tokens) */
.dd-head {
  position: relative; padding: 26px 30px 22px; color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent, #58C8DC) -40%, transparent 46%),
    linear-gradient(135deg, var(--sidebar, #381D54), var(--primary-dark, #2A1640));
}
.dd-eyebrow {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; font-size: 12.5px;
  color: rgba(255,255,255,.74); margin-bottom: 4px;
}
.dd-titulo { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.12; letter-spacing: -.01em; }
.dd-meta { margin-top: 6px; font-size: 13px; color: rgba(255,255,255,.78); }
.dd-close {
  position: absolute; top: 16px; right: 18px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 22px; line-height: 1;
  background: rgba(255,255,255,.14); color: #fff; transition: background .15s;
}
.dd-close:hover { background: rgba(255,255,255,.26); }

/* Body */
.dd-body { flex: 1; overflow-y: auto; overflow-x: hidden; background: #FAFAFB; }
.dd-loading { display: flex; align-items: center; gap: 10px; padding: 40px 30px; color: #6b7280; font-size: 14px; }
.dd-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid #e4e4e7; border-top-color: var(--accent, #58C8DC);
  animation: dd-spin .8s linear infinite;
}
@keyframes dd-spin { to { transform: rotate(360deg); } }

/* ── Conteúdo (reaproveitável fora do drawer) ──────────────── */
.dd-root { padding: 22px 30px 34px; color: #1f2430; }
.dd-root section { animation: dd-rise .4s ease both; }
.dd-root section:nth-child(2) { animation-delay: .04s; }
.dd-root section:nth-child(3) { animation-delay: .08s; }
.dd-root section:nth-child(4) { animation-delay: .12s; }
.dd-root section:nth-child(5) { animation-delay: .16s; }
.dd-root section:nth-child(6) { animation-delay: .20s; }
@keyframes dd-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dd-sec { margin-top: 22px; }
.dd-cap {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  text-transform: uppercase; letter-spacing: .045em; font-size: 14px;
  color: #2A1640; margin-bottom: 11px;
}
.dd-cap-sub, .dd-chips-cap-sub { font-weight: 500; text-transform: none; letter-spacing: 0; color: #9aa0aa; font-size: 12px; font-family: 'Barlow', sans-serif; }

/* Hero — gauge geral + sub-notas */
.dd-hero {
  display: flex; align-items: center; justify-content: center; gap: 32px; flex-wrap: wrap;
  padding: 20px 22px; border-radius: 16px; background: #fff;
  border: 1px solid #eceaf0; box-shadow: 0 1px 2px rgba(20,14,32,.04);
}
.dd-hero-gauges { flex: 1 1 470px; max-width: 540px; min-width: 260px; }
.dd-cluster-svg { width: 100%; height: auto; display: block; }

/* Coach — "3 pontos a melhorar" */
.dd-coach {
  margin-top: 18px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(180deg, #fff, #fdfbf4);
  border: 1px solid #f0e6c9; border-left: 4px solid var(--accent, #58C8DC);
}
.dd-coach--ok { background: linear-gradient(180deg, #fff, #effaf1); border-color: #cdeed6; border-left-color: #05AB34; }
.dd-coach-h { font-weight: 700; font-size: 14.5px; color: #2A1640; margin-bottom: 8px; }
.dd-coach p { margin: 0; font-size: 13.5px; color: #4b5563; line-height: 1.5; }
.dd-coach-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.dd-coach-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: #374151; line-height: 1.45; }
.dd-coach-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; }

/* Barra de composição */
.dd-compbar { display: flex; height: 16px; border-radius: 9px; overflow: hidden; background: #eef0f2; }
.dd-compbar span { display: block; height: 100%; }
.dd-legs { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 11px; }
.dd-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #4b5563; }
.dd-leg i { width: 11px; height: 11px; border-radius: 3px; }
.dd-leg b { color: #1f2430; font-weight: 700; }

/* Chips de indicador */
.dd-chips-grupo + .dd-chips-grupo { margin-top: 14px; }
.dd-chips-cap { font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.dd-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 9px; }
.dd-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 11px; background: #fff; border: 1px solid #ececf0;
}
.dd-chip--ctx { background: #f7f7f9; border-style: dashed; }
.dd-chip-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; }
.dd-chip-tx { display: flex; flex-direction: column; min-width: 0; }
.dd-chip-t { font-size: 12.5px; color: #4b5563; line-height: 1.2; }
.dd-chip-v { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 17px; color: #1f2430; line-height: 1.15; }

/* Grid de estatísticas */
.dd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.dd-stat { padding: 12px 14px; border-radius: 11px; background: #fff; border: 1px solid #ececf0; }
.dd-stat--alert { background: #fafafb; }
.dd-stat-v { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 21px; color: #1f2430; }
.dd-stat-l { font-size: 11.5px; color: #6b7280; margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }
.dd-stat-i { cursor: help; color: #b9933f; font-style: normal; }

/* Mapa de risco */
.dd-map { height: 320px; width: 100%; border-radius: 13px; overflow: hidden; border: 1px solid #e4e4e7; background: #eef1f4; }
.dd-maplegs { display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 10px; }
.dd-mapleg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #4b5563; }
.dd-mapleg i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.dd-mapleg b { color: #1f2430; }
.dd-pop { font-family: 'Barlow', sans-serif; font-size: 12.5px; line-height: 1.5; }

/* Vazios */
.dd-empty { text-align: center; padding: 48px 30px; color: #6b7280; }
.dd-empty-ic { font-size: 40px; margin-bottom: 8px; }
.dd-empty h3 { margin: 0 0 6px; color: #2A1640; font-size: 18px; }
.dd-empty p { margin: 0 auto; max-width: 360px; font-size: 13.5px; line-height: 1.5; }
.dd-empty-sm { padding: 20px; text-align: center; color: #9aa0aa; font-size: 13px; background: #f7f7f9; border-radius: 11px; }

/* Mobile */
@media (max-width: 560px) {
  .dd-drawer .dd-panel { width: 100vw; }
  .dd-root { padding: 18px 16px 30px; }
  .dd-head { padding: 22px 18px 18px; }
  .dd-hero { gap: 16px; justify-content: center; }
  .dd-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Abas Resumo / Dia a dia ───────────────────────────────── */
.dd-tabs { display: flex; gap: 4px; padding: 4px; background: #f0eef4; border-radius: 11px; margin-bottom: 18px; }
.dd-tab {
  flex: 1; border: 0; cursor: pointer; padding: 9px 12px; border-radius: 8px;
  background: transparent; color: #6b6478; font-weight: 600; font-size: 13.5px;
  font-family: 'Barlow', sans-serif; transition: background .15s, color .15s;
}
.dd-tab.is-active { background: #fff; color: #2A1640; box-shadow: 0 1px 2px rgba(20,14,32,.08); }
.dd-tab-c { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--accent, #58C8DC); color: #08313a; font-size: 11px; font-weight: 700; }
.dd-pane.is-hidden { display: none; }

/* ── Tabela Dia a dia ──────────────────────────────────────── */
.dd-daywrap { border: 1px solid #ececf0; border-radius: 13px; overflow: hidden; background: #fff; }
.dd-daytab { width: 100%; border-collapse: collapse; font-size: 13px; }
.dd-daytab thead th {
  position: sticky; top: 0; background: #faf9fc; color: #6b6478;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; font-size: 12px; padding: 9px 10px; text-align: left; border-bottom: 1px solid #ececf0;
}
.dd-daytab td { padding: 9px 10px; border-bottom: 1px solid #f3f2f6; color: #1f2430; }
.dd-daytab tbody tr:last-child td { border-bottom: 0; }
.dd-daytab tbody tr:hover { background: #faf9fc; }
.dd-daytab tbody tr.dd-d-gap td { background: #fbfbfc; color: #9aa0aa; }
.dd-daytab tbody tr.dd-d-gap td.dd-d-dia b { color: #6b7280; }
.dd-d-num { text-align: right; font-variant-numeric: tabular-nums; }
.dd-d-c { text-align: center; }
.dd-d-dia b { font-weight: 700; }
.dd-d-jan { display: block; font-size: 11px; color: #9aa0aa; }
.dd-daypill {
  display: inline-block; min-width: 30px; padding: 3px 7px; border-radius: 8px;
  color: #fff; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 14px;
}
.dd-day-foot { margin: 10px 2px 0; font-size: 12px; color: #9aa0aa; line-height: 1.45; }

/* ── Marcadores e clusters do mapa ─────────────────────────── */
.dd-pt-wrap { background: transparent !important; border: 0 !important; }
.dd-pt { display: block; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.dd-clu-wrap { background: transparent !important; border: 0 !important; }
.dd-clu {
  border-radius: 50%; color: #fff; text-align: center; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif; border: 2.5px solid rgba(255,255,255,.92);
  box-shadow: 0 2px 6px rgba(0,0,0,.3); font-size: 13px;
}

@media (max-width: 560px) {
  .dd-daytab { font-size: 12px; }
  .dd-daytab thead th, .dd-daytab td { padding: 7px 6px; }
}

/* ── Legenda de criticidade do mapa ────────────────────────── */
.dd-mapcrit { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dd-mapcrit-l { font-size: 11.5px; color: #9aa0aa; }
.dd-mapcrit-bar {
  flex: 0 0 120px; height: 9px; border-radius: 5px;
  background: linear-gradient(90deg, #05AB34, #E0BE4F, #E8743B, #F0392B);
}
.dd-maplegs .dd-mapleg-cap { font-size: 11.5px; color: #9aa0aa; margin-right: 2px; }

/* ── Card de indicador: total + MKBE ───────────────────────── */
.dd-chip-v em { font-style: normal; font-size: 11.5px; font-weight: 500; color: #9aa0aa; font-family: 'Barlow', sans-serif; }
.dd-chip-mkbe { display: block; font-size: 11px; color: #6b7280; margin-top: 1px; cursor: help; }

/* ── Hero: grupo [gauges + período] centralizado, composição embaixo ─── */
.dd-hero { justify-content: center; }
.dd-hero-resumo { display: flex; flex-direction: column; gap: 13px; min-width: 168px; padding-left: 24px; border-left: 1px solid #eceaf0; }
.dd-hr-item { display: flex; flex-direction: column; }
.dd-hr-l { font-size: 11px; color: #9aa0aa; text-transform: uppercase; letter-spacing: .03em; }
.dd-hr-v { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 20px; color: #2A1640; }
.dd-hero-comp { flex-basis: 100%; width: 100%; margin-top: 4px; padding-top: 16px; border-top: 1px solid #eceaf0; }
.dd-hero-comp-cap { display: block; font-size: 11px; color: #9aa0aa; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }

/* estatísticas: 4 itens em 2×2 (km/dias subiram pro hero) */
.dd-stats { grid-template-columns: repeat(2, 1fr); }

/* ── Skeleton ──────────────────────────────────────────────── */
.dd-sk > *, .dd-sk-hero > *, .dd-sk-side span, .dd-sk-chips span {
  background: linear-gradient(90deg, #ededf1 25%, #f6f6f8 37%, #ededf1 63%);
  background-size: 400% 100%; animation: dd-shimmer 1.4s ease infinite; border-radius: 10px;
}
@keyframes dd-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.dd-sk-tabs { height: 42px; border-radius: 11px; margin-bottom: 18px; }
.dd-sk-hero { display: flex; align-items: center; gap: 22px; background: none !important; animation: none !important; padding: 6px 0; }
.dd-sk-circle { width: 120px; height: 120px; border-radius: 50% !important; flex: 0 0 120px; }
.dd-sk-mini { width: 70px; height: 70px; border-radius: 50% !important; flex: 0 0 70px; }
.dd-sk-side { margin-left: auto; display: flex; flex-direction: column; gap: 9px; background: none !important; animation: none !important; }
.dd-sk-side span { width: 140px; height: 16px; }
.dd-sk-coach { height: 70px; margin: 16px 0; }
.dd-sk-line { height: 14px; width: 60%; margin: 14px 0 10px; }
.dd-sk-line.lg { width: 38%; height: 16px; }
.dd-sk-bar { height: 16px; }
.dd-sk-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; background: none !important; animation: none !important; }
.dd-sk-chips span { height: 48px; }
.dd-sk-map { height: 300px; margin-top: 6px; }

@media (max-width: 560px) {
  .dd-hero-resumo { margin-left: 0; border-left: 0; padding-left: 0; border-top: 1px solid #eceaf0; padding-top: 12px; width: 100%; flex-direction: row; justify-content: space-between; }
}
