/* Entregas — complementa o design system do hub MyPharm */

.ent-section { animation: entFade .25s ease; }
@keyframes entFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.ent-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.ent-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px !important;
  width: auto !important;
  height: auto !important;
  border-radius: 8px !important;
  font-weight: 600;
  white-space: nowrap;
}

.ent-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0;
}
.ent-form-grupo label {
  display: block;
  font-size: .72rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ent-form-grupo input,
.ent-form-grupo textarea,
.ent-input {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .9rem;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #0f172a);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ent-form-grupo input:focus,
.ent-form-grupo textarea:focus,
.ent-input:focus,
.ent-select:focus {
  border-color: var(--mp-brand, #E63946);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, .12);
}

/* Select próprio — evita conflito com .filter-select (setas repetidas) */
.ent-select,
.ent-form-grupo select.ent-select,
#entApp select.ent-select {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 40px 10px 12px;
  font-size: .9rem;
  line-height: 1.3;
  background-color: var(--bg-card, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px 12px !important;
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  outline: none;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}

.ent-toolbar .ent-input,
.ent-toolbar .ent-select {
  width: auto;
  min-width: 140px;
}

/* Liberar entrega */
.ent-liberar__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.ent-liberar__brand img {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
}
.ent-liberar__titles { flex: 1; min-width: 0; }
.ent-liberar__titles .chart-title { margin: 0; }
.ent-liberar__section {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ent-liberar__section--mot {
  border-color: rgba(230, 57, 70, .25);
  background: rgba(230, 57, 70, .04);
}
.ent-liberar__section-title {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ent-liberar__section-title i { color: var(--mp-brand, #E63946); }
.ent-liberar__alert {
  margin-bottom: 12px;
}
.ent-liberar__alert:empty { display: none; }
.ent-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .88rem;
  line-height: 1.4;
}
.ent-alert--ok {
  background: rgba(6, 214, 160, .1);
  color: #0f766e;
  border: 1px solid rgba(6, 214, 160, .3);
}
.ent-alert--warn {
  background: rgba(217, 119, 6, .1);
  color: #c2410c;
  border: 1px solid rgba(217, 119, 6, .3);
}
.ent-alert--info {
  background: rgba(2, 132, 199, .08);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, .25);
}

.ent-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.ent-cand {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  margin-bottom: 8px;
  background: var(--bg-card, #fff);
  transition: border-color .15s, background .15s;
}
.ent-cand:hover {
  border-color: var(--mp-brand, #E63946);
  background: rgba(230, 57, 70, .04);
}
.ent-cand strong { display: block; color: var(--text-primary); }
.ent-cand span { font-size: .8rem; color: var(--text-secondary, #64748b); }

.ent-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-secondary, #64748b);
  font-size: .9rem;
}

/* Status badges (hub-like) */
.ent-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.ent-status--liberado { background: rgba(2, 132, 199, .12); color: #0284c7; }
.ent-status--coletado { background: rgba(217, 119, 6, .14); color: #c2410c; }
.ent-status--entregue { background: rgba(6, 214, 160, .14); color: #0f766e; }
.ent-status--problema { background: rgba(230, 57, 70, .12); color: #c1121f; }
.ent-status--cancelado { background: rgba(100, 116, 139, .14); color: #64748b; }

/* Frota */
.ent-frota {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.ent-frota-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary, #f8fafc);
}
.ent-frota-card.is-online {
  border-color: rgba(6, 214, 160, .45);
  background: rgba(6, 214, 160, .08);
}
.ent-frota-card__name {
  font-weight: 700;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.ent-frota-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.ent-frota-dot.is-on {
  background: #06D6A0;
  box-shadow: 0 0 0 3px rgba(6, 214, 160, .25);
}
.ent-frota-card__meta {
  font-size: .8rem;
  color: var(--text-secondary, #64748b);
  margin-top: 6px;
  line-height: 1.45;
}
.ent-frota-card__meta a {
  color: var(--mp-brand, #E63946);
  font-weight: 600;
  text-decoration: none;
}

/* Barras dashboard */
.ent-bars { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.ent-bar-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; }
.ent-bar-row span { font-size: .8rem; color: var(--text-secondary); }
.ent-bar-row strong { font-size: .85rem; text-align: right; color: var(--text-primary); }
.ent-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-secondary, #e2e8f0);
  overflow: hidden;
}
.ent-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #E63946, #FF6B6B);
  min-width: 0;
  transition: width .4s ease;
}
.ent-bar-fill--info { background: linear-gradient(90deg, #0284C7, #38BDF8); }
.ent-bar-fill--warn { background: linear-gradient(90deg, #D97706, #FBBF24); }
.ent-bar-fill--ok { background: linear-gradient(90deg, #0F766E, #06D6A0); }
.ent-bar-fill--danger { background: linear-gradient(90deg, #C1121F, #E63946); }

.ent-serie {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding-top: 8px;
}
.ent-serie-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}
.ent-serie-col .ent-serie-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #E63946, #C1121F);
  min-height: 4px;
  transition: height .35s ease;
}
.ent-serie-col .ent-serie-lbl {
  font-size: .68rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.ent-serie-col .ent-serie-val {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Ranking */
.ent-rank-list { list-style: none; margin: 0; padding: 0; }
.ent-rank-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.ent-rank-list li:last-child { border-bottom: 0; }
.ent-rank-meta { flex: 1; min-width: 0; }
.ent-rank-meta strong {
  display: block;
  font-size: .9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ent-rank-meta span { font-size: .75rem; color: var(--text-secondary); }

/* Timeline */
.ent-timeline { list-style: none; padding: 0; margin: 0; }
.ent-timeline li {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--border, #e2e8f0);
  font-size: .85rem;
  color: var(--text-primary);
}
.ent-timeline li:last-child { padding-bottom: 0; }
.ent-timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mp-brand, #E63946);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, .15);
}
.ent-timeline__when {
  font-size: .75rem;
  color: var(--text-secondary, #64748b);
  margin-top: 2px;
}
.ent-timeline__note {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary, #64748b);
  font-size: .8rem;
}

.ent-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mp-brand, #E63946);
  font-weight: 600;
  text-decoration: none;
}

.ent-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ent-row-actions .topbar-btn {
  width: auto !important;
  height: auto !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
}

/* ===== Detalhe da entrega ===== */
.ent-detalhe {
  border: 1px solid var(--border, #e2e8f0);
  overflow: hidden;
}
.ent-detalhe__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.ent-detalhe__brand img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}
.ent-detalhe__titles { flex: 1; min-width: 0; }
.ent-detalhe__titles .chart-title { margin: 0; }
.ent-detalhe__titles .chart-subtitle { margin-top: 2px; }
.ent-detalhe__close {
  width: auto !important;
  height: auto !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  flex-shrink: 0;
}

.ent-det-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.ent-det-card {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
}
.ent-det-card__label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-secondary, #64748b);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ent-det-card__label i { color: var(--mp-brand, #E63946); }
.ent-det-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ent-det-card__text {
  font-size: .88rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.45;
  margin: 0;
}
.ent-det-card__text strong { color: var(--text-primary); }

.ent-det-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.ent-det-step {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-card, #fff);
}
.ent-det-step.is-done {
  border-color: rgba(6, 214, 160, .4);
  background: rgba(6, 214, 160, .06);
}
.ent-det-step.is-active {
  border-color: rgba(217, 119, 6, .45);
  background: rgba(217, 119, 6, .08);
}
.ent-det-step__k {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ent-det-step__v {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ent-det-loc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}
.ent-det-loc a,
.ent-det-loc .ent-det-loc__wait {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}
.ent-det-loc a {
  background: rgba(230, 57, 70, .08);
  color: var(--mp-brand, #E63946);
  border: 1px solid rgba(230, 57, 70, .2);
}
.ent-det-loc a:hover { background: rgba(230, 57, 70, .14); }
.ent-det-loc__wait {
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-secondary);
  border: 1px solid var(--border, #e2e8f0);
}

.ent-detalhe__timeline-wrap {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.ent-detalhe__section-title {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ent-detalhe__section-title i { color: var(--mp-brand, #E63946); }

.ent-detalhe__actions {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e2e8f0);
  gap: 10px;
}
.ent-btn-primary,
.ent-btn-warn,
.ent-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}
.ent-btn-primary {
  background: var(--mp-brand, #E63946);
  color: #fff;
  border-color: var(--mp-brand, #E63946);
}
.ent-btn-primary:hover { filter: brightness(.95); }
.ent-btn-warn {
  background: rgba(217, 119, 6, .1);
  color: #c2410c;
  border-color: rgba(217, 119, 6, .35);
}
.ent-btn-ghost {
  background: transparent;
  color: var(--text-secondary, #64748b);
  border-color: var(--border, #cbd5e1);
}
.ent-btn-ghost:hover { border-color: #94a3b8; color: var(--text-primary); }

.ent-code-pill {
  display: inline-block;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .82rem;
  font-weight: 700;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 4px 8px;
  letter-spacing: .03em;
}

#entApp .kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

#entApp .page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .ent-bar-row { grid-template-columns: 90px 1fr 36px; }
  .charts-grid { grid-template-columns: 1fr !important; }
  .ent-det-grid { grid-template-columns: 1fr; }
  .ent-det-steps { grid-template-columns: 1fr; }
  .ent-detalhe__head { flex-wrap: wrap; }
}
