/* Citiwell ID — sign-in and message pages. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-strong); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 12px; height: 12px; }

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; will-change: transform; }
.glow-a { width: 46vmax; height: 46vmax; left: -14vmax; top: -18vmax; background: radial-gradient(circle, rgba(29, 143, 189, 0.55), transparent 65%); animation: drift-a 26s ease-in-out infinite alternate; }
.glow-b { width: 38vmax; height: 38vmax; right: -12vmax; top: 18vh; background: radial-gradient(circle, rgba(72, 196, 184, 0.4), transparent 65%); animation: drift-b 30s ease-in-out infinite alternate; }
.glow-c { width: 30vmax; height: 30vmax; left: 30vw; bottom: -16vmax; background: radial-gradient(circle, rgba(255, 107, 112, 0.28), transparent 65%); animation: drift-c 34s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-6vmax, 8vmax) scale(0.94); } }
@keyframes drift-c { to { transform: translate(-8vmax, -4vmax) scale(1.1); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .glow { opacity: 0.35; } }
:root[data-theme="dark"] .glow { opacity: 0.35; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; box-shadow: 0 8px 20px -10px rgba(21, 115, 168, 0.8); }
.brand-word { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 6px; }
.brand-id { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 7px; border-radius: 7px; color: var(--brand-strong); background: var(--brand-soft); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--glass); color: var(--brand);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: var(--brand); }
.theme-toggle .icon { width: 18px; height: 18px; }

/* language switcher */
.lang { position: relative; }
.lang-button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lang-button:hover { border-color: var(--border-strong); }
.lang-button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: var(--brand); }
.lang-button .icon:first-child { color: var(--brand); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 210px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 50px -20px rgba(14, 29, 42, 0.35);
  animation: pop 0.14s ease-out;
}
.lang-menu li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  font-weight: 600; font-size: 15px; cursor: pointer; outline: none;
}
.lang-menu li:hover, .lang-menu li:focus-visible { background: var(--surface-2); }
.lang-code { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; background: var(--surface-3); color: var(--muted); }
.lang-check { margin-left: auto; color: var(--brand); opacity: 0; }
.lang-menu li[aria-selected="true"] .lang-check { opacity: 1; }
.lang-menu li[aria-selected="true"] .lang-code { background: var(--brand-soft); color: var(--brand-strong); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }

/* ---------- stage & card ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px 16px 12px; }
.card {
  position: relative;
  width: min(100%, 448px);
  padding: 34px 34px 30px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  animation: rise 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card-wide { width: min(100%, 580px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.view { animation: slide 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slide { from { opacity: 0; transform: translateX(10px); } }

.title { margin: 0 0 8px; font-size: clamp(26px, 6.4vw, 31px); line-height: 1.14; font-weight: 800; letter-spacing: -0.025em; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; text-wrap: pretty; }
.muted { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

[data-mode="code"] [data-mode-only="password"],
[data-mode="password"] [data-mode-only="code"] { display: none !important; }

/* ---------- fields ---------- */
.field { margin: 22px 0 0; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
.label { display: block; margin: 0 0 8px; padding: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.01em; color: var(--text); }

.phone {
  position: relative; display: flex; align-items: stretch;
  height: 58px; border-radius: var(--radius-field);
  border: 1.5px solid var(--border); background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.phone:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.phone.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.country {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 10px 0 14px; border: 0; background: transparent;
  border-right: 1px solid var(--border); border-radius: var(--radius-field) 0 0 var(--radius-field);
  font-weight: 800; font-size: 16px;
}
.country:focus-visible { outline: none; background: var(--brand-soft); }
.country .icon { color: var(--faint); }
.flag { width: 22px; height: 16px; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); flex-shrink: 0; }
.dial { font-variant-numeric: tabular-nums; }
.phone-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  padding: 0 16px; font-size: 19px; font-weight: 700; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.phone-input::placeholder { color: var(--faint); font-weight: 600; opacity: 0.8; }

.country-menu {
  position: absolute; left: -1.5px; right: -1.5px; top: calc(100% + 8px); z-index: 25;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 30px 60px -24px rgba(14, 29, 42, 0.4);
  overflow: hidden; animation: pop 0.14s ease-out;
}
.country-search { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--faint); }
.country-search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; padding: 4px 0; }
.country-menu ul { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.country-menu li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; cursor: pointer; font-weight: 600; outline: none; }
.country-menu li:hover, .country-menu li:focus-visible { background: var(--surface-2); }
.country-menu li[aria-selected="true"] { background: var(--brand-soft); }
.country-menu .country-dial { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }

