.admin-shell {
  min-height: 100vh; min-height: 100dvh;
  background: var(--color-cream);
}
.admin-topbar {
  background: var(--color-ink);
  color: var(--color-white);
  padding: 14px 0;
}
.admin-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-topbar .brand {
  color: var(--color-white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-topbar .brand-mark {
  width: 28px;
  height: 28px;
  color: var(--color-gold);
}
.admin-topbar .brand-name {
  font-family: var(--font-brand, var(--font-body));
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 0.95rem;
}
/* The logo as a "back" button (profile.js initBrandBack): on hover/focus the mark turns and fades
   away and an arrow takes its place, in the same spot, then nudges gently toward the left. */
.admin-topbar .brand.has-back { position: relative; }
.admin-topbar .brand.has-back .brand-mark {
  display: inline-flex;
  transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.admin-topbar .brand-back {
  position: absolute;
  left: 0;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  opacity: 0;
  color: var(--color-gold);
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.12);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.6);
  transform: translateX(6px) scale(0.7);
  transition: opacity 0.22s ease 0.06s, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.06s;
  pointer-events: none;
}
.admin-topbar .brand-back svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-topbar .brand.has-back:hover .brand-mark,
.admin-topbar .brand.has-back:focus-visible .brand-mark {
  opacity: 0;
  transform: rotate(-25deg) scale(0.6);
}
.admin-topbar .brand.has-back:hover .brand-back,
.admin-topbar .brand.has-back:focus-visible .brand-back {
  opacity: 1;
  transform: none;
}
.admin-topbar .brand.has-back:hover .brand-back svg,
.admin-topbar .brand.has-back:focus-visible .brand-back svg { animation: brand-back-nudge 1.6s ease-in-out 0.4s infinite; }
@keyframes brand-back-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .admin-topbar .brand-back,
  .admin-topbar .brand.has-back .brand-mark { transition: opacity 0.15s ease; transform: none; }
  .admin-topbar .brand.has-back:hover .brand-mark,
  .admin-topbar .brand.has-back:focus-visible .brand-mark { transform: none; }
  .admin-topbar .brand.has-back:hover .brand-back svg,
  .admin-topbar .brand.has-back:focus-visible .brand-back svg { animation: none; }
}
.admin-topbar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  row-gap: 10px;
}
.admin-nav-link,
.admin-topbar-nav .btn-outline.btn-sm {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 32px;
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.admin-nav-link:hover,
.admin-topbar-nav .btn-outline.btn-sm:hover {
  background: var(--color-gold);
  color: var(--color-ink);
  border-color: var(--color-gold);
}
.admin-nav-link:focus-visible,
.admin-topbar-nav .btn-outline.btn-sm:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}
.admin-nav-link.is-active {
  background: var(--color-gold);
  color: var(--color-ink);
  border-color: var(--color-gold);
}

.admin-nav-viewsite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  background: transparent;
}
.admin-nav-viewsite svg {
  width: 14px;
  height: 14px;
}

/* .btn-outline defaults to white-on-transparent (styles.css) for use over dark/hero
   backgrounds — the public site's own hero sections rely on that. Every light-background
   surface across THIS admin shell (toolbars, table rows, cards, and every modal — modals are
   siblings of <main>, not descendants, hence the separate .modal-card selector) needs the
   opposite — white-on-cream/white is unreadable — so it's re-inked for the whole admin area at
   once here, rather than fixing one more page every time this bug resurfaces on yet another
   screen. .bulk-action-bar is the one deliberately-dark admin surface, so its buttons are
   re-asserted white again right after (same specificity, later in the cascade wins). */
.admin-main .btn-outline,
.modal-card .btn-outline,
.crm-sc-panel .btn-outline {
  color: var(--color-ink);
  border-color: var(--color-border);
}
.admin-main .btn-outline:hover,
.modal-card .btn-outline:hover,
.crm-sc-panel .btn-outline:hover {
  background: var(--color-cream-dim);
}
.bulk-action-bar .btn-outline {
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.5);
}
.bulk-action-bar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

.profile-menu {
  position: relative;
}
.profile-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 150ms ease;
}

/* The header mailbox icon (public/js/profile.js) — same 40x40 circle-button footprint as
   .profile-avatar, sitting next to it, so the two read as one control group on both the public
   header (dark, on .nav-actions) and the admin topbar (also dark, on .admin-topbar-nav). */
.nav-mailbox {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 150ms ease;
}
.nav-mailbox:hover {
  border-color: var(--color-gold);
}
.nav-mailbox svg {
  width: 19px;
  height: 19px;
}
.nav-mailbox-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-gold);
  color: var(--color-ink);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--color-ink);
}
.profile-avatar:hover {
  border-color: var(--color-gold);
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar svg {
  width: 20px;
  height: 20px;
}
/* Lead behavior tracking's own bell icon (public/js/profile.js's initActivityBell) — a sibling
   of #profile-mount next to "Ver sitio", same insertion trick .nav-mailbox already used. Its own
   dropdown, not folded into the profile menu, since it's an activity feed, not an account menu. */
.activity-bell {
  position: relative;
}
.activity-bell-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--color-error);
  border: 2px solid var(--color-ink);
  pointer-events: none;
}
.activity-bell-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: min(420px, calc(100vh - 90px)); max-height: min(420px, calc(100dvh - 90px));
  overflow-y: auto;
  background: var(--color-white);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lifted);
  padding-bottom: 8px;
  z-index: 60;
}
.activity-bell-dropdown[hidden] {
  display: none;
}
.profile-activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-2);
}
.profile-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-text);
}
.profile-activity-item:hover {
  background: var(--color-cream-dim);
}
.profile-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: transparent;
}
.profile-activity-item.is-unread .profile-activity-dot {
  background: var(--color-gold);
}
.profile-activity-text {
  flex: 1;
  font-size: 0.8rem;
  line-height: 1.4;
}
.profile-activity-time {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  max-height: min(520px, calc(100vh - 90px)); max-height: min(520px, calc(100dvh - 90px));
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lifted);
  z-index: 60;
}
.profile-dropdown[hidden] {
  display: none;
}
/* A role with many admin pages (e.g. admin itself) can make the links list taller than the
   viewport — this scrolls just that part, while Sign Out (below, outside this wrapper) stays
   pinned at the bottom of the dropdown so it's never scrolled out of reach. */
.profile-dropdown-scroll {
  overflow-y: auto;
  padding: var(--space-3);
  flex: 1 1 auto;
  min-height: 0;
}
.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.profile-dropdown-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-cream-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.profile-dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-dropdown-avatar svg {
  width: 24px;
  height: 24px;
}
.profile-photo-btn {
  background: none;
  border: none;
  color: var(--color-gold);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.profile-photo-btn svg {
  width: 15px;
  height: 15px;
}
.profile-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 36px;
}
.profile-link:hover {
  background: var(--color-cream-dim);
}
.profile-link svg {
  width: 16px;
  height: 16px;
  color: var(--color-gold);
  flex-shrink: 0;
}
.profile-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.profile-dropdown .lang-switch {
  border-color: var(--color-border);
  width: 100%;
}
.profile-dropdown .lang-btn {
  color: var(--color-text-muted);
  flex: 1;
}
.profile-dropdown .lang-btn[aria-pressed="true"] {
  color: var(--color-ink);
}
.profile-signout {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-white);
  border: none;
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-3);
  color: var(--color-error);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 36px;
}
.profile-signout svg {
  width: 16px;
  height: 16px;
}

.login-wrap {
  min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-card);
}
.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.login-card p.lead-sm {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
}
/* Approve the sign-in from the phone (login.html waitForApproval, profile.js showSignInApproval). */
.tf-approval { margin-bottom: var(--space-3); text-align: center; }
.tf-approval p { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.tf-approval-number { font-size: 2.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--color-gold); line-height: 1.1; }
.tf-approval-or { font-size: 0.85rem; color: var(--color-text-muted); }
.sign-in-approval-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; margin: var(--space-3) 0; }
.sign-in-approval-choices .btn { flex: 1 1 0; min-width: 0; font-size: 1.5rem; font-weight: 700; padding: var(--space-3) var(--space-2); }
.sign-in-approval-meta { font-size: 0.85rem; color: var(--color-text-muted); overflow-wrap: anywhere; }

.admin-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  margin-top: var(--space-4);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  cursor: pointer;
}
.checkbox-field input[type='checkbox'] {
  width: auto;
  min-height: auto;
}

.field {
  margin-bottom: var(--space-3);
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-ink);
}
.field .hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* Record pager: the ‹ 3 / 39 › control a record pop-up carries, so a long list is walked from
   inside the pop-up instead of closing and reopening it (UIKit.recordPager). */
.record-pager {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.record-pager[hidden] { display: none; }
.record-pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.record-pager-btn svg { width: 16px; height: 16px; }
.record-pager-btn:hover:not(:disabled) { background: var(--color-white); color: var(--color-gold); }
.record-pager-btn:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.record-pager-btn:disabled { opacity: 0.35; cursor: default; }
.record-pager-count {
  min-width: 56px;
  padding: 0 4px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Importar CSV: the detail a person only needs the first time they build the file is folded
   away behind a summary, so the file picker and the Import button stay within reach on a
   phone instead of sitting under four screens of fine print. */
.import-help {
  margin: var(--space-3) 0;
}
.import-help > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.import-help > summary:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}
.import-help > .hint:first-of-type {
  margin-top: var(--space-2);
}

/* Info bubble (ⓘ) next to a field label — hover OR keyboard-focus reveals the explanation, so
   it's reachable without a mouse (focus-within/focus-visible), not just on :hover. */
.field-info {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 5px;
}
.field-info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: help;
}
.field-info-trigger svg {
  width: 15px;
  height: 15px;
}
.field-info-text {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-width: 70vw;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: var(--color-white);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.field-info:hover .field-info-text,
.field-info:focus-within .field-info-text {
  opacity: 1;
  visibility: visible;
}

/* "Información privada" sections (Datos propietario, Observaciones, Comisión empresa,
   Contrato de exclusividad) — a distinct green header so they read as a separate, private
   part of the form, matching the reference software's own visual language for this data. */
.private-section {
  margin: var(--space-4) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.private-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #163d20;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}
.private-section-head svg {
  width: 16px;
  height: 16px;
}
.private-section-body {
  padding: var(--space-3) 14px;
  background: var(--color-cream-dim);
}
.private-info-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--space-4) 0 var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #e3ede5;
  color: #163d20;
  font-size: 0.85rem;
}
.private-info-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* A short unit badge (%, $, ₡) glued to the right edge of a value input — swaps automatically
   with the commission type radio (percentage vs. fixed amount) instead of the field silently
   staying labeled "%" while holding a currency figure. */
.input-with-unit {
  display: flex;
  align-items: stretch;
}
.input-with-unit input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-with-unit .input-unit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-left: none;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: #163d20;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}
/* A money unit (₡/$) always reads before the number, never after — only a percentage sign
   correctly trails the value. Toggled by JS alongside the unit's own text (see updateCommissionUI
   in admin.js). */
.input-with-unit.is-currency-unit .input-unit {
  order: -1;
  border-left: 1px solid var(--color-border);
  border-right: none;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-with-unit.is-currency-unit input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.hint-computed {
  font-weight: 600;
  color: #163d20;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--color-white);
  min-height: 44px;
}
/* Flag emoji for systems that draw none (Windows shows "CR" instead of the flag). Only the flag
   characters come from this font (unicode-range); every other letter keeps the page's own font.
   From country-flag-emoji-polyfill (MIT; Twemoji art CC-BY 4.0, see fonts/TwemojiCountryFlags-LICENSE.md). */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url('/fonts/TwemojiCountryFlags.woff2') format('woff2');
  font-display: swap;
}
/* Languages an agent speaks (app.js spokenLanguagesHTML; My Profile › Idiomas): emoji flags,
   drawn by the bundled flag font where the system has none. */
.lang-flag { font-family: "Twemoji Country Flags", var(--font-body); font-size: 1.1em; line-height: 1; }
.lang-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.lang-chip { display: inline-flex; align-items: center; gap: 5px; }
.lang-chips.has-names { gap: 6px 8px; }
.lang-chips.has-names .lang-chip { padding: 3px 10px 3px 8px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-white); font-size: 0.88rem; }
.agent-profile-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; min-width: 0; }
.agent-profile-langs-label { font-size: 0.8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-muted); }
.mp-languages { border: 0; padding: 0; margin: 0; min-width: 0; }
.mp-languages-legend { padding: 0; font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.mp-languages-count { font-weight: 600; font-size: 0.8rem; color: var(--color-text-muted); margin-left: 6px; }
.mp-languages .hint { margin: 0 0 8px; }
.mp-language-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; min-width: 0; }
.mp-language { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--color-border);
  border-radius: 12px; background: var(--color-white); cursor: pointer; font-size: 0.9rem; transition: border-color .15s ease, background .15s ease; }
.mp-language input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.mp-language-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mp-language-check { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--color-border); color: transparent; }
.mp-language-check svg { width: 12px; height: 12px; }
.mp-language:hover { border-color: var(--color-gold); }
.mp-language.is-on { border-color: var(--color-gold); background: var(--color-cream-dim); font-weight: 600; }
.mp-language.is-on .mp-language-check { background: var(--color-gold); border-color: var(--color-gold); color: var(--color-white); }
.mp-language:has(input:focus-visible) { outline: 2px solid var(--color-gold); outline-offset: 2px; }
@media (max-width: 380px) { .mp-language-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.phone-field {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.phone-field select {
  width: auto;
  flex: 0 0 118px;
}
.phone-code-flag,
.phone-code-opt-flag,
.phone-country-select,
.phone-country-select option,
.cal-holiday-chip {
  font-family: "Twemoji Country Flags", var(--font-body);
}
.phone-field input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
}
/* The country code box (phone-input.js enhanceCountrySelect): the flag, the code the person types
   or picks, and the list sorted by code from +1 up. The real <select> stays hidden behind it. */
.phone-field .phone-code {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  width: 124px;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.phone-field .phone-code:focus-within { border-color: var(--color-gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18); }
.phone-code-flag { flex: none; padding-left: 10px; font-size: 1.15rem; line-height: 1; }
.phone-field .phone-code .phone-code-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 6px;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
}
.phone-field .phone-code .phone-code-input:focus { outline: none; box-shadow: none; }
.phone-code-toggle {
  flex: none;
  align-self: stretch;
  min-width: 30px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.phone-code-toggle:disabled { cursor: not-allowed; }
.phone-code-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, calc(100vw - 32px));
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px -8px rgba(35, 45, 39, 0.28);
}
.phone-code-list[hidden] { display: none; }
.phone-code-list [role="option"] {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.phone-code-list [role="option"]:hover,
.phone-code-list [role="option"].is-active { background: var(--color-cream-dim, #f4f0e8); }
.phone-code-list [role="option"][aria-selected="true"] { font-weight: 700; }
.phone-code-opt-flag { flex: none; font-size: 1.1rem; line-height: 1; }
.phone-code-opt-dial { flex: none; min-width: 3.4em; font-variant-numeric: tabular-nums; color: var(--color-ink, inherit); }
.phone-code-opt-name { min-width: 0; overflow-wrap: anywhere; color: var(--color-text-muted); }
.phone-code-empty { padding: 8px 10px; color: var(--color-text-muted); font-size: 0.9rem; }

.field input[readonly] {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.field textarea {
  min-height: 110px;
  resize: vertical;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.field-row > .field {
  /* A grid item's default min-width is "auto", which refuses to shrink below its content's
     intrinsic width — the .phone-field select+input pair (or any other wide child) can then
     overflow its own column and visually overlap the next field instead of wrapping/shrinking
     inside its assigned track. */
  min-width: 0;
}
.form-error {
  background: #fbeceb;
  color: var(--color-error);
  border: 1px solid #f3c8c5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: var(--space-3);
}
.form-error:empty {
  display: none;
}
.import-error-list {
  max-height: 220px;
  overflow-y: auto;
  margin: 0 0 var(--space-3);
  padding-left: 20px;
  color: var(--color-error);
  font-size: 0.85rem;
}
.import-error-list li {
  margin-bottom: 4px;
  /* Messages quote whole photo/video links (and the cell they came from); a long Drive address
     breaks onto the next line instead of running off a phone screen. */
  overflow-wrap: anywhere;
  min-width: 0;
}
/* What the import created: each new property by code and title, with an "Abrir" button. */
.import-created-banner {
  margin: 0 0 var(--space-2);
  color: var(--color-success, #1f7a4d);
}
.import-created-list {
  max-height: 220px;
  overflow-y: auto;
  margin: 0 0 var(--space-3);
  padding-left: 20px;
  font-size: 0.9rem;
}
.import-created-list li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.import-created-list .btn {
  margin-left: 4px;
  vertical-align: baseline;
}
/* A row with more than one problem lists all of them under its row number, so the person
   fixes the lot in one pass instead of one per upload. */
.import-error-list ul {
  margin: 2px 0 0;
  padding-left: 18px;
  list-style: disc;
}
.import-error-list ul li {
  margin-bottom: 2px;
}
/* The file-level list (missing columns…) sits inside .form-error, which has its own colour. */
.form-error .import-error-list {
  margin: 0;
  color: inherit;
}
.form-success {
  background: #e8f5ee;
  color: #1f7a4d;
  border: 1px solid #bfe4d0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: var(--space-3);
}
.form-success:empty {
  display: none;
}
.password-reset-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
/* Users › Edit user › History: a timeline, newest first. Each row: icon, what happened (with the
   changed fields underneath), who and when. Long values wrap instead of widening the pop-up. */
.user-history-list {
  list-style: none;
  margin: var(--space-3, 12px) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.user-history-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}
.user-history-item:first-child { border-top: 0; }
.user-history-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-cream-dim);
  color: var(--color-ink);
}
.user-history-icon svg { width: 15px; height: 15px; }
.user-history-body { min-width: 0; }
.user-history-what { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.user-history-changes { margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--color-text-muted); }
.user-history-changes li { overflow-wrap: anywhere; }
.user-history-changes .from { text-decoration: line-through; }
.user-history-meta { margin-top: 2px; font-size: 0.8rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.user-history-empty { font-size: 0.875rem; color: var(--color-text-muted); padding: 8px 0; }
#eu-history-more { margin-top: var(--space-2, 8px); }

/* Users › Edit user › Invitation: the status (sent / accepted / none) and its button on one row,
   stacking when the pop-up is narrow. */
.invite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 8px) var(--space-3, 12px);
  margin-top: var(--space-2, 8px);
}
.invite-status {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.invite-status.is-accepted { color: var(--color-success, #2f7d4f); }
.invite-btn { display: inline-flex; align-items: center; gap: 6px; }
.invite-btn-icon { display: inline-flex; }
.invite-btn-icon svg { width: 16px; height: 16px; }
.password-reset-section h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.password-reset-section .password-reset-row input[type="password"] {
  flex: 1 1 9rem;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.required-asterisk {
  color: var(--color-error);
  font-weight: 700;
}
.required-notice {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3);
}
.email-optin-field label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}
.email-optin-field input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.coordinates-help {
  background: var(--color-cream-dim);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 6px 0 8px;
}
.user-avatar-sm {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.user-avatar-sm svg {
  width: 17px;
  height: 17px;
}
.user-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-avatar-lg {
  width: 64px;
  height: 64px;
}
/* The Verified star pinned to the bottom-right of an avatar bubble (Users table). Default size
   matches -sm avatars (34px); .avatar-badges-lg scales it up for larger photos. */
.avatar-badges {
  position: absolute;
  bottom: -1px;
  right: -1px;
  display: flex;
}
.avatar-badges-lg {
  bottom: -2px;
  right: -2px;
}
.avatar-badge {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-white);
  font-size: 8px;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-badge + .avatar-badge {
  margin-left: -6px;
}
.avatar-badges-lg .avatar-badge {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-width: 2px;
}
.avatar-badges-lg .avatar-badge + .avatar-badge {
  margin-left: -10px;
}
.avatar-badge svg {
  width: 60%;
  height: 60%;
}
.avatar-badge-verified {
  background: linear-gradient(140deg, #6ea8f2, #3b7bd0 35%, #1f4f96);
  color: #ffffff;
}
.edit-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.edit-photo-row input[type="file"] {
  min-height: auto;
  padding: 0;
  border: none;
}

.admin-main {
  padding: var(--space-5) 0 var(--space-8);
}
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.analytics-overview {
  margin-bottom: var(--space-5);
}
.analytics-overview h2 {
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}
.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.5vw + 0.6rem, 1.8rem);
  color: var(--color-ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
a.stat-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
a.stat-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-card);
}
/* Per-pipeline breakdown inside the CRM summary's third stat card (Accounting page) — each
   segment drills into that pipeline's own board instead of the whole line being plain text. */
.stat-pipeline-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}
.stat-pipeline-link:hover {
  text-decoration-color: var(--color-gold);
  color: var(--color-gold);
}

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.filter-toolbar input,
.filter-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--color-white);
  min-height: 38px;
}
.filter-toolbar .filter-search {
  flex: 1 1 220px;
  min-width: 180px;
}
.filter-toolbar select {
  flex: 0 1 auto;
}
/* Under a multi-value search ("CUST3 | CUST9", list-search.js): how many matched, which codes
   don't exist and which are hidden by the other filters. */
.list-search-note {
  margin: 4px 0 12px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
/* Checkbox-list "choose OR conditions" filter (e.g. Customer Directory's Contact filter). */
.filter-checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  min-height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: 0.85rem;
}
.filter-checkbox-group-label {
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.filter-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-checkbox-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}
.filter-toolbar #export-csv-btn {
  margin-left: auto;
}

.admin-table-wrap {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  vertical-align: middle;
}
.admin-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  background: var(--color-cream-dim);
}
/* :not(.btn) so a real .btn used as a link inside a table cell (e.g. Templates' "View / Print"
   business-card row, which needs an <a href target="_blank"> rather than a button) is left alone
   to use its own .btn-primary/.btn-outline/etc. colors — otherwise this rule's higher specificity
   than a plain .btn-primary would repaint its text the same gold as its own background,
   making the label unreadable. */
.admin-table td a:not(.btn) {
  color: var(--color-gold);
  font-weight: 600;
  text-decoration: none;
}
.admin-table td a:not(.btn):hover {
  text-decoration: underline;
}
/* The ProptyCenter ID column opens the admin edit modal (see admin.js's openModalForEdit) rather
   than navigating anywhere, so it's a <button>, not an <a> — this just makes it look identical
   to the plain-link styling above. */
.proptycenter-id-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-gold);
  font-weight: 600;
  cursor: pointer;
}
.proptycenter-id-link:hover {
  text-decoration: underline;
}
.admin-table img {
  width: 56px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-cream-dim);
}
/* Equal specificity to `.admin-table img` above, so without this override the rule order alone
   decides the winner — the Users table's circular avatar photo would otherwise inherit this
   rectangular property-thumbnail sizing just for sitting inside an `.admin-table` row. */
.admin-table .user-avatar-sm img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.admin-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-table th.actions-col {
  text-align: center;
  /* Guarantees room for up to 4 icon-btns (32px + 8px gap each) on one line — without this,
     table auto-layout can squeeze this column narrow enough that .row-actions wraps into a
     tall, uneven multi-line stack instead of a single compact row. */
  min-width: 190px;
}
.row-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.row-menu-btn:not(:disabled):hover,
.row-menu-btn[aria-expanded="true"] {
  background: var(--color-cream-dim);
  border-color: var(--color-border);
  color: var(--color-ink);
}
.row-menu-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.row-menu-btn svg {
  width: 18px;
  height: 18px;
}
/* A single shared dropdown, repositioned to whichever row's "..." button was clicked —
   position: fixed so it always renders on top of the table's own scroll container instead
   of being clipped by its overflow-x: auto. */
