/* =====================================================================
   PLANEJAMENTO · layout e estilo do painel de OS
   Carregado por último em index.html. Escopo em #detail para
   sobrescrever as regras antigas de modern.css e workspace.css.
   ===================================================================== */

#detail {
  --p-card: #fff;
  --p-line: #e3e9ee;
  --p-soft: #f5f8fa;
  --p-ink: #1d3645;
  --p-muted: #63798a;
  --p-accent: #214a63;
  --p-accent-soft: #e8f0f5;
  --p-radius: 12px;
}

/* Painel: fundo neutro e colunas de conteúdo */
#detail #fields {
  background: #f2f4f6;
  padding: 14px 16px 24px;
}

#detail #fields > section[data-pane] {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#detail #fields > section[data-pane][hidden],
#detail [hidden] {
  display: none !important;
}

/* ---------- Cartão do problema ---------- */
#detail .case-summary {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 36, 50, 0.05);
  margin: 0;
}

#detail .summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

#detail .summary-top-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

#detail .origin-pill {
  background: var(--p-accent-soft);
  color: var(--p-ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

#detail .summary-top-badges .badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
}

#detail [data-open-edit] {
  background: #fff;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--p-accent);
  cursor: pointer;
}

#detail [data-open-edit]:hover {
  background: var(--p-soft);
}

#detail .summary-problem .field-label,
#detail .summary-obs .field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-muted);
}

#detail .summary-problem-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--p-ink);
  margin: 6px 0 0;
  white-space: pre-wrap;
}

#detail .summary-obs {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 9px 12px;
  background: #fff8ef;
  border-left: 3px solid #f0b27a;
  border-radius: 6px;
  font-size: 12.5px;
  color: #6b4a2b;
}

#detail .obs-inline-tag {
  font-size: 10px;
  font-weight: 700;
  color: #9a6230;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

#detail .summary-edit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--p-line);
}

#detail .summary-edit .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

#detail .summary-edit .field.full {
  grid-column: 1 / -1;
}

#detail .summary-edit-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Fotos e vídeos */
#detail .media-section {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--p-line);
  border-radius: 0;
  padding: 14px 0 0;
  margin-top: 14px;
}

#detail .media-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--p-ink);
  margin: 0;
}

#detail .media-section h3 span {
  color: var(--p-muted);
  font-weight: 500;
}

#detail .media-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

#detail .media-thumb-card {
  width: 72px;
  height: 50px;
  border-radius: 6px;
  border: 1px solid var(--p-line);
}

#detail .add-media-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--p-accent);
}

/* ---------- Cartão de planejamento ---------- */
#detail #planning {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 36, 50, 0.05);
  margin: 0;
}

#detail #planning > .section-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

#detail #planning .section-line h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--p-ink);
  margin: 0;
}

#detail .planning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

#detail .planning-grid .full,
#detail .planning-grid .field.full,
#detail .planning-grid .schedule-occupancy-hint.full,
#detail .planning-grid .tech-selection-field {
  grid-column: 1 / -1;
}

#detail .field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-muted);
  margin-bottom: 6px;
  display: block;
}

#detail .field select,
#detail .field input,
#detail .field textarea {
  width: 100%;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--p-ink);
  background: #fff;
}

#detail .field textarea {
  min-height: 72px;
  resize: vertical;
}

#detail .field select:focus,
#detail .field input:focus,
#detail .field textarea:focus {
  outline: 2px solid rgba(33, 74, 99, 0.25);
  outline-offset: 0;
  border-color: var(--p-accent);
}

/* Agendamento */
#detail .schedule-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

#detail .schedule-label-row .field-label {
  margin-bottom: 0;
}

#detail .batch-time-buttons,
#detail .btn-time-shortcut {
  display: flex;
  gap: 6px;
}

#detail .btn-time-shortcut {
  background: #fff;
  border: 1px solid #d3dde5;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  color: var(--p-accent);
  cursor: pointer;
}

#detail .datetime-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  color: var(--p-ink);
  cursor: pointer;
}

#detail .datetime-picker-trigger .dp-chevron {
  margin-left: auto;
  color: var(--p-muted);
}

/* Ocupação e check-in */
#detail .schedule-occupancy-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#detail .plan-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

#detail .plan-status-pill.is-vacant {
  background: #e6f6ec;
  color: #1f6b3b;
}

#detail .plan-status-pill.is-occupied {
  background: #fdeee9;
  color: #9a3412;
}

#detail .plan-status-pill.is-checkin {
  background: var(--p-accent-soft);
  color: var(--p-accent);
}

#detail .plan-status-pill.is-urgent-checkin {
  background: #fde2de;
  color: #8b2c22;
}

/* Equipe */
#detail .tech-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#detail .tech-pill {
  display: inline-flex;
  border: 1px solid #d3dde5;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--p-ink);
  background: #fff;
  cursor: pointer;
}

#detail .tech-pill.selected {
  background: var(--p-accent);
  border-color: var(--p-accent);
  color: #fff;
  font-weight: 600;
}

/* Blocos internos do planejamento: separados por divisória, sem caixas dentro de caixas */
#detail #planning > #context-suggestions,
#detail #planning > .technician-run-container,
#detail #planning > #route-opportunities {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--p-line);
  background: none;
  border-radius: 0;
  box-shadow: none;
}