.secret { position: relative; }
.secret input {
  width: 100%; height: 58px; padding: 0 56px 0 16px;
  border-radius: var(--radius-field); border: 1.5px solid var(--border); background: var(--surface-2);
  font-size: 18px; font-weight: 600; letter-spacing: 0.02em; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.secret input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.reveal {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted);
}
.reveal:hover { background: var(--surface-3); color: var(--text); }
.reveal:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---------- messenger picker ---------- */
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.channel {
  --channel: var(--brand);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 16px 6px 13px; border-radius: 18px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; user-select: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.channel[data-channel="whatsapp"] { --channel: var(--whatsapp); }
.channel[data-channel="viber"] { --channel: var(--viber); }
.channel[data-channel="telegram"] { --channel: var(--telegram); }
.channel input { position: absolute; opacity: 0; pointer-events: none; }
.channel:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.channel-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--channel); color: #fff;
  box-shadow: 0 10px 18px -10px var(--channel);
  transition: transform 0.2s;
}
.channel-icon .icon { width: 24px; height: 24px; }
.channel-name { font-size: 13px; font-weight: 800; }
.channel-tick {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--channel); color: #fff;
  opacity: 0; transform: scale(0.5); transition: opacity 0.15s, transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.channel-tick .icon { stroke-width: 3.5; }
.channel.is-checked,
.channel:has(input:checked) {
  border-color: var(--channel);
  background: color-mix(in srgb, var(--channel) 7%, var(--surface));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--channel) 16%, transparent);
}
.channel.is-checked .channel-tick,
.channel:has(input:checked) .channel-tick { opacity: 1; transform: scale(1); }
.channel.is-checked .channel-icon,
.channel:has(input:checked) .channel-icon { transform: scale(1.06); }
.channel:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.channel.is-unavailable { opacity: 0.5; cursor: not-allowed; }
.channel.is-unavailable:hover { transform: none; }
.channel.is-unavailable .channel-name::after { content: attr(data-note); display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.2; margin-top: 2px; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 56px; margin-top: 24px; padding: 0 20px;
  border: 0; border-radius: var(--radius-field);
  font-size: 16px; font-weight: 800; letter-spacing: 0.005em; text-decoration: none;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s, background 0.15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #25a6d6 0%, #1d8fbd 45%, #146f9f 100%);
  box-shadow: 0 14px 28px -14px rgba(20, 111, 159, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }
.btn-primary .icon { transition: transform 0.2s; }
.btn-primary:hover .icon { transform: translateX(3px); }
.btn-soft { color: var(--brand-strong); background: var(--brand-soft); }
.btn-soft:hover { filter: brightness(0.97); }
.btn-ghost { color: var(--text); background: transparent; border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn[disabled] { opacity: 0.6; cursor: default; transform: none; filter: none; }
.spinner {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: none;
}
.btn-ghost .spinner, .btn-soft .spinner { border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-top-color: var(--brand); }
.btn.is-loading > :not(.spinner) { visibility: hidden; }
.btn.is-loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.switch {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 14px auto 0; padding: 9px 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--brand-strong); font-size: 14px; font-weight: 700; text-decoration: none;
}
.switch:hover { background: var(--brand-soft); }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
form > .switch, .stack > .switch { display: flex; width: fit-content; }


/* ---------- alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 18px 0 0; padding: 12px 14px; border-radius: 14px;
  font-size: 14px; font-weight: 600; line-height: 1.45;
  color: var(--danger); background: var(--danger-soft);
  animation: pop 0.18s ease-out;
}
.alert .icon { margin-top: 1px; }
.alert a { color: inherit; font-weight: 800; }
.alert-info { color: var(--brand-strong); background: var(--brand-soft); }
.alert-success { color: var(--success); background: var(--success-soft); }
.alert-warn { color: var(--warn); background: var(--warn-soft); }

/* ---------- verify screen ---------- */
[data-screen="verify"] { text-align: center; }
.back {
  position: absolute; top: 18px; left: 18px;
  display: grid; place-items: center; width: 42px; height: 42px;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text);
  transition: background 0.15s;
}
.back:hover { background: var(--surface-3); }
.back:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.sent-badge {
  --channel: var(--brand);
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 2px auto 18px; border-radius: 50%;
  background: var(--channel); color: #fff;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--channel) 15%, transparent), 0 14px 26px -14px var(--channel);
}
.sent-badge[data-channel="whatsapp"] { --channel: var(--whatsapp); }
.sent-badge[data-channel="viber"] { --channel: var(--viber); }
.sent-badge[data-channel="telegram"] { --channel: var(--telegram); }
.sent-badge .icon { width: 28px; height: 28px; }
.delivery-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--success); }