.row-menu-dropdown {
  position: fixed;
  width: 190px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lifted);
  padding: 6px;
  z-index: 80;
}
.row-menu-dropdown[hidden] {
  display: none;
}
.row-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
}
.row-menu-item:hover {
  background: var(--color-cream-dim);
}
.row-menu-item:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.row-menu-item:disabled:hover {
  background: none;
}
.row-menu-item-danger {
  color: var(--color-error);
}
.admin-table tbody tr {
  transition: background-color 150ms ease;
}
.admin-table tbody tr:hover {
  background: var(--color-cream-dim);
}

.title-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* A small hover/focus tooltip for an inline info icon — reusable anywhere a control needs a
   longer explanation than fits in a label, without permanently taking up page space the way a
   static hint paragraph would (see the Calendar page's Country picker for the first use). */
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
}
.info-tooltip svg {
  width: 18px;
  height: 18px;
}
.info-tooltip:hover,
.info-tooltip:focus-visible {
  color: var(--color-gold);
}
.info-tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  /* Right-anchored, not left — this icon typically sits near the right edge of a toolbar (see
     the Calendar page's Country picker), and a left-anchored box of this width would run off the
     right side of the viewport from there instead of opening back over the page. */
  right: 0;
  width: 320px;
  max-width: 70vw;
  background: var(--color-ink);
  color: var(--color-white);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lifted);
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease;
  z-index: 50;
  pointer-events: none;
}
/* "Also listed by someone else" notice in the listing editor (listing-duplicates.js). */
.dup-notice { display: flex; gap: 10px; align-items: flex-start; margin-bottom: var(--space-3); padding: 12px 14px; border: 1px solid var(--color-gold); border-radius: var(--radius-sm); background: rgba(201, 162, 39, 0.08); font-size: 0.86rem; line-height: 1.5; }
.dup-notice svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--color-gold); }
.dup-notice p { margin: 4px 0; }
.dup-notice ul { margin: 4px 0 0; padding-left: 18px; }

/* Opens toward the right — for an icon near the left edge, e.g. inside a form label. */
.info-tooltip--start { vertical-align: middle; margin-left: 4px; cursor: help; }
.info-tooltip--start .info-tooltip-text { right: auto; left: -8px; text-transform: none; letter-spacing: normal; }
.info-tooltip:hover .info-tooltip-text,
.info-tooltip:focus .info-tooltip-text,
.info-tooltip:focus-within .info-tooltip-text {
  opacity: 1;
  visibility: visible;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover {
  background: var(--color-cream-dim);
  color: var(--color-gold);
  border-color: var(--color-border);
}

.expiry-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.expiry-badge.is-ok {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
}
.expiry-badge.is-expired {
  background: #fbeceb;
  color: var(--color-error);
}
.archived-section {
  margin-top: var(--space-6);
}
.archived-section h2 {
  margin-bottom: 2px;
}
.archived-section > p {
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4);
}
.archived-date {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

/* "Bases de Datos" — an ERP-style master/detail: a fixed list of tables on the left, the
   selected table's editable rows on the right. */
.databases-layout {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.databases-sidebar {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}
.databases-sidebar button,
.databases-sidebar a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
}
.databases-sidebar button:hover,
.databases-sidebar a:hover {
  background: var(--color-cream-dim);
}
.databases-sidebar button.is-active,
.databases-sidebar a.is-active {
  background: var(--color-gold);
  color: var(--color-white);
  font-weight: 600;
}
.databases-sidebar button .count-badge {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: var(--color-cream-dim);
  border-radius: 999px;
  padding: 1px 8px;
}
.databases-sidebar button.is-active .count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: var(--color-white);
}

/* The Settings module's own left rail (public/js/settings-nav.js) — Databases, Language, Ads,
   Email Drip, Attractions, Access Rights. Its own compact item style (small icon, icon+label on
   one line) rather than reusing .databases-sidebar button's, which is sized for that sidebar's
   very different label+count-badge layout. */
.settings-nav {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  align-self: flex-start;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
}
.settings-nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.settings-nav-item:hover {
  background: var(--color-cream-dim);
}
.settings-nav-item.is-active {
  background: var(--color-gold);
  color: var(--color-white);
  font-weight: 600;
}
.settings-nav-group {
  all: unset;
}
.settings-nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: none;
  list-style: none;
  font-weight: 500;
}
.settings-nav-group-header::marker {
  content: '';
}
.settings-nav-group-header::-webkit-details-marker {
  display: none;
}
.settings-nav-group-header::before {
  content: '▶';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  font-size: 0.7rem;
  line-height: 1;
  transition: transform 0.2s ease;
  color: var(--color-text-muted);
  order: -1;
}
.settings-nav-group[open] > .settings-nav-group-header::before {
  transform: rotate(90deg);
}
.settings-nav-group-header:hover {
  background: var(--color-cream-dim);
}
.settings-nav-group-header svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.settings-nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 10px;
  border-left: 1px solid var(--color-border-dim);
  padding-left: 9px;
  margin-top: 1px;
}
.settings-nav-group-items .settings-nav-item {
  padding: 6px 8px;
  font-size: 0.8rem;
}
.settings-with-nav {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.settings-with-nav > .settings-nav-content {
  flex: 1;
  min-width: 0;
}
@media (max-width: 720px) {
  /* Stacked: both rows take the screen's width. With flex-start the content row sized itself to
     its widest table and pushed every Settings page off the side of a phone. */
  .settings-with-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-with-nav > .settings-nav-content { width: 100%; }
  .settings-nav {
    flex: 1 1 auto;
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
  }
  .settings-nav-item {
    width: auto;
    white-space: nowrap;
  }
  /* The rail becomes one row of chips that scrolls sideways. A group (Base de datos,
     Integraciones) opens its items inline in that row, never on top of the page below. */
  .settings-nav { align-items: center; gap: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-group { display: flex; align-items: center; gap: 6px; flex: none; }
  .settings-nav-group-header { white-space: nowrap; width: auto; }
  .settings-nav-item, .settings-nav-group-header { min-height: 40px; border-radius: 999px; padding: 8px 14px; }
  .settings-nav-group-items { flex-direction: row; align-items: center; gap: 6px; margin: 0; padding-left: 0; border-left: 0; }
}
.databases-panel {
  flex: 1;
  min-width: 0;
}
.databases-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.databases-panel-head h2 {
  margin: 0 0 2px;
  font-size: 1.3rem;
}
.databases-panel-head-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.databases-values-table th[data-sort-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.databases-values-table th[data-sort-col]:hover {
  color: var(--color-gold);
}
.databases-values-table th[data-sort-col] .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.7;
}
#crm-list-wrap th[data-sort-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
#crm-list-wrap th[data-sort-col]:hover {
  color: var(--color-gold);
}
#crm-list-wrap th[data-sort-col] .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.7;
}
/* Generic version of the two rules above, for any .admin-table with sortable columns (currently
   just Matches — see matches-admin.js) that isn't one of those two pages' own specifically-scoped
   tables. */
.admin-table th[data-sort-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.admin-table th[data-sort-col]:hover {
  color: var(--color-gold);
}
.admin-table th[data-sort-col] .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.7;
}
@media (max-width: 720px) {
  /* Stacked: both take the screen's width (flex-start sized them to their content, past the edge). */
  .databases-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .databases-sidebar {
    flex: 1 1 auto;
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
    min-width: 0;
  }
  .databases-layout > .databases-panel { width: 100%; min-width: 0; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-5) var(--space-3);
  overflow-y: auto;
  z-index: 80;
  /* A fast scroll used to flicker: the overlay's see-through dimming kept Chrome from scrolling it
     on the compositor (it repainted the whole form every frame), and a scroll past either end
     chained to the page behind, which then repainted its table and glass toolbar under the dim.
     Scroll the overlay on its own layer and keep the scroll inside it. */
  will-change: scroll-position;
  overscroll-behavior: contain;
}
.modal-overlay[hidden] {
  display: none;
}
/* While a pop-up is open the page behind it stays still; the reserved gutter keeps the table from
   jumping sideways when its scrollbar goes away. */
html:has(.modal-overlay:not([hidden])) {
  overflow: hidden;
  scrollbar-gutter: stable;
}
.modal-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-lifted);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}
/* Property form: the title with the "Traducción IA" button and its explanation bubble beside it.
   Wraps under the title on a narrow screen. */
.modal-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; flex: 1 1 auto; }
.modal-title-row h2 { min-width: 0; }
.ai-text-tool { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.ai-text-tool .btn svg { width: 16px; height: 16px; }
/* Its explanation opens below (above would run into the dialog's top edge), from the button's left
   edge, never wider than the screen — so it stays on screen with large text and narrow phones. */
.ai-text-tool { position: relative; }
.ai-text-tool .info-tooltip { position: static; }
.ai-text-tool .info-tooltip-text { top: calc(100% + 8px); bottom: auto; left: 0; right: auto; width: min(320px, calc(100vw - 64px)); max-width: none; }
/* The language a box is written in: Descripción ES / EN. */
.lang-badge { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--color-cream-dim); color: var(--color-text); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; vertical-align: middle; }
/* The pop-up listing what the AI button will translate or write. */
.ai-text-card { max-width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; text-align: left; }
.ai-text-list { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; gap: 6px; }
.ai-text-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); min-width: 0; }
.ai-text-list img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; flex: none; }
.ai-text-item { font-weight: 600; min-width: 0; }
.ai-text-job { margin-left: auto; font-size: 0.85rem; color: var(--color-text-muted); min-width: 0; overflow-wrap: anywhere; }
.ai-text-job--translate, .ai-text-job--write { color: var(--color-text); }
.ai-text-status { min-height: 1.4em; font-size: 0.9rem; }
/* Above the phones' bottom navigation bar (workspace.css .ws-bottom-nav, z-index 900), so the
   pop-up's buttons are never covered; the buttons stay pinned while the list scrolls. */
.confirm-modal-overlay.ai-text-overlay, .confirm-modal-overlay.plan-upgrade-overlay { z-index: 1000; }
.ai-text-card .confirm-modal-actions { position: sticky; bottom: calc(-1 * var(--space-5)); margin-bottom: calc(-1 * var(--space-5)); padding: var(--space-2) 0 var(--space-5); background: var(--color-white, #fff); flex-wrap: wrap; }
/* With large text on a narrow phone the two buttons stack instead of running off the sides. */
.ai-text-card .confirm-modal-actions .btn { flex: 1 1 140px; min-width: 0; white-space: normal; }
.confirm-modal-actions .btn svg { width: 16px; height: 16px; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--color-text-muted);
}

/* Built/torn down entirely in JS by confirmActionModal() (app.js) — vertically centered, unlike
   .modal-overlay above (which top-aligns for taller forms), since a short "are you sure?"
   prompt reads better dead-center than pinned to the top of a long page. */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  z-index: 200;
}
.confirm-modal-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lifted);
  text-align: center;
}
.confirm-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-cream-dim);
  color: var(--color-gold);
  margin-bottom: var(--space-3);
}
.confirm-modal-icon svg {
  width: 24px;
  height: 24px;
}
/* The closing-details variant of the confirm modal carries real form fields (date, price,
   collaborator search) — those read better left-aligned than the plain yes/no confirm's
   centered text, so only its title/intro paragraph stay centered (inline styles below). */
.closing-details-card {
  text-align: left;
  max-height: 85vh;
  overflow-y: auto;
}
/* A closed deal posts straight to the Ledger and can't be undone — this box surfaces exactly
   which property is about to be marked sold so a closer double-checks it before confirming,
   the same "read it back before you commit" pattern as the price/date fields below it. */
.closing-property-confirm {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-cream-dim);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 var(--space-4);
}
.closing-property-confirm-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.confirm-modal-details { margin: var(--space-3) 0 calc(var(--space-3) + 4px); text-align: left; }
.confirm-modal-detail-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--color-border); font-size: 0.86rem; color: var(--color-text-muted); }
.confirm-modal-detail-row:first-of-type { margin-top: 10px; }
.confirm-modal-detail-row strong { color: var(--color-ink); font-variant-numeric: tabular-nums; }
.closing-property-confirm-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-ink);
}
.confirm-modal-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.15rem;
}
.confirm-modal-card p {
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0 0 var(--space-4);
}
.confirm-modal-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}
/* "Offer Accepted" with several properties: one tickable row per property (several allowed). */
.offer-accepted-options { border: 0; padding: 0; margin: 0 0 var(--space-2); text-align: left; display: flex; flex-direction: column; gap: 6px; }
.offer-accepted-options legend { font-weight: 600; font-size: 0.9rem; color: var(--color-ink); margin: 0 auto var(--space-2); text-align: center; }
.offer-accepted-options .offer-accepted-option {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; font-weight: 500; font-size: 0.95rem; color: var(--color-ink); text-align: left;
}
.offer-accepted-option:hover { border-color: var(--color-gold); }
.offer-accepted-option:has(input:checked) { border-color: var(--color-gold); background: var(--color-cream-dim); }
.offer-accepted-options .offer-accepted-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-gold); flex-shrink: 0; }
.confirm-modal-card p#offer-accepted-split-hint { margin: 0 0 var(--space-2); color: var(--color-ink); font-weight: 500; }
.confirm-modal-card p#offer-accepted-split-hint:empty { display: none; }
/* Captación's "Clasificar" question: a white box (in every theme, as asked) with one large button
   per pipeline the lead can go to. */
.classify-card { max-width: 520px; background: #fff; color: #29342e; }
.classify-card h2 { color: #29342e; }
.classify-card p { color: #4a4f48; }
.classify-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-4); }
.classify-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  border: 1px solid #c9c6ba; border-radius: var(--radius-md); background: #fff; color: #29342e;
  padding: 14px 16px; font: inherit; cursor: pointer; min-height: 72px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.classify-option strong { font-size: 1rem; }
.classify-option span { font-size: 0.82rem; color: #4a4f48; line-height: 1.35; }
.classify-option:hover, .classify-option:focus-visible { border-color: var(--color-gold); box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25); background: #fffdf5; outline: none; }
.classify-card .btn-ghost { color: #29342e; }
@media (max-width: 480px) { .classify-options { grid-template-columns: 1fr; } }

/* The property form's brochure (one PDF): its name links to the file; "Quitar" removes it. Wraps
   on a narrow phone so a long file name never pushes the button off the side. */
.brochure-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 6px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.brochure-current[hidden] { display: none; }
.brochure-current-icon { display: inline-flex; flex: none; }
.brochure-current-icon svg { width: 20px; height: 20px; }
.brochure-current-name {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.brochure-current-note { flex: 1 1 100%; margin: 0; }

#admin-pick-map {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-top: 6px;
}

.image-preview-grid {
  position: relative; /* the photos' offsetLeft/Top are read against it while sorting */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.image-preview-grid figure {
  margin: 0;
  position: relative;
  min-width: 0;
}
.image-preview-grid .photo-media {
  position: relative;
}
.image-preview-grid img,
.image-preview-grid video {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-ink);
}
/* ---- Photo order (admin.js initPhotoReorder): drag a photo by its grip (or, with a mouse, by the
   photo itself); the first is the cover. ---- */
.image-preview-grid.is-sortable .photo-media > img,
.image-preview-grid.is-sortable .photo-media > video {
  cursor: grab;
}
.image-preview-grid .is-cover .photo-media > img,
.image-preview-grid .is-cover .photo-media > video {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 2px var(--color-gold);
}
.photo-cover-badge,
.photo-pos-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  pointer-events: none;
}
.photo-cover-badge {
  background: var(--color-gold);
  color: var(--color-ink);
}
.photo-pos-badge {
  min-width: 1.5em;
  text-align: center;
  background: rgba(47, 59, 52, 0.72);
  color: #fff;
}
.image-preview-grid .photo-drag-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  touch-action: none;
}
.image-preview-grid .photo-drag-handle:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}
/* Six dots: the usual "drag me" mark. */
.photo-grip {
  width: 10px;
  height: 16px;
  background: radial-gradient(circle, var(--color-ink) 1.6px, transparent 1.9px) 0 0 / 5px 5.4px;
}
.image-preview-grid.is-sorting {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}
.image-preview-grid figure.is-dragging {
  z-index: 10;
  pointer-events: none;
  opacity: 0.95;
  filter: drop-shadow(0 14px 22px rgba(35, 45, 39, 0.35));
}
.image-preview-grid.is-sorting figure:not(.is-dragging) .photo-media > img,
.image-preview-grid.is-sorting figure:not(.is-dragging) .photo-media > video {
  opacity: 0.85;
}
@media (prefers-reduced-motion: reduce) {
  .image-preview-grid figure { transition: none !important; }
}
.image-preview-grid input[type='text'] {
  width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  font-size: 0.78rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  min-height: auto;
}
.lead-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  background: #fdf6e3;
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.lead-card strong {
  display: block;
}
.lead-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.collab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.collab-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.collab-list li {
  flex-wrap: wrap;
}
.collab-who {
  min-width: 0;
  flex: 1 1 12rem;
}
/* The collaboration contract (admin.js openCollabContract): the filled template to read, then send. */
.collab-contract-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 400;
  font-size: 0.88rem;
  width: auto;
}
.collab-contract-toggle input {
  width: auto;
  min-height: auto;
}
.collab-contract {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-md);
  background: #fdf9ee;
}
.collab-contract h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.collab-contract-commission {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}
.collab-contract-commission svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--color-gold);
}
.collab-contract-referral {
  margin-bottom: 10px;
}
.collab-contract-referral .input-with-unit {
  max-width: 9rem;
}
.collab-contract-referral .hint {
  margin: 4px 0 0;
}
.collab-contract-body {
  max-height: 260px;
  max-height: min(260px, 40dvh);
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 10px;
}
.collab-contract-body:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}
.collab-contract-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.collab-contract-done {
  margin: 0 0 var(--space-3);
}
.collab-contract-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex-basis: 100%;
  min-width: 0;
}
.collab-contract-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.collab-contract-state svg {
  width: 14px;
  height: 14px;
}
.collab-contract-state.is-completed {
  color: var(--color-success);
  font-weight: 600;
}
.collab-contract-state.is-sent,
.collab-contract-state.is-draft {
  color: #8a6300;
  font-weight: 600;
}
.collab-contract-state.is-declined,
.collab-contract-state.is-expired {
  color: var(--color-error);
}
.collab-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.collab-status--pending {
  background: #fdf1d6;
  color: #8a6300;
}
.collab-status--accepted {
  background: #e3ede5;
  color: #163d20;
}
.collab-status--rejected {
  background: #f8dede;
  color: #8a1f1f;
}
/* Collaborating needs a paid plan (plan-features.js 'collaboration'). A locked button stays in
   view, greyed, and still answers a click with the upgrade pop-up (so no `disabled`). */
.btn.is-plan-locked {
  opacity: 0.55;
  filter: grayscale(1);
  cursor: pointer;
}
.btn.is-plan-locked:hover,
.btn.is-plan-locked:focus-visible {
  opacity: 0.75;
}
/* The brochure file box on the Básico plan: greyed, still clickable (opens the upgrade pop-up). */
input[type="file"].is-plan-locked {
  opacity: 0.55;
  filter: grayscale(1);
  cursor: pointer;
  max-width: 100%;
}
/* The collaborator search: a Básico agent is shown greyed with a tag, never hidden. */
.collab-result { min-width: 0; }
.collab-result-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.collab-result.is-basic .collab-result-name { color: var(--color-text-muted); }
.collab-result:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -2px; }
.collab-plan-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.collab-basic-hint {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
}
.collab-plan-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-3, 12px);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--color-gold) 55%, transparent);
  background: color-mix(in srgb, var(--color-gold) 12%, transparent);
}
.collab-plan-notice[hidden] { display: none; }
.collab-plan-notice-icon { flex: 0 0 auto; color: var(--color-gold); line-height: 0; margin-top: 2px; }
.collab-plan-notice-body { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; }
.collab-plan-notice-body p { margin: 4px 0 0; overflow-wrap: anywhere; }
.collab-plan-notice-close { flex: 0 0 auto; position: static; }
.is-360-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  width: auto;
  min-height: auto;
}
.is-360-label input[type='checkbox'] {
  width: auto;
  min-height: auto;
}
/* Why a photo couldn't be marked 360° (admin.js): under its box, wrapping inside the tile. */
.is-360-note {
  margin: 4px 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--color-error);
  overflow-wrap: break-word;
}
.image-preview-grid .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(47, 59, 52, 0.75);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.image-preview-grid .photo-remove svg {
  width: 14px;
  height: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* "Generate Document" modal (public/admin/templates.html) — property autofill preview and
   seller/buyer section headings. */
.gen-property-preview {
  background: var(--color-cream-dim);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: -8px 0 var(--space-3);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.gen-property-preview strong {
  color: var(--color-ink);
}
.gen-section-heading {
  font-size: 0.95rem;
  margin: var(--space-4) 0 var(--space-2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}
.gen-section-heading:first-of-type {
  margin-top: var(--space-2);
}
.generated-docs-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

/* ---------- App launcher (public/admin/apps.html) ---------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.app-tile {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.app-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--color-gold);
}
.app-tile-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-cream-dim);
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-tile-icon svg {
  width: 26px;
  height: 26px;
}
.app-tile-label {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- CRM Kanban board (public/admin/crm.html) ---------- */
.crm-board[hidden] {
  display: none;
}
.crm-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
  overflow-x: auto;
}
@media (max-width: 900px) {
  .crm-board {
    grid-auto-flow: row;
    grid-auto-columns: unset;
  }
}

/* ---------- Pipeline switcher + Manage Pipelines modal ---------- */
.crm-pipeline-switcher-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-3);
}
.crm-pipeline-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crm-pipeline-tab {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.crm-pipeline-tab.is-active {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-ink);
}
.crm-pipeline-tab-add {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  cursor: pointer;
}
.crm-pipeline-manage-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-white);
}
.crm-pipeline-manage-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.crm-pipeline-name-input {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.05rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
}
.crm-pipeline-name-input:hover,
.crm-pipeline-name-input:focus {
  border-color: var(--color-border);
  background: var(--color-cream-dim);
}
.crm-stage-manage-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crm-stage-manage-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.crm-stage-manage-row:hover {
  background: var(--color-cream-dim);
}
.crm-stage-manage-row input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
}
.crm-stage-manage-row input:hover,
.crm-stage-manage-row input:focus {
  border-color: var(--color-border);
  background: var(--color-white);
}
/* Move-up/move-down sit as a tight pair, visually separate from the destructive delete icon. */
.crm-stage-reorder {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding-right: 6px;
  border-right: 1px solid var(--color-border);
}
.icon-btn-danger {
  color: var(--color-error);
}
.icon-btn-danger:hover {
  background: #f7e6e5;
  border-color: transparent;
  color: var(--color-error);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.icon-btn:disabled:hover {
  background: transparent;
  color: var(--color-text-muted);
}

/* ---------- Health legend ---------- */
.crm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.crm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.crm-legend-item svg {
  width: 14px;
  height: 14px;
}
.crm-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.crm-legend-hot {
  background: var(--color-success);
}
.crm-legend-warm {
  background: #c9a227;
}
.crm-legend-cold {
  background: var(--color-error);
}
.crm-column {
  background: var(--color-cream-dim);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
/* Stage name + count on the first line; the totals underneath, one currency per line — never
   squeezed side by side, so they can't wrap mid-number or get cut off. */
.crm-column-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-3);
  padding: 0 4px;
  min-width: 0;
}
.crm-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
  font-size: 0.9rem;
}
.crm-column-title > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-column-count {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(47, 59, 52, 0.1);
  color: var(--color-ink);
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .crm-column-count { background: rgba(236, 230, 214, 0.12); }
.crm-column-total {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary, var(--color-text-muted));
  font-variant-numeric: tabular-nums;
}
.crm-column-total > span { white-space: nowrap; }
.crm-column-total.is-converted { cursor: help; }