#detail #route-opportunities:empty {
  display: none;
}

/* ---------- Sugestões operacionais ---------- */
#detail #context-suggestions .section-line {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

#detail #context-suggestions .section-line h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-muted);
  margin: 0;
}

#detail .suggestion-count {
  background: var(--p-accent-soft);
  color: var(--p-accent);
  border-radius: 999px;
  padding: 0 7px;
  margin-left: 4px;
  font-size: 11px;
  letter-spacing: 0;
}

#detail #context-suggestions .suggestion-item {
  background: #fbfcfd;
  border: 1px solid var(--p-line);
  border-left: 3px solid var(--p-accent);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
}

#detail #context-suggestions .suggestion-item h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--p-ink);
  margin: 4px 0;
}

#detail #context-suggestions .suggestion-item p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--p-muted);
  margin: 2px 0 6px;
}

#detail #context-suggestions .suggestion-item small {
  font-size: 11px;
  color: var(--p-muted);
}

#detail #context-suggestions .suggestion-priority {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--p-accent);
}

#detail #context-suggestions .suggestion-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#detail #context-suggestions .suggestion-actions button {
  border: 1px solid #d3dde5;
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--p-accent);
  cursor: pointer;
}

#detail #context-suggestions .suggestion-actions button.release {
  background: var(--p-accent);
  border-color: var(--p-accent);
  color: #fff;
  font-weight: 600;
}

/* ---------- Roteiro do técnico ---------- */
#detail .run-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

#detail .run-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-muted);
}

#detail .run-tech-switcher {
  display: flex;
  gap: 4px;
}

#detail .run-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#detail .run-timeline-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--p-line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  color: var(--p-ink);
  cursor: pointer;
}

#detail .run-timeline-slot:hover {
  background: var(--p-soft);
}

#detail .run-timeline-slot.is-current {
  border-color: #f2b49e;
  background: #fff7f3;
}

#detail .run-slot-time {
  font-weight: 600;
  color: var(--p-accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#detail .run-slot-desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#detail .run-tag {
  margin-left: auto;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

#detail .run-empty-notice {
  font-size: 12px;
  color: var(--p-muted);
  margin: 0;
}

/* ---------- Outras OS para esta visita ---------- */
#detail .route-details {
  margin: 0;
}

#detail .route-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-muted);
}

#detail .route-summary::-webkit-details-marker {
  display: none;
}

#detail .route-summary::before {
  content: '▸';
  font-size: 11px;
  transition: transform 0.15s ease;
}

#detail .route-details[open] > .route-summary::before {
  transform: rotate(90deg);
}

#detail .route-count {
  background: var(--p-accent-soft);
  color: var(--p-accent);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  letter-spacing: 0;
}

#detail .route-group {
  margin-top: 10px;
}

#detail .route-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--p-ink);
  margin-bottom: 4px;
}

#detail .route-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--p-line);
}

#detail .route-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

#detail .route-row-main input[type='checkbox'] {
  width: 15px;
  height: 15px;
  accent-color: var(--p-accent);
}

#detail .route-row-title {
  display: block;
  font-size: 12.5px;
  color: var(--p-ink);
}

#detail .route-row-sub {
  display: block;
  font-size: 11.5px;
  color: var(--p-muted);
  margin-top: 2px;
}

#detail .route-ver {
  background: none;
  border: 0;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--p-accent);
  cursor: pointer;
}

#detail .route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#detail .btn-primary-action {
  background: var(--p-accent);
  border: 1px solid var(--p-accent);
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

#detail .btn-sub-action {
  background: #fff;
  border: 1px solid #d3dde5;
  color: var(--p-accent);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
}

#detail .priority-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 2px;
}

#detail .route-more {
  font-size: 11.5px;
  color: var(--p-muted);
  padding: 8px 0 0;
  border-top: 1px dashed var(--p-line);
  margin-top: 2px;
}

/* ===================== Ajustes desta rodada ===================== */

/* Fase e data: mesma linha de rótulo e mesma altura de campo */
#detail .planning-grid > .field,
#detail .planning-grid > .schedule-field,
#detail .planning-grid > .tech-selection-field {
  align-self: start;
}

#detail .planning-grid .field-label,
#detail .planning-grid .schedule-label-row {
  display: flex;
  align-items: center;
  height: 24px;
  margin: 0 0 6px;
}

#detail .planning-grid .schedule-label-row .field-label {
  margin: 0;
  height: auto;
}

#detail .planning-grid select,
#detail .planning-grid .datetime-picker-trigger {
  height: 38px;
}

/* Layout: linha 1 = fase | data; linha 2 = equipe | ocupação (tags abaixo da data) */
#detail .planning-grid .tech-selection-field {
  grid-column: 1;
  grid-row: 2;
}

#detail .planning-grid .schedule-occupancy-hint {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

/* Roteiro: OS atual com destaque legível */
#detail .run-timeline-slot.is-current {
  background: #edf5fa;
  border-color: #9ac2da;
  border-left: 3px solid var(--p-accent);
  color: var(--p-ink);
  font-weight: 600;
}

