/* Scoped enhancement to existing Ziarama form controls. No extra UI theme. */
.zi-country-pick{position:relative;display:block;min-width:0;width:100%;font:inherit;color:inherit}
.zi-country-pick-native{position:absolute!important;left:0;top:0;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}
.zi-country-pick-trigger{display:flex;align-items:center;gap:9px;justify-content:space-between;width:100%;min-width:0;min-height:44px;border:1px solid currentColor;border-radius:10px;padding:9px 12px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
.zi-country-pick-trigger:focus-visible{outline:2px solid var(--zd-accent,var(--creator-gold,currentColor));outline-offset:2px}
.zi-country-pick-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.zi-country-pick-flag{width:24px;height:18px;flex:none;object-fit:cover;border-radius:2px;box-shadow:0 0 0 1px color-mix(in srgb,currentColor 20%,transparent)}
.zi-country-pick-pop{position:absolute;z-index:4000;top:calc(100% + 5px);left:0;right:0;min-width:min(340px,90vw);padding:9px;border:1px solid currentColor;border-radius:12px;background:var(--zd-paper,var(--creator-paper,Canvas));color:var(--zd-ink,var(--creator-ink,CanvasText));box-shadow:0 14px 40px rgb(0 0 0 / .25)}
.zi-country-pick-pop[hidden]{display:none!important}
.zi-country-pick-search{width:100%;min-height:40px;padding:8px 10px;border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;font:inherit}
.zi-country-pick-list{display:block;overflow:auto;max-height:min(300px,45vh);margin-top:6px}
.zi-country-pick-option{display:flex;align-items:center;gap:12px;width:100%;padding:10px 8px;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
.zi-country-pick-option[hidden]{display:none!important}
.zi-country-pick-option:hover,.zi-country-pick-option:focus-visible,.zi-country-pick-option[aria-selected=true]{background:color-mix(in srgb,currentColor 9%,transparent);outline:0}
.zi-country-pick-option:disabled{opacity:.5;cursor:not-allowed}
.zi-couple-phone-field{display:grid;gap:7px;min-width:0}
.zi-couple-phone-inline{display:flex;align-items:center;gap:8px;min-width:0}
.zi-couple-phone-prefix{display:flex;align-items:center;gap:5px;flex:none;border:1px solid color-mix(in srgb,currentColor 25%,transparent);border-radius:7px;padding:8px;min-height:40px;font-size:.9em}
.zi-couple-phone-inline input{flex:1;min-width:0}
body.dark-skin .zi-country-pick-pop,.dark .zi-country-pick-pop{background:var(--zd-paper,var(--creator-ink,Canvas));color:var(--zd-ink,var(--creator-paper,CanvasText))}
@media(max-width:600px){.zi-country-pick-pop{min-width:0}.zi-country-pick-option{padding:11px 8px}}

.zi-country-detect-bar{display:flex;flex-direction:column;align-items:flex-start;gap:5px;min-width:0}
.zi-country-detect-action{display:inline-flex;align-items:center;gap:5px;border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;padding:8px 11px;font:inherit;font-size:.82em;cursor:pointer}
.zi-country-detect-action:disabled{opacity:.55;cursor:wait}
.zi-country-detect-bar small{font-size:.75em;opacity:.77;line-height:1.4}

select[data-zi-country-flag]+.zi-country-native-flag{display:inline-block;margin-inline-start:7px;vertical-align:middle}
select[data-zi-country-flag]+.zi-country-native-flag[hidden]{display:none!important}

/* Country sits inside the existing telephone field, not as an extra form row.
   Inherit the form palette on light/dark layouts. */
.zi-phone-country-embedded{display:inline-flex;flex:0 0 auto;min-width:0;max-width:128px}
.zi-phone-country-embedded .zi-country-pick{width:auto}
.zi-country-pick--compact .zi-country-pick-trigger{min-height:42px;gap:6px;padding:8px;justify-content:flex-start;white-space:nowrap;border-radius:9px}
.zi-country-pick--compact .zi-country-pick-title{min-width:39px;max-width:54px;font-weight:700}
.zi-country-pick--compact .zi-country-pick-pop{left:0;right:auto;width:min(345px,calc(100vw - 36px));min-width:260px}
.zi-country-pick--compact .zi-country-pick-option{font-size:.88em;white-space:normal}
.zi-couple-phone-inline{align-items:stretch;width:100%}
.zi-couple-phone-inline>[data-zi-phone-number],.zi-couple-phone-inline>input[type=tel]{flex:1;min-width:0}
.zi-phone-country-feedback{display:block;line-height:1.4;margin-top:5px;opacity:.78;font-size:.77em}
.zi-couple-phone-field input[aria-invalid="true"]{outline:2px solid var(--zd-accent,#b77d56)}
.zi-phone-country-embedded .zi-country-pick-native{opacity:0}
.rsvp-phone-country-shell{display:flex;gap:0;align-items:stretch;width:100%;min-width:0;padding:0!important;overflow:visible}
.rsvp-phone-country-shell .zi-phone-country-embedded{max-width:146px;min-width:112px;border-inline-end:1px solid color-mix(in srgb,currentColor 15%,transparent)}
.rsvp-phone-country-shell .zi-country-pick-trigger{min-height:50px;height:100%;color:inherit;border:0;border-radius:14px 0 0 14px;padding-inline:12px;background:color-mix(in srgb,currentColor 4%,transparent)}
.rsvp-phone-country-shell input[type=tel]{min-width:0;flex:1;border:0!important;outline:0!important;box-shadow:none!important;background:transparent!important;padding-inline:14px!important;min-height:50px}
.rsvp-phone-country-shell:focus-within{box-shadow:0 0 0 2px color-mix(in srgb,var(--zd-accent,#b77d56) 35%,transparent)}
.rsvp-phone-country-shell .zi-country-pick--compact .zi-country-pick-pop{top:calc(100% + 8px)}
.zi-rsvp-phone-field{min-width:0}
@media(max-width:400px){.zi-country-pick--compact .zi-country-pick-trigger{padding:7px 5px;gap:4px}.zi-country-pick-flag{width:21px;height:16px}.zi-phone-country-embedded{max-width:108px}.zi-country-pick--compact .zi-country-pick-pop{min-width:240px}}

/* Phone validation mirrors the existing email affordance: neutral while
   incomplete, green only for a country-valid number, and red on a real mismatch. */
[data-zi-couple-phone].is-phone-valid .rsvp-phone-country-shell,
[data-zi-couple-phone].is-phone-valid .zi-couple-phone-inline{
  box-shadow:0 0 0 2px color-mix(in srgb,#238a57 48%,transparent);
  border-radius:14px;
}
[data-zi-couple-phone].is-phone-valid [data-zi-phone-feedback]{color:#17643f;opacity:1;font-weight:600}
[data-zi-couple-phone].is-phone-invalid .rsvp-phone-country-shell,
[data-zi-couple-phone].is-phone-invalid .zi-couple-phone-inline{
  box-shadow:0 0 0 2px color-mix(in srgb,#b44747 42%,transparent);
  border-radius:14px;
}
[data-zi-couple-phone].is-phone-invalid [data-zi-phone-feedback]{color:#9a3434;opacity:1}


/* Portal layer: the country list lives under <body>, never inside a card.
   This prevents overflow clipping and stacking-context bugs on mobile Safari. */
.zi-country-pick-backdrop{
  position:fixed;
  inset:0;
  z-index:2147482990;
  background:rgb(0 0 0 / .22);
  backdrop-filter:blur(1px);
  -webkit-backdrop-filter:blur(1px);
  touch-action:none;
}
.zi-country-pick-backdrop[hidden]{display:none!important}
.zi-country-pick-pop{
  position:fixed!important;
  z-index:2147483000!important;
  display:flex;
  flex-direction:column;
  box-sizing:border-box;
  overflow:hidden;
  min-width:0!important;
  max-width:calc(100vw - 24px);
  max-height:calc(100dvh - 24px);
  padding:10px;
  border-radius:14px;
  background:var(--zd-paper,var(--creator-paper,#fff));
  color:var(--zd-ink,var(--creator-ink,#221f1c));
  box-shadow:0 22px 70px rgb(0 0 0 / .30);
  overscroll-behavior:contain;
}
.zi-country-pick-pop .zi-country-pick-search{flex:0 0 auto}
.zi-country-pick-pop .zi-country-pick-list{
  flex:1 1 auto;
  min-height:0;
  max-height:none;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.zi-country-pick-pop--sheet{
  border-radius:18px;
  padding:12px;
  box-shadow:0 24px 80px rgb(0 0 0 / .36);
}
.zi-country-pick-pop--sheet .zi-country-pick-search{
  min-height:48px;
  font-size:16px; /* prevents Safari from zooming the page on focus */
}
.zi-country-pick-pop--sheet .zi-country-pick-option{
  min-height:48px;
  padding:12px 10px;
  font-size:15px;
}
@media(max-width:700px){
  .zi-country-pick-pop{max-width:none}
  .zi-country-pick-backdrop{background:rgb(0 0 0 / .28)}
}


/* Couple onboarding uses the exact RSVP single-field visual language. */
.zi-couple-phone-shell{
  border:1px solid color-mix(in srgb,#806a55 22%,transparent);
  border-radius:14px;
  background:rgba(255,252,247,.72);
  transition:box-shadow .18s ease,border-color .18s ease,background .18s ease;
}
.zi-couple-phone-shell .zi-phone-country-embedded{
  min-width:112px;
  max-width:146px;
}
.zi-couple-phone-shell .zi-country-pick-trigger{
  min-height:50px;
  height:100%;
  border:0!important;
  border-radius:14px 0 0 14px!important;
  padding-inline:12px!important;
}
.zi-couple-phone-shell input[type=tel]{
  min-height:50px!important;
  padding:0 14px!important;
  border:0!important;
  border-radius:0 14px 14px 0!important;
  background:transparent!important;
  box-shadow:none!important;
}
.zi-couple-phone-shell:focus-within{
  border-color:color-mix(in srgb,var(--zd-accent,#b77d56) 55%,transparent);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--zd-accent,#b77d56) 14%,transparent);
}
.zi-intake-field .zi-couple-phone-shell + .zi-phone-country-feedback,
.zi-access-phone .zi-phone-country-feedback{margin-top:7px}
.zi-tenant-source-note{
  width:min(720px,calc(100% - 28px));
  margin:18px auto 0;
  padding:10px 14px;
  border:1px solid rgba(101,70,43,.12);
  border-radius:999px;
  background:rgba(255,252,247,.82);
  text-align:center;
  color:#806a55;
  font:500 10px/1.4 var(--zi-sans,system-ui,sans-serif);
}
.zi-tenant-source-note span{margin-right:6px;opacity:.78}
.zi-tenant-source-note strong{color:#5f4632;font-weight:700}
@media(max-width:520px){
  .zi-couple-phone-shell .zi-phone-country-embedded{min-width:105px;max-width:124px}
  .zi-couple-phone-shell .zi-country-pick-trigger{padding-inline:9px!important}
  .zi-couple-phone-shell input[type=tel]{padding-inline:11px!important}
  .zi-tenant-source-note{border-radius:14px}
}

/* Theme-aware couple phone controls. The country list is portalled under <body>,
   so it needs an explicit dark palette instead of relying on local form variables. */
html[data-zi-theme="dark"] .zi-couple-phone-shell,
html[data-zi-theme="dark"] .rsvp-phone-country-shell{
  background:rgba(43,34,28,.92);
  border-color:rgba(225,189,113,.24);
  color:#f3e9dc;
  color-scheme:dark;
}
html[data-zi-theme="dark"] .zi-couple-phone-shell .zi-country-pick-trigger,
html[data-zi-theme="dark"] .rsvp-phone-country-shell .zi-country-pick-trigger{
  background:rgba(255,255,255,.025);
  color:#f3e9dc;
}
html[data-zi-theme="dark"] .zi-couple-phone-shell input[type=tel],
html[data-zi-theme="dark"] .rsvp-phone-country-shell input[type=tel]{
  color:#f3e9dc!important;
  caret-color:#e1bd71;
}
html[data-zi-theme="dark"] .zi-couple-phone-shell input[type=tel]::placeholder,
html[data-zi-theme="dark"] .rsvp-phone-country-shell input[type=tel]::placeholder{
  color:#b9a89a;
  opacity:.82;
}
html[data-zi-theme="dark"] [data-zi-couple-phone] .zi-phone-country-feedback{
  color:#c7b7aa;
}
html[data-zi-theme="dark"] .zi-country-pick-pop{
  background:#211b18;
  color:#f3e9dc;
  border-color:#635044;
  color-scheme:dark;
}
html[data-zi-theme="dark"] .zi-country-pick-pop .zi-country-pick-search{
  background:#2b2420;
  color:#f3e9dc;
  border-color:#635044;
}
html[data-zi-theme="dark"] .zi-country-pick-pop .zi-country-pick-option:hover,
html[data-zi-theme="dark"] .zi-country-pick-pop .zi-country-pick-option:focus-visible,
html[data-zi-theme="dark"] .zi-country-pick-pop .zi-country-pick-option[aria-selected=true]{
  background:rgba(225,189,113,.12);
}