/* "Totales: Original · US$ · ₡" in the pipeline bar. */
.crm-currency { display: inline-flex; align-items: center; gap: 8px; }
.crm-currency-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-secondary, var(--color-text-muted)); }
.ui-segmented.ui-segmented-sm button { height: 30px; padding: 0 11px; font-size: 0.8rem; }
.ui-segmented button:disabled { opacity: 0.45; cursor: not-allowed; }
.crm-column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 60px;
  border-radius: var(--radius-md);
  transition: background 0.1s ease;
}
.crm-column-body.is-drag-over {
  background: rgba(201, 162, 39, 0.14);
  outline: 2px dashed var(--color-gold);
  outline-offset: -2px;
}
/* Captación's "Clasificar": a transfer zone, never a column of cards (crm-admin.js renderBoard). */
.crm-column-body.crm-classify-zone {
  align-items: center; justify-content: flex-start; gap: 8px; min-height: 220px; padding: 56px 12px 16px;
  border: 2px dashed var(--color-border); text-align: center; font-size: 0.85rem; line-height: 1.4; color: var(--color-text-muted);
}
.crm-classify-arrow { display: inline-flex; color: var(--color-gold); }
.crm-classify-arrow svg { width: 26px; height: 26px; }
.crm-column-body.crm-classify-zone.is-drag-over { border-color: var(--color-gold); outline: none; }
/* The whole destination column lights up while a card is dragged over it. */
.crm-column { transition: box-shadow 180ms ease, background-color 180ms ease; }
.crm-column:has(.crm-column-body.is-drag-over) { box-shadow: 0 0 0 2px var(--color-gold), 0 10px 28px -14px rgba(201, 162, 39, 0.8); background-color: rgba(201, 162, 39, 0.08); }
.crm-column-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: var(--space-3) 4px;
  text-align: center;
}
.crm-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-card);
}
.crm-card.is-dragging {
  opacity: 0.4;
}
/* The copy the pointer carries while dragging a card (see setCardDragImage in crm-admin.js):
   drawn off-screen, where the browser photographs it. Padding leaves room for the shadow. */
.crm-drag-holder {
  position: fixed;
  top: 0;
  left: -10000px;
  padding: 18px;
  pointer-events: none;
}
.crm-card.crm-card-ghost {
  opacity: 1;
  transform: rotate(2deg);
  box-shadow: 0 14px 30px -10px rgba(17, 22, 19, 0.45), 0 2px 6px rgba(17, 22, 19, 0.12);
  transition: none;
}
/* Health indicator — computed client-side from how recently the lead moved (see crm-admin.js's
   healthClassFor()); an alert always wins over the recency color since it's an explicit flag. */
.crm-card.crm-health-hot {
  border-left-color: var(--color-success);
}
.crm-card.crm-health-warm {
  border-left-color: #c9a227;
}
.crm-card.crm-health-cold {
  border-left-color: var(--color-error);
}
.crm-card.crm-health-alert {
  border-left-color: var(--color-error);
  border-left-width: 4px;
  border-left-style: double;
}
/* Where the deal came from: quiet — small icon + light gray text, no uppercase. */
.crm-card-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.crm-card-source svg { flex: none; width: 12px; height: 12px; }
.crm-card-source span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card-outcome {
  align-self: flex-start;
}
.crm-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-ink);
}
.crm-card-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
/* The client is a key field: full text color and medium weight (the agent in the footer stays
   secondary). */
.crm-card > .crm-card-contact { color: var(--color-text); font-weight: 500; }
.crm-card-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.crm-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.crm-card-revenue {
  font-weight: 700;
  color: var(--color-ink);
}
.crm-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.badge-crm-tag {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
}
/* Customer Directory's per-contact pipeline status (public/admin/clientdirectory.html) — one
   color per CRM stage so a contact's status reads at a glance. */
.badge-stage-nuevo {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
}
.badge-stage-calificado {
  background: #fdf3d8;
  color: #8a6d1d;
}
.badge-stage-propuesta {
  background: #e4ecf7;
  color: #2b5a96;
}
.badge-stage-ganado {
  background: #eef4ea;
  color: var(--color-success);
}
.badge-stage-perdido {
  background: #f7e6e5;
  color: var(--color-error);
}
.badge-stage-none {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
}
/* Customer Directory's "Propietario" flag (isOwner) — set from a property's own Datos
   propietario fields, orthogonal to the buyer/seller/both pipeline badges above. */
.badge-owner {
  background: #f1e9d3;
  color: #8a6a12;
}
.owner-properties-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.owner-properties-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-cream-dim);
}
.owner-properties-list a {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--color-gold);
  text-decoration: none;
}
.owner-properties-list a:hover {
  text-decoration: underline;
}
.owner-properties-title {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The Matches app's inline "reveal contact" panel (see matches-admin.js) — a raw icon() SVG has
   no intrinsic size of its own, so every button that embeds one needs its own sizing rule (same
   reason property.css's .contact-social-btn svg exists) or it renders at the browser's ~300x150
   SVG default and swallows the button. */
.match-contact-details .btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
/* .owner-properties-list a (above) sets every plain link inside it gold-on-transparent, which
   otherwise beats .btn-primary's ink-on-gold at equal specificity and renders this button's icon
   and label gold-on-gold — invisible. Same fix shape as the .btn-outline visibility bug elsewhere
   in this file: re-assert the button's own colors at matching specificity, later in the cascade. */
.match-contact-details .btn-primary {
  color: var(--color-ink);
  font-weight: 600;
}
/* Agent Verified badge — shown on the Users table, agent directory, and profile. */
.badge-verified {
  background: #e4ecf7;
  color: #2b5a96;
}
/* The Verified star next to a paying agent's name (directories, profile, property page) and on
   map cards: what the subscription buys, so it is the most precious-looking thing on the card. A
   blue seal (scalloped edge; blue for trust, the owner's choice) with a white star, a soft halo
   and a slow glint of light; a hover/focus tooltip explains what it means, since a bare badge
   invites "verified how?". Fixed colors, not tokens: the dark theme swaps --color-white. */
.verified-badge {
  --seal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.00 1.80Q15.29 -0.27 17.10 3.17Q20.98 3.02 20.83 6.90Q24.27 8.71 22.20 12.00Q24.27 15.29 20.83 17.10Q20.98 20.98 17.10 20.83Q15.29 24.27 12.00 22.20Q8.71 24.27 6.90 20.83Q3.02 20.98 3.17 17.10Q-0.27 15.29 1.80 12.00Q-0.27 8.71 3.17 6.90Q3.02 3.02 6.90 3.17Q8.71 -0.27 12.00 1.80Z'/%3E%3C/svg%3E");
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: #ffffff;
  cursor: default;
  vertical-align: middle;
}
/* The seal: deep blue, with a band of light that crosses it every few seconds. */
.verified-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 58%) 130% 0 / 300% 100% no-repeat,
    linear-gradient(140deg, #6ea8f2 0%, #3b7bd0 34%, #2459a6 66%, #173f7c 100%);
  -webkit-mask: var(--seal) center / contain no-repeat;
  mask: var(--seal) center / contain no-repeat;
  animation: verified-glint 4.5s ease-in-out infinite;
}
/* The halo behind it. */
.verified-badge::after {
  content: '';
  position: absolute;
  inset: -22%;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 123, 208, 0.42) 38%, rgba(59, 123, 208, 0) 70%);
  pointer-events: none;
}
@keyframes verified-glint {
  0%, 55% { background-position: 130% 0, 0 0; }
  85%, 100% { background-position: -30% 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .verified-badge::before { animation: none; }
}
.verified-badge svg {
  /* Explicit, not inherited — an ancestor's own "svg { color: gold }" rule (e.g. .property-address)
     otherwise beats the badge's inherited color at equal specificity, since a direct match always
     outranks inheritance. Same fix shape as the .btn-outline visibility bug elsewhere in this file. */
  color: #ffffff;
  width: 50%;
  height: 50%;
}
.name-badge-nowrap { white-space: nowrap; }
.name-badge-nowrap .verified-badge-tip { white-space: normal; }
.agent-name-line .verified-badge,
.property-owner-link + .verified-badge,
.contact-owner .verified-badge {
  /* Sized by the name's own text, so it matches whatever font size the name uses. */
  width: 1.25em;
  height: 1.25em;
  margin-left: 0.35em;
  top: -0.1em;
}
/* The tooltip opens to the RIGHT of the star, vertically centred on it: opening upward put it
   under the sticky site header on a profile's name, cut off with no way to scroll up to it.
   It resets the type it would otherwise inherit from the heading (small caps, serif, tracking). */
.verified-badge-tip {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(-4px);
  width: 260px;
  max-width: min(260px, 60vw);
  background: var(--color-ink);
  color: var(--color-white);
  font-family: var(--font-body, inherit);
  font-size: 0.8rem;
  font-weight: 400;
  font-style: normal;
  font-variant: normal;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
}
.verified-badge-tip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--color-ink);
}
.verified-badge:hover .verified-badge-tip,
.verified-badge:focus-visible .verified-badge-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
.crm-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  min-height: 26px;
}
/* Footer: stars (if any) on the left; the agent's initials and ⋯ on the right. */
.crm-card-footer { justify-content: flex-end; }
.crm-card-footer .crm-stars { margin-right: auto; }
/* The ⋯ actions menu: always there for keyboard/touch, fades in on hover with a mouse. */
/* Selected card (one click selects; the CRM side panel follows it) and its "Abrir" button, which
   shows on the selected card and on hover/focus — always on touch screens, where there's no hover. */
.crm-card.is-selected { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.crm-card-open {
  flex: none;
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
}
.crm-card-open:hover { border-color: var(--color-gold); }
.crm-card-open:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; opacity: 1; }
.crm-card.is-selected .crm-card-open,
.crm-card:hover .crm-card-open,
.crm-card:focus-within .crm-card-open { opacity: 1; }
@media (hover: none) { .crm-card.is-selected .crm-card-open { min-height: 36px; padding: 6px 14px; } }
.crm-card-more {
  flex: none;
  width: 26px;
  height: 26px;
  margin-right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: opacity 140ms, background 140ms;
}
.crm-card-more svg { width: 16px; height: 16px; }
.crm-card-more:hover { background: rgba(47, 59, 52, 0.08); color: var(--color-ink); }
.crm-card-more:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
@media (hover: hover) {
  .crm-card-more { opacity: 0; }
  .crm-card:hover .crm-card-more, .crm-card:focus-within .crm-card-more, .crm-card:focus .crm-card-more { opacity: 1; }
}
.crm-stars {
  display: inline-flex;
  gap: 2px;
  color: var(--color-gold);
}
.crm-stars svg {
  width: 15px;
  height: 15px;
}
.crm-stars button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  line-height: 0;
}
.crm-card-agent {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.crm-card-agent img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- CRM lead detail (public/admin/crm-lead.html) ---------- */
.crm-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.crm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.crm-breadcrumb-step {
  background: var(--color-cream-dim);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
}
.crm-breadcrumb-step.is-active {
  background: var(--color-ink);
  color: var(--color-white);
  border-color: var(--color-ink);
}
.crm-breadcrumb-step.is-lost {
  background: var(--color-error);
  color: var(--color-white);
  border-color: var(--color-error);
}
.crm-detail-actions {
  display: flex;
  gap: 8px;
}
.crm-tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.crm-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-cream-dim);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 0.8rem;
}
.crm-tag-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  padding: 2px;
}
.crm-tag-chip button svg {
  width: 12px;
  height: 12px;
}

/* ---------- Property picker (lead detail page) ---------- */
.crm-property-search-results {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}
.crm-property-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.crm-property-search-result:last-child {
  border-bottom: none;
}
.crm-property-search-result:hover {
  background: var(--color-cream-dim);
}
.crm-property-search-result img {
  width: 40px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.crm-property-selected-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.crm-property-send { color: var(--color-gold); flex: none; }
.crm-property-send:hover { color: var(--color-ink); }
.crm-property-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-cream-dim);
}
.crm-property-row img {
  width: 44px;
  height: 34px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.crm-property-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
}
/* Drill-down into the property's own edit modal (see admin.js's editId query-param handling) —
   reset from an <a>'s default link styling, with just a title-hover underline as the affordance. */
.crm-property-row-info:hover strong {
  text-decoration: underline;
}
.crm-property-row-info strong {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-property-row-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

/* ---------- Lead attachments ---------- */
.crm-attachment-field {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: 8px;
}
.crm-attachment-field-label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  display: block;
}
.crm-attachment-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.crm-attachment-file {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.crm-attachment-file a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Closing checklist ---------- */
.crm-checklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--color-border);
}
.crm-checklist-row:last-child {
  border-bottom: none;
}
.crm-checklist-row input[type='checkbox'] {
  width: auto;
  flex-shrink: 0;
}
.crm-checklist-row label {
  flex: 1;
  font-size: 0.9rem;
  cursor: pointer;
}
.crm-checklist-row.is-done label {
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.crm-checklist-row-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Floating "edit this page" control shown to a logged-in admin on an otherwise public page
   (About, and any other page with editable marketing copy) — fixed so it never pushes the
   page's own content around, and icon-only so it reads as a discreet admin affordance rather
   than part of the page itself. */
.page-edit-fab {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-ink);
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.page-edit-fab:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}
.page-edit-fab svg {
  width: 20px;
  height: 20px;
}
@media (max-width: 640px) {
  .page-edit-fab {
    right: var(--space-3);
    bottom: var(--space-3);
    width: 46px;
    height: 46px;
  }
}

/* Generic status-badge variants (Property Management's active/vacant/ended, and anywhere else
   a simple traffic-light status needs a pill) — same shape as .badge, just three reusable colors
   instead of a bespoke class per specific status value. */
.badge-success {
  background: #eef4ea;
  color: var(--color-success);
}
.badge-warning {
  background: #f1e9d3;
  color: #8a6a12;
}
.badge-muted {
  background: #e8e6e2;
  color: var(--color-text-muted);
}

/* Kanban/List view toggle (CRM board) — a small segmented control, same visual language as the
   pipeline tabs beside it but visually distinct (pill-in-a-pill) so it doesn't read as a third
   pipeline. */
.crm-view-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.crm-view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  background: var(--color-white);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.crm-view-toggle-btn svg {
  width: 14px;
  height: 14px;
}
.crm-view-toggle-btn.is-active {
  background: var(--color-ink);
  color: var(--color-white);
}

/* Odoo-style bulk-selection action bar — sits above the table, only shown once at least one
   row checkbox is checked. */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-ink);
  color: var(--color-white);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}
.bulk-action-bar #bulk-action-count {
  font-weight: 600;
  margin-right: 6px;
}

/* ---------- Donation banner (profile dropdown) — see app.js's
   donationBannerHTML/wireDonationBanner/donationBannerDismissed for the one-time-dismissible
   localStorage-backed logic. ---------- */
.donation-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-cream-dim);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}
.donation-banner-icon {
  color: var(--color-gold);
  flex-shrink: 0;
  display: flex;
}
.donation-banner-icon svg {
  width: 26px;
  height: 26px;
}
.donation-banner-text {
  flex: 1;
  min-width: 220px;
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.5;
  /* Clear of the × in the corner (its 26px button + 8px offset). */
  padding-right: 38px;
}
.donation-banner-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex-basis: 100%;
  margin-top: -4px;
}
.donation-banner-close {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--color-text-muted);
  padding: 4px;
}
.donation-banner-close:hover {
  color: var(--color-ink);
}
/* Compact variant — tucked into the profile dropdown (see profile.js), a much tighter space than
   a full page (that dropdown is only 260px wide — see .profile-dropdown). The text is forced onto
   its own full-width row (flex-basis: 100%) rather than sharing a row with the button: squeezing
   all three (icon/text/button) onto one flex row left the text almost no room to wrap in, so it
   rendered one word per line. Giving text the full row first, then the button its own row below,
   fixes that regardless of exactly how narrow the dropdown is. */
.donation-banner-compact {
  align-items: flex-start;
  margin: 4px 0 0;
  padding: 8px 26px 8px 10px;
  gap: 4px 8px;
}
.donation-banner-compact .donation-banner-icon {
  margin-top: 1px;
}
.donation-banner-compact .donation-banner-icon svg {
  width: 18px;
  height: 18px;
}
.donation-banner-compact .donation-banner-text {
  flex: 1 1 100%;
  font-size: 0.76rem;
  line-height: 1.45;
  min-width: 0;
  padding-right: 0;
}
.donation-banner-compact .donation-banner-link {
  margin-left: 26px;
}
.donation-banner-compact .donation-banner-close {
  top: 4px;
  right: 4px;
  font-size: 0.95rem;
}
/* A softer take on Buy Me a Coffee's own brand yellow (still clearly that service, not this app's
   gold/ink) — a full pill shape and a lighter, less saturated yellow read calmer against the
   banner's cream background than a flat, fully-saturated rectangle. */
.donation-banner-bmc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffe767;
  color: #4a3b00;
  border: 1px solid #f0d23a;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(74, 59, 0, 0.15);
}
.donation-banner-bmc:hover {
  background: #ffdd45;
  color: #4a3b00;
}
.donation-banner-bmc svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.donation-banner-compact .donation-banner-bmc {
  padding: 4px 12px;
  font-size: 0.72rem;
}

/* ---------- Reports (public/admin/reports.html) ---------- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.report-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  min-width: 0;
}
.report-span-4 {
  grid-column: span 4;
}
.report-span-6 {
  grid-column: span 6;
}
.report-span-8 {
  grid-column: span 8;
}
.report-span-12 {
  grid-column: span 12;
}
@media (max-width: 1000px) {
  .report-span-4,
  .report-span-6,
  .report-span-8 {
    grid-column: span 12;
  }
}
.report-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-ink);
  margin: 0 0 2px;
}
.report-card-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3);
}
.report-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.report-bar-row .top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.report-bar-row .top .n {
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-bar-row .top .v {
  font-weight: 600;
  color: var(--color-ink);
  flex-shrink: 0;
}
.report-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--color-cream-dim);
  overflow: hidden;
}
.report-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--color-gold);
}
.report-bar-fill.danger {
  background: var(--color-error);
}
.report-bar-fill.success {
  background: var(--color-success);
}
.report-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  flex-shrink: 0;
}

/* Donut chart (activities, inventory status) — same multi-color-arc SVG technique used site-wide
   wherever a single ring needs to show several categories at once (see Matches' own badge
   language for the same "read it in one glance" goal, just as a ring instead of bars). */
.report-donut-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.report-donut-wrap svg {
  flex-shrink: 0;
}
.report-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.report-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text);
}
.report-donut-legend-item b {
  margin-left: auto;
  color: var(--color-ink);
  font-weight: 600;
}

.report-stat-rows {
  display: flex;
  flex-direction: column;
}
.report-stat-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
}
.report-stat-row:last-child {
  border-bottom: none;
}
.report-stat-row .n {
  font-size: 0.85rem;
  color: var(--color-text);
}
.report-stat-row .n em {
  font-style: normal;
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}
.report-stat-row .v {
  margin-left: auto;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  text-align: right;
}

.report-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 20px;
}
.report-chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.report-chart-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
}
.report-chart-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 4px 4px 0 0;
  background: var(--color-gold);
  min-height: 2px;
}
.report-chart-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  white-space: nowrap;
}
/* Phones: full amounts ($3,548,440) don't fit a twelfth of the screen, so each month keeps room
   for its value and the chart scrolls sideways instead of printing amounts over each other. */
@media (max-width: 760px) {
  .report-chart { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 4px; }
  .report-chart-col { flex: 0 0 auto; min-width: 76px; }
}

.report-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-3);
}
.report-empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: var(--space-3) 0;
}

/* ---------- Data tables (public/js/data-table.js): sortable headers and the columns button in the
   last header cell; its menu lives in <body> (position: fixed) so a scrolling table can't clip it. */
.dt-th { padding: 0 !important; white-space: nowrap; }
.dt-sort { display: inline-flex; align-items: center; gap: 6px; width: 100%; padding: 10px 12px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.dt-sort:hover { color: var(--color-ink); background: rgba(47, 59, 52, 0.05); }
.dt-sort:focus-visible { outline: none; box-shadow: inset var(--ui-ring); }
.dt-sort-icon { font-size: 0.66rem; opacity: 0.35; }
.dt-th.is-sorted .dt-sort-icon { opacity: 1; color: #8a6d10; }
:root[data-theme="dark"] .dt-th.is-sorted .dt-sort-icon { color: var(--color-gold-soft); }
.dt-picker-th { width: 44px; text-align: right !important; }
.dt-picker-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--ui-hairline-strong); border-radius: 8px; background: var(--color-white); color: var(--color-text-muted); cursor: pointer; }
.dt-picker-btn:hover, .dt-picker-btn[aria-expanded="true"] { color: var(--color-ink); border-color: var(--color-gold); }
.dt-picker-btn:focus-visible { outline: none; box-shadow: var(--ui-ring); }
.dt-picker-btn svg { width: 16px; height: 16px; }
.dt-actions { text-align: right; }
/* The last column (columns button + row actions) stays pinned to the right edge while a wide
   table scrolls sideways, so the button is always in reach. */
