/* Visitas com roteiro de imóveis (Casa Carvalho): assistente em 3 etapas, lista de seleção e detalhe.
 * Usa os tokens do casa.css (petróleo, areia, ouro). Desktop, tablet e celular sem rolagem lateral. Autor: Claude — Anthropic */

.vr { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vr *, .vr *::before, .vr *::after { box-sizing: border-box; }
.vr-carregando { padding: 40px; text-align: center; color: var(--muted); }

/* Faixa de topo */
.vr-topo {
  background: radial-gradient(120% 140% at 0% 0%, #22506b 0%, var(--petroleo) 55%, #0f2a3b 100%);
  color: var(--areia); border-radius: 18px; padding: 18px 22px; box-shadow: var(--sombra);
  position: relative; overflow: hidden;
}
.vr-topo::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(223,196,156,.22), transparent 70%); pointer-events: none; }
.vr-topo .eyebrow { color: var(--ouro-claro); }
.vr-resumo-topo { font-size: 20px; font-family: Georgia, 'Times New Roman', serif; margin-top: 4px; }

/* Etapas */
.vr-etapas { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--linha); border-radius: 16px; padding: 12px 16px; box-shadow: var(--sombra); }
.vr-etapa { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; cursor: pointer; color: var(--muted); font: inherit; border-radius: 10px; min-width: 0; }
.vr-etapa:disabled { cursor: default; opacity: .55; }
.vr-etapa:focus-visible { outline: 2px solid var(--ouro); outline-offset: 2px; }
.vr-num-et { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--linha); font-weight: 700; flex: none; }
.vr-nome-et { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-etapa.atual { color: var(--petroleo); }
.vr-etapa.atual .vr-num-et { background: var(--petroleo); border-color: var(--petroleo); color: #fff; box-shadow: 0 0 0 4px rgba(184,148,91,.25); }
.vr-etapa.feito .vr-num-et { background: var(--ouro-claro); border-color: var(--ouro); color: var(--ouro-escuro); }
.vr-linha-et { flex: 1; height: 2px; background: var(--linha); min-width: 12px; border-radius: 2px; }

/* Mensagens */
.vr-msg { background: var(--alerta-bg); color: var(--alerta); border: 1px solid #ecd9a8; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.vr-msg[hidden], .vr-aviso[hidden] { display: none; }
.vr-aviso { background: var(--alerta-bg); color: #5f4a14; border: 1px solid #ecd9a8; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.vr-aviso.ruim { background: var(--ruim-bg); color: #7a2f27; border-color: #efc4bc; }
.vr-aviso-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vr-texto-ruim { color: var(--ruim) !important; }

/* Painel (cartão) */
.vr-painel { background: var(--card); border: 1px solid var(--linha); border-radius: 16px; padding: 18px 20px; box-shadow: var(--sombra); min-width: 0; }
.vr-painel h3 { margin: 0 0 8px; font-size: 17px; font-family: Georgia, 'Times New Roman', serif; color: var(--petroleo); }
.vr-h3 { margin-top: 18px !important; }
.vr-h4 { margin: 18px 0 8px; font-size: 15px; color: var(--petroleo); display: flex; align-items: center; gap: 8px; }
.vr-ajuda { color: var(--muted); font-size: 14px; margin: 0 0 14px; line-height: 1.5; }
.vr-link { background: none; border: 0; color: var(--verde); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
.vr-link:focus-visible, .vr-mini:focus-visible, .vr-row:focus-within { outline: 2px solid var(--ouro); outline-offset: 2px; }

/* Etapa 1: categorias */
.vr-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.vr-cat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer; font: inherit;
  background: linear-gradient(180deg, #fff, var(--areia-2)); border: 1.5px solid var(--linha); border-radius: 16px; padding: 18px; color: var(--tinta);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.vr-cat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(22,52,73,.10); }
.vr-cat:focus-visible { outline: 2px solid var(--ouro); outline-offset: 3px; }
.vr-cat.on { border-color: var(--ouro); box-shadow: 0 0 0 4px rgba(184,148,91,.18); background: linear-gradient(180deg, #fffdf8, #f5e9d2); }
.vr-cat-ic { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; background: var(--petroleo); color: var(--areia); }
.vr-cat b { font-size: 18px; font-family: Georgia, 'Times New Roman', serif; color: var(--petroleo); }
.vr-cat small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.vr-cat em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--ouro-escuro); background: var(--ouro-claro); border-radius: 999px; padding: 3px 10px; margin-top: 4px; }

.vr-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.vr-nav-final { margin-top: 14px; }

/* Etapa 2: barra de pesquisa e filtros */
.vr-barra { display: flex; flex-direction: column; gap: 10px; }
.vr-busca { display: flex; align-items: center; gap: 8px; border: 1px solid var(--linha); border-radius: 12px; padding: 0 12px; background: #fff; }
.vr-busca span { color: var(--muted); font-size: 18px; }
.vr-busca input { border: 0; outline: 0; flex: 1; min-width: 0; padding: 11px 0; font: inherit; background: transparent; }
.vr-busca:focus-within { border-color: var(--ouro); box-shadow: 0 0 0 3px rgba(184,148,91,.18); }
.vr-filtros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.vr-filtros select, .vr-filtros input, .vr-campo input, .vr-campo select, .vr-campo textarea {
  width: 100%; min-width: 0; border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: var(--tinta);
}
.vr-campo textarea { resize: vertical; }
.vr-filtros select:focus, .vr-filtros input:focus, .vr-campo input:focus, .vr-campo select:focus, .vr-campo textarea:focus { outline: 0; border-color: var(--ouro); box-shadow: 0 0 0 3px rgba(184,148,91,.18); }
.vr-acoes-filtro { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.vr-selecao { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 16px 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--areia-2); border: 1px solid #ecdfc6; }
.vr-contador { color: var(--petroleo); font-size: 15px; white-space: nowrap; }
.vr-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.vr-chips small { color: var(--muted); }
.vr-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--petroleo); color: #fff; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600; }
.vr-chip button { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; }

/* Lista de seleção */
.vr-cabecalho, .vr-row {
  display: grid; grid-template-columns: 28px 72px minmax(0, 1.7fr) 74px 84px 60px minmax(0, 1.2fr) 150px; gap: 12px; align-items: center;
}
.vr-cabecalho { padding: 8px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--linha); }
.vr-lista { display: flex; flex-direction: column; margin-top: 6px; }
.vr-row {
  padding: 10px 14px; border-bottom: 1px solid #efe9dc; border-radius: 12px; cursor: pointer; transition: background .12s ease;
}
.vr-row:hover { background: #faf6ee; }
.vr-row.on { background: linear-gradient(90deg, #f6ecd9, #fbf6ec); box-shadow: inset 3px 0 0 var(--ouro); }
.vr-row.fora { opacity: .9; }
.vr-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--petroleo); cursor: pointer; margin: 0; }
.vr-thumb { width: 72px; height: 54px; border-radius: 10px; background: #e9e4da center/cover no-repeat; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; color: var(--muted); }
.vr-thumb.pq { width: 56px; height: 44px; }
.vr-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.vr-info b { color: var(--petroleo); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-info small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-tipo { font-size: 12px; color: var(--ouro-escuro); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.vr-num { font-size: 13px; color: var(--tinta); white-space: nowrap; }
.vr-preco { font-weight: 700; color: var(--tinta); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vr-status .tag { white-space: nowrap; }
.vr-vazio { padding: 36px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.vr-vazio b { color: var(--petroleo); font-size: 16px; }

/* Rodapé fixo (celular) */
.vr-rodape { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--linha); border-radius: 16px; padding: 12px 16px; box-shadow: var(--sombra); }
.vr-rodape-info { color: var(--muted); font-size: 14px; }
.vr-rodape-info b { color: var(--petroleo); font-size: 16px; }
.vr-rodape-botoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* Etapa 3: dados e roteiro */
.vr-dados { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.vr-dados > .vr-painel:first-child { display: flex; flex-direction: column; gap: 12px; }
.vr-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vr-campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.vr-campo > span { font-weight: 600; color: var(--tinta); }
.vr-seg { display: inline-flex; background: var(--areia-2); border: 1px solid var(--linha); border-radius: 12px; padding: 4px; gap: 4px; align-self: flex-start; max-width: 100%; flex-wrap: wrap; }
.vr-seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.vr-seg button.on { background: var(--petroleo); color: #fff; box-shadow: 0 2px 6px rgba(22,52,73,.2); }
.vr-escolhido { display: flex; align-items: center; gap: 12px; background: var(--bom-bg); border-radius: 12px; padding: 10px 12px; }
.vr-escolhido .av { width: 38px; height: 38px; }
.vr-escolhido div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.vr-escolhido small { color: var(--muted); }
.vr-resultados { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.vr-pessoa { text-align: left; border: 1px solid var(--linha); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; }
.vr-pessoa:hover { border-color: var(--ouro); background: #fffdf8; }
.vr-pessoa small { color: var(--muted); }

.vr-roteiro { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.vr-roteiro-cab { display: flex; align-items: center; justify-content: space-between; }
.vr-roteiro-cab h3 { margin: 0; }
.vr-lista-roteiro, .vr-det-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vr-item, .vr-det-item {
  display: grid; grid-template-columns: 26px 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--areia-2); border: 1px solid #ecdfc6; border-radius: 12px; padding: 8px 10px;
}
.vr-item.alerta { border-color: #efc4bc; background: var(--ruim-bg); }
.vr-ordem { width: 26px; height: 26px; border-radius: 50%; background: var(--petroleo); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.vr-ctrl { display: flex; gap: 4px; }
.vr-mini { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--linha); background: #fff; color: var(--petroleo); cursor: pointer; font-weight: 700; }
.vr-mini:disabled { opacity: .35; cursor: default; }
.vr-mini.ruim { color: var(--ruim); border-color: #efc4bc; }
.vr-vazio-li { color: var(--muted); font-size: 14px; padding: 8px 0; }
.vr-resumo-visita { display: flex; flex-wrap: wrap; gap: 6px; }
.vr-resumo-visita span { background: var(--areia-2); border: 1px solid #ecdfc6; border-radius: 999px; padding: 5px 10px; font-size: 13px; color: var(--tinta); }

/* Detalhe do agendamento (modal) */
.vr-det { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vr-det-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.vr-det-cab small { color: var(--muted); }
.vr-det-cab h3 { margin: 2px 0 0; font-family: Georgia, 'Times New Roman', serif; color: var(--petroleo); font-size: 20px; }
.vr-det-dados { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0 0; }
.vr-det-dados div { background: var(--areia-2); border-radius: 10px; padding: 8px 12px; }
.vr-det-dados dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.vr-det-dados dd { margin: 2px 0 0; color: var(--tinta); font-weight: 600; overflow-wrap: anywhere; }
.vr-det-obs { background: #fff; border-left: 3px solid var(--ouro); padding: 8px 12px; color: var(--tinta); margin: 8px 0 0; white-space: pre-wrap; }
.vr-det-item { grid-template-columns: 26px 56px minmax(0, 1fr) auto; }
.vr-det-item .vr-info { grid-column: 3; grid-row: 1; }
.vr-det-item .vr-status { grid-column: 4; grid-row: 1; justify-self: end; }
.vr-acoes-item { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; grid-column: 3 / 5; grid-row: 2; }
.vr-det-item .vr-info b, .vr-det-item .vr-info small { white-space: normal; overflow: visible; text-overflow: clip; }
.vr-det-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Linha da agenda (lista de visitas) */
.vr-linha { cursor: pointer; }
.vr-linha:focus-visible { outline: 2px solid var(--ouro); outline-offset: 2px; }
.vr-ic-linha { width: 40px; height: 40px; border-radius: 12px; background: var(--petroleo); color: var(--areia); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.vr-selo { font-size: 11px; font-weight: 700; color: var(--ouro-escuro); background: var(--ouro-claro); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 2px; }
.vr-tag-alerta { color: var(--ruim); font-weight: 700; }

/* Tablet (até 1100 px): some banheiros e vagas; a lista usa as colunas essenciais */
@media (max-width: 1100px) {
  .vr-dados { grid-template-columns: minmax(0, 1fr); }
  .vr-roteiro { position: static; }
  .vr-cabecalho, .vr-row { grid-template-columns: 28px 64px minmax(0, 1.6fr) 70px minmax(0, 1fr) 140px; }
  .vr-so-tablet { display: none; }
  .vr-filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vr-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Celular (até 720 px): cartões, sem rolagem lateral; rodapé fixo com a ação principal */
@media (max-width: 720px) {
  .vr { gap: 12px; }
  .vr-topo { padding: 14px 16px; border-radius: 14px; }
  .vr-resumo-topo { font-size: 17px; }
  .vr-etapas { padding: 8px 10px; gap: 4px; }
  .vr-nome-et { display: none; }
  .vr-linha-et { min-width: 6px; }
  .vr-etapa.atual .vr-nome-et { display: inline; font-size: 13px; }
  .vr-painel { padding: 14px; border-radius: 14px; }
  .vr-cats { grid-template-columns: minmax(0, 1fr); }
  .vr-cat { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 14px; }
  .vr-cat-ic { width: 38px; height: 38px; font-size: 18px; }
  .vr-cat small { flex-basis: 100%; }
  .vr-cat em { margin-left: auto; margin-top: 0; }
  .vr-filtros { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vr-acoes-filtro { justify-content: stretch; }
  .vr-acoes-filtro .btn { flex: 1; justify-content: center; }
  .vr-cabecalho { display: none; }
  .vr-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px; border: 1px solid var(--linha); margin-bottom: 8px; background: #fff;
  }
  .vr-row input[type=checkbox] { order: 0; }
  .vr-row .vr-thumb { order: 1; width: 64px; height: 50px; }
  .vr-row .vr-info { order: 2; flex: 1 1 0; min-width: 0; }
  .vr-row .vr-info .vr-tipo, .vr-row .vr-info small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
  .vr-row .vr-num, .vr-row .vr-preco, .vr-row .vr-status { order: 3; font-size: 13px; }
  .vr-row .vr-num::before { content: attr(data-l) ': '; color: var(--muted); font-weight: 400; }
  .vr-row .vr-preco { flex: 1 1 100%; color: var(--petroleo); font-size: 15px; }
  .vr-row .vr-status { margin-left: auto; }
  .vr-row .vr-so-tablet { display: inline; }
  .vr-rodape { position: sticky; bottom: 8px; z-index: 5; padding: 10px 12px; }
  .vr-rodape-botoes { width: 100%; }
  .vr-rodape-botoes .btn { flex: 1; justify-content: center; }
  .vr-dados > .vr-painel:first-child { gap: 10px; }
  .vr-duplo { grid-template-columns: minmax(0, 1fr); }
  .vr-nav { flex-direction: column-reverse; align-items: stretch; }
  .vr-nav .btn { width: 100%; justify-content: center; }
  .vr-nav-final .btn { width: 100%; justify-content: center; }
  .vr-det-dados { grid-template-columns: minmax(0, 1fr); }
  .vr-det-cab { flex-direction: column; }
  .vr-det-item { grid-template-columns: 26px 52px minmax(0, 1fr); }
  .vr-det-item .vr-info { grid-column: 3; grid-row: 1; }
  .vr-det-item .vr-status { grid-column: 3; grid-row: 2; justify-self: start; }
  .vr-acoes-item { grid-column: 1 / 4; justify-content: flex-start; grid-row: 3; }
  .vr-det-acoes .btn { flex: 1 1 100%; justify-content: center; }
  .vr-selecao { flex-direction: column; align-items: stretch; }
  .vr-seg { width: 100%; }
  .vr-seg button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .vr-cat, .vr-row { transition: none; }
  .vr-cat:hover { transform: none; }
}