#detail .run-timeline-slot.is-current .run-slot-time {
  background: var(--p-accent);
  color: #fff;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
}

/* Container vazio que deixava uma faixa creme */
#detail .related:empty {
  display: none;
}

/* Linhas de rota: a linha inteira abre a OS; só o checkbox vincula */
#detail .route-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  border-top: 1px solid var(--p-line);
}

#detail .route-check {
  width: 15px;
  height: 15px;
  margin-left: 4px;
  accent-color: var(--p-accent);
  flex-shrink: 0;
  cursor: pointer;
}

#detail .route-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 8px;
  text-align: left;
  cursor: pointer;
  color: var(--p-ink);
}

#detail .route-open:hover {
  background: var(--p-soft);
}

#detail .route-open:focus-visible {
  outline: 2px solid rgba(33, 74, 99, 0.35);
  outline-offset: -2px;
}

#detail .route-arrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--p-accent);
  flex-shrink: 0;
}

#detail .route-group-label {
  margin-top: 2px;
}

/* Correção: equipe (esquerda) e tags de ocupação (direita, abaixo da data).
   Seletores com IDs para vencer as regras de largura total anteriores. */
#detail #planning .planning-grid > .tech-selection-field {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  align-self: start;
}

/* Tags de ocupação: dentro do campo de data, abaixo do seletor */
#detail #planning .schedule-field .schedule-occupancy-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#detail .route-hint {
  font-weight: 400;
  color: var(--p-muted);
  margin-left: 4px;
}

/* =====================================================================
   Modais de sugestões: central e revisão
   ===================================================================== */
#suggestions-dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(580px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  background: #fff;
  color: #1d3645;
  box-shadow: 0 24px 60px rgba(12, 30, 42, 0.28);
  overflow: hidden;
}

#suggestions-dialog[open] {
  display: flex;
  flex-direction: column;
}

#suggestions-dialog::backdrop {
  background: rgba(14, 32, 44, 0.42);
  backdrop-filter: blur(2px);
}

#suggestion-review-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #eef2f5;
}

.suggestion-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1d3645;
  margin: 0;
}

.suggestion-header p {
  font-size: 12.5px;
  line-height: 1.5;
  color: #63798a;
  margin: 4px 0 0;
}

#suggestions-close,
#review-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
  background: #fff;
  color: #5b7180;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#suggestions-close:hover,
#review-close:hover {
  background: #f4f7f9;
}

/* ----- Revisão ----- */
#suggestion-review-fields {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 8px;
}

#suggestion-review .review-caution {
  background: #fff8ef;
  border: 1px solid #f5d6b5;
  color: #7a4a22;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 12px;
}

#suggestion-review .window-line {
  font-size: 12px;
  color: #63798a;
  margin: 0 0 12px;
}

#suggestion-review h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #63798a;
  margin: 16px 0 8px;
}

#suggestion-review .checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#suggestion-review .checks label {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d3dde5;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: #1d3645;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

#suggestion-review .checks label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#suggestion-review .checks label:has(input:checked) {
  background: #214a63;
  border-color: #214a63;
  color: #fff;
  font-weight: 600;
}

#suggestion-review .checks label:focus-within {
  outline: 2px solid rgba(33, 74, 99, 0.35);
  outline-offset: 2px;
}

#suggestion-review .note {
  font-size: 12px;
  color: #63798a;
  margin: 8px 0 0;
}

#suggestion-review .review-record {
  border: 1px solid #e3e9ee;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
}

#suggestion-review .review-select {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #1d3645;
  cursor: pointer;
}

#suggestion-review .review-select input,
#suggestion-review .release-check input {
  width: 16px;
  height: 16px;
  accent-color: #214a63;
  cursor: pointer;
}

#suggestion-review .review-record > p {
  font-size: 13px;
  color: #1d3645;
  margin: 8px 0 2px;
}

#suggestion-review .review-record > small {
  display: block;
  font-size: 11.5px;
  color: #63798a;
}

.rv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.rv-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #63798a;
}

#suggestion-review .rv-date {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #1d3645;
  text-align: left;
  cursor: pointer;
}

#suggestion-review .rv-date:hover,
#suggestion-review .rv-date:focus-visible {
  border-color: #214a63;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 74, 99, 0.12);
}

#suggestion-review .rv-date .dp-cal-icon {
  display: inline-flex;
  color: #214a63;
}

#suggestion-review .rv-date .dp-chevron {
  margin-left: auto;
  color: #63798a;
}

#suggestion-review .release-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: #1d3645;
  cursor: pointer;
}

#suggestion-review .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #eef2f5;
  background: #fafbfc;
}

#suggestion-review .modal-actions button,
#suggestions-dialog .suggestion-actions button,
#suggestion-list .suggestion-actions button {
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid #d3dde5;
  background: #fff;
  color: #214a63;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#suggestion-review .modal-actions button:hover,
#suggestion-list .suggestion-actions button:hover {
  background: #f4f7f9;
}

#suggestion-review .modal-actions button.primary,
#suggestion-list .suggestion-actions button.release {
  background: #214a63;
  border-color: #214a63;
  color: #fff;
}