.dt-picker-th, .dt-actions { position: sticky; right: 0; z-index: 1; }
.dt-picker-th { background: var(--color-cream-dim); }
.dt-actions { background: var(--color-white); box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.18); }
.dt-picker-th { box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.18); }
.dt-menu { position: fixed; z-index: 90; width: 260px; max-height: min(460px, 70vh); display: flex; flex-direction: column; background: #fffdf8; border: 1px solid var(--ui-hairline); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-float); animation: ui-pop 140ms var(--ui-ease); }
.dt-menu[hidden] { display: none; }
:root[data-theme="dark"] .dt-menu { background: #1f2622; }
.dt-menu-title { margin: 12px 14px 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.dt-menu-list { overflow-y: auto; padding: 0 6px; }
.dt-menu-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 0.88rem; cursor: pointer; }
.dt-menu-item:hover { background: rgba(201, 162, 39, 0.12); }
.dt-menu-item input { width: 16px; height: 16px; accent-color: var(--color-ink); }
.dt-menu-foot { padding: 8px 14px 12px; border-top: 1px solid var(--ui-hairline); margin-top: 6px; }
.dt-menu-reset { padding: 0; border: 0; background: transparent; color: #8a6d10; font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
:root[data-theme="dark"] .dt-menu-reset { color: var(--color-gold-soft); }
.dt-menu-reset:hover { text-decoration: underline; }

/* Google vs Outlook comparison on the calendar settings page — plan-comparison style. */
.cmp-card { --cmp-g: #1e8e3e; --cmp-o: #7b3fbf; }
.cmp-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}
.cmp-summary::-webkit-details-marker { display: none; }
.cmp-chevron { display: inline-flex; color: var(--color-text-muted); transition: transform 150ms ease; }
.cmp-chevron svg { width: 20px; height: 20px; }
.cmp-card[open] .cmp-chevron { transform: rotate(180deg); }
.cmp-table {
  border-collapse: separate;
  border-spacing: 10px 0;
  margin: 0 -10px;
  width: calc(100% + 20px);
  table-layout: fixed;
  font-size: 0.88rem;
}
.cmp-table th,
.cmp-table td { padding: 10px 12px; vertical-align: middle; }
.cmp-label-head {
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-ink);
  width: 34%;
  border-bottom: 2px solid var(--color-ink);
}
.cmp-col { text-align: center; }
.cmp-g { border-left: 2px solid var(--cmp-g); border-right: 2px solid var(--cmp-g); }
.cmp-o { border-left: 2px solid var(--cmp-o); border-right: 2px solid var(--cmp-o); }
.cmp-head {
  border-top: 2px solid;
  border-bottom: 2px solid;
  border-radius: 10px 10px 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.2;
  padding: 14px 10px;
}
.cmp-head.cmp-g { color: var(--cmp-g); border-color: var(--cmp-g); }
.cmp-head.cmp-o { color: var(--cmp-o); border-color: var(--cmp-o); }
.cmp-head small {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body, inherit);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.cmp-head-icon { display: inline-flex; vertical-align: -3px; margin-right: 6px; }
.cmp-head-icon svg { width: 18px; height: 18px; }
.cmp-row th {
  text-align: left;
  font-weight: 400;
  color: var(--color-text);
}
.cmp-label-wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmp-row th .info-tooltip { flex-shrink: 0; }
.cmp-row th .info-tooltip svg { width: 16px; height: 16px; }
.cmp-row th .info-tooltip-text { right: auto; left: 0; bottom: auto; top: calc(100% + 6px); }
.cmp-row:nth-child(even) th,
.cmp-row:nth-child(even) td { background: #f6f4ef; }
.cmp-section th {
  text-align: left;
  padding-top: 18px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.cmp-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}
.cmp-yes { background: var(--color-success); }
.cmp-no { background: var(--color-error); }
.cmp-note { display: block; margin-top: 3px; font-size: 0.78rem; color: var(--color-text-muted); }
.cmp-text { color: var(--color-text); }
.cmp-last { border-bottom: 2px solid; border-radius: 0 0 10px 10px; }
.cmp-g.cmp-last { border-bottom-color: var(--cmp-g); }
.cmp-o.cmp-last { border-bottom-color: var(--cmp-o); }
.cmp-proscons td { text-align: left; vertical-align: top; }
.cmp-list { list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.82rem; }
.cmp-list li { position: relative; padding-left: 20px; margin-bottom: 4px; }
.cmp-list li::before { position: absolute; left: 0; font-weight: 700; }
.cmp-pros li::before { content: '+'; color: var(--color-success); }
.cmp-cons li::before { content: '–'; color: var(--color-error); }
.cmp-limit {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--color-error);
  background: #fbeeed;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--color-text);
}
@media (max-width: 640px) {
  .cmp-table { font-size: 0.78rem; }
  .cmp-table th, .cmp-table td { padding: 8px 6px; }
  .cmp-label-head { width: 38%; }
  .cmp-head { font-size: 0.95rem; }
}

/* Company-name logo preview on Settings > Localization. */
.brand-preview {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  gap: 10px;
  background: #1C3328;
  color: #F6F1E7;
  --logo-house: #F6F1E7;
  --logo-core: #C9A24A;
}
.brand-preview .brand-mark { width: 30px; height: 30px; display: inline-flex; }
.brand-preview .brand-mark svg { width: 100%; height: 100%; }
.brand-preview .brand-name-light { color: #D9B862; }

/* ---------- Phone layout: admin top bar ----------
   On a phone the brand, the "Back to …" link, the bell and the avatar must fit on one row
   instead of wrapping over each other. */
@media (max-width: 600px) {
  .admin-topbar { padding: 10px 0; }
  .admin-topbar .container { gap: 10px; }
  .admin-topbar .brand { min-width: 0; flex-shrink: 1; }
  .admin-topbar .brand-name { font-size: 0.78rem; letter-spacing: 1px; line-height: 1.15; }
  .admin-topbar-nav { flex-wrap: nowrap; min-width: 0; gap: 6px; }
  .admin-nav-link,
  .admin-topbar-nav .btn-outline.btn-sm { padding: 6px 11px; font-size: 0.74rem; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .admin-nav-link [data-icon] svg { width: 14px; height: 14px; }
  /* Detail-page headers: smaller display name so it doesn't take half the screen. */
  .crm-detail-header h1 { font-size: 1.25rem !important; }
}
@media (max-width: 600px) {
  /* "← Back to …" links become just the arrow on a phone (the full text stays as the tooltip). */
  .admin-nav-link:has(> [data-icon]) > span:not([data-icon]) { display: none; }
  .admin-nav-link:has(> [data-icon]) { padding: 6px 10px; }
}

/* The bulk "N selected — Delete / Clear" bar uses the [hidden] attribute while nothing is
   selected; its own display rule must not override that. */
.bulk-action-bar[hidden] { display: none; }
@media (max-width: 600px) {
  .bulk-action-bar { flex-wrap: wrap; gap: 8px; }
}

/* =====================================================================================
   UI kit — the shared page-header pattern (first used on the CRM board). Reuse it on every
   list/board page: .ui-page-head (title · search · primary action) followed by .ui-toolbar
   (record switcher on the left · tools menu + view switch on the right). Behaviour lives in
   /js/ui-kit.js (UIKit.menu / UIKit.search / UIKit.segmented).
   ===================================================================================== */
:root {
  --ui-glass: rgba(255, 255, 255, 0.72);
  --ui-hairline: rgba(47, 59, 52, 0.12);
  --ui-hairline-strong: rgba(47, 59, 52, 0.2);
  --ui-ring: 0 0 0 4px rgba(201, 162, 39, 0.22);
  --ui-radius: 12px;
  --ui-radius-lg: 16px;
  --ui-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ui-shadow-float: 0 1px 2px rgba(47, 59, 52, 0.06), 0 12px 32px -8px rgba(47, 59, 52, 0.22), 0 32px 64px -24px rgba(47, 59, 52, 0.18);
  --ui-shadow-soft: 0 1px 2px rgba(47, 59, 52, 0.05), 0 4px 14px -6px rgba(47, 59, 52, 0.12);
}

.ui-page-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.ui-page-title { margin: 0; line-height: 1; }

/* Search — a glassy command field with a ⌘K hint. */
.ui-search {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 10px 0 44px;
  background: var(--ui-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--ui-hairline);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 160ms var(--ui-ease), box-shadow 160ms var(--ui-ease), background 160ms var(--ui-ease);
}
.ui-search:hover { border-color: var(--ui-hairline-strong); }
.ui-search:focus-within { background: var(--color-white); border-color: var(--color-gold); box-shadow: var(--ui-ring), var(--ui-shadow-soft); }
.ui-search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); display: flex; color: var(--color-text-muted); pointer-events: none; }
.ui-search-icon svg { width: 18px; height: 18px; }
.ui-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  box-shadow: none;
}
.ui-search input::placeholder { color: var(--color-text-muted); opacity: 0.85; }
.ui-search input::-webkit-search-cancel-button { display: none; }
.ui-search-kbd {
  flex: none;
  font: 600 0.72rem/1 var(--font-body);
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  padding: 5px 7px;
  border: 1px solid var(--ui-hairline-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.6);
}
.ui-search-clear {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(47, 59, 52, 0.07);
  color: var(--color-text-muted);
  cursor: pointer;
}
.ui-search-clear:hover { background: rgba(47, 59, 52, 0.13); color: var(--color-ink); }
.ui-search-clear svg { width: 14px; height: 14px; }
.ui-search.has-value .ui-search-clear { display: inline-flex; }
.ui-search.has-value .ui-search-kbd,
.ui-search:focus-within .ui-search-kbd { display: none; }

.ui-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 8px 20px -8px rgba(201, 162, 39, 0.7);
  transition: transform 140ms var(--ui-ease), box-shadow 140ms var(--ui-ease), filter 140ms;
  white-space: nowrap;
}
.ui-btn-primary svg { width: 18px; height: 18px; }
.ui-btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 12px 26px -10px rgba(201, 162, 39, 0.85); }
.ui-btn-primary:active { transform: translateY(0); }
/* Keyboard shortcut hint inside a primary button (e.g. "N" on New lead). */
.ui-btn-kbd { margin-left: 2px; min-width: 20px; padding: 3px 6px; border: 1px solid rgba(17, 22, 19, 0.22); border-bottom-width: 2px; border-radius: 6px; background: rgba(255, 255, 255, 0.28); font: 700 0.7rem/1 var(--font-body); color: inherit; text-align: center; }

/* Toolbar — one floating glass bar under the header. */
.ui-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 6px;
  margin-bottom: var(--space-4);
  background: var(--ui-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--ui-hairline);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-soft);
  /* backdrop-filter makes a stacking context: lift the bar so its menus float over the content. */
  position: relative;
  z-index: 30;
}
.ui-toolbar-start,
.ui-toolbar-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-toolbar-end { margin-left: auto; }

.ui-dropdown { position: relative; }

/* Record switcher button (e.g. pipeline). */
.ui-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px 0 14px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  background: var(--color-white);
  box-shadow: 0 1px 2px rgba(47, 59, 52, 0.08), 0 0 0 1px var(--ui-hairline);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: box-shadow 150ms var(--ui-ease);
}
.ui-select-btn:hover,
.ui-select-btn[aria-expanded="true"] { box-shadow: 0 1px 2px rgba(47, 59, 52, 0.08), 0 0 0 1px var(--color-gold); }
.ui-select-btn:focus-visible,
.ui-icon-btn:focus-visible,
.ui-segmented button:focus-visible,
.ui-menu-item:focus-visible { outline: none; box-shadow: var(--ui-ring); }
.ui-select-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.ui-select-value { font-weight: 700; font-size: 0.95rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select-count {
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.16);
  color: #7a5f0c;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.ui-select-count:empty { display: none; }
.ui-select-caret { display: inline-flex; color: var(--color-text-muted); transition: transform 180ms var(--ui-ease); }
.ui-select-caret svg { width: 16px; height: 16px; }
[aria-expanded="true"] > .ui-select-caret { transform: rotate(180deg); }

.ui-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: var(--ui-radius);
  background: transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: background 150ms var(--ui-ease), color 150ms;
}
.ui-icon-btn > [data-icon="settings"] svg,
.ui-icon-btn > span:first-child svg { width: 18px; height: 18px; }
.ui-icon-btn:hover,
.ui-icon-btn[aria-expanded="true"] { background: rgba(47, 59, 52, 0.07); color: var(--color-ink); }

.ui-result-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(47, 59, 52, 0.07);
  color: var(--color-ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  animation: ui-fade-in 180ms var(--ui-ease);
}

/* Menus / popovers. */
.ui-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 270px;
  max-width: min(340px, calc(100vw - 32px));
  padding: 6px;
  /* Solid, not glass: a backdrop-filter nested inside the (glass) toolbar can't see the page
     behind it, so a translucent menu would let the content show through unblurred. */
  background: #fffdf8;
  border: 1px solid var(--ui-hairline);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-float);
  transform-origin: top left;
  animation: ui-pop 160ms var(--ui-ease);
}
.ui-menu[data-align="end"] { left: auto; right: 0; transform-origin: top right; }
/* No room below (ui-kit.js menu fit): it opens upward, and scrolls inside itself if still too tall. */
.ui-menu { overflow-y: auto; overscroll-behavior: contain; }
.ui-menu[data-drop="up"] { top: auto; bottom: calc(100% + 8px); transform-origin: bottom left; }
.ui-menu[data-drop="up"][data-align="end"] { transform-origin: bottom right; }
.ui-menu-label {
  margin: 6px 10px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.ui-menu-sep { border: 0; border-top: 1px solid var(--ui-hairline); margin: 6px 4px; }
.ui-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms var(--ui-ease);
}
.ui-menu-item:hover,
.ui-menu-item:focus-visible { background: rgba(201, 162, 39, 0.12); }
.ui-menu-item:disabled { opacity: 0.5; cursor: not-allowed; background: transparent; }
.ui-menu-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(47, 59, 52, 0.06);
  color: var(--color-ink-soft);
}
.ui-menu-icon svg { width: 16px; height: 16px; }
.ui-menu-item[aria-checked="true"] .ui-menu-icon { background: var(--color-gold); color: var(--color-ink); }
.ui-menu-item[aria-checked="true"] .ui-menu-text > span { font-weight: 700; }
.ui-menu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 0.9rem; font-weight: 600; }
.ui-menu-text small { font-size: 0.76rem; font-weight: 500; color: var(--color-text-muted); }
.ui-menu-text small:empty { display: none; }

/* Segmented control with a sliding indicator. */
.ui-segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: var(--ui-radius);
  background: rgba(47, 59, 52, 0.07);
  isolation: isolate;
}
.ui-segmented::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: var(--ui-seg-w, 0);
  transform: translateX(var(--ui-seg-x, 0));
  border-radius: 9px;
  background: var(--color-ink);
  box-shadow: 0 4px 12px -4px rgba(47, 59, 52, 0.5);
}
.ui-segmented.is-ready::before { transition: transform 260ms var(--ui-ease), width 260ms var(--ui-ease); }
.ui-segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 200ms var(--ui-ease);
}
.ui-segmented button svg { width: 16px; height: 16px; }
.ui-segmented button:hover { color: var(--color-ink); }
.ui-segmented button.is-active { color: var(--color-white); }
/* Until the indicator is measured, the active button paints its own background. */
.ui-segmented:not(.is-ready) button.is-active { background: var(--color-ink); }

@keyframes ui-pop { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes ui-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .ui-menu, .ui-result-chip { animation: none; }
  .ui-segmented.is-ready::before, .ui-btn-primary { transition: none; }
}

@media (max-width: 760px) {
  .ui-page-head { grid-template-columns: 1fr auto; gap: var(--space-3); }
  .ui-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .ui-search-kbd, .ui-btn-kbd { display: none; }
  .ui-btn-primary { height: 42px; padding: 0 14px; }
  .ui-toolbar { padding: 5px; }
  .ui-toolbar-start { flex: 1 1 100%; }
  .ui-toolbar-end { flex: 1 1 100%; justify-content: space-between; margin-left: 0; flex-wrap: wrap; row-gap: 6px; }
  .crm-currency-label { display: none; }
  .ui-toolbar-start > .ui-dropdown { flex: 1; min-width: 0; }
  .ui-select-btn { width: 100%; min-width: 0; }
  .ui-select-value { max-width: none; flex: 1; text-align: left; }
  .ui-segmented button span:last-child { display: none; }
  .ui-segmented button { padding: 0 12px; }
}

/* Manage Pipelines dialog — add-stage row and the lock shown on system pipelines. */
.crm-add-stage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed var(--ui-hairline-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms var(--ui-ease), border-color 140ms var(--ui-ease), color 140ms;
}
.crm-add-stage-btn svg { width: 16px; height: 16px; }
.crm-add-stage-btn:hover { background: rgba(201, 162, 39, 0.1); border-color: var(--color-gold); color: var(--color-ink); }
.crm-pipeline-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(47, 59, 52, 0.06);
  color: var(--color-text-muted);
}
.crm-pipeline-lock svg { width: 16px; height: 16px; }

/* Title switcher — the page title doubles as the section picker (e.g. CRM ⇄ Credit memos), so
   sections of one module don't need their own row of buttons. */
.ui-title-switch .ui-page-title { margin: 0; }
.ui-title-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: -6px -10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms var(--ui-ease);
}
.ui-title-btn:hover,
.ui-title-btn[aria-expanded="true"] { background: rgba(47, 59, 52, 0.06); }
.ui-title-btn:focus-visible { outline: none; box-shadow: var(--ui-ring); }
.ui-title-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(47, 59, 52, 0.07);
  color: var(--color-ink-soft);
  transition: transform 200ms var(--ui-ease), background 160ms;
}
.ui-title-caret svg { width: 16px; height: 16px; }
.ui-title-btn:hover .ui-title-caret { background: var(--color-gold); color: var(--color-ink); }
.ui-title-btn[aria-expanded="true"] .ui-title-caret { transform: rotate(180deg); background: var(--color-gold); color: var(--color-ink); }
.ui-title-switch .ui-menu { top: calc(100% + 12px); min-width: 300px; z-index: 70; }
.ui-page-head { position: relative; z-index: 40; }

.ui-toolbar-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  min-height: 40px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.ui-toolbar-note svg { width: 16px; height: 16px; flex: none; }

/* Empty state — a calm panel instead of a bare sentence under an empty table. */
.ui-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 56px 24px;
  border: 1px dashed var(--ui-hairline-strong);
  border-radius: var(--ui-radius-lg);
  background: rgba(255, 255, 255, 0.45);
  animation: ui-fade-in 220ms var(--ui-ease);
}
.ui-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: rgba(201, 162, 39, 0.16);
  color: #7a5f0c;
}
.ui-empty-icon svg { width: 24px; height: 24px; }
.ui-empty-title { margin: 0; font-weight: 700; font-size: 1rem; color: var(--color-ink); }
.ui-empty-text { margin: 0; max-width: 420px; font-size: 0.88rem; color: var(--color-text-muted); }

/* ---------- Stage info bubble (ⓘ beside a built-in stage's name): what the stage means and what
   the system does on its own. The bubble itself is one floating layer on <body> (see crm-admin.js),
   so the board's sideways scroll can never cut it off. */
.crm-stage-info { display: inline-flex; flex: none; }
.crm-stage-info-src { display: none; }
.crm-stage-info-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.crm-stage-info-btn svg { width: 15px; height: 15px; }
.crm-stage-info-btn:hover, .crm-stage-info-btn.is-active { color: var(--color-ink); background: rgba(47, 59, 52, 0.12); }
.crm-stage-info-btn:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.crm-stage-info-pop {
  position: fixed;
  z-index: 80;
  width: 300px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--ui-hairline);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 16px 36px -12px rgba(17, 22, 19, 0.35);
  color: var(--color-text);
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: left;
  animation: ui-fade-in 120ms;
}
.crm-stage-info-pop[hidden] { display: none; }
:root[data-theme="dark"] .crm-stage-info-pop { background: #1f2622; }
.crm-stage-info-pop strong { font-size: 0.86rem; color: var(--color-ink); }
.crm-stage-info-label { margin-top: 2px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.crm-stage-info-pop ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; }
.crm-stage-info-foot { margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--ui-hairline); color: var(--color-text-muted); }

/* Confetti layer for a closed deal (celebrateClose in app.js). */
.celebrate-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 2000; pointer-events: none; }

