/* ==========================================================================
   TABELA DE OS (substitui os cards da fila)
   ========================================================================== */

:root {
  --os-w-os: 190px;   /* OS / Apartamento (congelada) */
  --os-w-tit: 230px;  /* Título (congelada, logo após OS) */
}

/* Barra superior: visões salvas à esquerda, busca e prédio à direita */
.os-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #edf1f4;
}
.os-topbar #attention {
  border-bottom: 0;
  padding: 6px 0;
  flex: 0 1 auto;
  min-width: 0;
}
.os-topbar .toolbar {
  margin-left: auto;
  flex: 1 1 320px;
  justify-content: flex-end;
  min-width: 0;
}
.os-topbar #attention button {
  font-size: 12.5px;
  padding: 5px 9px;
  border: 1px solid transparent;
}
.os-topbar #attention button:hover {
  background: #f1f5f8;
}
.os-topbar #attention button.selected {
  border-color: #cfdde7;
}
/* Visões salvas à esquerda (Todas, Vencidas, Hoje, Sem equipe, Retorno) ocultas.
   Os filtros da direita continuam visíveis. */

/* A lista é o contêiner: as colunas secundárias somem quando ela estreita */
.work-list {
  container-type: inline-size;
}

/* Lista: rolagem nos dois eixos. Sem padding lateral: a coluna congelada
   gruda na borda da área de rolagem, e o conteúdo não aparece na margem. */
#list {
  overflow: auto;
}
/* modern.css define #list com padding !important; a tabela precisa começar na borda */
#list:has(> .os-table) {
  padding: 0 !important;
  display: block !important;
  gap: 0 !important;
}

.os-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: #1f3340;
}
.os-table th,
.os-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #edf1f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.os-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f9fb;
  color: #617786;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #dfe7ed;
}

/* Larguras fixas (table-layout: fixed). Observação absorve o espaço restante. */
.os-table .os-c-os,
.os-table .os-c-titulo,
.os-table .os-status,
.os-table .os-date,
.os-table .os-control,
.os-table .os-next,
.os-table .os-col-urg,
.os-table .os-col-foto {
  width: auto;
}
.os-table col.w-os { width: var(--os-w-os); }
.os-table col.w-tit { width: var(--os-w-tit); }
.os-table col.w-status { width: 210px; }
.os-table col.w-date { width: 180px; }
.os-table col.w-tech { width: 170px; }
.os-table col.w-next { width: 170px; }
.os-table col.w-urg { width: 116px; }
.os-table col.w-foto { width: 130px; }

/* Coluna congelada: OS/apartamento. Título rola com as demais colunas. */
.os-table .os-c-os {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  background-clip: padding-box;
}
.os-row.current .os-c-os,
.os-row:hover .os-c-os {
  background: #e8f0f5;
}
.os-table .os-c-os {
  left: 0;
  width: var(--os-w-os);
  min-width: var(--os-w-os);
  max-width: var(--os-w-os);
  border-right: 1px solid #edf1f4;
}
.os-table .os-c-titulo {
  width: var(--os-w-tit);
  min-width: var(--os-w-tit);
  max-width: var(--os-w-tit);
}
.os-table thead .os-c-os {
  z-index: 4;
  background: #f7f9fb;
}

/* Observação: uma linha, com reticências */
.os-obs {
  color: #36505f;
}

/* Linhas */
.os-row {
  cursor: pointer;
}
.os-row td {
  background: #fff;
  transition: background 0.12s ease;
}
.os-row:hover td {
  background: #f6f9fb;
}
.os-row:focus-visible {
  outline: none;
}
.os-row:focus-visible td {
  background: #f1f6fa;
}
.os-row.current td {
  background: #e8f0f5;
}
.os-row.in-drawer .os-c-os {
  box-shadow: inset 3px 0 0 #214a63;
}

.os-os-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  color: #1f3340;
}
.os-apt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.os-os-line strong {
  font-weight: 600;
}
.os-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  white-space: nowrap;
}
.os-os-id {
  font-size: 12px;
  line-height: 1.3;
  color: #617786;
}
.os-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef2f5;
  color: #4b5b68;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.os-titulo {
  display: block;
  font-weight: 700;
  color: #1f3340;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status: pílula colorida (vermelho vencida, âmbar hoje, cinza agendada) */