#suggestion-review .modal-actions button.primary:hover,
#suggestion-list .suggestion-actions button.release:hover {
  background: #1a3d52;
}

/* ----- Central de sugestões ----- */
#suggestions-dialog[open] #suggestion-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px 22px;
}

#suggestions-dialog .suggestion-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 22px 0;
  border-bottom: 1px solid #eef2f5;
}

#suggestions-dialog .suggestion-tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  font-size: 13px;
  color: #63798a;
  cursor: pointer;
}

#suggestions-dialog .suggestion-tabs button.selected {
  color: #214a63;
  border-bottom-color: #214a63;
  font-weight: 600;
}

#suggestions-dialog .suggestion-demo {
  font-size: 11.5px;
  color: #63798a;
  margin: 10px 22px 0;
}

#suggestion-list .suggestion-item {
  background: #fbfcfd;
  border: 1px solid #e3e9ee;
  border-left: 3px solid #214a63;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

#suggestion-list .suggestion-item h3 {
  font-size: 13px;
  font-weight: 600;
  color: #1d3645;
  margin: 4px 0;
}

#suggestion-list .suggestion-item p {
  font-size: 12px;
  line-height: 1.5;
  color: #63798a;
  margin: 2px 0 6px;
}

#suggestion-list .suggestion-item small {
  font-size: 11px;
  color: #63798a;
}

#suggestion-list .suggestion-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#suggestion-list .suggestion-actions button {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

#suggestion-list .empty {
  font-size: 13px;
  color: #63798a;
  padding: 24px 0;
  text-align: center;
}

/* Sobreposição do modal de revisão (não é <dialog>, para o seletor de data abrir por cima) */
.sr-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(14, 32, 44, 0.42);
}

.sr-overlay[hidden] {
  display: none !important;
}

.sr-panel {
  width: min(580px, 100%);
  max-height: min(720px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1d3645;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(12, 30, 42, 0.28);
  overflow: hidden;
}


/* Área de arrastar e soltar para mídia */
#detail .dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  padding: 12px 16px;
  border: 1.5px dashed #c5d2dc;
  border-radius: 12px;
  background: #f6f9fc;
  text-align: center;
  color: #5b7180;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#detail .dropzone:hover {
  background: #eef4f9;
  border-color: #9fb6c6;
}

#detail .dropzone:focus-visible {
  outline: 2px solid rgba(33, 74, 99, 0.35);
  outline-offset: 3px;
}

#detail .dropzone.is-dragover {
  background: #e4eef6;
  border-style: solid;
  border-color: #214a63;
}

#detail .dz-icon {
  width: 28px;
  height: 28px;
  color: #6b7a86;
}

#detail .dz-title {
  margin: 0;
  font-size: 13px;
  color: #4d6270;
}

#detail .dz-or {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: #7a8a96;
}

#detail .dz-browse {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 6px;
  background: #214a63;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

#detail .dropzone.is-compact {
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 16px;
  text-align: left;
}

#detail .dropzone.is-compact .dz-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

#detail .dropzone.is-compact .dz-text {
  flex: 1;
}

#detail .dropzone.is-compact .dz-browse {
  margin-left: auto;
}

/* Modal de revisão: sobrepõe a regra de largura do style.css (#suggestion-review) */
#suggestion-review.sr-overlay {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  overflow: hidden;
  border: 0;
  padding: 16px;
  box-shadow: none;
  background: rgba(14, 32, 44, 0.42);
}

/* Remover mídia */
#detail .media-thumb-wrap {
  position: relative;
  display: inline-block;
}

#detail .media-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #8b2c22;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  padding: 0;
}

#detail .media-remove:hover {
  background: #6e2119;
}

/* Remover data no planejamento */
#detail .btn-time-clear {
  color: #8b2c22;
  border-color: #e7c3bd;
}

/* Remover nova data na revisão */
.rv-date-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.rv-date-row .rv-date {
  flex: 1;
}

#suggestion-review .rv-clear {
  width: 40px;
  flex-shrink: 0;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  background: #fff;
  color: #63798a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#suggestion-review .rv-clear:hover {
  background: #f4f7f9;
  color: #8b2c22;
}

#suggestion-review .rv-hint {
  font-size: 11.5px;
  color: #63798a;
}

/* Linha de rótulo da data: altura automática, botões visíveis acima do campo */
#detail .planning-grid .schedule-label-row {
  height: auto;
  min-height: 28px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  margin-bottom: 6px;
}

#detail .planning-grid .batch-time-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* × da mídia fica dentro da miniatura, para não ser cortado pelo contêiner */
#detail .media-remove {
  top: 4px;
  right: 4px;
}

/* Balão de confirmação */
.confirm-pop {
  position: fixed;
  z-index: 1100;
  width: max-content;
  max-width: 240px;
  padding: 12px 12px 10px;
  background: #fff;
  color: #1d3645;
  border: 1px solid #e3e9ee;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(12, 30, 42, 0.22);
  font-size: 13px;
}

.confirm-pop-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 10px;
}

.confirm-pop-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid #c2412d;
  color: #c2412d;
  font-size: 12px;
  font-weight: 700;
}

.confirm-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-pop-actions button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.confirm-pop-no {
  border: 1px solid #d3dde5;
  background: #fff;
  color: #4d6270;
}