/* ---------- CRM card details ---------- */
/* Avatars: the photo, or initials on a color picked from the name. */
.crm-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: var(--avatar-bg, #59625d); color: #fff; font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.crm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crm-avatar-client { width: 20px; height: 20px; font-size: 0.56rem; }
.crm-avatar-agent { width: 24px; height: 24px; font-size: 0.62rem; box-shadow: 0 0 0 2px var(--color-white); }
.crm-card-owner { display: inline-flex; }
.crm-card-contact > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Amount + days in the stage on one line. */
.crm-card-money { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crm-age { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: rgba(47, 59, 52, 0.08); color: var(--color-text-muted); font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.crm-age svg { width: 11px; height: 11px; }
.crm-age.is-warn { background: #fbe8cc; color: #7a4300; }
.crm-age.is-late { background: #f9dcd8; color: #9a1f17; }
:root[data-theme="dark"] .crm-age { background: rgba(236, 230, 214, 0.1); }
:root[data-theme="dark"] .crm-age.is-warn { background: rgba(240, 160, 60, 0.18); color: #ffc078; }
:root[data-theme="dark"] .crm-age.is-late { background: rgba(255, 110, 100, 0.18); color: #ff9a90; }

/* The next step: one thin line at the very bottom — short text left, button right. */
.crm-card .ws-next.crm-next { flex-wrap: nowrap; justify-content: space-between; gap: 10px; margin: 4px 0 0; padding: 9px 0 0; border: 0; border-top: 1px solid var(--color-border); border-radius: 0; background: none; font-size: 0.76rem; }
.crm-card .crm-next .ws-next-text { flex: 1 1 auto; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; color: var(--color-text-muted); font-weight: 600; }
.crm-card .crm-next.is-urgent .ws-next-text { color: #9a1f17; }
.crm-card .crm-next.is-urgent .ws-next-text::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #c4473a; vertical-align: 1px; }
:root[data-theme="dark"] .crm-card .crm-next.is-urgent .ws-next-text { color: #ff9a90; }
.crm-card .crm-next .ws-next-go { flex: none; width: 30px; min-height: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }
.crm-card .crm-next .ws-next-go svg { width: 14px; height: 14px; }
.crm-card .crm-next .crm-next-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Compact view: title, amount and health only. */
#crm-board.is-compact .crm-card-extra,
#crm-board.is-compact .crm-age { display: none; }
#crm-board.is-compact .crm-card { padding-top: 8px; padding-bottom: 8px; gap: 2px; }
#crm-board.is-compact .crm-card-title { font-size: 0.86rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
#crm-board.is-compact .crm-card-top { align-items: center; }
#crm-board.is-compact .ws-health { transform: scale(0.72); transform-origin: center right; margin: -6px 0; }
#crm-board.is-compact .crm-card-revenue { font-size: 0.9rem; }
.crm-compact-btn.is-on { background: var(--color-ink); color: var(--color-white); }

/* Key figures in the pipeline bar. */
.crm-kpis { display: flex; align-items: stretch; gap: 2px; min-width: 0; }
.crm-kpis[hidden] { display: none; }
.crm-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 4px 7px; border: 0; border-left: 1px solid var(--ui-hairline); border-radius: 0; background: transparent; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; white-space: nowrap; transition: background 140ms; }
.crm-kpi:first-child { border-left: 0; }
.crm-kpi span { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted); }
.crm-kpi strong { font-size: 0.95rem; font-weight: 700; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.crm-kpi:hover { background: rgba(47, 59, 52, 0.06); border-radius: 10px; }
.crm-kpi.is-active { background: rgba(201, 162, 39, 0.16); border-radius: 10px; }
.crm-kpi[data-kpi="risk"] strong { color: #9a1f17; }
.crm-kpi[data-kpi="strong"] strong { color: #1f6b45; }
.crm-kpi[data-kpi="steady"] strong { color: #7a5f0c; }
:root[data-theme="dark"] .crm-kpi[data-kpi="strong"] strong { color: #7fd6a6; }
:root[data-theme="dark"] .crm-kpi[data-kpi="steady"] strong { color: var(--color-gold-soft); }
:root[data-theme="dark"] .crm-kpi[data-kpi="risk"] strong { color: #ff9a90; }
.crm-kpi:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; border-radius: 10px; }
.crm-kpi[hidden] { display: none; }
@media (max-width: 760px) { .crm-kpis { display: none; } }
.crm-currency-label.is-squeezed { display: none; }
/* CRM bar with key figures: one line on desktop — the left side (pipeline + figures) shrinks and
   crm-admin.js's fitKpis hides figures that would be cut off. */
@media (min-width: 761px) {
  .ui-toolbar.has-kpis { flex-wrap: nowrap; }
  /* No overflow:hidden here — it would clip the Pipeline dropdown menu that opens from this side. */
  .ui-toolbar.has-kpis > .ui-toolbar-start { flex: 1 1 auto; min-width: 0; }
  .ui-toolbar.has-kpis > .ui-toolbar-end { flex: none; }
  .ui-toolbar.has-kpis .crm-kpis { flex: none; }
}

/* ---------- Manage pipelines: inline "new stage / new pipeline" field (no browser prompt). */
.crm-inline-new {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  animation: crm-inline-in 180ms ease-out;
}
.crm-inline-new.is-big { margin: 0 0 var(--space-3); padding: var(--space-3); }
.crm-inline-new input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); color: var(--color-text); font: inherit; }
.crm-inline-new.is-big input { font-family: var(--font-display); font-size: 1.05rem; }
.crm-inline-new input:focus { outline: none; border-color: var(--color-gold); }
.crm-inline-ok, .crm-inline-cancel { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.crm-inline-ok { background: var(--color-ink); color: var(--color-white); }
.crm-inline-ok:hover { filter: brightness(1.15); }
.crm-inline-cancel { background: transparent; color: var(--color-text-muted); }
.crm-inline-cancel:hover { background: var(--color-cream-dim); color: var(--color-ink); }
.crm-inline-ok svg, .crm-inline-cancel svg { width: 16px; height: 16px; }
.crm-inline-ok:focus-visible, .crm-inline-cancel:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.crm-inline-hint { flex-basis: 100%; padding: 0 2px; font-size: 0.74rem; color: var(--color-text-muted); }
.crm-inline-new.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity 140ms, transform 140ms; }
.crm-inline-new.is-shake { animation: crm-inline-shake 280ms; }
.crm-stage-manage-row.is-new, .crm-pipeline-manage-item.is-new { animation: crm-new-glow 1.6s ease-out; }
@keyframes crm-inline-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes crm-inline-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes crm-new-glow { 0% { background: rgba(201, 162, 39, 0.35); } 100% { background: transparent; } }
.crm-pipeline-manage-item.is-new { animation-name: crm-new-glow-card; }
@keyframes crm-new-glow-card { 0% { box-shadow: 0 0 0 3px var(--color-gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
:root[data-theme="dark"] .crm-inline-new, :root[data-theme="dark"] .crm-inline-new input { background: #1f2622; }
@media (prefers-reduced-motion: reduce) { .crm-inline-new, .crm-inline-new.is-shake, .crm-stage-manage-row.is-new, .crm-pipeline-manage-item.is-new { animation: none; } }

/* ---------- "Which properties will you show?" (moving a deal to En muestra) */
.showing-props-card { max-width: 560px; width: min(560px, calc(100vw - 32px)); text-align: left; }
.showing-props-card .closing-property-confirm { margin: var(--space-3) 0 0; }
.showing-props-search { margin-top: var(--space-3); }
.showing-props-picked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--space-3); }
.showing-props-picked[hidden] { display: none; }
.showing-props-picked-label { flex-basis: 100%; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.showing-props-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--color-ink); color: var(--color-white); font-size: 0.8rem; animation: crm-inline-in 160ms ease-out; }
.showing-props-chip b { padding: 1px 6px; border-radius: 999px; background: var(--color-gold); color: var(--color-ink); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; }
.showing-props-chip button { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.showing-props-chip button:hover { background: rgba(255, 255, 255, 0.2); }
.showing-props-chip button svg { width: 11px; height: 11px; }
.showing-props-results { max-height: min(320px, 40vh); overflow-y: auto; margin-top: 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); }
.showing-props-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-top: 1px solid var(--color-border); background: transparent; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; transition: background 120ms; }
.showing-props-row:first-child { border-top: 0; }
.showing-props-row:hover { background: rgba(201, 162, 39, 0.1); }
.showing-props-row.is-on { background: rgba(201, 162, 39, 0.16); }
.showing-props-row:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -2px; }
.showing-props-check { flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--color-border); border-radius: 6px; background: var(--color-white); color: var(--color-white); }
.showing-props-row.is-on .showing-props-check { border-color: var(--color-ink); background: var(--color-ink); }
.showing-props-check svg { width: 13px; height: 13px; }
.showing-props-row img { flex: none; width: 44px; height: 34px; border-radius: 6px; object-fit: cover; }
.showing-props-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.showing-props-info strong { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.showing-props-info span { font-size: 0.74rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.showing-props-price { flex: none; font-size: 0.8rem; font-weight: 700; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.showing-props-empty { margin: 0; padding: 14px; font-size: 0.85rem; color: var(--color-text-muted); }
:root[data-theme="dark"] .showing-props-results, :root[data-theme="dark"] .showing-props-check { background: #1f2622; }
.showing-props-card .confirm-modal-actions { margin-top: var(--space-3); }
.showing-props-card .form-error:empty { display: none; }

/* Closing form: estimated taxes under the country's fiscal rules (country pack → fiscal). */
.closing-fiscal { margin: var(--space-3) 0 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-cream-dim); text-align: left; }
.closing-fiscal[hidden] { display: none; }
.closing-fiscal-title { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.closing-fiscal ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.closing-fiscal li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.86rem; }
.closing-fiscal li small { display: block; color: var(--color-text-muted); font-size: 0.74rem; }
.closing-fiscal li strong { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--color-ink); }
.closing-fiscal-note { margin: 8px 0 0; font-size: 0.74rem; color: var(--color-text-muted); }
/* Public site country selector (fills itself from the countries open to the public). */
/* Same look as the ES/EN switch beside it: a light pill on the dark header. Compact (flag +
   country code); the full name is in its tooltip and in the list. */
.country-switch-select { height: 32px; padding: 0 22px 0 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23f4f1e8' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center; color: #f4f1e8; font: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; appearance: none; -webkit-appearance: none; }
.country-switch-select:hover { border-color: rgba(255, 255, 255, 0.55); }
/* The flag image sits inside the pill, left of the code (see rcFlagHTML in app.js). */
.country-switch.has-flag, .country-switch-item.has-flag { position: relative; }
.has-flag > .rc-flag { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.has-flag > .country-switch-select { padding-left: 36px; }
.country-switch-item.has-flag > .rc-flag { top: calc(50% + var(--space-2) / 2); }
.rc-flag { display: inline-block; width: 20px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); vertical-align: middle; object-fit: cover; }
.country-switch-select:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.country-switch-select option { color: #29342e; background: #fff; }
/* The country selector shares the header: keep "REAL ESTATE · COSTA RICA" on one line. */
.site-header .brand { flex: none; }
.site-header .brand-sub { white-space: nowrap; }

/* Agent articles (admin/articles.html, js/articles-admin.js). */
.articles-admin { padding-bottom: 48px; }
.art-head h1 { margin: 0 0 6px; }
.art-why { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--color-gold); border-radius: 14px; background: rgba(201, 162, 39, 0.07); }
.art-why summary { font-weight: 700; cursor: pointer; }
.art-why ul { margin: 10px 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.art-section { margin-top: 28px; }
.art-section h2 { display: flex; align-items: center; gap: 8px; }
.art-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; }
.art-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.art-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--ui-hairline, var(--color-border)); border-radius: 12px; background: var(--color-white); }
.art-row > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 280px; }
.art-row span { font-size: 0.84rem; color: var(--color-text-muted); }
.art-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.art-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; background: rgba(47, 59, 52, 0.08); color: var(--color-ink); }
.art-badge.is-gold { background: rgba(201, 162, 39, 0.18); }
.art-badge.is-warn { background: rgba(229, 72, 77, 0.14); color: #b3261e; }
.art-badge.is-ok { background: rgba(31, 122, 77, 0.14); color: #1f7a4d; }
.art-note { display: block; padding: 8px 10px; border-radius: 8px; background: rgba(229, 72, 77, 0.08); color: var(--color-text); font-size: 0.86rem; }
.art-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; margin: 12px 0; }
.art-grid label, .art-field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.86rem; margin-bottom: 10px; }
.art-field input, .art-field textarea, .art-grid select { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-white); color: var(--color-text); }
.art-field textarea { line-height: 1.55; }
.art-preview { padding: 18px 22px; border: 1px dashed var(--color-border); border-radius: 14px; background: var(--color-white); line-height: 1.65; }
/* Article photos: permission box, cover photo, insert button, drop target, preview figures */
.art-photos { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.art-rights { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--color-cream); font-size: 0.85rem; line-height: 1.45; cursor: pointer; }
.art-rights input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; accent-color: var(--color-ink); }
.art-cover { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 14px; align-items: start; }
.art-cover > img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: var(--color-cream-dim); }
.art-cover-fields { display: flex; flex-direction: column; gap: 8px; font-size: 0.86rem; }
.art-cover-fields label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.art-cover-fields input { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-white); color: var(--color-text); }
.art-cover-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; border: 1.5px dashed var(--color-border); border-radius: 14px; background: transparent; color: var(--color-text); font: inherit; text-align: center; cursor: pointer; }
.art-cover-empty:hover, .art-cover-empty:focus-visible { border-color: var(--color-gold); background: var(--color-cream); }
.art-cover-empty svg { width: 26px; height: 26px; color: var(--color-gold); }
.art-cover-empty span { max-width: 460px; font-size: 0.82rem; color: var(--color-text-muted); }
.art-body-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.art-body-head .btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.art-body-head .btn svg { width: 15px; height: 15px; }
.art-field textarea.is-drop { border-color: var(--color-gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-gold) 30%, transparent); }
.art-preview .article-figure { margin: 16px 0; }
.art-preview .article-figure img { display: block; width: 100%; max-width: 640px; height: auto; border-radius: 12px; }
.art-preview figcaption { margin-top: 4px; font-size: 0.78rem; color: var(--color-text-muted); }
.art-preview .art-missing-alt { color: var(--color-error); font-weight: 600; }
@media (max-width: 640px) { .art-cover { grid-template-columns: 1fr; } }
.art-preview h1 { font-size: 1.5rem; margin-top: 0; }

/* Phones: the header keeps logo · language · account · ☰; the country selector moves into the
   ☰ menu and the "REAL ESTATE · COSTA RICA" line is dropped so nothing runs off the screen. */
.country-switch-item { display: none; }
@media (max-width: 640px) {
  .site-header .nav { padding: 10px 14px; gap: 8px; }
  .site-header .brand-sub { display: none; }
  .site-header .nav-actions { gap: 8px; }
  .site-header .nav-actions > .country-switch { display: none; }
  .site-header .nav-links .country-switch-item { display: block; padding-top: var(--space-2); }
  .site-header .lang-btn { padding: 6px 9px; min-height: 32px; }
  .site-header .brand { gap: 6px; }
  .site-header .brand-mark { width: 28px; height: 28px; }
  .site-header .brand-name { font-size: 1.05rem; letter-spacing: -0.01em; }
  .site-header .nav-actions { gap: 6px; }
}
/* No room to the right (app.js placeVerifiedTip): the tooltip opens below the star, or above it
   when a card would cut it off below, centred on the star and slid by --tip-shift to fit. */
.verified-badge--tip-below .verified-badge-tip,
.verified-badge--tip-up .verified-badge-tip {
  left: 50%;
  max-width: calc(100vw - 32px);
  transform: translateX(calc(-50% + var(--tip-shift, 0px))) translateY(var(--tip-slide, 4px));
}
.verified-badge--tip-below .verified-badge-tip { top: calc(100% + 9px); bottom: auto; --tip-slide: -4px; }
.verified-badge--tip-up .verified-badge-tip { top: auto; bottom: calc(100% + 9px); }
.verified-badge--tip-below:hover .verified-badge-tip,
.verified-badge--tip-below:focus-visible .verified-badge-tip,
.verified-badge--tip-up:hover .verified-badge-tip,
.verified-badge--tip-up:focus-visible .verified-badge-tip { --tip-slide: 0px; transform: translateX(calc(-50% + var(--tip-shift, 0px))) translateY(0); }
.verified-badge--tip-below .verified-badge-tip::after,
.verified-badge--tip-up .verified-badge-tip::after {
  right: auto;
  left: calc(50% - var(--tip-shift, 0px));
  transform: translateX(-50%);
  border-right-color: transparent;
}
.verified-badge--tip-below .verified-badge-tip::after { top: auto; bottom: 100%; border-bottom-color: var(--color-ink); }
.verified-badge--tip-up .verified-badge-tip::after { top: 100%; border-top-color: var(--color-ink); }
/* Phones: 260px rarely fits beside the star, so the tooltip is a bit narrower there. */
@media (max-width: 640px) {
  .verified-badge-tip { width: 240px; }
}

/* Listing form: the line under the video / 3D tour link saying whether the link was recognised
   (admin.js checkTourLink). */
.tour-link-status {
  margin: 6px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}
.tour-link-status svg {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: -2px;
}
.tour-link-status.is-ok {
  color: var(--color-success);
}
.tour-link-status.is-bad {
  color: var(--color-error);
}
.tour-link-status a {
  margin-left: 4px;
  color: inherit;
  font-weight: 600;
}
/* A link we recognise but cannot put in a frame (Insta360 refuses to be framed): the listing
   opens it at the provider instead, and the agent is told here rather than finding out from
   their own listing. It is a note, not a failure, so it keeps its own muted colour. */
.tour-link-note {
  display: block;
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.closing-service { border: 0; padding: 0; margin: 0 0 12px; }
.closing-service legend { font-weight: 600; margin-bottom: 6px; }
.closing-service label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-weight: 400; }
.closing-service input { width: auto; min-height: auto; }

/* CRM deal › Offers tab: one card per offer round, newest first. */
.badge-danger {
  background: color-mix(in srgb, var(--color-error) 14%, transparent);
  color: var(--color-error);
}
.ld-offers-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.ld-offer {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
}
.ld-offer.is-accepted { border-color: var(--color-success); }
.ld-offer.is-withdrawn { opacity: 0.75; }
.ld-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.ld-offer-amount {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 4px 0 2px;
}
.ld-offer-property,
.ld-offer-notes,
.ld-offer-response,
.ld-offer-meta {
  margin: 2px 0;
  font-size: 0.88rem;
}
.ld-offer-notes { white-space: pre-line; }
.ld-offer-meta { color: var(--color-text-muted); font-size: 0.8rem; }
.ld-offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.ld-offer-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.ld-offer-actions .btn svg { width: 16px; height: 16px; }

.ld-offer-suggest {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-gold) 14%, transparent);
  font-size: 0.86rem;
}
.ld-offer-suggest svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }

/* Offer box: one row per property the buyer can offer on (tick + amount + currency). */
.offer-modal-props { border: 0; padding: 0; margin: 0 0 var(--space-3); min-width: 0; }
.offer-modal-props legend { font-weight: 600; font-size: 0.9rem; margin-bottom: var(--space-2); padding: 0; }
.offer-modal-rows { display: grid; gap: var(--space-2); max-height: 240px; overflow-y: auto; }
/* Several property rows can make the box taller than the screen: it scrolls inside instead. */
.offer-modal-card { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.offer-modal-row {
  display: grid;
  gap: 6px;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: left;
}
.offer-modal-props .offer-modal-check { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.88rem; cursor: pointer; }
.offer-modal-props .offer-modal-check input { width: auto; flex: 0 0 auto; margin: 0; }
.offer-modal-amounts { display: flex; gap: 8px; }
.offer-modal-amounts input { flex: 1; min-width: 0; }
.offer-modal-amounts select { flex: 0 0 90px; }

/* Brokerage positioning line above the broker sign-up title (pitch.tagline). */
.pitch-eyebrow { margin: 0 0 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-gold-dark, #7a5c00); }

/* Users › Edit › Reset Password: the box and its button share a line; the live checklist
   (password-rules.js puts it right after the box) takes the full width underneath. */
.password-reset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}
.password-reset-row > input {
  flex: 1 1 9rem;
  min-width: 0;
}
.password-reset-row > .btn {
  flex: 0 0 auto;
}
.password-reset-row > .pw-checklist {
  order: 3;
  flex: 1 0 100%;
  min-width: 0;
  margin: 0;
}

/* Settings › Access Rights: which matrix is being edited (own brokerage or platform defaults). */
.access-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}
.access-scope label { font-weight: 600; }
.access-scope label { flex: 0 0 auto; margin: 0; }
.field.access-scope select { flex: 1 1 16rem; min-width: 0; width: auto; max-width: 100%; text-overflow: ellipsis; }
.access-scope-note { color: var(--color-text-muted); margin: 0 0 var(--space-4); }
.access-scope-note:empty { display: none; }
/* Access groups (Básico, Agente de Ventas, Corredor): one card per plan above the matrix. */
.access-groups { margin: 0 0 var(--space-4); min-width: 0; }
.access-groups h2 { font-size: 1.05rem; margin: 0 0 4px; }
.access-groups-lead { margin: 0 0 var(--space-3); color: var(--color-text-muted); max-width: 80ch; }
.access-groups-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-3); }
.access-group-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-white); }
.access-group-card h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.access-group-who { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.access-group-card ul { margin: 0; padding-left: 1.1em; display: grid; gap: 3px; font-size: 0.88rem; }
.access-group-card li { overflow-wrap: anywhere; }
.access-groups-more { margin: var(--space-2) 0 0; font-size: 0.88rem; }
:root[data-theme="dark"] .access-group-card { background: #1f2622; }
.access-head-groups th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); text-align: center; }
.access-head-groups th.is-groups { border-bottom: 2px solid var(--color-gold, #c9a227); }
.access-cell { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }

/* The upgrade pop-up a plan-locked module shows (profile.js showUpgradePrompt). */
/* Above the phone bottom bar (z-index 2000) and its toasts, clear of the notch and home indicator. */
.plan-upgrade-overlay {
  z-index: 2200;
  padding: max(var(--space-3), env(safe-area-inset-top)) max(var(--space-3), env(safe-area-inset-right)) max(var(--space-3), env(safe-area-inset-bottom)) max(var(--space-3), env(safe-area-inset-left));
}
/* The buttons stay in view while the text scrolls. */
.plan-upgrade-card .confirm-modal-actions {
  position: sticky;
  bottom: calc(-1 * var(--space-5));
  background: var(--color-white);
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  padding: var(--space-3) var(--space-5) var(--space-5);
}
@media (max-width: 480px) {
  /* Phones: the upgrade button first, both full width. */
  .plan-upgrade-card .confirm-modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .plan-upgrade-card .confirm-modal-icon { display: none; }
  .plan-upgrade-perks { font-size: 0.92rem; }
}
.plan-upgrade-card { max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
.plan-upgrade-perks {
  text-align: left;
  margin: 0 0 var(--space-3);
  padding-left: 1.2em;
  color: var(--color-ink);
  line-height: 1.5;
}
.plan-upgrade-perks li + li { margin-top: 4px; }
/* Why a locked feature is worth it (profile.js planWhyHTML), above the plans. */
.plan-why {
  text-align: left;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-gold) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-gold) 40%, transparent);
}
.plan-why h3 { margin: 0 0 6px; font-size: 1rem; }
.plan-why-list { margin: 0; padding-left: 1.1em; font-size: 0.9rem; }
.plan-why-list li { overflow-wrap: anywhere; }
.plan-why-list li + li { margin-top: 6px; }
.plan-why-note { margin: 8px 0 0; font-size: 0.85rem; color: var(--color-text-muted); }
/* One block per plan: Agente, then Corredor. */
.plan-offer { text-align: left; border: 1px solid var(--color-border); border-radius: var(--radius-md, 10px); padding: var(--space-3); margin: 0 0 var(--space-3); min-width: 0; }
.plan-offer h3 { font-size: 1rem; margin: 0 0 2px; }
.confirm-modal-card .plan-offer p { margin: 0 0 var(--space-2); }
.confirm-modal-card .plan-offer p.plan-offer-lead { color: var(--color-text-muted); }
.plan-offer .plan-upgrade-perks { margin-bottom: 0; }
.plan-offer-broker .btn { margin-top: var(--space-3); width: 100%; white-space: normal; }
.confirm-modal-card p.plan-upgrade-price { color: var(--color-ink); font-weight: 600; }
.confirm-modal-card p.plan-upgrade-error:empty { display: none; }
.plan-upgrade-card .confirm-modal-actions { flex-wrap: wrap; }
.plan-upgrade-card .confirm-modal-actions .btn { min-width: 0; }

/* Rows per page under every DataTable (data-table.js): range, size picker and page arrows. Wraps on
   narrow screens; "Todas" shows every row so the whole result fits one page. */
.dt-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; min-width: 0; margin: var(--space-2, 8px) 0 var(--space-3, 12px); font-size: 0.88rem; color: var(--color-text-muted); }
.dt-pager[hidden] { display: none; }
.dt-pager-range { min-width: 0; margin-right: auto; }
.dt-pager-size { display: inline-flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-weight: 500; }
.dt-pager-size select { width: auto; min-width: 0; min-height: 36px; padding: 4px 28px 4px 10px; }
.dt-pager-nav { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.dt-pager-nav .btn { min-width: 36px; min-height: 36px; padding: 0 10px; font-size: 1.1rem; line-height: 1; }
.dt-pager-pages { white-space: nowrap; }

/* Property form: the Videos box holds several links (comma-separated or one per line). */
textarea.f-video-url { min-height: 0; height: auto; resize: vertical; overflow-wrap: anywhere; }

/* ── My Profile (my-profile.html): section cards + a sticky card with photo, QR and link ── */
.mp-container { max-width: 1100px; }
.mp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  gap: var(--space-5, 24px);
  align-items: start;
}
.mp-sections { display: flex; flex-direction: column; gap: var(--space-4, 16px); min-width: 0; }
.mp-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.mp-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}
.mp-card-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--font-display); color: var(--color-ink); }
.mp-card-body { padding: 16px 20px 20px; }
.mp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 4px 20px;
}
.mp-grid .field { max-width: none; min-width: 0; margin-bottom: 12px; }
.mp-grid .field[hidden] { display: none; }

.mp-required-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-4, 16px);
  padding: 10px 14px;
  border: 1px solid var(--color-error);
  border-radius: var(--radius-sm);
  background: #fdf1f0;
  color: var(--color-error);
  font-weight: 600;
}
.mp-required-note[hidden] { display: none; }
.mp-required-note > span:last-child { min-width: 0; }
#mp-location-card [aria-invalid="true"] { border-color: var(--color-error); box-shadow: 0 0 0 1px var(--color-error); }
.mp-icon { display: inline-flex; align-items: center; }
.mp-icon svg { width: 16px; height: 16px; }