.otp { position: relative; height: 66px; margin: 24px auto 0; max-width: 380px; }
.otp-input {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; font-size: 16px; caret-color: transparent;
  cursor: text;
}
.otp-cells { display: flex; gap: 9px; height: 100%; }
.otp-cell {
  position: relative; display: grid; place-items: center; flex: 1 1 0; min-width: 0;
  border-radius: var(--radius-field); border: 1.5px solid var(--border); background: var(--surface-2);
  font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.15s;
}
.otp-cell.is-filled { background: var(--surface); border-color: var(--border-strong); }
.otp.is-focused .otp-cell.is-active { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.otp.is-focused .otp-cell.is-active:empty::after { content: ""; width: 2px; height: 28px; border-radius: 2px; background: var(--brand); animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.otp.has-error .otp-cell { border-color: var(--danger); background: var(--danger-soft); }
.otp.has-error { animation: shake 0.38s; }
.otp.is-done .otp-cell { border-color: var(--success); background: var(--success-soft); }
.otp.is-locked .otp-cell { opacity: 0.45; }
/* The code reads as 123-456, like in the message. */
.otp-sep { flex: 0 0 12px; align-self: center; height: 3px; border-radius: 2px; background: var(--muted); opacity: 0.6; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.resend { margin-top: 16px; min-height: 40px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--muted); }
.resend .switch { margin: 0; }
.resend-timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.alt-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
.alt-row .switch { margin: 0; padding: 8px 10px; }
.hint { margin: 14px auto 0; max-width: 340px; font-size: 12.5px; line-height: 1.55; color: var(--faint); }

[data-screen="second"] .view-head { text-align: center; }

/* ---------- done ---------- */
.view-done { text-align: center; padding: 18px 0 8px; }
.done-mark { width: 88px; height: 88px; margin: 0 auto 20px; }
.done-mark svg { width: 100%; height: 100%; }
.done-mark circle { fill: var(--success-soft); stroke: var(--success); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.6s ease-out forwards; }
.done-mark path { fill: none; stroke: var(--success); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.35s 0.45s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- states ---------- */
[data-view="noaccess"], [data-view="message"] { text-align: center; }
.state-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 4px auto 20px; border-radius: 50%; }
.state-icon .icon { width: 32px; height: 32px; }
.state-warn { color: var(--warn); background: var(--warn-soft); }
.state-ok { color: var(--success); background: var(--success-soft); }
.stack { display: grid; gap: 10px; margin-top: 24px; }
.stack .btn { margin-top: 0; }
[data-view="noaccess"] .alert, [data-view="message"] .alert { text-align: left; }

/* ---------- "как войти": a superuser enters as themself or as someone with access ---------- */
[data-view="actas"] .view-head { margin-bottom: 20px; }
.options { display: grid; gap: 10px; }
.option, .person {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  text-align: left; text-decoration: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}
.option { min-height: 76px; padding: 14px 16px; border-radius: 20px; }
.person { padding: 10px 14px; border-radius: 16px; }
.option-self { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); background: var(--brand-soft); }
.option:hover:not([disabled]), .person:hover { border-color: var(--brand); }
.option:active:not([disabled]) { transform: scale(0.99); }
.option-people:hover:not([disabled]), .person:hover { background: var(--surface-2); }
.option:focus-visible, .person:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.option[disabled] { cursor: default; opacity: 0.65; }
.option-icon { display: grid; flex-shrink: 0; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3); color: var(--brand-strong); }
.who { display: grid; flex: 1; min-width: 0; }
.who b { overflow: hidden; font-size: 15.5px; font-weight: 800; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.option .who b { font-size: 16.5px; }
.who small { overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.go { color: var(--faint); transition: transform 0.2s, color 0.15s; }
.option-self .go, .option:hover:not([disabled]) .go, .person:hover .go, .person:focus-visible .go { color: var(--brand); }
.option:hover:not([disabled]) .go, .person:hover .go { transform: translateX(3px); }
.option .spinner, .person .spinner { right: 16px; border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-top-color: var(--brand); }
.option.is-loading .go, .person.is-loading .go { visibility: hidden; }
.option.is-loading .spinner, .person.is-loading .spinner { display: block; }
.person.is-hinted { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

.avatar { display: grid; flex-shrink: 0; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.option .avatar { width: 44px; height: 44px; font-size: 15px; }
.avatar.c0 { background: linear-gradient(135deg, #27a3d6, #1573a8); }
.avatar.c1 { background: linear-gradient(135deg, #48c4b8, #1d8a80); }
.avatar.c2 { background: linear-gradient(135deg, #ff8f86, #db4f58); }
.avatar.c3 { background: linear-gradient(135deg, #a191f5, #6653d6); }
.avatar.c4 { background: linear-gradient(135deg, #f4b24a, #cf7f12); }
.avatar.c5 { background: linear-gradient(135deg, #6fc27d, #36964a); }
.avatar-self { box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 5px color-mix(in srgb, var(--brand) 45%, transparent); }

/* the list of people: a header with the way back, search, salon filters */
.screen-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.screen-head .back { position: static; flex-shrink: 0; margin-top: 2px; }
.screen-head .title { font-size: clamp(24px, 5.6vw, 28px); margin-bottom: 4px; }
.people-search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px;
  border-radius: var(--radius-field); border: 1.5px solid var(--border); background: var(--surface-2); color: var(--faint);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.people-search:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.people-search input { flex: 1; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; font-size: 16px; }
.people-filters { display: flex; gap: 6px; margin: 12px -4px 0; padding: 2px 4px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.people-filters::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; flex-shrink: 0; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 700; white-space: nowrap; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chip b { font-weight: 800; opacity: 0.55; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.people { max-height: min(50vh, 440px); margin: 12px -6px 0; padding: 3px 6px 6px; overflow-y: auto; overscroll-behavior: contain; }
.people-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.people-label { margin: 16px 2px 8px; color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.people > .people-label:first-child { margin-top: 2px; }
.people-empty { margin: 16px 0 6px; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; }

.no-access { margin-top: 16px; border-radius: 14px; background: var(--surface-2); }
.no-access summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--muted); font-size: 13.5px; font-weight: 700; list-style: none; cursor: pointer; border-radius: 14px; }
.no-access summary::-webkit-details-marker { display: none; }
.no-access summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.no-access .chev { margin-left: auto; transition: transform 0.2s; }
.no-access[open] .chev { transform: rotate(180deg); }
.no-access p { margin: 0 14px 10px; color: var(--muted); font-size: 13px; }
.no-access ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 14px 14px; list-style: none; }
.no-access li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; }
.no-access li .avatar { width: 22px; height: 22px; font-size: 9.5px; opacity: 0.75; }

.actas-note { display: flex; align-items: flex-start; gap: 8px; margin: 18px 2px 0; color: var(--faint); font-size: 12.5px; line-height: 1.5; }
.actas-note .icon { margin-top: 2px; }
.actas-foot { display: flex; justify-content: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.actas-foot .switch { margin: 0; color: var(--muted); }
.actas-foot .switch:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- desktop: the sign-in form next to a word about Citiwell ID ---------- */
.brand-panel { display: none; }
.brand-panel .brand { gap: 14px; }
.brand-panel .brand-mark { width: 60px; height: 60px; border-radius: 18px; box-shadow: 0 16px 34px -16px rgba(21, 115, 168, 0.9); }
.brand-panel .brand-word { font-size: 26px; }
.brand-panel .brand-id { font-size: 13px; padding: 4px 9px; }
.brand-panel-title { margin: 30px 0 0; font-size: clamp(34px, 3.3vw, 46px); line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; text-wrap: balance; }
.brand-points { display: grid; gap: 18px; margin: 32px 0 0; padding: 0; list-style: none; }
.brand-points li { display: flex; align-items: flex-start; gap: 14px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.point-icon { display: grid; flex-shrink: 0; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- footer ---------- */
.footnote {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 14px 16px max(18px, env(safe-area-inset-bottom));
  font-size: 12.5px; font-weight: 600; color: var(--faint);
}
.footnote .icon { color: var(--success); }
.footnote .dot { opacity: 0.6; }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .topbar { padding: max(14px, env(safe-area-inset-top)) 16px 4px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-word { font-size: 17px; }
  .lang-button { height: 38px; padding: 0 10px 0 12px; font-size: 13px; }
  .theme-toggle { width: 38px; height: 38px; }
  .stage { padding: 12px 12px 4px; align-items: start; }
  .card { padding: 26px 20px 22px; border-radius: 24px; }
  .back { top: 14px; left: 14px; }
  .channel { padding: 14px 4px 11px; }
  .channel-icon { width: 40px; height: 40px; }
  .otp-cells { gap: 7px; }
  .otp-cell { font-size: 24px; border-radius: 14px; }
}

@media (max-width: 360px) {
  .country { padding: 0 6px 0 10px; gap: 6px; }
  .phone-input { padding: 0 12px; font-size: 17px; }
}

/* ---------- phones: the card becomes a sheet to the bottom of the screen ---------- */
@media (max-width: 599px) {
  .stage { place-items: stretch; padding: 10px 0 0; }
  .card, .card-wide {
    width: 100%; min-height: 100%;
    padding: 28px 20px 20px;
    border-width: 1px 0 0; border-radius: 28px 28px 0 0;
    box-shadow: 0 -14px 40px -28px rgba(14, 29, 42, 0.45);
  }
  .footnote { background: var(--surface); padding-top: 6px; }
  .people { max-height: none; margin: 12px 0 0; padding: 0; overflow: visible; }
  .who small { white-space: normal; }
  .option { min-height: 70px; padding: 12px 14px; }
}
/* short phones: everything up to the button stays above the keyboard */
@media (max-width: 599px) and (max-height: 720px) {
  .card { padding-top: 22px; }
  .title { font-size: 25px; margin-bottom: 4px; }
  .lead { font-size: 14px; }
  .field { margin-top: 16px; }
  .phone { height: 54px; }
  .channel { padding: 10px 4px 9px; }
  .channel-icon { width: 36px; height: 36px; }
  .btn { height: 52px; margin-top: 18px; }
  .otp { height: 58px; margin-top: 18px; }
}

/* ---------- tablets: a larger card ---------- */
@media (min-width: 600px) and (max-width: 1023px) {
  .stage { padding: 28px 28px 20px; }
  .card { width: min(100%, 520px); padding: 42px 44px 36px; border-radius: 32px; }
  .card-wide { width: min(100%, 640px); }
  .title { font-size: 34px; }
  .lead { font-size: 16px; }
  .phone { height: 62px; }
  .btn { height: 60px; font-size: 17px; }
  .otp { height: 72px; max-width: 430px; }
  .channel-icon { width: 48px; height: 48px; }
}

/* ---------- landscape phones and low windows: less air ---------- */
@media (max-height: 520px) and (min-width: 600px) {
  .topbar { padding-top: 10px; padding-bottom: 4px; }
  .stage { padding: 8px 24px; }
  .card { padding: 24px 32px 22px; }
  .title { font-size: 26px; }
}

/* ---------- desktops and landscape tablets: the form next to a word about Citiwell ID ---------- */
@media (min-width: 1024px) and (min-height: 600px) {
  .with-panel .stage {
    grid-template-columns: minmax(0, 460px) minmax(0, 470px);
    justify-content: center; align-items: center;
    column-gap: clamp(56px, 8vw, 140px);
    padding: 24px 48px 16px;
  }
  .with-panel .brand-panel { display: block; justify-self: stretch; }
  .with-panel .topbar .brand { visibility: hidden; }
  .with-panel .card { width: 100%; }
}
@media (min-width: 1600px) {
  .card { width: min(100%, 480px); }
  .with-panel .stage { grid-template-columns: minmax(0, 520px) minmax(0, 480px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .glow { animation: none; }
}

/* ---------- "Подключение ИИ к Citiwell ID" (MCP consent) ---------- */
.consent-list { margin: 18px 0 4px; padding-left: 20px; display: grid; gap: 6px; text-align: left; font-size: 14.5px; line-height: 1.5; color: var(--text); }
[data-view="message"] .consent-list + .hint { margin-top: 10px; }
