:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1f2937;
  --ink-muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1f3a5f;
  --brand-soft: #e8eef6;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 36px 0 28px;
}
.page-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lede {
  margin: 0;
  color: var(--ink-muted);
  max-width: 640px;
}

main { padding: 28px 0 80px; }

.state-msg {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-muted);
}
.state-error {
  color: var(--red);
  background: var(--red-soft);
  border-radius: var(--radius);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(15,23,42,0.06), 0 12px 28px rgba(15,23,42,0.08); }

.card-photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #eef2f7 0%, #e2e8f0 100%);
  overflow: hidden;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-photo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 14px;
}
.card-photo img + .card-photo-fallback { display: none; }
.card-photo:hover img { opacity: 0.94; }

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}
.card-meta {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}
.card-price {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn-ghost {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}
.btn-ghost:hover { background: #d8e3f1; }
.btn-idealista { align-self: flex-start; }

.vote-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.vote {
  appearance: none;
  background: #fafafa;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 10px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}
.vote:hover { background: #f1f5f9; }
.vote-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.vote[data-active="true"][data-estado="Gostei, quero visitar"] {
  background: var(--green-soft); border-color: var(--green); color: var(--green);
}
.vote[data-active="true"][data-estado="Gostei, quero visitar"] .vote-icon {
  background: var(--green); color: #fff;
}
.vote[data-active="true"][data-estado="Gostei, não 1ª opção"] {
  background: var(--amber-soft); border-color: var(--amber); color: var(--amber);
}
.vote[data-active="true"][data-estado="Gostei, não 1ª opção"] .vote-icon {
  background: var(--amber); color: #fff;
}
.vote[data-active="true"][data-estado="A pensar"] {
  background: var(--blue-soft); border-color: var(--blue); color: var(--blue);
}
.vote[data-active="true"][data-estado="A pensar"] .vote-icon {
  background: var(--blue); color: #fff;
}
.vote[data-active="true"][data-estado="Não gostei"] {
  background: var(--red-soft); border-color: var(--red); color: var(--red);
}
.vote[data-active="true"][data-estado="Não gostei"] .vote-icon {
  background: var(--red); color: #fff;
}

.comment-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 4px;
}
.comment {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
  min-height: 44px;
  background: #fafafa;
  color: var(--ink);
}
.comment:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

.card-status {
  font-size: 12px;
  color: var(--ink-muted);
  min-height: 16px;
  margin-top: 2px;
}
.card-status.is-success { color: var(--green); }
.card-status.is-error { color: var(--red); }

.page-footer {
  padding: 24px 0;
  color: var(--ink-muted);
  text-align: center;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 480px) {
  .vote-row { grid-template-columns: 1fr; }
  .page-header { padding: 24px 0 18px; }
  .page-header h1 { font-size: 22px; }
}