.confirm-pop-no:hover {
  background: #f4f7f9;
}

.confirm-pop-yes {
  border: 0;
  background: #d9462b;
  color: #fff;
}

.confirm-pop-yes:hover {
  background: #bf3b23;
}

/* Rótulo da data com a mesma altura do rótulo da fase: campos alinhados */
#detail .planning-grid .schedule-label-row {
  height: 24px;
  min-height: 24px;
  flex-wrap: nowrap;
  margin-bottom: 6px;
}

/* Atalhos de horário abaixo do seletor de data, sem empurrar o campo */
#detail .schedule-field .batch-time-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Miniaturas não se movem no hover */
#detail .media-thumb-card:hover,
#detail .media-thumb-wrap:hover {
  transform: none;
}

/* × da mídia: vermelho mais claro, sem contorno branco */
#detail .media-remove {
  border: 0;
  background: #e5533d;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

#detail .media-remove:hover {
  background: #d4432d;
}

/* Duas colunas reais no planejamento: esquerda (fase + equipe) e direita (data) */
#detail #planning .planning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  align-items: start;
}

#detail #planning .plan-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* =====================================================================
   PLANEJAMENTO DO DIA (visão separada da OS)
   ===================================================================== */
#planning-view[hidden],
#workspace-left[hidden],
#detail[hidden] {
  display: none !important;
}

#planning-view {
  grid-column: 1 / -1;
  width: 100%;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pv-head h1 {
  font-size: 19px;
  color: #1d3645;
  margin: 2px 0 0;
}

.pv-day {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pv-day button {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border: 1px solid #d3dde5;
  background: #fff;
  border-radius: 8px;
  color: #214a63;
  font-weight: 600;
  cursor: pointer;
}

.pv-day button:hover {
  background: #f4f7f9;
}

#pv-day-label {
  min-width: 280px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #1d3645;
  text-transform: capitalize;
}

.pv-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.pv-queue {
  background: #fff;
  border: 1px solid #e3e9ee;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pv-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pv-queue-head h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #63798a;
  margin: 0;
}

#pv-queue-count {
  background: #e8f0f5;
  color: #214a63;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

#pv-queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.pv-item {
  text-align: left;
  background: #fbfcfd;
  border: 1px solid #e3e9ee;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.pv-item:hover {
  border-color: #9fb6c6;
  background: #f4f8fb;
}

.pv-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1d3645;
}

.pv-item-name {
  font-size: 12.5px;
  color: #1d3645;
}

.pv-item-meta {
  font-size: 11.5px;
  color: #63798a;
}

.pv-empty {
  font-size: 13px;
  color: #63798a;
  padding: 16px 0;
  text-align: center;
}

.pv-main {
  background: #fff;
  border: 1px dashed #c9d5dd;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 300px;
}

.pv-placeholder {
  font-size: 13px;
  color: #63798a;
  text-align: center;
  max-width: 380px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .pv-body {
    grid-template-columns: 1fr;
  }
}

/* Passo 2: raias por técnico (somente leitura) */
#planning-view .pv-main {
  background: transparent;
  border: 0;
  padding: 0;
  min-height: 0;
  display: block;
}

.pv-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
  align-items: start;
}

.pv-lane {
  background: #fff;
  border: 1px solid #e3e9ee;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.pv-lane.is-unassigned {
  border-style: dashed;
}

.pv-lane-head h3 {
  margin: 0;
  font-size: 14px;
  color: #1d3645;
}

.pv-lane-head small {
  font-size: 11.5px;
  color: #63798a;
}

.pv-conflict-count {
  color: #8b2c22;
  font-weight: 600;
}

.pv-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pv-block {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: #f7fafc;
  border: 1px solid #e3e9ee;
  border-left: 3px solid #214a63;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.pv-block:hover {
  background: #eef4f9;
}

.pv-block.is-conflict {
  border-left-color: #d9462b;
  background: #fff5f2;
}

.pv-block-time {
  min-width: 96px;
  font-size: 11.5px;
  font-weight: 600;
  color: #214a63;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pv-block-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.pv-block-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #1d3645;
}

.pv-block-name {
  font-size: 12px;
  color: #63798a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv-block-flag {
  font-size: 10.5px;
  font-weight: 700;
  color: #8b2c22;
  text-transform: uppercase;
}

.pv-lane-empty {
  font-size: 12px;
  color: #63798a;
  padding: 10px 0;
  text-align: center;
}
/* ==========================================================================
   PLANEJAMENTO + PAINEL LATERAL (desktop)
   A visão de planejamento divide a linha com o painel da OS, em vez de
   ocupar a largura toda.
   ========================================================================== */
@media (min-width: 1024px) {
  #planning-view {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: auto !important;
    height: 100%;
    overflow-y: auto;
  }

  .workspace.drawer-open #planning-view .pv-body {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

/* ==========================================================================
   AGENDAMENTO: DRAG & DROP E INTERATIVIDADE DO SELETOR DE DATA
   ========================================================================== */

/* Seletor de data interativo */
#pv-day-label {
  cursor: pointer;
  user-select: none;
  padding: 5px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#pv-day-label:hover {
  background: #eef3f7;
  color: var(--p-accent, #214a63);
}

