/* Inmo PWA — marca teal #0D7377 */
:root {
  --brand: #0d7377;
  --brand-dark: #095456;
  --brand-soft: #e6f3f3;
  --ink: #1a1f1f;
  --muted: #5c6b6b;
  --line: #d5e0e0;
  --bg: #f7fafb;
  --surface: #ffffff;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(13, 115, 119, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --nav-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d8efef 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #eef6f6 0%, transparent 50%),
    var(--bg);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 24px);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.brand:hover {
  text-decoration: none;
  color: var(--brand);
}

.sync-status {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 40vw;
  text-align: right;
}

.offline-banner {
  background: #fff4e5;
  color: #8a4b08;
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0d2a8;
}

.wrap {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
  padding-block: 1.25rem 2rem;
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

/* Filtros */
.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (min-width: 720px) {
  .filters {
    grid-template-columns: 1.4fr repeat(3, 1fr);
  }
  .filters__row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
  }
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.filters input,
.filters select,
.form input,
.form textarea,
.form select {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.filters input:focus,
.filters select:focus,
.form input:focus,
.form textarea:focus,
.form select:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-color: var(--brand);
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  margin-top: 1.35rem;
}

.filters__actions {
  display: flex;
  gap: 0.5rem;
  align-items: end;
}

/* Grid / cards */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card__media {
  aspect-ratio: 16 / 10;
  background: var(--brand-soft);
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__placeholder {
  width: 100%;
  height: 100%;
  min-height: 160px;
  background: linear-gradient(135deg, var(--brand-soft), #cfe8e8);
}

.card__body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.card__meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.card__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__price {
  margin: 0.15rem 0;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 1.15rem;
}

.card__loc,
.card__advisor {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.card__actions {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.chip--dest {
  background: #e8f6ef;
  color: #1b6b45;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-fav {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  color: #b7c4c4;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}

.btn-fav.is-fav {
  color: #c62828;
}

/* Detalle / galería */
.gallery {
  margin-bottom: 1.25rem;
}

.gallery__main {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--brand-soft);
  aspect-ratio: 16 / 10;
}

.gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.gallery__thumb {
  flex: 0 0 72px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
}

.gallery__thumb.is-active {
  border-color: var(--brand);
}

.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-head h1 {
  margin: 0.25rem 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.block {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.block h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.prose {
  white-space: pre-wrap;
  line-height: 1.55;
  color: #2c3535;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1rem;
  margin: 0;
}

.specs div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.specs dt {
  font-size: 0.7rem;
  color: var(--muted);
}

.specs dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

.feat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.feat-list li {
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.advisor__name {
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.advisor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Form contacto */
.form {
  display: grid;
  gap: 0.85rem;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.form textarea {
  min-height: 120px;
  resize: vertical;
}

.context {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--brand-soft);
  border-radius: 8px;
  color: var(--brand-dark);
}

.pending-label {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--danger);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.bottom-nav--4 {
  grid-template-columns: repeat(4, 1fr);
}

.bottom-nav--4 .bottom-nav__link {
  font-size: 0.72rem;
  text-align: center;
  padding: 0 0.2rem;
}

.bottom-nav--5 {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav--5 .bottom-nav__link {
  font-size: 0.65rem;
  text-align: center;
  padding: 0.35rem 0.1rem;
}

.bottom-nav__link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.bottom-nav__link.is-active {
  color: var(--brand);
  box-shadow: inset 0 3px 0 var(--brand);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 50;
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.list {
  display: grid;
  gap: 0.75rem;
}

.lead-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.lead-card__link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.lead-card__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.section-title,
.form-title {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
}

.form-title {
  margin-top: 0;
}

/* Próxima visita / countdown */
.next-visit {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.next-visit--ok {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  background: linear-gradient(135deg, #e6f3f3, var(--surface));
}

.next-visit--warn {
  border-color: #e0b45a;
  background: linear-gradient(135deg, #fff8e8, var(--surface));
}

.next-visit--danger {
  border-color: #e5a3a0;
  background: linear-gradient(135deg, #fdecea, var(--surface));
}

.next-visit--empty {
  opacity: 0.95;
}

.next-visit__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.next-visit__countdown {
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--brand-dark);
}

.next-visit--warn .next-visit__countdown {
  color: #8a4b08;
}

.next-visit--danger .next-visit__countdown {
  color: #b42318;
}

.next-visit__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.chips-row-wrap {
  margin-bottom: 0.5rem;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stat-chip {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.stat-chip--danger {
  background: #fdecea;
  color: #b42318;
}

.countdown-inline {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.countdown-inline--ok {
  color: var(--brand-dark);
}

.countdown-inline--warn {
  color: #8a4b08;
}

.countdown-inline--danger {
  color: #b42318;
}

.chip--warn {
  background: #fff4e5;
  color: #8a4b08;
}

.chip--danger {
  background: #fdecea;
  color: #b42318;
}

.chip--ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.agenda-section {
  margin-top: 1.25rem;
}

.agenda-section__title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.agenda-section--overdue .agenda-section__title {
  color: #b42318;
}

/* CRM Mis Propiedades */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form--wide { max-width: 720px; }
.form-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.form-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
@media (min-width: 640px) {
  .form-row { grid-template-columns: repeat(3, 1fr); }
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}
.form-error { color: var(--danger); margin: 0.5rem 0 0; }
.form-ok { color: var(--brand-dark); margin: 0.5rem 0 0; }
.login-body { min-height: 100dvh; display: grid; align-items: center; }
.login-wrap { max-width: 420px; }

.menu-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
  margin-top: 1.25rem;
}
@media (min-width: 560px) {
  .menu-grid { grid-template-columns: 1fr 1fr; }
}
.menu-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.menu-tile:hover {
  border-color: var(--brand);
  text-decoration: none;
  transform: translateY(-1px);
}
.menu-tile strong { font-size: 1.05rem; }
.menu-tile span { color: var(--muted); font-size: 0.875rem; }
.perfil-preview { margin-bottom: 0.75rem; }

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.photo-picks {
  display: grid;
  gap: 0.85rem;
  margin: 0.85rem 0;
}

.photo-pick input[type='file'].photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.photo-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--surface);
}

.photo-pick .btn {
  margin-top: 0.35rem;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.photo-pick strong {
  font-size: 1.05rem;
  color: var(--ink);
}

.photo-pick span {
  font-size: 0.85rem;
  color: var(--muted);
}

.photo-pick--gallery {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.photo-pick--camera {
  border-color: #c5d0d0;
}

.activation-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.activation-box input {
  width: 100%;
  margin: 0.5rem 0;
  font-size: 0.8rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.brand--lg { font-size: 1.5rem; margin-bottom: 1rem; }
.map-box {
  height: 240px;
  margin-top: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 1;
}
.amenity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.75rem;
}
.amenity { font-size: 0.9rem; color: var(--ink); flex-direction: row !important; align-items: center; gap: 0.35rem !important; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.photo-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  aspect-ratio: 1;
  background: var(--brand-soft);
}
.photo-item.is-principal { border-color: var(--brand); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item__actions {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  background: rgba(0,0,0,0.55);
  padding: 2px;
}
.photo-item__actions button {
  flex: 1;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 0.65rem;
  padding: 0.25rem;
  cursor: pointer;
}
.photo-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--brand);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.chip--muted { background: #eef1f1; color: #5c6b6b; }
.filters--mine {
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .filters--mine { grid-template-columns: 1.4fr repeat(4, 1fr); }
}
