/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-md);
  border: 1px solid transparent; background: var(--c-surface-2); color: var(--c-ink);
  font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.btn--soft { background: var(--c-accent-soft); color: var(--c-accent); }
.btn--outline { background: var(--c-surface); border-color: var(--c-line-2); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--c-neg-soft); color: var(--c-neg); }
.btn--pos { background: var(--c-pos-soft); color: var(--c-pos); }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 6px 0; min-height: 32px; color: var(--c-accent); font-weight: 650; font-size: var(--fs-sm); }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--c-line); background: var(--c-surface);
  display: inline-grid; place-items: center; flex-shrink: 0; color: var(--c-ink); padding: 0;
}
.lang-btn { width: auto; padding: 0 10px; gap: 4px; display: inline-flex; align-items: center; font-weight: 800; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- Cards & lists ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card--pad { padding: 16px; }
.card + .card { margin-top: var(--gap); }
.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--c-line); color: inherit; min-height: 56px; }
.list__item:first-child { border-top: 0; }
a.list__item:hover { background: var(--c-surface-2); text-decoration: none; }
.list__body { flex: 1; min-width: 0; }
.list__title { font-weight: 650; display: block; }
.list__sub { font-size: var(--fs-xs); color: var(--c-muted); display: block; margin-top: 2px; }
.list__end { text-align: right; flex-shrink: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }
.section-title > a { display: inline-flex; align-items: center; min-height: 32px; font-size: var(--fs-sm); font-weight: 650; }
.page-title { margin: 4px 0 16px; }
.page-title p { color: var(--c-muted); margin: 4px 0 0; }

/* ---------- Avatars & chips ---------- */
.avatar {
  --c: var(--c-accent); width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: inline-grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c) 16%, var(--c-surface)); color: var(--c); font-weight: 800; font-size: 13px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; border-radius: 10px; font-size: 11.5px; }
.avatar--lg { width: 64px; height: 64px; border-radius: 20px; font-size: 20px; }
.emoji-tile { width: 42px; height: 42px; border-radius: 13px; background: var(--c-surface-2); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--c-surface-2); color: var(--c-muted); white-space: nowrap; }
.chip--accent { background: var(--c-accent-soft); color: var(--c-accent); }
.chip--pos { background: var(--c-pos-soft); color: var(--c-pos); }
.chip--neg { background: var(--c-neg-soft); color: var(--c-neg); }
.chip--warn { background: var(--c-warn-soft); color: var(--c-warn); }

/* ---------- Amounts ---------- */
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount--pos { color: var(--c-pos); }
.amount--neg { color: var(--c-neg); }
.amount--big { font-size: 28px; letter-spacing: -.02em; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field > label, .field__label { display: block; font-weight: 650; font-size: var(--fs-sm); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: var(--r-md);
  border: 1px solid var(--c-line-2); background: var(--c-surface); outline: none; font-size: 16px; /* 16px: avoids iOS zoom */
}
.input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
textarea.input { min-height: 90px; resize: vertical; }
.input--big { font-size: 26px; font-weight: 800; min-height: 58px; }
.hint { display: block; font-size: var(--fs-xs); color: var(--c-muted); margin-top: 5px; line-height: 1.45; }
.guide { font-size: var(--fs-xs); color: var(--c-muted); background: var(--c-surface-2); border-radius: var(--r-sm); padding: 8px 10px; margin: 6px 0 10px; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--c-accent); flex-shrink: 0; }
.check--box { border: 1px solid var(--c-line-2); border-radius: var(--r-md); padding: 12px; background: var(--c-surface); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px; }
@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child { grid-column: 1 / -1; }
  .grid-2--stack { grid-template-columns: 1fr; }
}
.alert { padding: 11px 14px; border-radius: var(--r-md); font-size: var(--fs-sm); margin-bottom: 14px; }
.alert--error { background: var(--c-neg-soft); color: var(--c-neg); }
.alert--success { background: var(--c-pos-soft); color: var(--c-pos); }
.alert--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.alert--info { background: var(--c-accent-soft); color: var(--c-accent); }
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }

/* Phone: country (flag + code) + number + messaging apps */
.phone { display: grid; grid-template-columns: 116px 1fr; gap: 8px; }
.apps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.app-chip { --ac: var(--c-accent); position: relative; border: 1.5px solid var(--c-line-2); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; color: var(--c-muted); cursor: pointer; background: var(--c-surface); user-select: none; }
.app-chip input { position: absolute; opacity: 0; pointer-events: none; }
.app-chip:has(input:checked) { border-color: var(--ac); color: var(--ac); background: color-mix(in srgb, var(--ac) 10%, var(--c-surface)); }
.app-chip:focus-within { outline: 2px solid var(--ac); outline-offset: 1px; }
.contact { display: flex; flex-wrap: wrap; gap: 5px; }
.contact__btn { --ac: var(--c-accent); display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border-radius: 8px; background: var(--ac); color: #fff; font-size: 12px; font-weight: 700; }
.contact__btn:hover { text-decoration: none; filter: brightness(1.05); }
.contact__btn--label { background: var(--c-surface-2); color: var(--c-muted); }

/* Segmented control & tabs */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--c-surface-2); border-radius: var(--r-md); }
.seg__item { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; line-height: 1.2; text-align: center; padding: 6px 6px; border-radius: 9px; font-weight: 700; font-size: var(--fs-sm); color: var(--c-muted); border: 0; background: none; min-height: 38px; }
.seg__item--on, .seg__item:has(input:checked) { background: var(--c-surface); color: var(--c-accent); box-shadow: var(--shadow); }
.seg__item input { position: absolute; opacity: 0; pointer-events: none; }
.seg__item:hover { text-decoration: none; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--c-line); margin: 18px 0 14px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.tabs::-webkit-scrollbar { display: none; }
.tabs__item { padding: 10px 12px; font-weight: 700; font-size: var(--fs-sm); color: var(--c-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs__item:hover { text-decoration: none; color: var(--c-ink); }
.tabs__item--active { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--c-line-2); background: var(--c-surface); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; color: var(--c-muted); }
.pill:hover { text-decoration: none; }
.pill--on { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-accent); }

/* Collapsible sections (detailed profile) */
.fold { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); margin-bottom: 10px; overflow: hidden; }
.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "›"; margin-left: auto; font-size: 20px; color: var(--c-muted); transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold__body { padding: 4px 14px 14px; border-top: 1px solid var(--c-line); }
.fold__icon { width: 32px; height: 32px; border-radius: 10px; background: var(--c-surface-2); display: grid; place-items: center; }

/* Stats & empty states */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--c-surface-2); border-radius: var(--r-md); padding: 12px; }
.stat__label { font-size: var(--fs-xs); color: var(--c-muted); }
.stat__value { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 16px; color: var(--c-muted); }
.empty__icon { font-size: 40px; }
.empty h3 { color: var(--c-ink); margin-top: 8px; }

/* Dialog (language menu, confirmations) */
.dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(420px, calc(100vw - 24px)); background: var(--c-surface); color: var(--c-ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(15, 15, 35, .45); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--c-line); font-weight: 800; }
.dialog__body { padding: 14px 16px; }
.dialog__foot { display: flex; gap: 8px; padding: 12px 16px 16px; }
.dialog__foot .btn { flex: 1; }
.lang-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; background: none; border-radius: var(--r-md); text-align: left; font-weight: 650; }
.lang-option:hover { background: var(--c-surface-2); }
.lang-option--on { background: var(--c-accent-soft); color: var(--c-accent); }
.lang-option__code { width: 34px; height: 28px; border-radius: 8px; background: var(--c-surface-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: var(--c-muted); }

/* Photos */
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photo { width: 76px; height: 76px; border-radius: var(--r-md); overflow: hidden; background: var(--c-surface-2); position: relative; border: 1px solid var(--c-line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo--add { display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--c-muted); cursor: pointer; border-style: dashed; }
.photo--add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast-area { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px); z-index: 50; width: min(440px, calc(100vw - 24px)); }
@media (min-width: 1024px) { .toast-area { bottom: 24px; } }
.toast { background: var(--c-ink); color: var(--c-bg); padding: 12px 16px; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