#pv-day-label:focus-visible {
  outline: 2px solid var(--p-accent, #214a63);
  outline-offset: 1px;
}

/* Indicadores de arrasto nos cartões */
.pv-item,
.pv-block {
  cursor: grab;
  user-select: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.pv-item:active,
.pv-block:active {
  cursor: grabbing;
}

.pv-item.is-dragging,
.pv-block.is-dragging {
  opacity: 0.35;
  transform: scale(0.98);
}

/* Realce pontilhado ao pairar sobre a raia de destino */
.pv-lane.is-dragover,
.pv-queue.is-dragover,
#pv-queue-list.is-dragover {
  background: #f0f7fb !important;
  outline: 2px dashed var(--p-accent, #214a63) !important;
  outline-offset: -2px;
  border-radius: 12px;
}

.pv-item.current,
.pv-block.current {
  border-color: #9ac2da !important;
  border-left-color: var(--p-accent, #214a63) !important;
  background: #edf5fa !important;
}

/* ==========================================================================
   CARDS DE AGENDAMENTO E FILA: LAYOUT LIMPO, CURSOR E MÍDIAS
   ========================================================================== */

/* Cursor padrão é o normal de clique (pointer). Grabbing só ocorre ao clicar e segurar */
.pv-block,
.pv-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-left: 3px solid #214a63 !important;
  border-radius: 8px !important;
  padding: 8px 10px !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.pv-block:hover,
.pv-item:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

.pv-block:active,
.pv-item:active,
.pv-block.is-dragging,
.pv-item.is-dragging {
  cursor: grabbing !important;
  opacity: 0.45 !important;
  transform: scale(0.98) !important;
}

/* Área de informações do card */
.pv-card-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Linha superior: horário + badge + apartamento lado a lado sem quebras estranhas */
.pv-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.pv-card-time {
  font-size: 11px;
  font-weight: 700;
  color: #214a63;
  background: #eaf1f6;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  line-height: 1.3;
}

.pv-card-apt {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Nome do problema / descrição da OS */
.pv-card-name {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.3;
}

.pv-card-meta {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-block-flag {
  font-size: 9px;
  font-weight: 750;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-left: auto;
}

/* Miniatura da primeira foto ou vídeo no canto direito */
.pv-media-thumb {
  position: relative;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #1e293b;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pv-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pv-media-thumb .pv-media-play {
  position: absolute;
  font-size: 9px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.pv-media-count {
  position: absolute;
  bottom: 1px;
  right: 1px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
}

/* Card selecionado que está aberto no painel lateral */
.pv-block.current,
.pv-item.current {
  background: #edf5fa !important;
  border-color: #9ac2da !important;
  border-left-color: #214a63 !important;
}

/* Indicador de km da OS a partir da parada anterior */
.pv-card-km {
  font-size: 10.5px;
  font-weight: 600;
  color: #557587;
  background: #eef3f6;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ==========================================================================
   CARDS DE AGENDAMENTO (PADRÃO KANBAN COM TEXTO COMPLETO E GALERIA)
   ========================================================================== */

.pv-kanban-card,
.pv-block,
.pv-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid #dce4ea !important;
  border-left: 4px solid #214a63 !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: 0 1px 3px rgba(15, 34, 48, 0.05) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease !important;
}

.pv-kanban-card:hover,
.pv-block:hover,
.pv-item:hover {
  background: #ffffff !important;
  border-color: #9cb8ca !important;
  box-shadow: 0 4px 12px rgba(15, 34, 48, 0.08) !important;
}

.pv-kanban-card:active,
.pv-block:active,
.pv-item:active,
.pv-kanban-card.is-dragging,
.pv-block.is-dragging,
.pv-item.is-dragging {
  cursor: grabbing !important;
  opacity: 0.4 !important;
  transform: scale(0.98) !important;
}

/* Linha superior: horário, apartamento, prioridade e km */
.pv-card-header {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.pv-card-time {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #214a63 !important;
  background: #eaf1f6 !important;
  padding: 2px 6px !important;
  border-radius: 5px !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1.2 !important;
}

.pv-card-apt-pill {
  font-size: 12px !important;
  font-weight: 750 !important;
  color: #1a425a !important;
  background: #f0f4f8 !important;
  border: 1px solid #d0dce4 !important;
  padding: 2px 7px !important;
  border-radius: 5px !important;
}

.pv-card-km {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #557587 !important;
  background: #eef3f6 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  margin-left: auto !important;
  font-variant-numeric: tabular-nums !important;
}

/* Título e descrição sem cortes (quebra natural de linhas) */
.pv-card-title {
  margin: 0 !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  line-height: 1.4 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

.pv-card-desc {
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: #526b7b !important;
  line-height: 1.5 !important;
  white-space: pre-wrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

/* ==========================================================================
   MINIATURAS DO CARD: ESPAÇO INTERNO PARA EVITAR CORTE NO HOVER
   ========================================================================== */

.pv-card-media-strip {
  display: flex !important;
  gap: 8px !important;
  overflow-x: auto !important;
  padding: 4px 6px !important; /* Folga para a expansão do scale(1.05) não bater no overflow */
  margin: -2px -6px !important; /* Compensa o padding mantendo o alinhamento com o texto */
}

.pv-card-media-item {
  position: relative !important;
  width: 54px !important;
  height: 42px !important;
  min-width: 54px !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  border: 1px solid #cbd5e1 !important;
  background: #1e293b !important;
  padding: 0 !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transform-origin: center center !important;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.pv-card-media-item:hover {
  transform: scale(1.05) !important;
  border-color: #214a63 !important;
  box-shadow: 0 2px 8px rgba(15, 34, 48, 0.18) !important;
  z-index: 2 !important; /* Garante que fica por cima dos elementos adjacentes */
}

.pv-card-media-item img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.pv-card-media-item .pv-media-play {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 10px !important;
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.25) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
  pointer-events: none !important;
}

/* Rodapé do card: etapa à esquerda e prioridade à direita */
.pv-card-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding-top: 6px !important;
  border-top: 1px solid #f1f5f9 !important;
  margin-top: 2px !important;
}

.pv-card-footer .pv-card-meta {
  font-size: 11px !important;
  color: #8fa1ad !important;
  font-weight: 500 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.pv-card-footer .priority-badge {
  margin-left: auto !important;
  flex-shrink: 0 !important;
}
.pv-card-meta {
  font-size: 11px !important;
  color: #8fa1ad !important;
  font-weight: 500 !important;
}

/* Card selecionado que está aberto no painel lateral */
.pv-kanban-card.current,
.pv-block.current,
.pv-item.current {
  background: #edf5fa !important;
  border-color: #9ac2da !important;
  border-left-color: #214a63 !important;
}

/* Card com conflito de horário */
.pv-block.is-conflict {
  border-left-color: #dc2626 !important;
  background: #fffafa !important;
}

/* ==========================================================================
   CARDS KANBAN: REMOÇÃO DA LINHA LATERAL AZUL E BORDA UNIFORME
   ========================================================================== */

.pv-kanban-card,
.pv-block,
.pv-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid #dce4ea !important;
  border-left: 1px solid #dce4ea !important; /* Remove a linha lateral azul */
  border-radius: 10px !important;
  padding: 12px 14px !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: 0 1px 3px rgba(15, 34, 48, 0.05) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease !important;
}

.pv-kanban-card:hover,
.pv-block:hover,
.pv-item:hover {
  background: #ffffff !important;
  border-color: #9cb8ca !important;
  box-shadow: 0 4px 12px rgba(15, 34, 48, 0.08) !important;
}

/* Card aberto no painel lateral: borda azul uniforme sutil, sem barra grossa */
.pv-kanban-card.current,
.pv-block.current,
.pv-item.current {
  background: #edf5fa !important;
  border: 1px solid #9ac2da !important;
  border-left: 1px solid #9ac2da !important;
}

/* Card em conflito de horário: borda avermelhada uniforme */
.pv-block.is-conflict {
  background: #fffafa !important;
  border: 1px solid #fca5a5 !important;
  border-left: 1px solid #fca5a5 !important;
}

body {
  background: url('background.svg') center center / cover no-repeat fixed !important;
}

.split-stage,
.strip,
.strip-canvas,
.pane-content,
.workspace,
.workspace-left {
  background: transparent !important;
}
/* ==========================================================================
   OS CONCLUÍDA NA AGENDA
   Cartão esmaecido, título riscado, sem arrastar, com selo "✓ Concluído".
   ========================================================================== */
.pv-block.is-done {
  background: #f6f8fa;
  border-color: #dfe6ec;
  box-shadow: none;
  opacity: 0.78;
  cursor: pointer;
}

.pv-block.is-done:hover {
  opacity: 1;
}

.pv-block.is-done .pv-card-title {
  color: #5b6b78;
  text-decoration: line-through;
  text-decoration-color: #9aa9b5;
}

.pv-block.is-done .pv-card-time,
.pv-block.is-done .pv-card-apt-pill {
  opacity: 0.85;
}

.pv-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid #bfe5d0;
  border-radius: 999px;
  background: #e7f6ee;
  color: #1f7a4d;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pv-done-count {
  color: #1f7a4d;
  font-weight: 600;
}

/* ==========================================================================
   PROGRESSO DO TÉCNICO, LINHA DO HORÁRIO ATUAL, ATRASADAS E RETORNOS
   ========================================================================== */
.pv-progress {
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: #e6edf2;
  overflow: hidden;
}

.pv-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1f7a4d;
  transition: width 0.2s ease;
}

.pv-now-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  color: #c2410c;
  font-size: 11px;
  font-weight: 600;
}

.pv-now-line::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: #f97316;
}

.pv-now-line span {
  white-space: nowrap;
}

.pv-block.is-overdue {
  border-color: #f1b5a4;
  box-shadow: inset 3px 0 0 #dc2626;
}

.pv-overdue-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid #f5c2b8;
  border-radius: 999px;
  background: #fdecea;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pv-return-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid #f3d9a4;
  border-radius: 999px;
  background: #fdf6e3;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pv-overdue-count {
  color: #b91c1c;
  font-weight: 600;
}

/* ==========================================================================
   CABEÇALHO CENTRALIZADO ACIMA DO KANBAN E LANES QUE OCUPAM A LARGURA
   ========================================================================== */
.pv-head {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}

.pv-day {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

/* auto-fit (em vez de auto-fill) estica as colunas para preencher a largura disponível */
.pv-lanes {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

/* ==========================================================================
   MAPA DAS ROTAS (planning-map.js)
   ========================================================================== */
.pv-body.has-map {
  grid-template-columns: 300px minmax(0, 1fr) 340px;
}

#pv-map-toggle[aria-pressed="true"] {
  background: #214a63;
  border-color: #214a63;
  color: #fff;
}

.pv-map-panel {
  background: #fff;
  border: 1px solid #e3e9ee;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  overflow: hidden;
}

.pv-map-panel[hidden] {
  display: none;
}

.pv-map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f4;
}

.pv-map-head h2 {
  margin: 0;
  font-size: 13px;
  color: #1d3645;
}

.pv-map-head span {
  font-size: 11px;
  color: #b91c1c;
}

.pv-map {
  flex: 1;
  min-height: 380px;
}

.pv-map-foot {
  padding: 8px 12px;
  border-top: 1px solid #edf1f4;
  font-size: 12px;
  color: #3d5566;
}

.pv-map-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.pv-map-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pv-map-legend small {
  color: #607583;
}

.pv-map-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pv-map-warn {
  margin: 6px 0 0;
  color: #b45309;
}

.pv-map-marker {
  background: none;
  border: 0;
}

.pv-map-stop {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.pv-map-stop.is-done {
  opacity: 0.55;
}

/* Telas estreitas: o mapa some e as colunas voltam ao layout normal */
@media (max-width: 1100px) {
  #pv-map-toggle,
  .pv-map-panel {
    display: none !important;
  }

  .pv-body.has-map {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

/* ==========================================================================
   AJUSTES: cabeçalho numa só linha, cards mais compactos, mapa maior
   ========================================================================== */

/* Título e filtros na mesma linha: título à esquerda, filtros centralizados */
.pv-head {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.pv-head > div:first-child {
  justify-self: start;
}

.pv-head .pv-day {
  grid-column: 2;
  width: auto;
  flex-wrap: wrap;
  justify-content: center;
}

/* Cards compactos */
.pv-lanes {
  gap: 10px;
}

.pv-lane {
  padding: 10px;
  gap: 8px;
}

.pv-blocks {
  gap: 5px;
}

.pv-kanban-card,
.pv-block,
.pv-item {
  gap: 5px !important;
  padding: 8px 10px !important;
}

.pv-card-title {
  font-size: 12.5px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}

.pv-card-desc {
  font-size: 11px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}

.pv-card-media-item {
  width: 40px !important;
  height: 32px !important;
  min-width: 40px !important;
}

.pv-card-footer {
  padding-top: 4px !important;
}

.pv-card-header {
  gap: 4px !important;
}

/* Mapa maior: coluna mais larga e altura acompanhando a tela */
.pv-body.has-map {
  grid-template-columns: 300px minmax(0, 1fr) 480px;
}

.pv-map {
  flex: none;
  height: max(520px, calc(100vh - 240px));
}

.pv-map-panel {
  align-self: stretch;
}

.pv-map,
.leaflet-container {
  isolation: isolate;
}

@media (max-width: 1100px) {
  .pv-body.has-map {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

/* O mapa divide a altura do painel com o rodapé; nada fica cortado */
.pv-map {
  flex: 1 1 auto;
  height: auto;
  min-height: 360px;
}

.pv-map-panel {
  min-height: 0;
}

/* Botão do mapa: ícone SVG centralizado, quadrado, sem o padding de texto */
#pv-map-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  line-height: 0;
}

#pv-map-toggle svg {
  display: block;
  flex-shrink: 0;
}
/* ==========================================================================
   SETAS DO DIA (Agendamento): botões quadrados com chevron desenhado
   O caractere ‹ / › some (font-size 0) e o chevron vem de um ::before com bordas.
   ========================================================================== */
#pv-prev,
#pv-next {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 35, 50, 0.05);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

#pv-prev::before,
#pv-next::before {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 2px solid #214a63;
  border-left: 2px solid #214a63;
  border-radius: 1px;
  transform: translateX(2px) rotate(-45deg);
  pointer-events: none;
}

#pv-next::before {
  border-left: 0;
  border-right: 2px solid #214a63;
  border-top: 2px solid #214a63;
  transform: translateX(-2px) rotate(45deg);
}

#pv-prev:hover,
#pv-next:hover {
  background: #f1f6f9;
  border-color: #b9cad6;
}

#pv-prev:active,
#pv-next:active {
  transform: scale(0.96);
}

#pv-prev:focus-visible,
#pv-next:focus-visible {
  outline: 2px solid #2b6f8f;
  outline-offset: 2px;
}

/* Card executado pelo técnico no Kanban */
.pv-block.is-tech-done {
  border-left: 3px solid #16a34a !important;
  background: #fbfdfb;
}

/* Badge verde no cabeçalho do card */
.pv-tech-done-badge {
  font-size: 10px;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Contador de executadas no cabeçalho da coluna */
.pv-tech-done-count {
  color: #16a34a;
  font-weight: 600;
}