/* Portal de clientes: mismo aspecto que tunuevaoficina.com (Overpass + Playfair Display,
   blanco, franja aqua, negro #262627). */
:root {
  --ink: #262627;
  --muted: #62646b;
  --line: #e4e6e8;
  --line-strong: #c9ccd1;
  --bg: #ffffff;
  --band: #e9f6f6;
  --panel: rgba(38, 38, 39, 0.86);
  --dark: #262627;
  --icon: #a3b1e8;
  --link: #0b4ea2;
  --wa: #25a35a;
  --ok: #1b7a4b;
  --ok-bg: #e2f4ea;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --radius: 4px;
  --shadow: 0 2px 14px rgba(38, 38, 39, 0.1);
  --body: 'Overpass', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--bg); font-size: 17px; line-height: 1.5; }
img { max-width: 100%; display: block; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #5b8bd6; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--dark); color: #fff; padding: 8px 12px; border-radius: var(--radius); z-index: 50; }
.skip:focus { left: 8px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.muted { color: var(--muted); }
.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(690px, 100% - 32px); margin-inline: auto; }

/* ---------- Encabezado ---------- */
.site { background: #fff; position: relative; z-index: 20; }
/* En la app de iPhone el contenido llega hasta arriba: el encabezado deja libre la barra de estado */
header.site { padding-top: env(safe-area-inset-top, 0px); }
.site-bar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.brand { grid-column: 2; justify-self: center; display: block; }
.brand img { height: 100px; width: auto; }
.burger { grid-column: 3; justify-self: end; width: 44px; height: 44px; border: 0; background: none; color: #1f6fd6; cursor: pointer; display: grid; place-items: center; padding: 0; }
.burger svg { width: 30px; height: 30px; }
.social { display: flex; justify-content: center; gap: 8px; padding: 22px 0 14px; }
.social a { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ink); color: var(--ink); display: grid; place-items: center; }
.social svg { width: 17px; height: 17px; }
.menu { position: absolute; left: 0; right: 0; background: #fff; box-shadow: var(--shadow); max-height: 75vh; overflow-y: auto; }
.menu[hidden] { display: none; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 11px 22px; color: var(--ink); text-decoration: none; background: none; border: 0; font-size: 16px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--band); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@media (max-width: 600px) { .brand img { height: 76px; } }

/* Barra inferior tipo app (celular, con sesión) */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
  .tabbar.staff { grid-template-columns: repeat(2, 1fr); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar svg { width: 24px; height: 24px; }
  body.authed .foot { padding-bottom: calc(84px + var(--safe-b)); }
}

/* Botón flotante de WhatsApp, como en el sitio */
.wa-float { position: fixed; left: 20px; bottom: calc(20px + var(--safe-b)); z-index: 25; width: 58px; height: 58px; border-radius: 50%; background: var(--wa); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3); }
.wa-float svg { width: 32px; height: 32px; }
@media (max-width: 760px) { body.authed .wa-float { bottom: calc(76px + var(--safe-b)); left: 14px; width: 50px; height: 50px; } }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: var(--radius); border: 1px solid var(--ink); background: #fff; color: var(--ink); font-weight: 400; text-decoration: none; cursor: pointer; }
.btn:hover { background: #f4f4f5; }
.btn.primary, .btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover, .btn.dark:hover { background: #000; }
.btn.white { background: #fff; border-color: #fff; color: var(--ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 15px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn svg { width: 20px; height: 20px; flex: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 600; font-size: 15px; }
.field small { color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--ink); border-radius: var(--radius); background: #fff; }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; min-height: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--dark); }
.form { display: flex; flex-direction: column; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: 15px; font-weight: 600; min-height: 1.2em; }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--band); font-size: 15px; }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.seller-card { margin-bottom: 20px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.seller-card p { margin: 0; }

/* ---------- Portada ---------- */
.hero { background: var(--dark) url('../img/hero.jpg') center / cover no-repeat; padding: 60px 16px; }
.hero-panel { width: min(450px, 100%); margin-left: max(0px, calc((100% - 690px) / 2)); background: var(--panel); color: #fff; padding: 24px; display: flex; flex-direction: column; gap: 14px; font-size: 21px; line-height: 1.25; }
.hero-panel .brandline b { font-weight: 700; }
.hero-panel em { font-style: italic; }
.hero-panel .pitch { font-weight: 700; font-style: italic; margin-top: 18px; }
.hero-panel select { background: transparent; color: #fff; border-color: #fff; font-size: 17px; }
.hero-panel select option { color: var(--ink); }
.join { background: var(--dark); color: #fff; padding: 22px 0; text-align: center; }
.join .wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.join p { max-width: 62ch; }
.join .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.section { padding: 48px 0; }
.band { background: var(--band); }
.title { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 700; text-align: center; margin-bottom: 32px; }
.about { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.about > img { width: 300px; height: 300px; border-radius: 50%; object-fit: cover; }
.about-box { width: min(450px, 100%); background: #fff; box-shadow: var(--shadow); padding: 28px 30px; text-align: center; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Tarjetas (como las del sitio) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 34px 30px; }
.card { display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; background: transparent; }
.card .ph { position: relative; aspect-ratio: 3 / 2; background: #eef0f1; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.card:hover .ph img { transform: scale(1.03); }
.card .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.op-tag { position: absolute; top: 0; left: 0; background: rgba(248, 245, 241, 0.78); padding: 8px 10px 6px; font-size: 17px; letter-spacing: 0.05em; text-transform: uppercase; }
.price-tag { position: absolute; bottom: 0; left: 0; background: rgba(38, 38, 39, 0.9); color: #fff; padding: 10px 26px 8px 18px; font-size: 25px; font-weight: 300; line-height: 1.2; }
.price-tag.ask { font-size: 16px; font-weight: 400; }
.card-body { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 3px; }
.card h3 { font-size: 17px; font-weight: 400; line-height: 1.5; }
.code { color: var(--muted); font-size: 13.5px; }
.specs { display: flex; flex-wrap: wrap; gap: 2px 16px; color: var(--muted); font-size: 15px; }
.specs span { display: inline-flex; align-items: center; gap: 5px; }
.specs svg { width: 17px; height: 17px; color: var(--icon); }
.fav { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); display: grid; place-items: center; cursor: pointer; color: var(--ink); z-index: 2; }
.fav svg { width: 22px; height: 22px; }
.fav[aria-pressed="true"] { color: #d33b4c; }
.fav[aria-pressed="true"] svg path { fill: currentColor; }
.d-actions .btn[aria-pressed="true"] svg { color: #d33b4c; }
.d-actions .btn[aria-pressed="true"] svg path { fill: currentColor; }

/* ---------- Catálogo ---------- */
.list-head { background: var(--band); padding: 30px 0 110px; }
.list-title { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.4rem); text-align: center; font-weight: 700; margin-bottom: 22px; }
.list-tools { display: flex; flex-direction: column; gap: 14px; }
.filters { background: #fff; box-shadow: var(--shadow); padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; align-items: end; }
.filters[hidden] { display: none; }
.filters-go { grid-column: 1 / -1; margin-top: 4px; }
@media (min-width: 761px) { .filters-go { display: none; } }
@media (max-width: 760px) { body.filters-open .wa-float { display: none; } }
@media (max-width: 760px) { .filters-go { position: sticky; bottom: calc(74px + var(--safe-b)); z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); } }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; min-height: 46px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--dark); color: #fff; }
.list-body { margin-top: -80px; padding-bottom: 56px; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.more { display: flex; justify-content: center; margin-top: 34px; }
.empty { text-align: center; padding: 48px 16px; background: #fff; border: 1px dashed var(--line-strong); color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; grid-column: 1 / -1; }
.empty h3 { color: var(--ink); }
.loading { padding: 48px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.error { padding: 16px; background: var(--danger-bg); color: var(--danger); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; grid-column: 1 / -1; }
.page { padding: 30px 0 56px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.7rem, 3.5vw, 2.3rem); }

/* ---------- Ficha ---------- */
.d-head { background: var(--band); padding: 18px 0 16px; }
.d-loc { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.d-loc svg { width: 15px; height: 15px; color: var(--ink); flex: none; }
.d-head h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 400; margin-top: 4px; }
.d-price { font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 3.5vw, 2rem); margin-top: 6px; }
.d-op { font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.d-sub { font-family: var(--serif); font-weight: 700; font-size: clamp(1.1rem, 2.6vw, 1.5rem); }
.gallery .main { position: relative; background: #111; height: min(72vh, 620px); overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.9); display: grid; place-items: center; cursor: pointer; }
.gallery .nav svg { width: 22px; height: 22px; }
.gallery .nav.prev { left: 12px; }
.gallery .nav.next { right: 12px; }
.gallery .count { position: absolute; bottom: 14px; left: 10px; max-width: calc(100% - 20px); background: rgba(38, 38, 39, 0.85); color: #fff; padding: 4px 8px; font-size: 13px; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--dark); position: relative; }
.thumbs button { flex: none; width: 92px; aspect-ratio: 3 / 2; border: 2px solid transparent; overflow: hidden; padding: 0; cursor: pointer; background: #333; }
.thumbs button[aria-current="true"] { border-color: #fff; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.stats { background: var(--dark); color: #fff; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; }
.stat { text-align: center; padding: 26px 10px; border-bottom: 1px solid #3c3c3e; }
.stat:nth-child(odd) { border-right: 1px solid #3c3c3e; }
.stat b { display: block; font-weight: 400; font-size: 20px; }
.stat span { font-size: 12px; letter-spacing: 0.12em; color: #b9babd; text-transform: uppercase; }
.d-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 24px 0 0; }
.d-actions .btn { flex: 1 1 200px; }
.d-block { padding-top: 28px; display: flex; flex-direction: column; gap: 6px; }
.d-block > h2 { font-size: 17px; font-weight: 400; }
.d-list { list-style: none; margin: 0; padding: 0; }
.desc { white-space: pre-line; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 6px 16px; padding: 0; margin: 0; list-style: none; }
.features li { display: flex; gap: 8px; align-items: center; }
.features svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.d-where { background: #3d3d3f; color: #fff; text-align: center; padding: 14px; margin-top: 36px; }
.d-where span { display: block; font-size: 15px; color: #c5c6c9; }
.d-contact { margin-top: 36px; background: var(--band); padding: 34px 16px; display: flex; justify-content: center; }
.d-contact .btn { width: min(300px, 100%); font-size: 19px; }

/* ---------- Registro / entrar ---------- */
.auth { background: var(--band); padding: 36px 0 64px; }
.auth-card { width: min(560px, 100% - 32px); margin: 0 auto; background: #fff; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 520px) { .auth-card { padding: 20px; } }
.auth-card h1 { font-family: var(--serif); font-size: 1.9rem; }
.intents { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.intent { border: 1px solid var(--line-strong); padding: 12px; background: #fff; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius); }
.intent b { font-size: 16px; }
.intent span { font-size: 13.5px; color: var(--muted); }
.intent[aria-pressed="true"] { border: 2px solid var(--dark); background: var(--band); padding: 11px; }
.intent-group { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; grid-column: 1 / -1; margin-top: 4px; }

/* ---------- Cuenta ---------- */
.account { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #fff; }
.panel h2 { font-size: 1.15rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ---------- Diálogos y avisos ---------- */
dialog.dlg { border: 0; border-radius: var(--radius); padding: 0; width: min(480px, 100% - 32px); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); }
dialog.dlg::backdrop { background: rgba(38, 38, 39, 0.55); }
/* En la app de iPhone: que el cuadro no quede debajo del reloj ni de la barrita de inicio (también con el teclado abierto) */
dialog.dlg { inset-block-start: env(safe-area-inset-top, 0px); inset-block-end: env(safe-area-inset-bottom, 0px); max-height: calc(100% - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.dlg-inner { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-inner h2 { font-family: var(--serif); font-size: 1.4rem; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60; max-width: calc(100% - 32px); }
@media (max-width: 760px) { body.authed .toast { bottom: calc(88px + var(--safe-b)); } }

/* ---------- Pie ---------- */
.foot { background: var(--dark); color: #fff; padding: 36px 0 28px; font-size: 16px; }
.foot h2 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 8px; }
.foot a { color: #fff; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-menu { margin: 0 0 22px; }
.foot-legal { font-style: italic; display: flex; flex-direction: column; gap: 12px; }
.foot-bottom { border-top: 1px solid #3c3c3e; margin-top: 26px; padding-top: 22px; text-align: center; font-weight: 600; font-size: 15px; display: flex; flex-direction: column; gap: 8px; }
.legal { max-width: 760px; }
.legal h1 { font-family: var(--serif); }
.legal h2 { font-size: 1.2rem; margin: 24px 0 8px; }
.legal p, .legal li { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* App de iPhone/iPad: franja fija detrás del reloj y la cámara para que el contenido no pase debajo al hacer scroll */
body::before { content: ''; position: fixed; inset: 0 0 auto 0; height: env(safe-area-inset-top, 0px); background: #fff; z-index: 90; pointer-events: none; }

/* Al saltar a los resultados desde los filtros, que el conteo no quede debajo del reloj en la app */
.results-bar { scroll-margin-top: calc(12px + env(safe-area-inset-top, 0px)); }
dialog.dlg:focus { outline: none; }