.mp-side { position: sticky; top: 16px; min-width: 0; }
.mp-id-card { padding: 24px 20px; text-align: center; }
.mp-avatar-wrap { position: relative; width: 112px; margin: 0 auto 12px; }
.mp-avatar {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-cream);
  border: 3px solid var(--color-white);
  box-shadow: 0 0 0 1px var(--color-border);
}
.mp-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-avatar-btn {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-white);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}
.mp-avatar-btn:focus-within, .mp-avatar-btn:hover { background: var(--color-ink-soft); }
.mp-avatar-wrap:focus-within .mp-avatar-btn { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.mp-id-name { margin: 0; font-family: var(--font-display); font-size: 1.2rem; color: var(--color-ink); overflow-wrap: anywhere; }
.mp-id-line { margin: 2px 0 0; color: var(--color-text-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.mp-id-line:empty { display: none; }
.mp-public { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--color-border); text-align: left; }
.mp-public h3 { margin: 0 0 2px; font-size: 1rem; color: var(--color-ink); }
.mp-public[hidden] { display: none; }
.mp-qr {
  margin: 10px auto 6px;
  padding: 12px;
  width: fit-content;
  max-width: 100%;
  border: 3px solid var(--color-ink);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.mp-qr img { display: block; width: 200px; max-width: 100%; height: auto; aspect-ratio: 1; }
.mp-qr-download { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 0.85rem; margin-bottom: 14px; }
.mp-link-label { display: block; font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 4px; }
.mp-link-row { display: flex; gap: 6px; min-width: 0; }
.mp-link-row input { flex: 1 1 auto; min-width: 0; font-size: 0.85rem; text-overflow: ellipsis; }
.mp-link-row .btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; }
.mp-view-link { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 10px; width: 100%; }

@media (max-width: 860px) {
  .mp-layout { grid-template-columns: minmax(0, 1fr); }
  /* On a phone the identity card (photo + QR) comes first, then the sections. */
  .mp-side { position: static; order: -1; }
}

.mp-span-all { grid-column: 1 / -1; }
.mp-span-all[hidden] { display: none; }
.mp-card input[readonly] { background: var(--color-cream); color: var(--color-text); cursor: default; }
.mp-logo-field { grid-column: 1 / -1; }
.mp-field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--color-ink); }
.mp-logo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 270px;
  aspect-ratio: 25 / 9;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-cream);
}
.mp-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mp-logo-box img[hidden], .mp-logo-empty[hidden] { display: none; }
.mp-logo-empty { color: var(--color-text-muted); font-weight: 700; font-size: 1.05rem; text-align: center; }
.mp-logo-actions { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mp-logo-actions .btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.mp-logo-actions .btn[hidden] { display: none; }
.mp-logo-field:focus-within .mp-logo-actions label { outline: 2px solid var(--color-gold); outline-offset: 2px; }

/* "Ubicar por" (Coordenadas / Dirección) on the property form: the fields of the other mode stay
   visible but read-only, so the agent always sees what was filled in. */
.locate-address-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
}
.locate-address-row .hint { min-width: 0; flex: 1 1 12rem; }
#property-form input[readonly],
#property-form select:disabled {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
  cursor: not-allowed;
}
#admin-pick-map.is-locked { cursor: default; }

/* The selling point on the sign-up pages: addresses the way they are given here, in every plan. */
.address-perk {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: var(--radius-sm);
  background: var(--color-cream-dim);
}
.address-perk-icon { flex: 0 0 auto; color: var(--color-gold); width: 22px; height: 22px; }
.address-perk-icon svg { width: 100%; height: 100%; }
.address-perk-text { min-width: 0; }
.address-perk-text strong { display: block; margin-bottom: 2px; }
.address-perk-text p { margin: 0; font-size: 0.88rem; line-height: 1.45; color: var(--color-text-muted); overflow-wrap: anywhere; }
/* "Ubicar por" sits between the map and Latitude / Longitude. */
.locate-by-field { margin: 10px 0 0; }
.locate-by-field .hint { margin: 4px 0 0; }

/* ── Import progress (public/js/import-progress.js) ─────────────────────────────────────────── */
.ip-card {
  --ip-track: rgba(47, 59, 52, 0.08);
  --ip-from: #1f7a4d;
  --ip-to: var(--color-gold);
  --ip-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 244, 236, 0.96));
  position: relative;
  margin: var(--space-3) 0;
  padding: var(--space-4);
  border-radius: 20px;
  background: var(--ip-surface);
  border: 1px solid rgba(201, 162, 39, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 18px 40px -18px rgba(31, 122, 77, 0.35);
  overflow: hidden;
  min-width: 0;
}
.ip-card::before {
  content: '';
  position: absolute;
  inset: -40% -10% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.16), transparent 65%);
  pointer-events: none;
}
.ip-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); min-width: 0; }
.ip-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ip-title { font-weight: 600; font-size: 1rem; color: var(--color-text); overflow-wrap: anywhere; }
.ip-pulse {
  flex: 0 0 auto;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ip-from);
  box-shadow: 0 0 0 0 rgba(31, 122, 77, 0.5);
  animation: ip-pulse 1.6s ease-out infinite;
}
.ip-percent { display: inline-flex; align-items: baseline; font-variant-numeric: tabular-nums; line-height: 1; color: var(--color-ink); }
.ip-percent-num { font-size: clamp(2rem, 6vw, 2.75rem); font-weight: 700; letter-spacing: -0.03em; }
.ip-percent-sign { font-size: 1rem; font-weight: 600; margin-left: 2px; color: var(--color-text-muted); }
.ip-bar {
  position: relative;
  height: 12px;
  margin: var(--space-3) 0 var(--space-4);
  border-radius: 999px;
  background: var(--ip-track);
  box-shadow: inset 0 1px 2px rgba(47, 59, 52, 0.12);
  overflow: hidden;
}
.ip-bar-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ip-from), #3c9a63 55%, var(--ip-to));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.ip-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.45) 45%, transparent 70%);
  background-size: 220% 100%;
  animation: ip-shimmer 1.8s ease-in-out infinite;
}
.ip-bar-glow {
  position: absolute; right: -6px; top: 50%;
  width: 18px; height: 18px; border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle, rgba(228, 199, 101, 0.95), rgba(228, 199, 101, 0) 70%);
}
.ip-steps {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 10px;
}
.ip-step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(47, 59, 52, 0.05);
  color: var(--color-text-muted);
  font-size: 0.85rem; font-weight: 500;
  transition: background 0.3s, color 0.3s;
  min-width: 0;
}
.ip-step-dot {
  position: relative;
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.ip-step-check { display: none; width: 14px; height: 14px; }
.ip-step-check svg { width: 14px; height: 14px; }
.ip-step.is-active { background: rgba(201, 162, 39, 0.16); color: var(--color-ink); }
.ip-step.is-active .ip-step-dot { border-color: var(--color-gold); box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.2); }
.ip-step.is-done { background: rgba(31, 122, 77, 0.1); color: var(--color-success); }
.ip-step.is-done .ip-step-dot { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.ip-step.is-done .ip-step-num { display: none; }
.ip-step.is-done .ip-step-check { display: inline-grid; place-items: center; }
.ip-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
  margin-top: var(--space-3);
  font-size: 0.875rem; color: var(--color-text-muted);
}
.ip-detail { min-width: 0; overflow-wrap: anywhere; }
.ip-eta { font-variant-numeric: tabular-nums; }
.ip-safe {
  display: flex; align-items: flex-start; gap: 8px;
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px dashed rgba(47, 59, 52, 0.15);
  font-size: 0.8rem; color: var(--color-text-muted);
}
.ip-safe svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--color-success); margin-top: 1px; }
.ip-card[data-state="done"] .ip-pulse { animation: none; background: var(--color-success); }
.ip-card[data-state="done"] .ip-bar-fill { background: linear-gradient(90deg, var(--ip-from), #2f9a62); }
.ip-card[data-state="done"] .ip-bar-fill::after { animation: none; opacity: 0; }
.ip-card[data-state="done"] .ip-percent { color: var(--color-success); }
.ip-card[data-state="cancelling"] .ip-bar-fill,
.ip-card[data-state="cancelled"] .ip-bar-fill { background: linear-gradient(90deg, #8a8f87, #b5b8ae); }
.ip-card[data-state="cancelled"] .ip-pulse,
.ip-card[data-state="cancelling"] .ip-pulse { background: #8a8f87; animation: none; }
.ip-card[data-state="cancelled"] .ip-bar-fill::after,
.ip-card[data-state="cancelling"] .ip-bar-fill::after,
.ip-card[data-state="failed"] .ip-bar-fill::after { animation: none; opacity: 0; }
.ip-card[data-state="failed"] .ip-bar-fill { background: linear-gradient(90deg, #b3261e, #d65a50); }
.ip-card[data-state="failed"] .ip-pulse { background: var(--color-error); animation: none; }
.ip-card[data-state="failed"] .ip-percent { color: var(--color-error); }
@keyframes ip-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes ip-pulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 122, 77, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(31, 122, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 122, 77, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ip-bar-fill, .ip-bar-fill::after, .ip-pulse { animation: none; }
  .ip-bar-fill { transition: none; }
}
:root[data-theme="dark"] .ip-card {
  --ip-track: rgba(236, 230, 214, 0.1);
  --ip-surface: linear-gradient(180deg, rgba(36, 44, 39, 0.96), rgba(29, 36, 32, 0.96));
  border-color: rgba(228, 199, 101, 0.25);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark"] .ip-percent { color: #f1ede2; }
:root[data-theme="dark"] .ip-title { color: #f1ede2; }
:root[data-theme="dark"] .ip-step { background: rgba(236, 230, 214, 0.06); }
:root[data-theme="dark"] .ip-step-dot { background: #1f2622; }
:root[data-theme="dark"] .ip-step.is-active { color: #f1ede2; }
.import-modal-running .import-modal-setup { display: none; }

/* ---- Send a property (property-share.js) ----------------------------------------------------
   Row button: the paper plane sits beside the ⋯ menu. The pop-up is a centered card on wide
   screens and a bottom sheet on phones; the preview scrolls inside it, the footer stays put. */
.row-icon-actions { display: flex; align-items: center; justify-content: center; gap: 2px; }
.row-icon-actions .row-menu-btn { margin: 0; }
.row-send-btn { color: var(--color-gold); }
/* "Ver en el sitio" (the globe), next to Send at the end of a Propiedades row. */
.row-web-btn { color: var(--color-gold); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.row-web-btn:hover { color: var(--color-ink); }
.row-send-btn:hover { color: var(--color-ink); }

body.ps-open { overflow: hidden; }
.ps-overlay {
  position: fixed;
  inset: 0;
  /* Above the phone app's bottom tab bar (.ws-bottom-nav, 900) so the sheet's button is never hidden. */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(var(--space-3), env(safe-area-inset-top)) max(var(--space-3), env(safe-area-inset-right)) max(var(--space-3), env(safe-area-inset-bottom)) max(var(--space-3), env(safe-area-inset-left));
  background: rgba(20, 24, 21, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  animation: ps-fade 160ms ease-out;
}
.ps-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  min-width: 0;
  background: color-mix(in srgb, var(--color-white) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(20, 28, 23, 0.28), 0 2px 6px rgba(20, 28, 23, 0.08);
  overflow: hidden;
  animation: ps-rise 220ms cubic-bezier(0.2, 0.9, 0.25, 1);
}
.ps-grabber { display: none; }
.ps-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 8px 20px;
}
.ps-head-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-soft));
  color: var(--color-ink);
}
.ps-head-icon svg { width: 18px; height: 18px; }
.ps-heading {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.ps-lang {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--color-cream-dim);
}
.ps-lang button {
  min-width: 38px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
}
.ps-lang button[aria-pressed="true"] { background: var(--color-white); color: var(--color-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.ps-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.ps-close:hover { background: var(--color-cream-dim); color: var(--color-ink); }
.ps-close svg { width: 18px; height: 18px; }
.ps-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 4px 20px 14px;
}
.ps-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--color-cream-dim);
}
.ps-thumb--empty { display: inline-flex; align-items: center; justify-content: center; color: var(--color-gold); }
.ps-thumb--empty svg { width: 26px; height: 26px; }
.ps-hero-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ps-hero-text h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.ps-ref {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-cream-dim);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.ps-channels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 14px;
}
.ps-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-white);
  font: inherit;
  text-align: left;
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.ps-channel:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }
.ps-channel:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.ps-channel[aria-selected="true"] { border-color: var(--ps-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ps-accent) 18%, transparent); }
.ps-channel--whatsapp { --ps-accent: #25d366; }
.ps-channel--email { --ps-accent: #3b82f6; }
.ps-channel--copy { --ps-accent: var(--color-gold); }
.ps-channel-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ps-accent) 14%, transparent);
  color: var(--ps-accent);
}
.ps-channel--copy .ps-channel-icon { color: var(--color-ink); }
.ps-channel-icon svg { width: 20px; height: 20px; }
.ps-channel-text { min-width: 0; display: flex; flex-direction: column; }
.ps-channel-text strong { font-size: 0.9rem; font-weight: 650; overflow-wrap: anywhere; }
.ps-channel-text small { font-size: 0.74rem; color: var(--color-text-muted); line-height: 1.3; overflow-wrap: anywhere; }
.ps-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ps-recipient { display: flex; flex-direction: column; gap: 4px; }
.ps-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps-field > span { font-size: 0.8rem; font-weight: 600; color: var(--color-ink); }
.ps-field input,
.ps-field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-white);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-ink);
}
.ps-field input:focus,
.ps-field select:focus { outline: none; border-color: var(--color-gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-gold) 22%, transparent); }
.ps-field .phone-field select { width: auto; flex: 0 0 118px; }
.ps-field .phone-field input { width: auto; flex: 1 1 auto; }
.ps-hint { margin: 0; font-size: 0.78rem; line-height: 1.4; color: var(--color-text-muted); }
.ps-preview {
  margin-bottom: 4px;
  border-radius: 18px;
  overflow: hidden;
}
.ps-preview:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.ps-chat {
  padding: 16px;
  background-color: #efe7dd;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 14px 14px;
}
.ps-bubble {
  position: relative;
  max-width: 92%;
  margin-left: auto;
  padding: 10px 12px;
  border-radius: 14px 4px 14px 14px;
  background: #d9fdd3;
  color: #111b21;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.ps-mail { border: 1px solid var(--color-border); border-radius: 18px; background: var(--color-white); }
.ps-mail-subject {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.ps-mail-subject span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.ps-mail-body,
.ps-plain {
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--color-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ps-plain { border: 1px dashed var(--color-border); border-radius: 18px; background: var(--color-cream); }
.ps-link { color: #2563eb; text-decoration: underline; text-decoration-thickness: 1px; }
.ps-loading,
.ps-error { padding: 32px 0; text-align: center; color: var(--color-text-muted); }
.ps-error { color: var(--color-error); }
.ps-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
}
.ps-status { flex: 1 1 160px; min-width: 0; margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }
.ps-go { display: inline-flex; align-items: center; gap: 8px; }
.ps-go svg { width: 18px; height: 18px; }
.ps-go--whatsapp { background: #25d366; color: #0b2e17; }
.ps-go--whatsapp:hover { background: #1fbe5b; }
.ps-go--email { background: #2563eb; color: #fff; }
.ps-go--email:hover { background: #1d4ed8; }
.ps-go.is-done { background: var(--color-success); color: #fff; }
@keyframes ps-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ps-rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ps-overlay, .ps-card { animation: none; }
  .ps-channel { transition: none; }
}
/* Phones: a bottom sheet with a grabber; the channel cards stack their text under the icon. */
@media (max-width: 600px) {
  .ps-overlay { align-items: flex-end; padding: 0; }
  .ps-card {
    width: 100%;
    max-height: calc(100vh - 24px); max-height: calc(100dvh - max(24px, env(safe-area-inset-top)));
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
  }
  .ps-grabber { display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: var(--color-border); }
  .ps-head { padding: 8px 12px 6px 16px; }
  .ps-hero, .ps-channels, .ps-body { padding-left: 16px; padding-right: 16px; }
  .ps-foot { padding-left: 16px; padding-right: 16px; }
  .ps-thumb { width: 52px; height: 52px; border-radius: 14px; }
  .ps-channel { flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px 6px; }
  .ps-channel-text small { display: none; }
  .ps-foot .btn-ghost { display: none; }
  .ps-go { flex: 1 1 100%; justify-content: center; min-height: 48px; }
}
/* Dual-screen phones spanned across the hinge: keep the sheet on one screen. */
@media (horizontal-viewport-segments: 2) {
  .ps-overlay { justify-content: flex-start; }
  .ps-card { width: min(560px, env(viewport-segment-width 0 0, 50vw)); }
}

/* ---------------------------------------------------------------------------------------------
   Property edit pop-up (admin/properties.html #property-modal): the form in titled sections
   (.pf-section), a jump bar that stays at the top while the form scrolls (.pf-nav, the section on
   screen marked by admin.js initFormSections), a photo drop zone, and the Save / Publish buttons
   pinned to the bottom. Colours are tokens only, so the dark theme follows.
   --------------------------------------------------------------------------------------------- */
#property-modal { --pf-pad: var(--space-5); }
/* The pinned Save / Publish bar sticks to the inside of the overlay's padding, so a bottom padding
   left a strip under the bar where the form (the map above all) scrolled past. The gap below the
   card is a margin instead, which still shows once the form is scrolled to its end. */
#property-modal.modal-overlay { padding-bottom: 0; --pf-stick: var(--space-5); }
/* A sticky bar stops at its scroller's padding edge, not its top edge, so with top: 0 the form (the
   map above all) showed through a strip above the jump bar. --pf-stick is the overlay's top padding
   (mobile.css adds the Demo notice and the notch on a phone; the 12px under them is what's left). */
@media (max-width: 760px) {
  #property-modal.modal-overlay { --pf-stick: 12px; }
}
#property-modal .modal-card { max-width: 880px; padding: var(--pf-pad) var(--pf-pad) 0; margin-bottom: var(--space-5); }
#property-modal .modal-head { margin-bottom: var(--space-2); }
#property-modal .required-notice { margin: var(--space-3) 0 0; }

.pf-nav {
  position: sticky;
  top: calc(-1 * var(--pf-stick, 0px));
  z-index: 4;
  display: flex;
  gap: 6px;
  margin: 0 calc(-1 * var(--pf-pad));
  padding: 10px var(--pf-pad);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pf-nav::-webkit-scrollbar { display: none; }
/* Wide enough for every pill: they wrap instead of hiding the last ones off the edge. On a phone
   (pointer: coarse or narrow) the bar stays one line that scrolls sideways. */
@media (min-width: 761px) {
  .pf-nav { flex-wrap: wrap; overflow-x: visible; }
}
.pf-nav-link {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pf-nav-link:hover { color: var(--color-text); border-color: var(--color-ink-soft); }
.pf-nav-link.is-current { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-white); }
.pf-nav-link:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }

.pf-section {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  /* Clears the sticky jump bar when a section is jumped to. */
  scroll-margin-top: 72px;
  min-width: 0;
  position: relative; /* keeps the visually hidden photo picker inside the section */
}
/* The m² / sqft switch at the top right of a form section (Características), and beside the
   wrench above the Propiedades table. */
.pf-section-unit { margin-left: auto; flex: none; align-self: flex-start; }
.fs-result-line .list-area-unit { margin-left: auto; display: inline-flex; align-items: center; }
.fs-result-line .list-area-unit + .list-tools { margin-left: 8px; }
.pf-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 var(--space-3);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.pf-section-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-cream-dim);
  color: var(--color-ink);
}
.pf-section-icon svg { width: 18px; height: 18px; }
.pf-section-heading { min-width: 0; }
.pf-section-title {
  margin: 0;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text);
}
.pf-section-sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--color-text-muted); }
.pf-section > .field:last-child,
.pf-section > .field-row:last-child > .field { margin-bottom: 0; }
/* The private blocks keep their own green heads; inside the section they need no extra margin. */
.pf-section .private-section:last-child { margin-bottom: 0; }
.pf-section .private-info-banner { margin-top: 0; }

/* A yes / no line (Venta urgente, Tiene vista): a calm bordered row, the whole row clickable. */
.pf-check > label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-width: 0;
}
.pf-check > label:hover { border-color: var(--color-ink-soft); }

/* "¿Cómo obtener coordenadas exactas?": the long explanation stays one click away. */
.pf-help { margin: 6px 0 8px; }
.pf-help > summary {
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-ink);
}
.pf-help[open] > summary { margin-bottom: 6px; }
.pf-help .coordinates-help { margin: 0; }

/* "Estado en el Registro" (private section): the official registry link and its steps. The
   button wraps on a phone instead of running off the side; the steps are a numbered list. */
.pf-registry-intro { margin-top: 0; }
.pf-registry-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  min-width: 0;
}
.pf-registry-help { margin-bottom: 0; }
.pf-registry-steps { padding-left: 30px; display: grid; gap: 4px; overflow-wrap: anywhere; }

/* "Mapa de Catastro" (Ubicación, admin.js renderCadastre): the parcel(s) under the listing's point.
   A status line marked by its tone (the text keeps the body colour, so it reads in both themes),
   then one card per parcel: label / value rows whose values wrap (a long cadastral address) with
   the copy button kept beside its number. Several parcels are radio cards, the chosen one marked.
   On a narrow phone each label sits above its value; buttons wrap instead of running off. */
.pf-cadastre-intro { margin-top: 0; }
.pf-cadastre-status {
  margin: 0 0 var(--space-2);
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--color-border);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.pf-cadastre-status:empty { display: none; }
.pf-cadastre-status[data-tone="ok"] { border-left-color: var(--color-success); }
.pf-cadastre-status[data-tone="warn"] { border-left-color: var(--color-gold); }
.pf-cadastre-status[data-tone="error"] { border-left-color: var(--color-error); }
.pf-cadastre.is-loading .pf-cadastre-status { color: var(--color-text-muted); }
.pf-cadastre.is-loading .pf-cadastre-parcels { opacity: 0.55; }
.pf-cadastre-parcels { display: grid; gap: 8px; min-width: 0; }
.pf-cadastre-parcels:empty { display: none; }
.pf-cadastre-parcel {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.pf-cadastre-parcel.is-selected { border-color: var(--color-success); box-shadow: inset 4px 0 0 var(--color-success); }
.pf-cadastre-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -6px 0 4px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
}
.pf-cadastre-pick input { width: auto; min-height: auto; margin: 0; flex: none; }
.pf-cadastre-pick span { min-width: 0; overflow-wrap: anywhere; }
.pf-cadastre-values {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 2px 14px;
  margin: 0;
}
.pf-cadastre-row { display: contents; }
.pf-cadastre-values dt { margin: 0; font-size: 0.82rem; color: var(--color-text-muted); }
.pf-cadastre-values dd { margin: 0; display: flex; align-items: center; gap: 4px; min-width: 0; min-height: 32px; }
.pf-cadastre-value { min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* A lot the map has no survey plan or finca for: the row stays, saying so, in the muted tone. */
.pf-cadastre-value.is-missing { font-weight: 400; font-style: italic; color: var(--color-text-muted); }
.pf-cadastre-copy {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
}
.pf-cadastre-copy:hover { border-color: var(--color-border); background: var(--color-cream-dim); }
.pf-cadastre-copy:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.pf-cadastre-copy svg { width: 16px; height: 16px; }
@media (pointer: coarse) {
  .pf-cadastre-copy { width: 44px; height: 44px; }
}
.pf-cadastre-meta { margin: var(--space-2) 0 0; overflow-wrap: anywhere; }
.pf-cadastre-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-2); min-width: 0; }
/* The ⓘ beside the title holds "no nos hacemos responsables… verifíquela en el sitio oficial". The
   box lets it out (its head and body keep the rounded corners themselves), and it opens downward
   over the box; on a phone it opens across the section under the title (rule further down). */
