/* ── Template editors (Links page / Blog) ─────────────────────────────────── */

/* Compact Profile editor: Telegram disclosure rows open the existing floating
   sheet primitive. The editor state remains in LinksEditor; only presentation
   moves in and out of the sheets. */
.profile-editor-menu .nav-row + .nav-row::before { left: 16px; right: 16px; }
.profile-editor-nav-row { min-height: 60px; }
.profile-editor-nav-row__copy,
.profile-section-sheet__copy {
  display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 1px; text-align: left;
}
.profile-editor-nav-row__copy strong,
.profile-section-sheet__copy strong {
  overflow: hidden; color: var(--text); font-size: 17px; line-height: 21px;
  font-weight: 510; letter-spacing: -0.43px; text-overflow: ellipsis; white-space: nowrap;
}
.profile-editor-nav-row__copy small,
.profile-section-sheet__copy small {
  overflow: hidden; color: var(--hint); font-size: 12.5px; line-height: 17px;
  text-overflow: ellipsis; white-space: nowrap;
}
.profile-sheet-fields { margin-bottom: 18px; }
.profile-sheet-about-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 3px 8px;
}
.profile-sheet-about-head strong { color: var(--text); font-size: 15px; font-weight: 590; }
.profile-sheet-about-head span { color: var(--hint); font-size: 12px; text-align: right; }
.profile-section-sheet__row {
  position: relative; display: flex; min-height: 60px; align-items: stretch;
}
.profile-section-sheet__open {
  display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px;
  padding: 8px 4px 8px 16px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; -webkit-tap-highlight-color: transparent;
}
.profile-section-sheet__open:active,
.profile-section-sheet__switch:active { background: color-mix(in srgb, var(--text) 6%, transparent); }
.profile-section-sheet__toggle {
  width: 88px; flex: none; display: grid; place-items: center;
  padding: 0 12px; border: 0; background: none;
}
.profile-section-sheet__toggle:disabled,
.profile-section-sheet__switch:disabled { opacity: 0.5; }
.profile-section-sheet__switch { min-height: 60px; gap: 12px; }
.profile-section-sheet__row + .profile-section-sheet__switch::before,
.profile-section-sheet__switch + .profile-section-sheet__switch::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  height: 0.5px; background: var(--separator);
}
.profile-action-sheet__row { position: relative; display: flex; min-height: 66px; align-items: stretch; }
.profile-action-sheet__row + .profile-action-sheet__row::before {
  content: ""; position: absolute; top: 0; left: 63px; right: 0;
  height: 0.5px; background: var(--separator);
}
.profile-action-sheet__open {
  display: flex; min-width: 0; flex: 1; align-items: center; gap: 11px;
  padding: 8px 4px 8px 14px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; -webkit-tap-highlight-color: transparent;
}
.profile-action-sheet__open:active { background: color-mix(in srgb, var(--text) 6%, transparent); }
.profile-action-sheet__toggle {
  width: 82px; flex: none; display: grid; place-items: center;
  padding: 0 12px; border: 0; background: none;
}
.profile-action-sheet__icon {
  display: grid; width: 38px; height: 38px; flex: none; place-items: center;
  border-radius: 11px; color: #fff;
}
.profile-action-sheet__icon--message { background: #2aabee; }
.profile-action-sheet__icon--tip { background: #8b5cf6; }
.profile-action-sheet__icon svg { width: 22px; height: 22px; fill: currentColor; }
.profile-action-sheet__icon svg.profile-tip-wallet-icon { width: 22px; height: 18px; }
.profile-action-sheet__copy {
  display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 1px; text-align: left;
}
.profile-action-sheet__copy strong {
  overflow: hidden; color: var(--text); font-size: 17px; line-height: 21px;
  font-weight: 510; letter-spacing: -0.43px; text-overflow: ellipsis; white-space: nowrap;
}
.profile-action-sheet__copy small {
  overflow: hidden; color: var(--hint); font-size: 12.5px; line-height: 17px;
  text-overflow: ellipsis; white-space: nowrap;
}
.profile-links-sheet .link-card { margin-bottom: 10px; }
.profile-field--invalid { color: var(--destructive) !important; }
.profile-field-error { margin: 6px 16px 10px; color: var(--destructive); font-size: 13px; line-height: 17px; }
.profile-field-error--standalone { margin: 2px 4px 10px; }

/* "New tonsite" chooser rows: two-line nav-rows with an emoji tile. */
.choice-row { min-height: 60px; }
.choice-row__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; text-align: left; }
.choice-row__title { font-size: 1rem; color: var(--text); }
.choice-row__sub { font-size: 0.8rem; color: var(--subtitle); }

/* iOS grouped-table field rows (Telegram UI Kit "Text Field", node 6211:5213:
   52px full-width row, 17px / -0.43px text, tertiary placeholder, 0.5px hairline
   inset 16px). Inputs are transparent — the section-card IS the field chrome. */
.field-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
/* Pin-a-bag id field: a soft rounded pill (no hard border), paste button inside on the
   right. 16px+ font so iOS never zooms on focus; no outline on focus. */
.import-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 6px 6px 6px 18px;
  background: var(--section-bg);
  border-radius: 999px;
}
.import-field__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
.import-field__input::placeholder { color: var(--subtitle); opacity: 0.55; }
.import-field__input:focus { box-shadow: none; }

