/* Estilos específicos do admin (carregados depois do style.css) */

.admin-body { background: #fafafa; }

.admin-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.admin-topbar h1 { margin: 0 0 4px; font-size: 22px; }

/* Sessão vem do backoffice (backoffice.zeist.pt) — daqui só se sai. */
.admin-session { display: flex; gap: 8px; align-items: center; }
.admin-session .btn { text-decoration: none; }

.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--ink-muted);
  font-weight: 500;
  border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: var(--surface);
}

.admin-main { padding: 24px 0 80px; }

.tab-pane[hidden] { display: none !important; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.summary .card-stat {
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.summary .num { font-size: 24px; font-weight: 600; color: var(--brand); }
.summary .lbl { font-size: 12px; color: var(--ink-muted); }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: #142a47; }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--line);
}
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border-color: #25d366;
  text-decoration: none;
}
.btn-whatsapp:hover { background: #128c7e; border-color: #128c7e; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.inline-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 12px 0 20px;
  box-shadow: var(--shadow);
}
.inline-form h3, .inline-form h4 { margin-top: 0; margin-bottom: 14px; font-size: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
}
.form-grid label.span-2 { grid-column: span 2; }
.form-grid input,
.form-grid textarea,
.form-grid select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.form-grid input:focus,
.form-grid textarea:focus { outline: none; border-color: var(--brand); }
.form-grid .hint { font-weight: 400; color: var(--ink-muted); }
.form-grid .hint code { background: #eef2f7; padding: 1px 5px; border-radius: 3px; }
.form-grid label small { color: var(--red); }

.url-row { display: flex; gap: 6px; }
.url-row input { flex: 1; }

.upload-row { display: flex; gap: 6px; align-items: stretch; }
.upload-row input[type="url"] { flex: 1; }
.upload-row .btn { white-space: nowrap; }

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.form-status {
  margin-top: 8px;
  font-size: 13px;
  min-height: 18px;
}
.form-status.is-success { color: var(--green); }
.form-status.is-error { color: var(--red); }

.fetch-status.is-success { color: var(--green); }
.fetch-status.is-error {
  color: var(--amber);
  background: var(--amber-soft);
  padding: 8px 10px;
  border-radius: 6px;
  display: block;
  margin-top: 6px;
}

.hint.is-success { color: var(--green); }
.hint.is-error { color: var(--red); }
.fetch-status.is-error small { color: var(--amber); display: block; margin-top: 4px; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.span-2 { grid-column: span 1; }
}

/* ── Clientes lista ───────────────────────────────────────────── */

.clientes-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cliente-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cliente-card summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
}
.cliente-card summary::-webkit-details-marker { display: none; }
.cliente-card summary::before {
  content: '▸';
  margin-right: 8px;
  color: var(--ink-muted);
  transition: transform 0.15s;
  display: inline-block;
}
.cliente-card[open] summary::before { transform: rotate(90deg); }

.cliente-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cliente-nome { margin: 0; font-size: 16px; font-weight: 600; display: inline; }
.cliente-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.cliente-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cliente-actions .btn { text-decoration: none; }

.cliente-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.imoveis-section h4 { margin: 0 0 10px; font-size: 14px; color: var(--ink-muted); }

.imoveis-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.imovel-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.imovel-row-main {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: #fafafa;
}
.imovel-row.is-inactive { opacity: 0.55; }
.imovel-row.has-notas [data-action="toggle-notas"] {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber);
}
.imovel-avaliacao {
  padding: 6px 12px;
  border-top: 1px dashed var(--line);
  background: #fcfcfc;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.avaliacao-estado {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.avaliacao-estado.avaliacao-sem {
  background: var(--line);
  color: var(--ink-muted);
  font-weight: 400;
}
.avaliacao-comment {
  color: var(--ink-muted);
  font-style: italic;
  flex: 1;
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avaliacao-when {
  color: var(--ink-muted);
  white-space: nowrap;
  font-size: 11px;
}
/* Destacar visualmente o row inteiro quando o cliente "Não gostou" */
.imovel-row.estado-nao-gostei { border-color: var(--red); }
.imovel-row.estado-nao-gostei .imovel-avaliacao { background: var(--red-soft); }

.imovel-notas {
  padding: 10px 12px 12px;
  border-top: 1px dashed var(--line);
  background: #fffdf5;
}
.imovel-notas textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 36px;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}
.imovel-notas textarea:focus { outline: none; border-color: var(--brand); }
.imovel-notas .notas-status {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  min-height: 12px;
}
.imovel-notas .notas-status.is-success { color: var(--green); }
.imovel-notas .notas-status.is-error { color: var(--red); }

.imovel-thumb {
  width: 72px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: #e2e8f0;
}
.imovel-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.imovel-info { min-width: 0; }
.imovel-titulo {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.imovel-titulo:hover { color: var(--brand); text-decoration: underline; }
.imovel-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.imovel-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.imovel-inactive-tag {
  font-size: 11px;
  background: var(--line);
  color: var(--ink-muted);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

.empty-imoveis {
  font-size: 13px;
  color: var(--ink-muted);
  padding: 8px 0 4px;
}

/* Filtros já existem no style.css inline da versão antiga; copia aqui */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 20px;
}
.filters label {
  font-size: 13px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filters select, .filters input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

table.evals {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}
table.evals th, table.evals td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.evals th {
  background: #fafafa;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
table.evals tr:last-child td { border-bottom: none; }
.estado-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.estado-verde { background: var(--green-soft); color: var(--green); }
.estado-amarelo { background: var(--amber-soft); color: var(--amber); }
.estado-azul { background: var(--blue-soft); color: var(--blue); }
.estado-vermelho { background: var(--red-soft); color: var(--red); }
.empty { padding: 40px; text-align: center; color: var(--ink-muted); }
.comment-cell { max-width: 320px; color: var(--ink-muted); }
.link-pill {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--brand);
}