.pf-cadastre { overflow: visible; }
.pf-cadastre > .private-section-head { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.pf-cadastre > .private-section-body { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.pf-cadastre-info { color: rgba(255, 255, 255, 0.85); }
.pf-cadastre-info:hover, .pf-cadastre-info:focus-visible { color: var(--color-gold); }
.pf-cadastre-info .info-tooltip-text { top: calc(100% + 8px); bottom: auto; font-weight: 400; }
.pf-cadastre-viewer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: left;
}
/* Phones (and a folded phone's cover screen): each label above its value, so a 12-digit plano and
   its copy button never break across lines; the two buttons take the whole width. */
@media (max-width: 420px) {
  .pf-cadastre-values { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pf-cadastre-values dt { margin-top: 6px; }
  .pf-cadastre-actions > .btn { flex: 1 1 100%; justify-content: center; }
}

/* ---- The Mapa de Catastro for everyone but a broker (plan-features.js BROKER_ONLY_FEATURES):
   what it does, and the way to it (plan locks show, never hide). */
.pf-cadastre-locked { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.pf-cadastre-locked[hidden] { display: none; }
.pf-cadastre-locked-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--color-gold) 18%, transparent); color: var(--color-ink); }
.pf-cadastre-locked-icon svg { width: 18px; height: 18px; }
.pf-cadastre-locked-body { min-width: 0; }
.pf-cadastre-locked-title { margin: 0 0 4px; font-size: 0.98rem; }
.pf-cadastre-locked-body p { margin: 0 0 8px; overflow-wrap: anywhere; }
.pf-cadastre-locked-list { margin: 0 0 12px; padding-left: 1.1em; display: grid; gap: 4px; font-size: 0.9rem; }
.pf-cadastre-locked-list li { overflow-wrap: anywhere; }
.pf-cadastre-main[hidden] { display: none; }

/* ---- The professional map (cadastre-map.js). Colours of what we draw are cadastre-map.js COLORS;
   everything else follows the theme. */
.pf-cadastre-alerts { display: grid; gap: 8px; margin: 0 0 var(--space-2); min-width: 0; }
.pf-cadastre-alerts[hidden] { display: none; }
.cad-checking { margin: 0; font-size: 0.88rem; color: var(--color-text-muted); }
.cad-alert {
  display: flex; gap: 10px; align-items: flex-start; min-width: 0;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); border-left-width: 4px;
  background: var(--color-white);
}
.cad-alert.is-critical { border-left-color: var(--color-error); background: color-mix(in srgb, var(--color-error) 7%, var(--color-white)); }
.cad-alert.is-warn { border-left-color: var(--color-gold); background: color-mix(in srgb, var(--color-gold) 10%, var(--color-white)); }
.cad-alert.is-ok { border-left-color: var(--color-success); }
.cad-alert.is-info { border-left-color: #6a1b9a; }
.cad-alert.is-unknown { border-left-color: var(--color-text-muted); }
.cad-alert-icon { flex: none; width: 22px; height: 22px; display: grid; place-items: center; margin-top: 1px; }
.cad-alert-icon svg { width: 18px; height: 18px; }
.cad-alert.is-critical .cad-alert-icon { color: var(--color-error); }
.cad-alert.is-warn .cad-alert-icon { color: #9a6b00; }
.cad-alert.is-ok .cad-alert-icon { color: var(--color-success); }
.cad-alert-body { min-width: 0; flex: 1 1 auto; }
.cad-alert-title { display: block; font-size: 0.9rem; }
.cad-alert-text { margin: 2px 0 0; font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; }
.cad-alert-show { margin-top: 6px; }

.pf-cadastre-pro { margin-top: var(--space-3); display: grid; gap: var(--space-2); min-width: 0; }
.pf-cadastre-pro[hidden] { display: none; }
.cad-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; min-width: 0; }
.cad-title { margin: 0; font-size: 0.98rem; min-width: 0; }
.cad-base { flex: none; max-width: 100%; }
.cad-note { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }
.cad-drag-hint { margin: 0; font-size: 0.85rem; }
/* The point on the cadastral map: a 36 px handle (44 px on touch, cadastre-map.js) around the drawn dot. */
.cad-point-handle { display: flex; align-items: center; justify-content: center; background: none; border: 0; cursor: grab; touch-action: none; }
.cad-point-handle:active { cursor: grabbing; }
.cad-point-handle:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; border-radius: 50%; }
.cad-point-dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2.5px solid #111; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 1px 4px rgba(0, 0, 0, 0.45); pointer-events: none; }
.coords-inside-lot { font-weight: 600; color: var(--color-text); }

.cad-area {
  padding: 10px 12px; border-radius: var(--radius-sm); min-width: 0;
  border: 1px solid var(--color-border); border-left-width: 4px; background: var(--color-white);
}
.cad-area[hidden] { display: none; }
.cad-area[data-tone="ok"] { border-left-color: var(--color-success); }
.cad-area[data-tone="warn"] { border-left-color: var(--color-gold); }
.cad-area[data-tone="bad"] { border-left-color: var(--color-error); }
.cad-area-title { margin: 0 0 6px; font-size: 0.9rem; }
.cad-area-rows { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.cad-area-row { display: contents; }
.cad-area-rows dt { margin: 0; font-size: 0.82rem; color: var(--color-text-muted); }
.cad-area-rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.cad-area[data-tone="bad"] .is-diff dd { color: var(--color-error); }
.cad-area-note { margin: 6px 0 0; }
.cad-area-use { margin-top: 8px; }

.cad-map-wrap { position: relative; min-width: 0; }
.cad-map {
  height: 340px;
  height: clamp(260px, 52vh, 480px);
  height: clamp(260px, 52dvh, 480px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: #e8e4da;
}
.cad-map:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.cad-map .leaflet-control-scale-line { background: rgba(255, 255, 255, 0.85); }
/* The credit line stays one line; its full text is its tooltip. */
.cad-map .cad-credit { max-width: calc(100% - 110px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.cad-north {
  background: rgba(255, 255, 255, 0.92); border-radius: var(--radius-sm); padding: 2px 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); line-height: 0;
}
.cad-bar .cad-ctl {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; background: #fff; color: #1b1b1b; cursor: pointer;
}
.cad-bar .cad-ctl svg { width: 16px; height: 16px; }
.cad-bar .cad-ctl.is-on { background: #1b1b1b; color: #fff; }
.cad-bar .cad-ctl:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -2px; }
/* Lengths along the outline and measured distances, readable on any base. */
.cad-side { background: none; border: 0; }
.cad-side span {
  display: inline-block; transform: translate(-50%, -50%); white-space: nowrap;
  font: 700 11px/1 var(--font-body); color: #1b1b1b; padding: 2px 4px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.88); box-shadow: 0 0 0 1px rgba(230, 0, 126, 0.55);
}
.cad-measure span { box-shadow: 0 0 0 1px rgba(27, 27, 27, 0.6); }
/* The legend on the map. */
.cad-legend {
  background: rgba(255, 255, 255, 0.95); color: #1b1b1b; border-radius: var(--radius-sm);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3); max-width: min(250px, calc(100vw - 80px));
  font-size: 0.74rem;
}
.cad-legend-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px;
  border: 0; background: none; color: inherit; font: 600 0.8rem var(--font-body); cursor: pointer;
}
.cad-legend-toggle svg { width: 14px; height: 14px; }
.cad-legend-list {
  list-style: none; margin: 0; padding: 0 10px 8px; display: grid; gap: 4px;
  max-height: 210px; overflow-y: auto; overscroll-behavior: contain;
}
.cad-legend-list[hidden] { display: none; }
.cad-legend-item { display: flex; align-items: center; gap: 8px; min-width: 0; line-height: 1.3; }
.cad-legend-item > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.cad-legend-base { color: #555; font-size: 0.72rem; margin-top: 2px; }
.cad-swatch { flex: none; }
.cad-legend-img { flex: none; width: 24px; height: 16px; overflow: hidden; border-radius: 2px; background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.cad-legend-img img { display: block; object-fit: none; object-position: left top; width: 24px; height: 16px; }
.cad-legend-img.is-missing { visibility: hidden; }

/* The layer list below the map: the full legend, one switch per layer, in folding groups. */
.cad-layers { min-width: 0; display: grid; gap: 8px; }
.cad-layers-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-width: 0; }
.cad-layers-title { margin: 0; font-size: 0.95rem; min-width: 0; }
.cad-layers-reset { flex: none; }
.cad-layers-missing { margin: 0; }
.cad-group {
  min-width: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-white); overflow: hidden;
}
.cad-group-head {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 46px;
  padding: 8px 12px; cursor: pointer; list-style: none; user-select: none;
}
.cad-group-head::-webkit-details-marker { display: none; }
.cad-group-head::marker { content: ''; }
.cad-group-head:hover { background: color-mix(in srgb, var(--color-gold) 7%, transparent); }
.cad-group-head:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -2px; }
.cad-group-icon {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--color-ink) 9%, transparent); color: var(--color-ink);
}
.cad-group-icon svg { width: 16px; height: 16px; }
.cad-group[data-group="restrictions"] .cad-group-icon { background: color-mix(in srgb, var(--color-error) 13%, transparent); color: var(--color-error); }
.cad-group[data-group="risks"] .cad-group-icon { background: rgba(239, 108, 0, 0.14); color: #c25700; }
.cad-group[data-group="value"] .cad-group-icon { background: rgba(46, 125, 50, 0.14); color: #2e7d32; }
.cad-group[data-group="services"] .cad-group-icon { background: rgba(30, 99, 196, 0.13); color: #1e63c4; }
.cad-group[data-group="lot"] .cad-group-icon { background: rgba(230, 0, 126, 0.12); color: #b8005f; }
.cad-group-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 0.9rem; overflow-wrap: break-word; hyphens: auto; }
.cad-group-count {
  flex: none; font-size: 0.74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--color-success) 14%, transparent); color: #17603c; white-space: nowrap;
}
.cad-group-count.is-none { background: color-mix(in srgb, var(--color-text-muted) 12%, transparent); color: var(--color-text-muted); }
.cad-group-chevron { flex: none; display: grid; place-items: center; color: var(--color-text-muted); transition: transform 0.18s ease; }
.cad-group-chevron svg { width: 18px; height: 18px; }
.cad-group[open] > .cad-group-head .cad-group-chevron { transform: rotate(180deg); }
.cad-group[open] > .cad-group-head { border-bottom: 1px solid var(--color-border); }
.cad-group-body { display: grid; gap: 2px; padding: 4px; min-width: 0; }
.cad-layer {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  padding: 8px; border-radius: var(--radius-sm); min-width: 0;
}
.cad-layer:hover { background: color-mix(in srgb, var(--color-ink) 4%, transparent); }
/* The switch: the layer's checkbox drawn as an on/off switch (role="switch"). */
.cad-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 36px; height: 22px; min-height: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--color-text-muted) 38%, transparent); border: 0;
  transition: background-color 0.18s ease;
}
.cad-switch::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.18s ease;
}
.cad-switch:checked { background: var(--color-success); }
.cad-switch:checked::before { transform: translateX(14px); }
.cad-switch:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.cad-switch:disabled { opacity: 0.55; cursor: default; }
.cad-layer-symbols { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 24px; max-width: 84px; }
.cad-layer-symbols:empty { min-width: 0; }
.cad-layer-text { min-width: 0; }
.cad-layer-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; cursor: pointer; font-weight: 600; font-size: 0.88rem; min-width: 0; }
.cad-layer-name { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.cad-layer-badge {
  font-size: 0.7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--color-gold) 22%, transparent); color: var(--color-text);
}
.cad-layer-note, .cad-layer-source, .cad-layer-zoom { margin: 2px 0 0; font-size: 0.8rem; color: var(--color-text-muted); overflow-wrap: anywhere; line-height: 1.4; }
.cad-layer-zoom { color: #9a6b00; }
.cad-layer-zoom[hidden] { display: none; }
.cad-layer-more {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--color-text-muted); cursor: pointer;
}
.cad-layer-more:hover, .cad-layer-more[aria-expanded="true"] { background: color-mix(in srgb, var(--color-ink) 8%, transparent); color: var(--color-text); }
.cad-layer-more:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.cad-layer-more svg { width: 17px; height: 17px; }
.cad-layer-details { grid-column: 3 / -1; min-width: 0; }
.cad-layer-details[hidden] { display: none; }
/* An official layer's own legend (its colours), on a light card in either theme. */
.cad-layer-legends { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cad-layer-legend { max-width: 100%; max-height: 140px; height: auto; padding: 4px; border-radius: 4px; background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); object-fit: contain; }
.cad-layer-legend[hidden] { display: none; }
.cad-excluded { margin: 0; }

