/* ============================================================
   wo-dashboard.css — Dashboard, KPIs, Busca, Filtros, Timeline,
                      Notificações e Melhorias Mobile da OS
   Precifika — Etapas 7, 8, 9, 10, 11
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   ETAPA 7 — KPI STRIP (faixa de indicadores da listagem)
═══════════════════════════════════════════════════════════ */

.wo-kpi-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.wo-kpi-card {
  flex: 1 1 120px;
  min-width: 110px;
  max-width: 200px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  user-select: none;
}

.wo-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
}

.wo-kpi-card:active {
  transform: translateY(0);
}

.wo-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.wo-kpi-total   .wo-kpi-icon { background: #eff6ff; color: #2563eb; }
.wo-kpi-config  .wo-kpi-icon { background: #fef3c7; color: #d97706; }
.wo-kpi-aguard  .wo-kpi-icon { background: #f0f9ff; color: #0284c7; }
.wo-kpi-liberada .wo-kpi-icon { background: #f0fdf4; color: #16a34a; }
.wo-kpi-cancel  .wo-kpi-icon { background: #fef2f2; color: #dc2626; }

.wo-kpi-total   { border-top: 3px solid #2563eb; }
.wo-kpi-config  { border-top: 3px solid #d97706; }
.wo-kpi-aguard  { border-top: 3px solid #0284c7; }
.wo-kpi-liberada { border-top: 3px solid #16a34a; }
.wo-kpi-cancel  { border-top: 3px solid #dc2626; }

.wo-kpi-body {
  display: flex;
  flex-direction: column;
}

.wo-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 3px;
}

.wo-kpi-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   ETAPA 10 — BARRA DE BUSCA E FILTROS
═══════════════════════════════════════════════════════════ */

.wo-search-bar {
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.wo-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.wo-search-input-wrap {
  position: relative;
  flex: 1 1 200px;
  min-width: 160px;
}

.wo-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}

.wo-search-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.wo-search-input:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.wo-search-input::placeholder { color: #94a3b8; }

.wo-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
}
.wo-search-clear:hover { color: #dc2626; background: #fef2f2; }

.wo-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  position: relative;
}

.wo-filter-toggle:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.wo-filter-toggle--active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.wo-filter-badge {
  width: 16px;
  height: 16px;
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -5px;
  right: -5px;
}

.wo-sort-wrap { flex-shrink: 0; }

.wo-sort-select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.wo-sort-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* Painel de filtros avançados */
.wo-filters-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  animation: woSlideDown 0.2s ease;
}

@keyframes woSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wo-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.wo-filter-field { display: flex; flex-direction: column; gap: 4px; }

.wo-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wo-filter-select,
.wo-filter-input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
  width: 100%;
}

.wo-filter-select:focus,
.wo-filter-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.wo-filter-actions { justify-content: flex-end; padding-top: 2px; }

.wo-btn-filter-clear {
  height: 36px;
  padding: 0 14px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.wo-btn-filter-clear:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.wo-filter-summary {
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
}

.wo-filter-count {
  font-weight: 700;
  color: #2563eb;
}

/* ════════════════════════════════════════════════════════════
   ETAPA 7 — CARDS DE OS APRIMORADOS
═══════════════════════════════════════════════════════════ */

.wo-card--exec {
  border-left: 4px solid #16a34a;
}

.wo-card--canceled {
  opacity: 0.65;
  filter: grayscale(0.3);
}

.wo-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.wo-card:hover .wo-card-icon { transform: scale(1.08); }

.wo-card-icon--liberada-execucao { background: #f0fdf4; color: #16a34a; }
.wo-card-icon--aguardando-configuracao { background: #fef3c7; color: #d97706; }
.wo-card-icon--em-preenchimento { background: #eff6ff; color: #2563eb; }
.wo-card-icon--aguardando-aprovacao { background: #f0f9ff; color: #0284c7; }
.wo-card-icon--cancelada { background: #fef2f2; color: #dc2626; }
.wo-card-icon--aprovada { background: #f0fdf4; color: #16a34a; }

.wo-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.wo-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.wo-card-tag--plan {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.wo-card-tag--rdo {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* ════════════════════════════════════════════════════════════
   ETAPA 7 — WIDGET DE PROGRESSO NO DETALHE DA OS
═══════════════════════════════════════════════════════════ */

#wo-progress-widget {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 12px 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.wo-prog-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wo-prog-kpis {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.wo-prog-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 70px;
}

.wo-prog-kpi-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.wo-prog-kpi-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.wo-prog-global-bar-wrap {
  height: 6px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.wo-prog-global-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.wo-prog-stages {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.wo-prog-stages-title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.wo-prog-stage {
  display: grid;
  grid-template-columns: 120px 1fr 36px 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.wo-prog-stage-name {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wo-prog-bar-wrap {
  height: 7px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.wo-prog-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.wo-prog-pct {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.wo-prog-count {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}

/* ════════════════════════════════════════════════════════════
   ETAPA 11 — TIMELINE DE HISTÓRICO
═══════════════════════════════════════════════════════════ */

.wo-section--timeline {
  margin-top: 24px;
}

.wo-section-title--collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.15s;
  border-radius: 8px;
  padding: 10px 12px;
}

.wo-section-title--collapsible:hover {
  background: #f8fafc;
}

.wo-tl-toggle-icon {
  color: #94a3b8;
  font-size: 13px;
  margin-left: auto;
  padding-left: 8px;
  transition: transform 0.2s;
}

.wo-timeline-wrap {
  padding: 12px 0;
  animation: woSlideDown 0.2s ease;
}

.wo-timeline {
  position: relative;
  padding-left: 28px;
}

.wo-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #e2e8f0, transparent);
}

.wo-tl-item {
  position: relative;
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.wo-tl-item:last-child { margin-bottom: 0; }

.wo-tl-dot {
  position: absolute;
  left: -22px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 0 0 3px #fff;
}

.wo-tl-content {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 0;
}

.wo-tl-msg {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
  margin-bottom: 4px;
}

.wo-tl-detail {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #64748b;
}

.wo-tl-old {
  text-decoration: line-through;
  color: #94a3b8;
}

.wo-tl-new {
  color: #16a34a;
  font-weight: 600;
}

.wo-tl-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.wo-tl-author,
.wo-tl-when {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wo-tl-loading,
.wo-tl-empty,
.wo-tl-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

.wo-tl-empty i,
.wo-tl-error i { font-size: 24px; }
.wo-tl-error i { color: #fca5a5; }

/* ════════════════════════════════════════════════════════════
   ETAPA 8 — BOTÃO + PAINEL DE NOTIFICAÇÕES
═══════════════════════════════════════════════════════════ */

.wo-notif-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  margin: 4px 0 4px 12px;
}

.wo-notif-nav-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
}

.wo-notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: #dc2626;
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-sizing: border-box;
  pointer-events: none;
}

.wo-notif-panel {
  position: fixed;
  top: 60px;
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: woNotifSlideIn 0.2s ease;
}

@keyframes woNotifSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wo-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.wo-notif-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wo-notif-title i { color: #2563eb; }

.wo-notif-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wo-notif-mark-all {
  background: none;
  border: none;
  font-size: 11px;
  color: #2563eb;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 600;
  transition: background 0.15s;
}
.wo-notif-mark-all:hover { background: #eff6ff; }

.wo-notif-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}
.wo-notif-close:hover { background: #fef2f2; color: #dc2626; }

.wo-notif-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.wo-notif-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
  border-bottom: 1px solid #f8fafc;
}

.wo-notif-item:last-child { border-bottom: none; }

.wo-notif-item:hover { background: #f8fafc; }

.wo-notif-item--unread {
  background: #fefbff;
}

.wo-notif-item--unread:hover { background: #f5f3ff; }

.wo-notif-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  opacity: 0.9;
}

.wo-notif-body {
  flex: 1;
  min-width: 0;
}

.wo-notif-msg {
  font-size: 12.5px;
  color: #1e293b;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
}

.wo-notif-sub {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wo-notif-when {
  font-size: 10px;
  color: #94a3b8;
}

.wo-notif-unread-dot {
  width: 7px;
  height: 7px;
  background: #2563eb;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.wo-notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}
.wo-notif-empty i { font-size: 28px; color: #bfdbfe; }

/* ════════════════════════════════════════════════════════════
   ETAPA 9 — RESPONSIVIDADE MOBILE COMPLETA
═══════════════════════════════════════════════════════════ */

/* ── Listagem de OS no mobile ── */
@media (max-width: 768px) {
  .wo-kpi-strip {
    gap: 8px;
    margin-bottom: 14px;
  }

  .wo-kpi-card {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
    padding: 10px 12px;
    gap: 8px;
  }

  .wo-kpi-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .wo-kpi-value { font-size: 18px; }
  .wo-kpi-label { font-size: 10px; }

  .wo-search-bar {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .wo-search-row {
    gap: 8px;
  }

  .wo-search-input { height: 36px; font-size: 13px; }

  .wo-filter-toggle span:first-of-type {
    display: none; /* Esconde texto no mobile, mantém ícone */
  }

  .wo-sort-select { font-size: 12px; height: 36px; }

  .wo-filters-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Card de OS no mobile */
  .wo-card {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .wo-card-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: 8px;
  }

  .wo-card-number { font-size: 14px; }
  .wo-card-project { font-size: 13px; }
  .wo-card-meta { gap: 6px; font-size: 11px; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .wo-kpi-strip { gap: 6px; }

  .wo-kpi-card {
    flex: 1 1 calc(50% - 6px);
    padding: 8px 10px;
    gap: 6px;
  }

  .wo-kpi-value { font-size: 16px; }

  .wo-search-input-wrap { min-width: 0; }

  .wo-filters-grid { grid-template-columns: 1fr; }

  /* Progress widget no mobile */
  #wo-progress-widget { padding: 12px 14px; margin: 8px 0 14px; }

  .wo-prog-kpis { gap: 12px; }
  .wo-prog-kpi-val { font-size: 18px; }

  .wo-prog-stage {
    grid-template-columns: 80px 1fr 34px 36px;
    gap: 6px;
  }

  .wo-prog-stage-name { font-size: 11px; }
  .wo-prog-pct { font-size: 11px; }
  .wo-prog-count { font-size: 10px; }

  /* Timeline no mobile */
  .wo-tl-item { margin-bottom: 12px; }
  .wo-tl-content { padding: 6px 10px; }
  .wo-tl-msg { font-size: 12px; }

  /* Notificações no mobile */
  .wo-notif-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    animation: woNotifSlideUp 0.25s ease;
  }

  @keyframes woNotifSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
}

/* ── OS Detail — header scrollável no mobile ── */
@media (max-width: 768px) {
  .wo-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .wo-detail-header-right {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Botões do header da OS — menores no mobile */
  .wo-detail-header-right .wo-btn-secondary,
  .wo-detail-header-right .wo-btn-financial {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 7px;
  }

  /* Esconde labels de botões para não empilhar */
  .wo-detail-header-right .wo-btn-label {
    display: none;
  }

  /* Mostra ícone menor */
  .wo-detail-header-right .wo-btn-secondary i,
  .wo-detail-header-right .wo-btn-financial i {
    font-size: 13px;
  }

  /* Info grid 2 colunas */
  .wo-info-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .wo-info-card {
    padding: 10px 12px;
  }

  .wo-info-label { font-size: 10px; }
  .wo-info-value { font-size: 13px; }

  /* Seções da OS */
  .wo-section {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  .wo-section-title {
    font-size: 14px;
    margin-bottom: 12px;
  }

  /* Tabela de serviços — scroll horizontal */
  .wo-svc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .wo-svc-table {
    min-width: 600px;
  }

  /* Ações da OS */
  .wo-actions-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .wo-actions-right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .wo-actions-right .wo-btn-secondary,
  .wo-actions-right .wo-btn-primary {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 110px;
  }

  /* RDO seção no mobile */
  .rdo-kpi-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .rdo-kpi {
    flex: 1 1 calc(50% - 8px);
    min-width: 100px;
  }

  /* Modal de detalhes do serviço */
  .wo-svc-detail-modal {
    align-items: flex-end;
  }

  .wo-svc-detail-box {
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
}

@media (max-width: 480px) {
  .wo-detail-header-right .wo-btn-secondary,
  .wo-detail-header-right .wo-btn-financial {
    height: 30px;
    padding: 0 8px;
  }

  .wo-info-grid { grid-template-columns: 1fr; }

  .wo-resp-grid { grid-template-columns: 1fr; }

  .wo-actions-right .wo-btn-secondary,
  .wo-actions-right .wo-btn-primary {
    flex: 1 1 100%;
  }
}

/* ── RDO mobile melhorado ── */
@media (max-width: 768px) {
  .rdo-tab-wrap { padding: 8px 0; }

  .rdo-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .rdo-item-row .rdo-right {
    width: 100%;
    justify-content: flex-start;
  }

  .rdo-svc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rdo-svc-table { min-width: 560px; }

  .rdo-modal-box {
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    margin: 0;
    max-height: 90vh;
  }

  .rdo-form-body { padding: 14px; }

  .rdo-entry-card {
    border-radius: 10px;
    padding: 12px;
  }

  .rdo-entry-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .rdo-entry-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .rdo-photos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Touch targets mínimos ── */
@media (max-width: 768px) {
  /* Todos os botões têm altura mínima de 44px para touch */
  .wo-btn-primary,
  .wo-btn-secondary,
  .wo-btn-bulk,
  .rdo-btn-icon,
  .wo-filter-toggle,
  .wo-sort-select,
  .wo-btn-stage-apply {
    min-height: 44px;
  }

  .wo-inline-select,
  .wo-inline-input,
  .wo-field-input,
  .wo-field-select {
    min-height: 40px;
    font-size: 16px; /* evita zoom automático do iOS */
  }

  /* Checkboxes maiores */
  .wo-svc-chk,
  .wo-inline-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
  }
}

/* ── Scroll suave ── */
.wo-detail-wrap,
.rdo-tab-wrap {
  -webkit-overflow-scrolling: touch;
}

/* ── Espaço extra no bottom para iOS home indicator ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    #page-work-orders {
      padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    .wo-notif-panel {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* ════════════════════════════════════════════════════════════
   MELHORIAS GERAIS — loading, empty, error states
═══════════════════════════════════════════════════════════ */

.wo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  color: #64748b;
  font-size: 14px;
}

.wo-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  color: #dc2626;
  font-size: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
}

.wo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 16px;
  text-align: center;
  color: #94a3b8;
}

.wo-empty i {
  font-size: 36px;
  color: #bfdbfe;
  margin-bottom: 4px;
}

.wo-empty h3 {
  color: #374151;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.wo-empty p {
  color: #64748b;
  font-size: 14px;
  margin: 0;
  max-width: 320px;
}

/* ── Transição suave na troca de seções ── */
#wo-list-section,
#wo-detail-section {
  transition: opacity 0.18s ease;
}

/* ── Focus visible para acessibilidade ── */
.wo-card:focus-visible,
.wo-kpi-card:focus-visible,
.wo-btn-primary:focus-visible,
.wo-btn-secondary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ── Animação de entrada dos cards ── */
@keyframes woCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wo-card {
  animation: woCardIn 0.2s ease backwards;
}

.wo-card:nth-child(1)  { animation-delay: 0.02s; }
.wo-card:nth-child(2)  { animation-delay: 0.04s; }
.wo-card:nth-child(3)  { animation-delay: 0.06s; }
.wo-card:nth-child(4)  { animation-delay: 0.08s; }
.wo-card:nth-child(5)  { animation-delay: 0.10s; }
.wo-card:nth-child(n+6){ animation-delay: 0.12s; }