.subdomain-collection-heading {
  display: flex;
  align-items: center;
  min-width: 0;
}
.subdomain-collection-heading .screen__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subdomain-collection-actions { display: flex; justify-content: flex-end; margin: 0 0 14px; }
.sub-create__hint { margin: 9px 6px 18px; color: var(--hint); font-size: 13px; line-height: 1.4; }
.sub-create__hint--error { color: var(--destructive); }
.sub-create__mode-row { min-height: 64px; }
.sub-create__mode-row .provider-row__meta { white-space: normal; }
.sub-create__min { margin-bottom: 0; }
.sub-create__pricing { margin-bottom: 12px; }
.sub-create__prices { margin-top: 12px; overflow: hidden; }
.sub-create__price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  font-size: 14px;
}
.sub-create__price + .sub-create__price { border-top: 0.5px solid var(--separator); }
.sub-create__price-input { display: flex; align-items: center; gap: 5px; min-width: 0; }
.sub-create__price-input input {
  width: 92px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: right;
}
.sub-create__price-input b { color: var(--hint); font-size: 12px; font-weight: 500; }
.sub-create__notice,
.sub-create__error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--section-bg);
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}
.sub-create__approvals { margin-top: 14px; overflow: hidden; }
.sub-create__approvals-title {
  display: block;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
}
.sub-create__approval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border-top: 0.5px solid var(--separator);
  color: var(--hint);
  font-size: 13px;
}
.sub-create__approval-row b { flex: none; color: var(--text); font-weight: 500; }
.sub-create__error { color: var(--destructive); }
.sub-create__error button { margin-left: 8px; color: var(--accent); font-weight: 600; }
.sub-create__status { margin: 14px 6px 0; color: var(--hint); font-size: 14px; text-align: center; }
.sub-create__actions { display: flex; gap: 10px; margin-top: 18px; }
.sub-create__actions > .tg-btn { flex: 1; width: auto; }
.sub-create__actions--stacked { flex-direction: column; }
.sub-create__actions--stacked > .tg-btn { flex: none; width: 100%; }
.subdomain-mint-field { margin-top: 8px; }
.subdomain-mint-suffix {
  flex: none;
  max-width: 55%;
  padding-right: 12px;
  overflow: hidden;
  color: var(--hint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subdomain-mint-hint { margin: 8px 6px 18px 10px; font-size: 13px; }
.subdomain-mint-summary { margin-top: 8px; }
.subdomain-mint-error { margin: 12px 6px 0; font-size: 14px; }
.subdomain-mint-action { margin-top: 16px; }

/* Domain search bar: a bare, borderless field with the app accent caret. */
.search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  font-family: inherit;
  caret-color: var(--accent);
  padding: 10px 2px;
  -webkit-tap-highlight-color: transparent;
}
.search-input::placeholder { color: var(--subtitle); }
.search-input:focus { box-shadow: none; }
.dns-catalog-tools {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(128px, auto);
  align-items: center; gap: 8px; margin-bottom: 10px;
}
.dns-catalog-tools--namespaces {
  grid-template-columns: minmax(0, 1fr) auto minmax(128px, auto);
}
.dns-catalog-tools--subdomain-modes {
  grid-template-columns: minmax(0, 1fr) auto minmax(128px, auto);
}
.dns-catalog-tools__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.dns-catalog-tools__controls .dns-sort-select { flex: 1; max-width: 180px; }
.dns-catalog-tools .search-input { min-width: 0; padding-right: 4px; }
.dns-list-toolbar {
  position: relative;
  height: 38px;
  margin-bottom: 10px;
  overflow: hidden;
}
.dns-list-toolbar__controls,
.dns-list-toolbar__search {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.dns-list-toolbar__controls {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  justify-content: flex-end;
}
.dns-list-toolbar__controls .dns-sort-select {
  flex: none;
  width: auto;
  max-width: 48vw;
}
.dns-list-toolbar__icon-btn,
.dns-list-toolbar__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--section-bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.dns-list-toolbar__icon-btn { margin-right: auto; }
.dns-list-toolbar__icon-btn svg,
.dns-list-toolbar__close svg,
.dns-list-toolbar__search-icon svg { width: 18px; height: 18px; }
.dns-list-toolbar__icon-btn:active,
.dns-list-toolbar__close:active { opacity: 0.6; }
.dns-list-toolbar__search {
  padding: 0 3px 0 12px;
  border-radius: 999px;
  background: var(--section-bg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.985);
}
.dns-list-toolbar__search-icon {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--hint);
}
.dns-list-toolbar__search .search-input {
  min-width: 0;
  height: 34px;
  padding: 0;
  font-size: 16px;
}
.dns-list-toolbar__close { background: transparent; color: var(--hint); }
.dns-list-toolbar--searching .dns-list-toolbar__controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.985);
}
.dns-list-toolbar--searching .dns-list-toolbar__search {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.dns-toolbar-action {
  flex: none; height: 34px; padding: 0 9px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-family: inherit; font-size: 13px; line-height: 17px; font-weight: 590;
  white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dns-toolbar-action:active { opacity: 0.65; }
.dns-toolbar-action:disabled { opacity: 0.45; cursor: default; }
.infinite-load-trigger {
  min-height: 32px; display: flex; align-items: center; justify-content: center;
  margin-top: 6px;
}
.infinite-load-trigger .mini-boot__spinner { width: 18px; height: 18px; border-width: 2px; }
.dns-namespace-toggle {
  display: flex; flex: none; gap: 2px; height: 34px; padding: 2px;
  border-radius: 999px; background: var(--section-bg);
}
.dns-namespace-toggle__btn {
  min-width: 42px; height: 30px; padding: 0 8px;
  border: 0; border-radius: 999px; background: transparent;
  color: var(--hint); font-family: inherit; font-size: 12.5px; font-weight: 590;
  white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.dns-namespace-toggle__btn--on { background: var(--bg); color: var(--text); }
.dns-namespace-toggle__btn:active { opacity: 0.65; }
.domain-namespace-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.screen__header-actions .domain-namespace-toolbar { margin-bottom: 0; }
.domain-view-toggle {
  display: flex;
  flex: none;
  gap: 2px;
  height: 34px;
  padding: 2px;
  border-radius: 999px;
  background: var(--section-bg);
}
.domain-view-toggle__btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--hint);
  transition: background 0.15s, color 0.15s;
}
.domain-view-toggle__btn svg { width: 18px; height: 18px; }
.domain-view-toggle__btn--on { background: var(--bg); color: var(--text); }
.domain-view-toggle__btn:active { opacity: 0.65; }
.subdomain-mode-toggle .dns-namespace-toggle__btn {
  display: grid; place-items: center; min-width: 34px; padding: 0 3px;
}
.subdomain-mode-toggle .collection-mode-icon {
  flex-basis: 24px; width: 24px; height: 24px;
}
.subdomain-mode-toggle .collection-mode-icon::before,
.subdomain-mode-toggle .collection-mode-icon::after { background: currentColor; }
.dns-sort-select {
  min-width: 0; max-width: 48vw; height: 34px; padding: 0 28px 0 12px;
  appearance: none; border: 0; border-radius: 999px;
  background-color: var(--section-bg); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  font-family: inherit; font-size: 13px; line-height: 17px; font-weight: 590;
  white-space: nowrap; text-overflow: ellipsis;
}
.dns-renew-message { margin: 0 8px 10px; text-align: center; font-size: 13px; }
.field-row__paste {
  flex: none;
  margin-left: 10px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 590;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.field-row__paste:active { opacity: 0.6; }
.field-row__paste--minimal { padding: 4px 8px; background: transparent; color: var(--accent); font-size: 13px; }
.field-row__paste--minimal:disabled { opacity: 0.4; }
.field-row + .field-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 0.5px;
  background: var(--separator);
}
.field-row__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  letter-spacing: -0.43px;
  line-height: 22px;
  padding: 15px 0;
}
.field-row__input::placeholder { color: var(--subtitle); opacity: 0.55; }
.field-row__input--area { resize: none; display: block; }
.sale-contact-field { gap: 12px; }
.sale-contact-field .field-row__input { text-align: right; }