/* The nearest public services: our own round marks, one colour per kind (cadastre-map.js POI). */
.cad-poi { background: none; border: 0; display: grid; place-items: center; }
.cad-poi-dot {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: #455a64; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
.cad-poi-dot svg { width: 15px; height: 15px; }
.cad-poi-dot.is-small { width: 20px; height: 20px; border-width: 1.5px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); flex: none; }
.cad-poi-dot.is-small svg { width: 11px; height: 11px; }
.cad-poi-dot[data-poi="school"], .cad-poi-dot[data-poi="college"], .cad-poi-dot[data-poi="preschool"] { background: #1e63c4; }
.cad-poi-dot[data-poi="college"] { background: #3949ab; }
.cad-poi-dot[data-poi="preschool"] { background: #0288d1; }
.cad-poi-dot[data-poi="health"], .cad-poi-dot[data-poi="ebais"], .cad-poi-dot[data-poi="clinic"] { background: #c62828; }
.cad-poi-dot[data-poi="hospital"] { background: #8e1a1a; }
.cad-poi-dot[data-poi="voting"] { background: #5e35b1; }
.cad-poi-dot[data-poi="tseOffice"] { background: #3949ab; }
.cad-poi-dot[data-poi="police"] { background: #263238; }
.cad-map .cad-poi:focus-visible .cad-poi-dot { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.cad-poi-tip strong { font-weight: 700; }
/* The map's own tooltips (a shape's name, a service's name and distance) wrap inside the map. */
.cad-map .leaflet-tooltip.cad-tip { white-space: normal; width: max-content; max-width: min(240px, calc(100vw - 112px)); overflow-wrap: anywhere; line-height: 1.35; }

/* The Ficha del terreno: one card per value the official maps give at the lot. */
.cad-insights { display: grid; gap: 10px; min-width: 0; }
.cad-insights[hidden] { display: none; }
.cad-insights-head { display: grid; gap: 2px; min-width: 0; }
.cad-insights-title { margin: 0; font-size: 0.98rem; }
.cad-insights-sub { margin: 0; font-size: 0.82rem; color: var(--color-text-muted); }
.cad-insights-fail { margin: 0; font-size: 0.86rem; color: var(--color-text-muted); }
.cad-insights-note { margin: 0; }
.cad-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; min-width: 0; }
.cad-tile {
  --tile-accent: #546e7a;
  --tile-ink: var(--tile-accent); /* the accent as text ("Ver en el mapa"): 4.5:1 or more on the card */
  position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 12px; min-width: 0; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-white);
  box-shadow: 0 1px 2px rgba(47, 59, 52, 0.06);
}
.cad-tile.is-wide { grid-column: 1 / -1; }
.cad-tile[data-accent="value"] { --tile-accent: #2e7d32; }
.cad-tile[data-accent="soil"] { --tile-accent: #8d6e63; }
.cad-tile[data-accent="social"] { --tile-accent: #7b1fa2; }
.cad-tile[data-accent="risk"] { --tile-accent: #ef6c00; --tile-ink: #b45309; }
.cad-tile[data-accent="services"] { --tile-accent: #1e63c4; }
.cad-tile[data-accent="access"] { --tile-accent: #455a64; }
.cad-tile[data-tone="warn"] { border-left: 4px solid var(--color-gold); }
.cad-tile[data-tone="critical"] { border-left: 4px solid var(--color-error); }
.cad-tile[data-tone="ok"] { border-left: 4px solid var(--color-success); }
.cad-tile[data-tone="info"] { border-left: 4px solid var(--tile-accent); }
.cad-tile[data-tone="muted"] .cad-tile-value { color: var(--color-text-muted); font-weight: 600; font-size: 0.92rem; }
.cad-tile-icon {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tile-accent) 14%, transparent); color: var(--tile-accent);
}
.cad-tile-icon svg { width: 19px; height: 19px; }
.cad-tile-body { display: grid; gap: 2px; min-width: 0; }
.cad-tile-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-muted); overflow-wrap: break-word; }
.cad-tile-value { font-size: 1.08rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: break-word; hyphens: auto; color: var(--color-text); }
.cad-tile-sub { font-size: 0.82rem; color: var(--color-text-muted); overflow-wrap: break-word; line-height: 1.4; }
.cad-tile-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; margin-top: 4px; min-width: 0; }
.cad-tile-source { font-size: 0.74rem; color: var(--color-text-muted); min-width: 0; overflow-wrap: anywhere; }
.cad-tile-show {
  flex: none; border: 0; background: none; padding: 2px 0; min-height: 28px; cursor: pointer;
  font: 600 0.8rem var(--font-body); color: var(--tile-ink); text-decoration: underline; text-underline-offset: 3px;
}
.cad-tile-show:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; border-radius: 3px; }
.cad-tile-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.cad-tile.is-wide .cad-tile-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 6px 18px; }
.cad-tile-list li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.88rem; }
.cad-tile-list-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.cad-tile-list-kind { font-weight: 400; color: var(--color-text-muted); }
.cad-tile-list-dist { flex: none; font-variant-numeric: tabular-nums; color: var(--color-text-muted); white-space: nowrap; }
/* Loading: the cards it will show, a soft shimmer where the value goes. */
.cad-tile-skeleton {
  display: block; height: 14px; width: 70%; margin-top: 4px; border-radius: 4px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-text-muted) 12%, transparent) 25%, color-mix(in srgb, var(--color-text-muted) 22%, transparent) 50%, color-mix(in srgb, var(--color-text-muted) 12%, transparent) 75%);
  background-size: 200% 100%; animation: cad-shimmer 1.2s ease-in-out infinite;
}
@keyframes cad-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .cad-tile-skeleton { animation: none; } }

/* Touch: 44 px targets for the map's own controls, the switches and the buttons. */
@media (pointer: coarse) {
  .cad-map .leaflet-bar a, .cad-bar .cad-ctl { width: 44px; height: 44px; line-height: 44px; }
  .cad-legend-toggle { min-height: 44px; }
  .cad-group-head { min-height: 52px; }
  .cad-layer { padding: 10px 8px; }
  .cad-switch { width: 44px; height: 26px; }
  .cad-switch::after { content: ''; position: absolute; inset: -9px -4px; }
  .cad-layer-label { padding-block: 10px; margin-block: -10px; }
  .cad-switch::before { width: 20px; height: 20px; }
  .cad-switch:checked::before { transform: translateX(18px); }
  .cad-layer-more { width: 44px; height: 44px; }
  .cad-tile-show { min-height: 44px; }
  .cad-poi-dot { width: 32px; height: 32px; }
}
/* Phones (and a folded phone's cover): the area's labels above their values; the map a little
   shorter so the form still scrolls past it; a layer's symbols under its switch. */
/* Very narrow (a tablet's Slide Over, a flip's cover): the groups' icons give their room to the names. */
@media (max-width: 360px) {
  .cad-group-icon { display: none; }
  .cad-group-head { gap: 8px; padding: 8px 10px; }
  .cad-layer { gap: 2px 8px; padding: 8px 4px; }
}
/* Narrow screens: a layer's note in two lines (ⓘ shows it in full with its source). */
@media (max-width: 600px) {
  /* Only a row whose ⓘ can open it in full (the lot's own row has none: its note stays whole). */
  .cad-layer:has(.cad-layer-more) .cad-layer-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .cad-layer.is-open .cad-layer-note { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
}
@media (max-width: 420px) {
  .cad-layer { grid-template-columns: auto minmax(0, 1fr) auto; }
  .cad-layer-symbols { grid-column: 2; grid-row: 2; max-width: none; }
  .cad-layer-symbols:empty { display: none; }
  .cad-layer-text { grid-column: 2; grid-row: 1; }
  .cad-layer-more { grid-column: 3; grid-row: 1; }
  .cad-layer-details { grid-column: 2 / -1; }
  .cad-switch { grid-row: 1; align-self: start; margin-top: 2px; }
  .cad-area-rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cad-area-rows dt { margin-top: 4px; }
  .cad-head .cad-base { width: 100%; }
  .cad-map { height: 300px; height: clamp(240px, 46vh, 420px); height: clamp(240px, 46dvh, 420px); }
  .cad-tile { grid-template-columns: 32px minmax(0, 1fr); padding: 10px; gap: 8px; }
  .cad-tile-icon { width: 32px; height: 32px; }
  .cad-tile-icon svg { width: 16px; height: 16px; }
}
:root[data-theme="dark"] .cad-alert,
:root[data-theme="dark"] .cad-area,
:root[data-theme="dark"] .cad-group,
:root[data-theme="dark"] .cad-tile { background: var(--color-white); }
:root[data-theme="dark"] .cad-tile { --tile-accent: #90a4ae; }
:root[data-theme="dark"] .cad-tile[data-accent="risk"] { --tile-accent: #ffa65c; --tile-ink: #ffa65c; }
:root[data-theme="dark"] .cad-group[data-group="risks"] .cad-group-icon { color: #ffa65c; }
:root[data-theme="dark"] .cad-group[data-group="value"] .cad-group-icon { color: #7ccf83; }
:root[data-theme="dark"] .cad-group[data-group="services"] .cad-group-icon { color: #8ab4ff; }
:root[data-theme="dark"] .cad-group[data-group="lot"] .cad-group-icon { color: #ff6fb7; }
:root[data-theme="dark"] .cad-tile[data-accent="value"] { --tile-accent: #7ccf83; }
:root[data-theme="dark"] .cad-tile[data-accent="soil"] { --tile-accent: #c8a69a; }
:root[data-theme="dark"] .cad-tile[data-accent="social"] { --tile-accent: #ce93d8; }
:root[data-theme="dark"] .cad-tile[data-accent="services"] { --tile-accent: #8ab4ff; }
:root[data-theme="dark"] .cad-tile[data-accent="access"] { --tile-accent: #b0bec5; }
:root[data-theme="dark"] .cad-layer-zoom { color: #e8cf7d; }
:root[data-theme="dark"] .cad-group-count:not(.is-none) { color: var(--color-success); }
/* The switches keep their track in the dark theme (workspace.css paints every input dark). */
:root[data-theme="dark"] .cad-switch { background-color: #4a524d; border: 0; }
:root[data-theme="dark"] .cad-switch:checked { background-color: var(--color-success); }
:root[data-theme="dark"] .cad-map img.leaflet-tile { opacity: 1; }

/* "Archivos de la Propiedad" (private section, admin.js renderSaleDocuments): one row per document
   — its name and file on the left, Adjuntar/Reemplazar and Quitar on the right. On a phone the
   buttons drop under the name instead of squeezing it; long file names wrap. */
.pf-sale-docs-intro { margin-top: 0; }
.pf-sale-docs-progress { margin: 0 0 var(--space-2); font-weight: 600; color: #8a4b00; }
.pf-sale-docs-progress.is-complete { color: #163d20; }
.pf-sale-docs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pf-sale-doc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-left: 4px solid #c98a1b;
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.pf-sale-doc.is-attached { border-left-color: #2f7d3a; }
.pf-sale-doc-icon { display: inline-flex; flex: none; color: #c98a1b; }
.pf-sale-doc.is-attached .pf-sale-doc-icon { color: #2f7d3a; }
.pf-sale-doc-icon svg { width: 20px; height: 20px; }
.pf-sale-doc-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-sale-doc-name { font-weight: 600; overflow-wrap: anywhere; }
.pf-sale-doc-file, .pf-sale-doc-missing { font-size: 0.875rem; overflow-wrap: anywhere; }
.pf-sale-doc-missing { color: var(--color-text-muted); }
.pf-sale-doc-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
@media (max-width: 600px) {
  .pf-sale-doc { grid-template-columns: auto minmax(0, 1fr); }
  .pf-sale-doc-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.pf-sale-doc-pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.pf-sale-doc-pick svg { width: 16px; height: 16px; }
.pf-sale-doc-pick.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
/* The real file box stays focusable for the keyboard (the label is its visible face). */
.pf-sale-doc-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pf-sale-doc:has(.pf-sale-doc-input:focus-visible) .pf-sale-doc-pick { outline: 2px solid var(--color-primary, #c9a227); outline-offset: 2px; }

/* The CRM's "documents missing" pop-up (app.js saleDocumentsModal): the missing ones as a list. */
.sale-docs-modal-list { margin: var(--space-2) 0 var(--space-3); padding-left: 22px; display: grid; gap: 4px; text-align: left; overflow-wrap: anywhere; }

/* Photos: a drop zone that is also the file picker's label. Shared by every photo upload (the
   property form and the sponsor form, js/photo-tiles.js). */
:is(#property-modal, #ct-modal) .pf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 112px;
  margin-top: 8px;
  padding: var(--space-3);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-text-muted);
  font-weight: 400;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pf-dropzone[hidden] { display: none !important; }
:is(#property-modal, #ct-modal) .pf-dropzone:hover,
:is(#property-modal, #ct-modal) .pf-dropzone.is-over { border-color: var(--color-gold); background: var(--color-cream-dim); }
.pf-dropzone-input { left: 0; }
.pf-dropzone-input:focus-visible + .pf-dropzone { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.pf-dropzone-icon { color: var(--color-ink); }
.pf-dropzone-icon svg { width: 28px; height: 28px; }
.pf-dropzone-text { min-width: 0; overflow-wrap: anywhere; }
.pf-dropzone-text strong { color: var(--color-text); }
/* The brochure's file button, in the form's own style rather than the browser's grey one. */
#property-modal input[type='file']::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#property-modal input[type='file']::file-selector-button:hover { border-color: var(--color-ink-soft); }
.pf-dropzone-pick { color: var(--color-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Photo tiles: rounded, the caption boxes and the 360 line tidy under each one. */
:is(#property-modal, #ct-modal) .image-preview-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
/* Two tiles per row on a phone (one per row made the list long to scroll). */
@media (max-width: 600px) {
  :is(#property-modal, #ct-modal) .image-preview-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); gap: 8px; }
}
#ct-modal .image-preview-grid + .hint { margin-top: 8px; }
:is(#property-modal, #ct-modal) .image-preview-grid figure {
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}

/* Save / Publish always within reach: pinned to the bottom of the pop-up while it scrolls. */
/* A save with new photos: the upload, then the server working through them one at a time
   (admin.js saveWithProgress). Its own full-width line above the buttons, on every screen. */
.save-progress {
  flex: 1 0 100%;
  order: -1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.save-progress[hidden] { display: none; }
.save-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}
.save-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-success, #2e7d4f);
  transition: width 0.4s ease;
}
.save-progress-text {
  min-width: 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: reduce) {
  .save-progress-fill { transition: none; }
}

#property-modal .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  flex-wrap: wrap;
  margin: var(--space-4) calc(-1 * var(--pf-pad)) 0;
  padding: 12px var(--pf-pad) calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 -10px 24px -18px rgba(20, 18, 16, 0.45);
}

/* While any pop-up is open, the phones' bottom navigation steps aside: it sat on top of the
   pop-up and covered its last fields and its buttons. */
html:has(.modal-overlay:not([hidden])) .ws-bottom-nav { display: none; }

/* Info bubbles in the form: a hidden one takes no room (it used to widen the pop-up, which could
   then be dragged sideways on a phone), and on a narrow screen one opens inside its own section,
   just under its line, instead of running off the edge. */
#property-modal .info-tooltip:not(:hover):not(:focus):not(:focus-within) .info-tooltip-text,
#property-modal .field-info:not(:hover):not(:focus-within) .field-info-text { display: none; }
@media (max-width: 760px) {
  #property-modal .pf-section .info-tooltip,
  #property-modal .pf-section .field-info { position: static; }
  #property-modal .pf-section .info-tooltip-text,
  #property-modal .pf-section .field-info-text {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: auto;
    width: auto;
    max-width: none;
    margin-top: 1.6em;
    transform: none;
  }
  /* The Mapa de Catastro's ⓘ sits in its green title bar: its note opens under the bar, as wide as
     the box, not over the title. */
  #property-modal .pf-cadastre > .private-section-head { position: relative; }
  #property-modal .pf-section .pf-cadastre-info .info-tooltip-text { top: calc(100% + 6px); left: 0; right: 0; margin-top: 0; }
}
/* Short screens (a phone on its side) pin nothing big: the jump bar and the buttons scroll away. */
@media (max-height: 500px) {
  .pf-nav,
  #property-modal .form-actions { position: static; box-shadow: none; }
}

@media (max-width: 600px) {
  #property-modal { --pf-pad: 16px; }
  #property-modal .modal-overlay, #property-modal.modal-overlay { padding-left: 8px; padding-right: 8px; }
  .pf-section { padding: var(--space-3); margin-top: var(--space-3); }
  .pf-section-icon { width: 32px; height: 32px; }
  #property-modal .form-actions > .btn { flex: 1 1 auto; min-height: 44px; }
  #property-modal .form-actions > .btn-primary { flex-basis: 100%; order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  .pf-nav-link, .pf-dropzone { transition: none; }
}

/* Properties list, Colaboradores column: one agent per line, pending invitations marked.
   Long names wrap inside the cell (min-width: 0) instead of pushing the table wider. */
.collab-cell {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.collab-cell li {
  overflow-wrap: anywhere;
}
.collab-cell-pending {
  font-size: 0.75rem;
  color: #8a6300;
  white-space: nowrap;
}

/* Properties list: compact so more columns fit on screen (owner's request, 2026-11-13).
   Tighter cells, headers that wrap onto two lines instead of setting the column width, a
   two-line title and a smaller thumbnail. Long text clips to two lines (.dt-clip). */
#properties-table th,
#properties-table td {
  padding: 8px;
  font-size: 0.84rem;
}
#properties-table th { letter-spacing: 0.04em; font-size: 0.68rem; }
#properties-table .dt-th { white-space: normal; }
#properties-table .dt-sort { padding: 8px; align-items: center; line-height: 1.25; }
@media (min-width: 768px) { #properties-table img { width: 44px; height: 36px; } }
#properties-table td[data-dt-col="title"] { min-width: 150px; max-width: 230px; }
#properties-table td[data-dt-col="title"] .title-cell > span:first-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
}
#properties-table td[data-dt-col="price"],
#properties-table td[data-dt-col="soldPrice"],
#properties-table td[data-dt-col="cuotaHOA"],
#properties-table td[data-dt-col="id"],
#properties-table td[data-dt-col="listingType"] { white-space: nowrap; }
#properties-table td[data-dt-col="collaborators"],
#properties-table td[data-dt-col="owner"],
#properties-table td[data-dt-col="amenities"] { min-width: 110px; max-width: 200px; }
/* Leads Vinculados: room for its two-line header and the count pill. */
#properties-table [data-dt-col="linkedLeads"] { min-width: 96px; white-space: nowrap; }
#properties-table th[data-dt-col="linkedLeads"] { white-space: normal; }
.dt-clip {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 220px;
  overflow-wrap: anywhere;
}

/* Columns menu of a table people arrange (data-table.js `reorder`): drag or ↑ ↓ per row. */
.dt-menu:has(.dt-menu-item--move) { width: min(300px, calc(100vw - 16px)); }
.dt-menu-item--move { gap: 6px; padding: 4px 6px; cursor: grab; }
.dt-menu-check { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; cursor: pointer; }
.dt-menu-check span { min-width: 0; overflow-wrap: anywhere; }
.dt-grip { color: var(--color-text-muted); font-size: 0.8rem; letter-spacing: -2px; user-select: none; }
.dt-move { flex: 0 0 auto; width: 28px; height: 28px; border: 1px solid var(--ui-hairline); border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.dt-move:disabled { opacity: 0.3; cursor: default; }
.dt-move:not(:disabled):hover { background: rgba(201, 162, 39, 0.12); }
.dt-menu .dt-menu-list .dt-menu-title { margin: 10px 8px 4px; }
.dt-menu-item.is-dragging, .dt-th.is-dragging { opacity: 0.45; }
.dt-menu-item.is-drop-target { box-shadow: inset 0 2px 0 var(--color-gold); }
.dt-th.is-drop-target { box-shadow: inset 2px 0 0 var(--color-gold); }
.dt-th[draggable="true"] { cursor: grab; }

/* Property form › Precio › Valor de avalúo (optional): its own soft box under the price row, the
   "Opcional" pill and ⓘ beside the label, and a live line comparing the price with it. */
.pf-appraisal { min-width: 0; margin: var(--space-3) 0; padding: 12px 14px; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); }
.pf-appraisal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; min-width: 0; }
.pf-appraisal-label { font-weight: 600; font-size: 0.9rem; margin: 0; }
.pf-optional { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--color-cream-dim); color: var(--color-text-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: .03em; }
.pf-appraisal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.pf-appraisal-row input { flex: 0 1 260px; min-width: 0; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.95rem; background: var(--color-white); }
.pf-appraisal-compare { margin: 0; flex: 1 1 200px; min-width: 0; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); }
.pf-appraisal-compare:empty { display: none; }
.pf-appraisal-compare.is-below { color: #1e6b34; }
.pf-appraisal .hint { margin: 6px 0 0; }
#property-modal.is-view-only .pf-appraisal { border-style: solid; }

/* ---------------------------------------------------------------------------------------------
   Property form › Owner Details (admin.js renderOwners, owner picker). Owners are clients of the
   Client Directory: one card each (initials, name, client code, email · phone, "Ver ficha", ✕),
   then one box that takes a client's code or name with a suggestion list and "Agregar", then the
   owner's contact boxes and the real coordinates. Everything wraps and stacks at 375px; colours
   are tokens only (except the private section's own green head).
   --------------------------------------------------------------------------------------------- */
.owner-block { min-width: 0; margin-bottom: var(--space-4); }
.owner-block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; min-width: 0; }
.owner-list-label { display: block; font-weight: 700; font-size: 0.95rem; color: var(--color-text); }
.owner-count { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); }
.owner-cards { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; min-width: 0; }
.owner-empty { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); color: var(--color-text-muted); }
.owner-empty p { margin: 0; min-width: 0; }
.owner-empty-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--color-cream-dim); }
.owner-empty-icon svg { width: 16px; height: 16px; }
.owner-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-gold); border-radius: var(--radius-sm); background: var(--color-white); }
.owner-card.is-legacy { border-left-color: var(--color-border); }
.owner-card.is-incomplete { border-left-color: #a15c00; }
.owner-card-avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--color-ink); color: var(--color-white); font-weight: 700; font-size: 0.85rem; letter-spacing: .02em; }
.owner-card.is-legacy .owner-card-avatar { background: var(--color-cream-dim); color: var(--color-ink); }
.owner-card-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.owner-card-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.owner-card-name strong { overflow-wrap: anywhere; }
.owner-code { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--color-cream-dim); color: var(--color-ink); font-size: 0.75rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.owner-card-contact { font-size: 0.85rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.owner-card.is-incomplete .owner-card-contact { color: #a15c00; }
.owner-card-link { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 6px; font-size: 0.85rem; font-weight: 600; color: var(--color-ink); text-decoration: none; border-radius: var(--radius-sm); }
.owner-card-link:hover, .owner-card-link:focus-visible { text-decoration: underline; }
.owner-card-link svg { width: 14px; height: 14px; }
.owner-card-create { flex: none; }
.owner-card-remove { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--color-border); background: var(--color-white);
  color: var(--color-text-muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.owner-card-remove:hover, .owner-card-remove:focus-visible { color: #a12626; border-color: #a12626; }
.owner-card-remove svg { width: 14px; height: 14px; }

.owner-picker { min-width: 0; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); }
.owner-picker-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.owner-picker-row { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.owner-picker-box { position: relative; flex: 1 1 auto; min-width: 0; }
.owner-picker-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; color: var(--color-text-muted); pointer-events: none; }
.owner-picker-icon svg { width: 16px; height: 16px; }
.owner-picker-box input { width: 100%; min-height: 44px; padding: 10px 12px 10px 38px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.95rem; background: var(--color-white); color: var(--color-text); }
.owner-picker-box input:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.owner-add-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.owner-add-btn svg { width: 14px; height: 14px; }
.owner-pick-hint { margin: 6px 0 0; }
.owner-suggestions { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: min(320px, 50dvh);
  overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-white); box-shadow: 0 10px 28px rgba(0, 0, 0, .14); }
.owner-suggestion { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.owner-suggestion:hover, .owner-suggestion.is-active { background: var(--color-cream-dim); }
.owner-suggestion-name { font-weight: 600; overflow-wrap: anywhere; }
.owner-suggestion-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-size: 0.8rem; color: var(--color-text-muted); }
.owner-suggestion-contact { overflow-wrap: anywhere; min-width: 0; }
.owner-notice { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-cream-dim); min-width: 0; }
.owner-notice.is-warn { border-color: #e0b25c; background: #fff7e6; }
.owner-notice-icon { flex: none; display: grid; place-items: center; color: var(--color-ink); padding-top: 2px; }
.owner-notice.is-warn .owner-notice-icon { color: #a15c00; }
.owner-notice-icon svg { width: 16px; height: 16px; }
.owner-notice-body { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.owner-notice-text { margin: 0; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.owner-notice-action { flex: none; }

.owner-coords { margin-bottom: 0; padding-top: var(--space-3); border-top: 1px solid var(--color-border); }

@media (max-width: 480px) {
  /* Phone: avatar | name + contact | ✕ on the first row; "Ver ficha" / "Crear cliente" under the name. */
  .owner-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 6px 10px; }
  .owner-card-avatar { grid-column: 1; grid-row: 1 / span 2; }
  .owner-card-text { grid-column: 2; grid-row: 1; }
  .owner-card-remove { grid-column: 3; grid-row: 1; width: 40px; height: 40px; }
  .owner-card-link, .owner-card-create { grid-column: 2; grid-row: 2; justify-self: start; }
  .owner-card-link { padding: 0; min-height: 36px; }
  .owner-picker { padding: 10px; }
  .owner-add-btn { min-height: 44px; padding-left: 12px; padding-right: 12px; }
}
/* Fold cover screens and other very narrow phones: the initials give their room to the name. */
@media (max-width: 360px) {
  .owner-card { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; }
  .owner-card-avatar { display: none; }
  .owner-card-text, .owner-card-link, .owner-card-create { grid-column: 1; }
  .owner-card-remove { grid-column: 2; }
  .owner-picker { padding: 8px; }
  .owner-picker-row { flex-wrap: wrap; }
  .owner-picker-box { flex-basis: 100%; }
  .owner-add-btn { flex: 1 1 auto; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .owner-notice.is-warn { background: rgba(224, 178, 92, .14); }
}
:root[data-theme="dark"] .owner-notice.is-warn { background: rgba(224, 178, 92, .14); }

/* ---------------------------------------------------------------------------------------------
   Propiedades › Leads Vinculados (admin.js linkedLeadsCell, openLinkedLeads): the count is a pill
   button; the pop-up shows a chip per stage, then one row per deal that opens its CRM card.
   --------------------------------------------------------------------------------------------- */
.linked-leads-count { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; min-width: 44px; padding: 2px 12px; border: 1px solid var(--color-gold);
  border-radius: 999px; background: var(--color-white); color: var(--color-ink); font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.linked-leads-count svg { width: 14px; height: 14px; color: var(--color-gold); }
.linked-leads-count:hover, .linked-leads-count:focus-visible { background: var(--color-cream-dim); }
.linked-leads-count:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.linked-leads-zero { color: var(--color-text-muted); }
.linked-leads-card { max-width: 640px; }
.linked-leads-head { min-width: 0; }
.linked-leads-head h2 { margin: 0; }
.linked-leads-sub { margin: 2px 0 0; color: var(--color-text-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.linked-leads-body { min-width: 0; }
.linked-leads-empty { margin: 8px 0; color: var(--color-text-muted); }
.linked-leads-empty.is-error { color: #a12626; }
.linked-leads-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.ll-stage { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: var(--color-cream-dim); color: var(--color-ink); white-space: nowrap; max-width: 100%; }
.ll-stage span { overflow: hidden; text-overflow: ellipsis; }
.ll-stage b { font-weight: 800; }
.ll-stage.is-won { background: #e3f3e8; color: #1e6b34; }
.ll-stage.is-lost { background: #f8e3e3; color: #962323; }
.linked-leads-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.linked-lead { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-white); color: inherit; text-decoration: none; }
.linked-lead:hover, .linked-lead:focus-visible { border-color: var(--color-gold); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.linked-lead:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.linked-lead-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.linked-lead-title { overflow-wrap: anywhere; }
.linked-lead-meta { font-size: 0.85rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.linked-lead-where { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 45%; min-width: 0; }
.linked-lead-pipeline { font-size: 0.75rem; color: var(--color-text-muted); text-align: right; overflow-wrap: anywhere; }
.linked-lead-go { flex: none; display: grid; place-items: center; color: var(--color-text-muted); }
.linked-lead-go svg { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .linked-lead { flex-wrap: wrap; }
  .linked-lead-main { flex-basis: calc(100% - 30px); }
  .linked-lead-where { order: 3; flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
  .linked-lead-pipeline { text-align: left; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ll-stage.is-won { background: rgba(46, 160, 90, .18); color: #8fd6a6; }
  :root:not([data-theme="light"]) .ll-stage.is-lost { background: rgba(209, 52, 56, .18); color: #f0a3a3; }
}
:root[data-theme="dark"] .ll-stage.is-won { background: rgba(46, 160, 90, .18); color: #8fd6a6; }
:root[data-theme="dark"] .ll-stage.is-lost { background: rgba(209, 52, 56, .18); color: #f0a3a3; }

/* Propiedades: a listing the user collaborates on (someone else's, accepted by signing the
   collaboration contract) has its own row colour and an accent bar, with a legend above the
   table, so it never looks like one of the user's own listings. Solid colours: the pinned
   actions cell sits over the scrolled columns. */
:root {
  --collab-row-bg: #e6eef6;
  --collab-row-hover: #d8e4ef;
  --collab-row-accent: #3b6e9a;
}
:root[data-theme="dark"] {
  --collab-row-bg: #1e2a33;
  --collab-row-hover: #24343f;
  --collab-row-accent: #7fb0dc;
}
.admin-table tbody tr.is-collab-row,
.admin-table tbody tr.is-collab-row > td.dt-actions {
  background: var(--collab-row-bg);
}
.admin-table tbody tr.is-collab-row:hover,
.admin-table tbody tr.is-collab-row:hover > td.dt-actions {
  background: var(--collab-row-hover);
}
.admin-table tbody tr.is-collab-row > td:first-child {
  box-shadow: inset 4px 0 0 var(--collab-row-accent);
}
.admin-table tbody tr.is-collab-row .collab-status--accepted {
  background: var(--collab-row-accent);
  color: #fff;
}
.admin-table tbody tr.is-collab-row .title-cell {
  flex-wrap: wrap;
  row-gap: 4px;
  min-width: 0;
}
/* Phones: the row is a card (mobile.css); the accent is its left edge. */
@media (max-width: 640px) {
  .admin-table tbody tr.is-collab-row {
    border-left: 5px solid var(--collab-row-accent);
  }
  .admin-table tbody tr.is-collab-row > td:first-child {
    box-shadow: none;
  }
  .admin-table tbody tr.is-collab-row > td.dt-actions {
    background: transparent;
    box-shadow: none;
  }
}
/* The legend: two labelled pills in the rows' own colours (never squares that read as checkboxes). */
.collab-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--space-2);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}
.collab-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
}
.collab-legend-item:has(.is-collab) {
  background: var(--collab-row-bg);
  border-color: var(--collab-row-accent);
}
.collab-legend-swatch {
  width: 6px;
  height: 18px;
  flex: none;
  border-radius: 999px;
  background: var(--color-border);
}
.collab-legend-swatch.is-collab {
  background: var(--collab-row-accent);
}
.row-leave-btn:hover,
.row-leave-btn:focus-visible {
  color: var(--color-error);
}

/* The property card opened read-only (admin.js setViewOnly): a listing the user collaborates on,
   or a broker's view of an admin's listing. Every field is disabled and greyed out; what only
   changes the listing (uploads, removing or moving photos, adding owners, saving, AI, inviting)
   is hidden; a banner says whose listing it is. */
.pf-view-only-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--collab-row-accent);
  border-left-width: 5px;
  background: var(--collab-row-bg);
  color: var(--color-ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}
.pf-view-only-banner[hidden] { display: none; }
.pf-view-only-banner svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--collab-row-accent); }
.pf-view-only-banner > span:last-child { min-width: 0; }
#property-modal.is-view-only :is(input, select, textarea):disabled {
  background: var(--color-cream-dim);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  -webkit-text-fill-color: var(--color-text-muted);
  opacity: 1;
  cursor: not-allowed;
}
#property-modal.is-view-only :is(input[type="checkbox"], input[type="radio"]):disabled {
  opacity: 1;
  accent-color: var(--collab-row-accent);
}
/* A greyed-out choice still reads at a glance: the chosen one is bold, the others are faded. */
#property-modal.is-view-only label:has(> :is(input[type="checkbox"], input[type="radio"]):disabled:checked) {
  font-weight: 700;
  color: var(--color-ink);
}
#property-modal.is-view-only label:has(> :is(input[type="checkbox"], input[type="radio"]):disabled:not(:checked)) {
  color: var(--color-text-muted);
}
#property-modal.is-view-only label:has(> :disabled) { cursor: not-allowed; }
#property-modal.is-view-only :is(
  #form-save-draft, #form-publish, .ai-text-tool, #collab-open-btn, .required-notice,
  .pf-dropzone, .photo-remove, .photo-drag-handle, .owner-picker, .owner-card-remove, .owner-card-create,
  #f-brochure, #f-brochure-remove, .autosave-status,
  .pf-sale-doc-actions, .pf-sale-docs-unsaved
) { display: none !important; }
#property-modal.is-view-only .image-preview-grid figure { cursor: default; }
#property-modal.is-view-only .leaflet-container { cursor: default; }
/* A collaborator never receives the property owner's data or the private notes. */
.pf-collab-private-note { display: none; }
#property-modal.is-collab-view .pf-owner-private { display: none; }
#property-modal.is-collab-view .private-info-banner { display: none; }
#property-modal.is-collab-view .pf-collab-private-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: var(--space-4) 0 var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--collab-row-bg);
  color: var(--color-ink);
  font-size: 0.85rem;
}
.pf-collab-private-note svg { flex: none; width: 18px; height: 18px; color: var(--collab-row-accent); }
.pf-collab-private-note > span:last-child { min-width: 0; }
.proptycenter-id-link.is-view-link { color: var(--collab-row-accent); }
