/* ==========================================================================
   Residenze app layer on top of portal.css (the approved mockup design system)
   --brand / --brand-on come from the property's theme color (set inline per page).
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../vendor/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root { --brand: #1c1917; --brand-on: #ffffff; }

/* Property theme color: primary actions, current page, focus */
.btn-ink, .btn-brand { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-ink:hover, .btn-brand:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-on); filter: brightness(.92); }
.mainnav a[aria-current="page"]::after { background: var(--brand); }
.filter[aria-pressed="true"], a.filter[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .icon { color: var(--brand); }
.logo-mark rect { fill: var(--brand); }
.logo-mark path { stroke: var(--brand-on); }
.brand-bar { height: 3px; background: var(--brand); }

a.filter { text-decoration: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Top loading bar for page changes without reload */
#progress { position: fixed; z-index: 100; top: 0; left: 0; height: 2px; width: 0; background: var(--brand); opacity: 0; transition: width .3s ease, opacity .2s; pointer-events: none; }
#progress.on { opacity: 1; width: 70%; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .1s; }
#progress.done { opacity: 0; width: 100%; transition: width .15s, opacity .3s .15s; }
#main { transition: opacity .12s; }
#main.loading { opacity: .55; }

/* Toasts */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: grid; gap: .5rem; width: min(440px, calc(100% - 2rem)); }
.toast { display: flex; gap: .75rem; align-items: flex-start; padding: .875rem 1rem; border-radius: 12px; background: var(--ink); color: #fafaf9; font-size: .875rem; box-shadow: var(--shadow-pop); animation: toast-in .2s ease; }
.toast .icon { margin-top: 1px; }
.toast.error { background: #7f1d1d; }
.toast button { margin-left: auto; border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; padding: 0 .25rem; font-size: 1.1rem; line-height: 1; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 860px) { .toasts { bottom: calc(5rem + env(safe-area-inset-bottom)); } }

/* Field errors */
.field-error { font-size: .8125rem; color: var(--danger); font-weight: 500; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(185, 28, 28, .1) !important; }
.form-alert { padding: .75rem 1rem; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: .875rem; font-weight: 500; }

/* Header extras */
.header-in .ctx-name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.header-in .ctx-name small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.menu { position: relative; }
.menu > button { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.menu-pop { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50; min-width: 240px; padding: .375rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); }
.menu-pop[hidden] { display: none; }
.menu-pop .who { padding: .625rem .75rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.menu-pop .who b { display: block; color: var(--ink); font-size: .875rem; }
.menu-pop .who span { font-size: .75rem; color: var(--muted); word-break: break-all; }
.menu-pop a, .menu-pop button.item { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .5rem .75rem; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: .875rem; text-decoration: none; text-align: left; cursor: pointer; }
.menu-pop a:hover, .menu-pop button.item:hover { background: var(--sunken); }

/* Generic page bits */
.empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }
.empty .row-ico { margin: 0 auto .875rem; }
.empty h3 { margin-bottom: .25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.kv-list { display: grid; grid-template-columns: max-content 1fr; gap: .625rem 1.5rem; font-size: .875rem; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.badge-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-on); font-size: .6875rem; font-weight: 700; }
.ch { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.ch-airbnb { background: var(--airbnb); } .ch-booking { background: var(--booking); } .ch-direct { background: var(--direct); } .ch-agoda { background: #7c3aed; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; margin-bottom: 1rem; font-size: .875rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.id-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.id-grid a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--sunken); }
.id-grid img { width: 100%; height: 100%; object-fit: cover; }
.sig-view { max-height: 90px; padding: .5rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.doc-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.stat-tile { padding: 1.25rem 1.375rem; }
.stat-tile .k { font-size: .8125rem; color: var(--muted); }
.stat-tile .v { margin-top: .25rem; font-size: 1.75rem; font-weight: 650; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.qr-box { display: grid; place-items: center; width: 100%; max-width: 280px; aspect-ratio: 1; margin: 0 auto; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.qr-box svg { width: 100%; height: auto; }
.qr-sm { width: 64px; height: 64px; padding: 4px; border-radius: 8px; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { width: 36px; height: 36px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff; }
.color-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.color-row input[type="color"] { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; }
.preview-btns { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: 1rem; border-radius: 12px; background: var(--sunken); }
.logo-preview { width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; background: #fff; }

/* Sign-in */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 2.5rem; background: #1c1917; color: #d6d3d1; }
.auth-side::after { content: ""; position: absolute; inset: auto -20% -30% auto; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(15, 118, 110, .35), transparent 65%); }
.auth-side h2 { color: #fafaf9; font-size: 2rem; line-height: 1.15; letter-spacing: -.03em; max-width: 26rem; }
.auth-side ul { position: relative; z-index: 1; display: grid; gap: .75rem; margin-top: 2rem; font-size: .9375rem; }
.auth-side li { display: flex; gap: .625rem; align-items: center; }
.auth-side .logo { color: #fafaf9; }
.auth-side .logo-mark rect { fill: #fafaf9; }
.auth-side .logo-mark path { stroke: #1c1917; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.625rem; }
.auth-card .lead-sm { margin-top: .375rem; color: var(--muted); }
.auth-card form { margin-top: 1.75rem; }
.auth-step[hidden] { display: none; }
.email-chip { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; padding: .375rem .375rem .375rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .875rem; font-weight: 500; }
.email-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-chip button { border: 0; background: var(--sunken); border-radius: 999px; padding: .125rem .5rem; font-size: .75rem; font-weight: 600; color: var(--text); cursor: pointer; }
.method-list { display: grid; gap: .625rem; }
.method { display: flex; align-items: center; gap: .875rem; width: 100%; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.method:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.method b { display: block; color: var(--ink); font-size: .9375rem; }
.method span.sub { font-size: .8125rem; color: var(--muted); }
.otp-input { font: 600 1.5rem var(--mono); letter-spacing: .5em; text-align: center; padding-left: 1.25rem !important; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; font-size: .75rem; color: var(--faint); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.linklike { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 600; font-size: .875rem; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 3rem; }
.pw-wrap button { position: absolute; right: .375rem; top: 50%; transform: translateY(-50%); }

/* Choose workspace */
.choose-list { display: grid; gap: .625rem; }
.choose-item { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; }
.choose-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.choose-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Scanner */
.scan-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
#reader { position: absolute; inset: 0; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader img, #reader__dashboard, #reader__header_message { display: none !important; }
.scanner .cam-off { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #d6d3d1; padding: 1.5rem; }
.scanner .cam-off .btn { margin-top: 1rem; }
.result-card { border-left: 4px solid var(--line-strong); }
.result-card.valid { border-left-color: var(--success); }
.result-card.bad { border-left-color: var(--danger); }
.result-card h2 { display: flex; align-items: center; gap: .5rem; }
.result-card.valid h2 { color: var(--success); }
.result-card.bad h2 { color: var(--danger); }

/* Public guest form */
.public-head { padding: 1rem 0 0; }
.public-head .logo { margin-bottom: 1rem; }
.cond[hidden] { display: none; }
.sig-wrap { position: relative; }
.sig-wrap .hint-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); pointer-events: none; font-size: .875rem; }
.done-card { padding: 2.5rem 1.75rem; text-align: center; }
.done-card .ok-ico { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 1.25rem; border-radius: 50%; background: var(--success-bg); color: var(--success); }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .scan-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .header-in .ctx-name small { display: none; }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Space between a panel and the next section */
.panel + .sec, .res-grid + .sec { margin-top: 2.5rem; }

/* Account menu also lists every section; shown on phones where the header nav is hidden. */
.menu-nav { display: none; padding: .25rem 0; margin-bottom: .25rem; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .menu-nav { display: block; } .menu-pop { position: fixed; top: calc(var(--header-h) - .25rem); right: .75rem; left: .75rem; max-height: calc(100vh - 9rem); overflow: auto; } }
.mainnav a { padding: 0 .625rem; }
@media (max-width: 1240px) { .mainnav a { padding: 0 .4rem; font-size: .875rem; } .header-in { gap: 1.25rem; } }
@media (max-width: 1080px) { .header-in .ctx-name small { display: none; } }

/* ---------- Guest message preview and editor ---------- */
.msg-preview { max-height: 420px; overflow: auto; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); font-size: .9375rem; line-height: 1.55; overflow-wrap: anywhere; }
.msg-preview img { max-width: 100%; height: auto; }
.token-list { display: flex; flex-wrap: wrap; gap: .375rem; }
.token-list .btn { font-family: var(--mono); font-size: .75rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.photo-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--sunken); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid figcaption { padding: .5rem; font-size: .8125rem; display: flex; flex-direction: column; gap: .375rem; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .75rem; }

/* ---------- Amenity bookings ---------- */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; margin-top: .5rem; }
.slot { position: relative; display: flex; flex-direction: column; gap: .125rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.slot input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.slot .t { font-weight: 600; font-size: .875rem; color: var(--ink); }
.slot .l { font-size: .75rem; color: var(--muted); }
.slot:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.slot:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.slot.off { background: var(--sunken); cursor: not-allowed; opacity: .6; }
.slot.off input { cursor: not-allowed; }
.slot-grid.compact { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .375rem; }
.slot-grid.compact .slot { cursor: default; padding: .375rem .5rem; }
.slot.some { border-color: var(--pending); }
.slot.full { background: var(--sunken); border-color: var(--line); }
.slot.full .l { color: var(--danger); font-weight: 600; }
.avail-list { display: grid; gap: .75rem; }
.am-opt { padding: .75rem 0; border-top: 1px solid var(--line); }
.am-opt:first-child { border-top: 0; padding-top: 0; }
/* Grid and flex containers set display, which would override the hidden attribute. */
.form-grid[hidden], .grid-2[hidden], .grid-3[hidden], .stack[hidden], [data-am-fields][hidden], [data-slot-only][hidden] { display: none !important; }

/* ---------- ID upload (one slot per guest) ---------- */
.id-up legend { font-weight: 600; font-size: .875rem; color: var(--ink); }
.id-slots { display: grid; gap: .625rem; margin-top: .625rem; }
.id-slot { position: relative; }
.id-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.id-drop { display: flex; align-items: center; gap: .875rem; min-height: 72px; padding: .875rem 1rem; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--sunken); cursor: pointer; transition: border-color .15s, background-color .15s; }
.id-drop:hover, .id-drop.drag { border-color: var(--ink); background: var(--surface); }
.id-slot:has(.id-file:focus-visible) .id-drop, .id-slot:has(.id-file:focus-visible) .id-preview { outline: 2px solid var(--brand, var(--ink)); outline-offset: 2px; }
.id-ico { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.id-txt { display: flex; flex-direction: column; gap: .125rem; flex: 1; min-width: 0; font-size: .875rem; }
.id-txt strong { color: var(--ink); font-weight: 600; }
.id-txt span { color: var(--muted); font-size: .8125rem; }
.id-cta { display: inline-flex; align-items: center; gap: .375rem; height: 36px; padding: 0 .875rem; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; font-size: .8125rem; white-space: nowrap; }
.id-preview { display: flex; align-items: center; gap: .875rem; padding: .625rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.id-preview img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--sunken); }
.id-meta { display: flex; flex-direction: column; gap: .125rem; flex: 1; min-width: 0; font-size: .875rem; }
.id-meta strong { color: var(--ink); }
.id-meta span { color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-actions { display: flex; gap: .375rem; }
.id-slot.extra .id-preview { border-color: var(--pending); }
.id-slot [data-slot-error] { margin: .375rem 0 0; }
.id-drop[hidden], .id-preview[hidden] { display: none !important; }
@media (max-width: 420px) { .id-cta { display: none; } }
@media (max-width: 420px) { .id-btn-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .id-preview img { width: 64px; height: 44px; } }

/* Required fields: every label of a required input gets a red asterisk (screen readers use the required attribute). */
.field:has(> input[required], > select[required], > textarea[required]) > label:not(:has(.req))::after,
.field:has(> div > input[required]) > label:not(:has(.req))::after { content: " *"; color: var(--danger); font-weight: 600; }
.req { color: var(--danger); }

/* ---------- Marketing ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; }
.tpl .btn { margin-top: auto; }
.strip.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .strip.cols-3 { grid-template-columns: 1fr; } }