.os-status-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.os-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.os-pill.is-late {
  background: #fdecea;
  color: #b42318;
}
.os-pill.is-today {
  background: #fdf3df;
  color: #92590a;
}
.os-pill.is-sched {
  background: #eef2f5;
  color: #4b5b68;
  font-weight: 500;
}

/* Data: gatilho do calendário compartilhado (datetime-picker-trigger) */
.os-date .datetime-picker-trigger {
  width: 100%;
  min-height: 28px;
  padding: 0 6px;
  font-size: 12.5px;
}

/* Técnico: select inline (dropdowns.js troca pelo menu customizado) */
.os-control .custom-select {
  display: inline-flex;
  width: 100%;
  max-width: 100%;
}
.os-control .custom-select-trigger {
  width: 100%;
  min-height: 28px;
  font-size: 12.5px;
}

.os-next {
  color: #1f3340;
  font-weight: 500;
}

/* Urgência e fotos: somente leitura */
.os-prio {
  font-size: 12px;
  font-weight: 700;
  color: #36505f;
  font-variant-numeric: tabular-nums;
}
/* Cores das etiquetas de urgência do app (chips Baixa / Logo / Urgente) */
.os-prio.is-urgente {
  color: #dc2626;
}
.os-prio.is-logo {
  color: #d97706;
}
.os-prio.is-baixa {
  color: #475569;
}
.os-none {
  color: #a3b3bd;
}

.os-photos {
  overflow: visible;
}
.os-photos .row-media-strip {
  display: flex;
  align-items: center;
  gap: 4px;
}
.os-photos .row-media-thumb {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 34px;
  border: 1px solid #dfe7ed;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f5f8;
  cursor: pointer;
}
.os-photos .row-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.os-photos .thumb-video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.35);
}
.os-photos .row-media-count {
  font-size: 11.5px;
  font-weight: 600;
  color: #617786;
}

/* Espaço estreito: somem Fotos e Urgência antes de qualquer outra coisa */
@container (max-width: 1100px) {
  .os-col-urg,
  .os-col-foto,
  col.os-col-urg,
  col.os-col-foto {
    display: none;
  }
}

/* Grupos (Agrupar ordens) */
.os-group-head td {
  padding: 0;
  border-bottom: 0;
}
.os-group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  background: #f1f5f8;
  border: 0;
  border-bottom: 1px solid #e3eaef;
  color: #36505f;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.os-group-toggle span {
  color: #617786;
  font-weight: 500;
}
.os-group-toggle .list-group-chev {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s ease;
}
.os-group-toggle.is-collapsed .list-group-chev {
  transform: rotate(-90deg);
}
.os-group-rows.is-collapsed {
  display: none;
}

/* Data e técnico: somente texto, sem caixa. O hover sublinha para indicar que é editável. */
.os-table .os-date .datetime-picker-trigger,
.os-table .os-control .custom-select-trigger {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #1f3340;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}
.os-table .os-date .datetime-picker-trigger .dp-cal-icon,
.os-table .os-date .datetime-picker-trigger .dp-chevron,
.os-table .os-control .custom-select-trigger .select-chevron {
  display: none;
}
.os-table .os-date .datetime-picker-trigger:hover,
.os-table .os-control .custom-select-trigger:hover {
  background: transparent;
  text-decoration: underline dotted #9fb3c0;
  text-underline-offset: 3px;
}
.os-table .os-date .datetime-picker-trigger:focus-visible,
.os-table .os-control .custom-select-trigger:focus-visible {
  outline: 2px solid #214a63;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Período e Mais filtros (painéis flutuantes sobre a lista) */
.os-period,
.os-more {
  position: relative;
  display: inline-flex;
}
.os-period-trigger {
  cursor: pointer;
  white-space: nowrap;
}
.os-period-trigger.is-set {
  border-color: #214a63;
  color: #214a63;
  font-weight: 600;
}
.os-period-panel,
.os-more-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.os-period-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
}
.os-period-panel[hidden] {
  display: none;
}
.os-period-panel .datetime-picker-trigger {
  min-width: 110px;
}
.os-more-trigger {
  list-style: none;
  cursor: pointer;
}
.os-more-trigger::-webkit-details-marker {
  display: none;
}
.os-more-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px 12px;
  padding: 12px;
  min-width: 340px;
}
.os-more-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.os-more-field > span {
  font-size: 11px;
  font-weight: 600;
  color: #617786;
}