/* Avatar row (Links page) — a tappable row like Telegram's "Set New Photo". */
.avatar-row { gap: 14px; cursor: pointer; transition: background 0.12s; }
.avatar-row:active { background: color-mix(in srgb, var(--text), transparent 94%); }
.avatar-row__img {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; margin: 10px 0;
  object-fit: cover; display: inline-flex; align-items: center; justify-content: center;
}
.avatar-row__ph { background: var(--secondary-bg); color: var(--subtitle); font-size: 26px; font-weight: 300; }
.avatar-row__label { color: var(--link); font-size: 17px; letter-spacing: -0.43px; }

/* Native color controls. */
.field-row--color { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.field-row__label { color: var(--text); font-size: 17px; letter-spacing: -0.43px; }
.swatch {
  position: relative; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(128, 128, 128, 0.25); box-shadow: inset 0 0 0 2px var(--section-bg);
}
.swatch--custom { display: grid; place-items: center; overflow: hidden; }
.swatch--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* One link = one card: iOS red ⊖ + a column of field rows. */
.link-card {
  display: flex; align-items: center; margin-bottom: 10px;
  transition: transform 0.14s, opacity 0.14s, box-shadow 0.14s;
}
.link-card--dragging { z-index: 1; opacity: 0.82; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2); transform: scale(1.01); }
.link-card__remove {
  border: 0; background: none; padding: 0 0 0 16px; flex-shrink: 0;
  color: var(--destructive); display: inline-flex; cursor: pointer;
}
.link-card__fields { flex: 1; min-width: 0; }
.link-card__grab {
  width: 48px; align-self: stretch; flex: none; display: grid; place-items: center;
  padding: 0; border: 0; background: none; color: var(--subtitle);
  cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.link-card__grab:active { cursor: grabbing; }

/* Blue action row ("Add link") — iOS Row-Button, Default value. */
.add-row { color: var(--link); font-size: 17px; letter-spacing: -0.43px; cursor: pointer; transition: background 0.12s; }
.add-row:active { background: color-mix(in srgb, var(--text), transparent 94%); }

/* iOS switch + its 52px toggle row (Tip/Token editors). Telegram UI Kit
   "Toggle - Switch" node 6028:3502: 64×28 pill, white 39×24 knob inset 2px,
   track green #34c759 on / rgba(120,120,120,.2) off. */
.toggle-row { gap: 12px; cursor: pointer; transition: background 0.12s; }
.toggle-row:active { background: color-mix(in srgb, var(--text), transparent 94%); }
.toggle-row__label { flex: 1; min-width: 0; font-size: 17px; letter-spacing: -0.43px; color: var(--text); text-align: left; }
.sw {
  position: relative; width: 64px; height: 28px; border-radius: 100px; flex-shrink: 0;
  background: rgba(120, 120, 120, 0.2); transition: background 0.2s;
}
.sw--on { background: #34c759; }
.sw::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 39px; height: 24px;
  border-radius: 100px; background: #fff;
  transition: transform 0.2s;
}
.sw--on::after { transform: translateX(21px); }

/* Amount rows (Tip editor): free label + right-aligned value + fixed unit. */
.field-row__amount { flex: 0 0 84px; width: 84px; max-width: 84px; margin-left: auto; text-align: right; }
.field-row__unit { color: var(--subtitle); font-size: 17px; letter-spacing: -0.43px; margin-left: 6px; flex-shrink: 0; }
.tip-jetton-label { display: flex; flex: 1; min-width: 0; flex-direction: column; line-height: 19px; }
.tip-jetton-label b { overflow: hidden; font-size: 16px; font-weight: 590; text-overflow: ellipsis; white-space: nowrap; }
.tip-jetton-label small { overflow: hidden; color: var(--subtitle); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tip-add-jetton { flex: none; min-width: 54px; padding: 8px 0 8px 12px; border: 0; background: none; color: var(--link); font-family: inherit; font-size: 15px; line-height: 18px; font-weight: 590; cursor: pointer; }
.tip-add-jetton:disabled { color: var(--hint); cursor: default; }
.sale-currency-select {
  flex: none; min-width: 92px; height: 36px; padding: 0 30px 0 14px; appearance: none;
  border: 0; border-radius: 999px; color: var(--link); background-color: var(--secondary-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%230077cc' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  font-family: inherit; font-size: 14px; line-height: 18px; font-weight: 590;
}
.tip-language-select { margin-left: auto; text-align-last: right; }
.sale-image-field { gap: 10px; }
.sale-image-field__pick {
  display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; padding: 0;
  border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.sale-image-field__pick:disabled, .sale-image-field__remove:disabled { opacity: 0.55; }
.sale-image-field__remove {
  flex: none; padding: 7px 0; border: 0; background: none; color: var(--destructive);
  font-family: inherit; font-size: 14px; line-height: 18px; font-weight: 590; cursor: pointer;
}
.theme-color-value { display: flex; align-items: center; gap: 10px; color: var(--hint); }
.theme-color-value code { font-size: 12px; }
.theme-reset-row { width: 100%; border: 0; background: none; color: var(--link); font: inherit; text-align: left; cursor: pointer; }
.theme-reset-row:active { background: color-mix(in srgb, var(--text), transparent 94%); }
.theme-range-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.theme-range-row input { flex: 1; min-width: 0; accent-color: var(--link); }
.theme-range-row output { width: 42px; color: var(--subtitle); font-size: 14px; text-align: right; }

/* Media thumbs beyond the round avatar: token logo (squircle) + wide banner. */
.avatar-row__img--logo { border-radius: 14px; }
.avatar-row__img--wide { width: 68px; height: 42px; border-radius: 10px; }

.tg-btn--danger { color: var(--destructive); }

.sub-manage-loading { display: grid; min-height: 88px; place-items: center; }
.sub-manage-callout {
  display: flex; flex-direction: column; gap: 7px; margin: 16px 0; padding: 15px;
  border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--section-bg));
}
.sub-manage-callout strong { color: var(--text); font-size: 17px; line-height: 21px; }
.sub-manage-callout span { color: var(--subtitle); font-size: 14px; line-height: 19px; }
.sub-manage-callout .tg-btn { margin-top: 5px; }
.sub-manage-callout--claim { text-align: center; }
.sub-manage-callout--warning { background: color-mix(in srgb, #ff9f0a 13%, var(--section-bg)); }
.sub-manage-list { overflow: hidden; padding: 0; }
.sub-manage-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 50px;
  padding: 0 13px 0 16px; border: 0; background: none; color: var(--text); font: inherit; text-align: left;
}
.sub-manage-row + .sub-manage-row { border-top: 0.5px solid var(--separator); }
.sub-manage-row:active { background: color-mix(in srgb, var(--text) 5%, transparent); }
.sub-manage-row:disabled { opacity: 0.5; }
.sub-manage-row__label { min-width: 0; font-size: 16px; line-height: 20px; }
.sub-manage-row__label--danger { color: var(--destructive); }
.sub-manage-row__trail { display: flex; align-items: center; gap: 7px; flex: none; color: var(--hint); }
.sub-manage-row__trail svg { width: 16px; height: 16px; }
.sub-manage-row__value { max-width: 42vw; overflow: hidden; color: var(--subtitle); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.sub-manage-message { margin: 10px 6px 0; color: var(--subtitle); font-size: 14px; line-height: 19px; }
.sub-manage-sheet__choices { overflow: hidden; padding: 0; }
.sub-manage-sheet__button { margin-top: 14px; }
.sub-manage-sheet__actions { display: flex; gap: 10px; margin-top: 14px; }
.sub-manage-sheet__actions .tg-btn { flex: 1; }

.mini-error {
  display: grid; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  place-items: center; background: var(--bg); color: var(--text); text-align: center;
}
.mini-error__card { width: min(100%, 420px); }
.mini-error__card h1 { margin: 0; font-size: 22px; line-height: 28px; }
.mini-error__card p { margin: 8px 0 20px; color: var(--subtitle); font-size: 15px; line-height: 20px; }
.sub-manage-sheet__actions--stack { flex-direction: column; }
.sub-manage-sheet__error { margin: 8px 4px 0; }
.sub-manage-danger-note {
  padding: 13px 14px; border-radius: 12px; background: color-mix(in srgb, var(--destructive) 10%, var(--section-bg));
  color: var(--destructive); font-size: 14px; line-height: 19px;
}

/* ── Post editor (telegra.ph-style) ───────────────────────────────────────── */
.post-editor { display: flex; flex-direction: column; padding-bottom: 8px; }
.ed-title {
  border: 0; background: none; outline: none; color: var(--text);
  font-size: 1.7rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em;
  padding: 6px 6px 10px; width: 100%;
}
.ed-title::placeholder { color: var(--subtitle); opacity: 0.6; }

.ed-toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1px;
  background: var(--section-bg); border-radius: 14px; padding: 4px 6px; margin: 0 2px 10px;
  overflow-x: auto; scrollbar-width: none;
}
.ed-toolbar::-webkit-scrollbar { display: none; }
.ed-tool {
  min-width: 34px; height: 36px; border: 0; background: none; border-radius: 10px;
  color: var(--text); font-size: 15.5px; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ed-tool__icon {
  display: block; width: 28px; height: 28px; background: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: 22px 22px; mask-size: 22px 22px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.ed-tool__link { -webkit-mask-image: url("../assets/telegram-link.svg"); mask-image: url("../assets/telegram-link.svg"); }
.ed-tool__media { -webkit-mask-image: url("../assets/telegram-search-media.svg"); mask-image: url("../assets/telegram-search-media.svg"); }
.ed-tool:active { background: var(--secondary-bg); }
.ed-toolbar__sep { width: 1px; height: 18px; background: var(--separator); margin: 0 3px; flex-shrink: 0; }

.ed-prompt { display: flex; gap: 8px; margin: 0 2px 10px; }
.ed-prompt__input {
  flex: 1; min-width: 0; border: 0; outline: none; font: inherit; font-size: 16px;
  color: var(--text); background: var(--section-bg); border-radius: 12px; padding: 10px 13px;
}
.ed-prompt__input::placeholder { color: var(--subtitle); opacity: 0.55; }
.ed-prompt__btn { padding: 0 14px; border-radius: 12px; }

.ed-body {
  position: relative;
  min-height: 42vh; outline: none; padding: 2px 6px 20px;
  font-size: 1.02rem; line-height: 1.62; color: var(--text);
  word-break: break-word;
}
.post-editor--compact .ed-body { min-height: 52px; }
/* Placeholder while the body is empty (a lone empty <p> counts as empty). */
.ed-body:empty::before, .ed-body:has(> p:only-child > br:only-child)::before {
  content: attr(data-placeholder); color: var(--subtitle); opacity: 0.6;
  position: absolute; top: 2px; left: 6px; pointer-events: none;
}
.ed-body p { margin: 0 0 12px; }
.ed-body h2 { font-size: 1.25rem; margin: 18px 0 8px; }
.ed-body blockquote { margin: 0 0 12px; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent); color: var(--subtitle); }
.ed-body a { color: var(--link); }
.ed-figure { margin: 14px 0; }
.ed-figure img { max-width: 100%; border-radius: 10px; display: block; }
/* Size preview — mirrors the published page (fig-s 45%, fig-m 70%). */
.ed-figure[data-w="s"] img { width: 45%; margin: 0 auto; }
.ed-figure[data-w="m"] img { width: 70%; margin: 0 auto; }
.ed-figure--sel img { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Size bar shown while an image is selected. */
.ed-sizebar { display: flex; align-items: center; gap: 6px; margin: 0 2px 10px; }
.ed-sizebar__label { font-size: 0.85rem; color: var(--subtitle); margin-right: auto; padding-left: 4px; }
.ed-size {
  border: 0; font: inherit; font-size: 0.9rem; padding: 7px 13px; border-radius: 10px;
  background: var(--section-bg); color: var(--text);
}
.ed-size--on {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); font-weight: 590;
}
.ed-embed {
  margin: 14px 0; padding: 14px; border-radius: 12px; background: var(--secondary-bg);
  color: var(--subtitle); font-size: 0.92rem; text-align: center;
}

/* Active formatting state at the caret (B/I/U/link/heading/quote). */
.ed-tool--on {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