/* Mais filtros: o details global tem caixa de fundo e margem; aqui fica só o gatilho,
   com as mesmas medidas dos demais filtros. */
.os-more.os-more {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  align-items: center;
  vertical-align: middle;
}
.os-more > summary.os-more-trigger {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font: inherit;
  font-size: 11px;
  font-weight: inherit;
  color: #334155;
}
.os-more-trigger .select-chevron {
  display: inline-flex;
  transition: transform 0.18s ease;
}
.os-more[open] > .os-more-trigger .select-chevron {
  transform: rotate(180deg);
}
.os-period .custom-select,
.os-more-trigger {
  vertical-align: middle;
}

/* Filtro de apartamento: gatilho, painel com busca e lista */
.os-apartment {
  position: relative;
  display: inline-flex;
}
.os-apt-trigger {
  cursor: pointer;
  white-space: nowrap;
}
.os-apt-trigger.is-set {
  border-color: #214a63;
  color: #214a63;
  font-weight: 600;
}
.os-apartment .select-chevron svg {
  transition: transform 0.18s ease;
}
.os-apartment[data-open="true"] .select-chevron svg {
  transform: rotate(180deg);
}
.os-apt-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 260px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dfe7ed;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.os-apt-panel[hidden] {
  display: none;
}
.os-apt-search {
  width: 100%;
  height: 32px;
  margin-bottom: 6px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid #cfdde7;
  border-radius: 6px;
  font-size: 13px;
}
.os-apt-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.os-apt-item {
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1f3340;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.os-apt-item:hover {
  background: #f1f5f8;
}
.os-apt-item.is-sel {
  background: #e8f0f5;
  color: #214a63;
  font-weight: 600;
}
.os-apt-empty {
  padding: 8px;
  font-size: 12px;
  color: #617786;
}

/* Mudanças desde a última visita */
.changes-panel {
  margin: 8px 12px 0;
  padding: 10px 12px;
  background: #fffaf0;
  border: 1px solid #f1d9a8;
  border-radius: 10px;
}
.changes-panel[hidden] {
  display: none;
}
.chg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #1f3340;
}
.chg-total {
  font-size: 12px;
  font-weight: 600;
  color: #92590a;
}
.chg-seen {
  margin-left: auto;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #cfdde7;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.chg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  margin-top: 8px;
  overflow-y: auto;
}
.chg-item {
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #f0e2c8;
  border-radius: 8px;
}
.chg-item summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  list-style: none;
}
.chg-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f3340;
}
.chg-count {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #92590a;
}
.chg-sum {
  font-size: 12px;
  color: #617786;
}
.chg-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #36505f;
}
.chg-events {
  margin: 0;
  padding-left: 16px;
}
.chg-body button {
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #cfdde7;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.os-chg-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #d97706;
  vertical-align: middle;
}
.change-diff {
  width: min(720px, 92vw);
  padding: 0;
  border: 1px solid #dfe7ed;
  border-radius: 12px;
}
.change-diff::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.change-diff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f4;
}
.change-diff-head button {
  font-size: 18px;
  background: none;
  border: 0;
  cursor: pointer;
}
.change-diff-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.change-diff-cols pre {
  max-height: 50vh;
  margin: 4px 0 0;
  padding: 10px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  background: #f8fafc;
  border-radius: 8px;
}

/* ==========================================================================
   LAYOUT DA LISTA DE OS
   - Remove a faixa laranja de sugestão ("OS vencida sem reagendamento").
   - Busca e filtros sobem para uma linha própria, logo abaixo de "Em aberto".
   - A linha dos botões de fila (Hoje + vencidas, Todas, ...) fica só com as filas.
   ========================================================================== */

#suggestion-banner {
  display: none !important;
}

.os-topbar .toolbar {
  order: -1;
  flex: 1 1 100%;
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
  padding: 8px 0 6px;
  border-bottom: 1px solid #edf1f4;
}

.os-topbar #attention {
  order: 0;
  flex: 1 1 auto;
}