@charset "UTF-8";

/* Independently implemented web styles, with layout metrics observed in the
   official Telegram clients (no native implementation is copied):
   https://github.com/TelegramMessenger/Telegram-iOS/blob/master/submodules/ItemListUI/Sources/Items/ItemListDisclosureItem.swift
   https://github.com/TelegramMessenger/Telegram-iOS/blob/master/submodules/ItemListUI/Sources/Items/ItemListSwitchItem.swift
   https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java
   https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java
   iOS: 16px text inset, 43px icon reservation, 17/15px text.
   Android SettingCell: 18px inset, 28px icon, 18px gap, 16/13px text. */

:root {
  color-scheme: light;
  --fallback-bg: #ffffff;
  --fallback-secondary-bg: #efeff4;
  --fallback-text: #000000;
  --fallback-hint: #707579;
  --fallback-link: #2481cc;
  --fallback-button: #2481cc;
  --fallback-button-text: #ffffff;
  --fallback-header: #efeff4;
  --fallback-section: #ffffff;
  --fallback-accent: #2481cc;
  --fallback-section-header: #707579;
  --fallback-subtitle: #707579;
  --fallback-destructive: #d93025;
  --fallback-bottom-bar: #ffffff;
  --page-bg: var(--tg-theme-secondary-bg-color, var(--fallback-secondary-bg));
  --paper: var(--tg-theme-secondary-bg-color, var(--fallback-secondary-bg));
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fallback-section)));
  --base: var(--tg-theme-bg-color, var(--fallback-bg));
  --ink: var(--tg-theme-text-color, var(--fallback-text));
  --muted: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, var(--fallback-subtitle)));
  --soft: var(--tg-theme-hint-color, var(--fallback-hint));
  --link: var(--tg-theme-link-color, var(--fallback-link));
  --accent: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, var(--fallback-accent)));
  --button: var(--tg-theme-button-color, var(--fallback-button));
  --button-text: var(--tg-theme-button-text-color, var(--fallback-button-text));
  --header: var(--tg-theme-header-bg-color, var(--tg-theme-secondary-bg-color, var(--fallback-header)));
  --section-header: var(--tg-theme-section-header-text-color, var(--tg-theme-hint-color, var(--fallback-section-header)));
  --bottom-bar: var(--tg-theme-bottom-bar-bg-color, var(--tg-theme-bg-color, var(--fallback-bottom-bar)));
  --danger: var(--tg-theme-destructive-text-color, var(--fallback-destructive));
  --line: var(--tg-theme-section-separator-color, color-mix(in srgb, var(--ink) 12%, transparent));
  --field: var(--base);
  --accent-bg: color-mix(in srgb, var(--button) 10%, var(--surface));
  --danger-bg: color-mix(in srgb, var(--danger) 9%, var(--surface));
  --pressed: color-mix(in srgb, var(--ink) 5%, var(--surface));
  --radius: 11px;
  --group-radius: 26px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --content-top: var(--tg-content-safe-area-inset-top, 0px);
  --content-right: var(--tg-content-safe-area-inset-right, 0px);
  --content-bottom: var(--tg-content-safe-area-inset-bottom, 0px);
  --content-left: var(--tg-content-safe-area-inset-left, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fallback-bg: #17212b;
  --fallback-secondary-bg: #0e1621;
  --fallback-text: #ffffff;
  --fallback-hint: #a0acb7;
  --fallback-link: #64b5ef;
  --fallback-button: #5288c1;
  --fallback-header: #17212b;
  --fallback-section: #17212b;
  --fallback-accent: #64b5ef;
  --fallback-section-header: #a0acb7;
  --fallback-subtitle: #a0acb7;
  --fallback-destructive: #ff6b6b;
  --fallback-bottom-bar: #17212b;
}

/* The standard iOS dark settings palette uses a black canvas. Custom Telegram
   themes keep their supplied colors instead of receiving this normalization. */
:root[data-native-palette="ios-dark"] {
  --page-bg: #000000;
  --surface: #1c1c1d;
  --base: #1c1c1d;
  --paper: #2c2c2e;
  --field: #2c2c2e;
  --header: #000000;
  --bottom-bar: #000000;
  --line: rgb(255 255 255 / 10%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fallback-bg: #17212b;
    --fallback-secondary-bg: #0e1621;
    --fallback-text: #ffffff;
    --fallback-hint: #a0acb7;
    --fallback-link: #64b5ef;
    --fallback-button: #5288c1;
    --fallback-header: #17212b;
    --fallback-section: #17212b;
    --fallback-accent: #64b5ef;
    --fallback-section-header: #a0acb7;
    --fallback-subtitle: #a0acb7;
    --fallback-destructive: #ff6b6b;
    --fallback-bottom-bar: #17212b;
  }
}

* { box-sizing: border-box; }
html { min-width: 280px; background: var(--page-bg); scroll-padding-top: 80px; }
body { margin: 0; min-width: 280px; min-height: 100svh; background: var(--page-bg); color: var(--ink); line-height: 1.35; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .42; }
a { color: var(--link); text-decoration: none; }
button, input, textarea, select { border-radius: var(--radius); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--button); outline-offset: 3px; }
input, textarea, select { min-width: 0; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3, .serif { font-family: inherit; letter-spacing: 0; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 600; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 500; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 500; }
[hidden] { display: none !important; }
#content { min-width: 0; }
#content:focus { outline: none; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 100; min-height: 44px; padding: 12px 16px; border-radius: 10px; color: var(--button-text); background: var(--button); }
.skip-link:focus { top: calc(12px + var(--safe-top)); }
.muted { color: var(--muted); }
.subtle { color: var(--soft); }
.small { font-size: 13px; }
.icon { display: inline-flex; flex-shrink: 0; width: 22px; height: 22px; align-items: center; justify-content: center; }
.icon svg { display: block; width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wordmark { display: inline-block; font-size: 23px; line-height: 1.2; font-weight: 650; letter-spacing: -.4px; }
.wordmark-dot { color: var(--accent); }
.boot-screen { min-height: 100svh; min-height: var(--app-viewport-height, 100dvh); padding: calc(24px + var(--safe-top) + var(--content-top)) calc(24px + var(--safe-right) + var(--content-right)) calc(24px + var(--safe-bottom) + var(--content-bottom)) calc(24px + var(--safe-left) + var(--content-left)); display: grid; place-items: center; text-align: center; }
.boot-screen .wordmark { font-size: clamp(38px, 11.8vw, 52px); line-height: 1.15; font-weight: 650; letter-spacing: -1.8px; white-space: nowrap; user-select: none; -webkit-user-select: none; }
.boot-screen .wordmark-dot { display: inline-block; letter-spacing: 0; animation: breathe 1.6s ease-in-out infinite; }
.boot-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.loading-dots { animation: breathe 1.2s ease-in-out infinite; }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100svh; max-width: 1200px; margin-inline: auto; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; align-items: stretch; padding: calc(28px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); border-right: .5px solid var(--line); }
.sidebar .wordmark { padding-inline: 12px; margin-bottom: 28px; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; width: 100%; min-height: 46px; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-size: 15px; line-height: 1.35; }
.nav-link .icon { color: var(--accent); width: 21px; height: 21px; }
.nav-link[aria-current="page"] { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 28px 12px 0; color: var(--muted); font-size: 13px; }
.profile-stamp { padding-bottom: 8px; }
.profile-name { margin-bottom: 3px; color: var(--ink); overflow-wrap: anywhere; font-size: 15px; }
.edition { font-size: 13px; color: var(--muted); }
.main { min-width: 0; padding: 0 32px calc(32px + var(--safe-bottom) + var(--content-bottom)); }
.native-header { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; min-height: calc(56px + var(--safe-top) + var(--content-top)); margin: 0 -32px 16px; padding: calc(var(--safe-top) + var(--content-top)) 16px 0; background: var(--header); }
.header-title { grid-column: 2; grid-row: 1; font-size: 17px; font-weight: 600; line-height: 1.25; text-align: center; color: var(--ink); overflow-wrap: anywhere; }
.header-back { grid-column: 1; grid-row: 1; justify-self: start; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; max-width: 100%; padding: 0 8px 0 0; border: 0; background: transparent; color: var(--link); font-size: 17px; }
.header-back .icon { width: 24px; height: 24px; }
:root[data-native-back="true"] .header-back { display: none; }
.topbar { display: flex; justify-content: flex-end; gap: 16px; min-height: 44px; align-items: center; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.page { max-width: 680px; margin-inline: auto; }
.page-heading { padding: 0 16px; margin: 6px 0 20px; }
.page-heading h1 { font-size: 22px; margin-bottom: 8px; }
.page-description { color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.eyebrow { margin-bottom: 8px; color: var(--section-header); font-size: 13px; font-weight: 400; }
.page-loading { padding: 32px 16px; color: var(--muted); font-size: 15px; text-align: center; }
.section-loading { min-height: 92px; padding: 20px 16px; border-radius: var(--radius); background: var(--surface); }
.section-loading > span { display: block; height: 12px; width: 38%; border-radius: 4px; background: var(--line); }
.section-loading > span + span { width: 68%; margin-top: 14px; opacity: .6; }

.home-profile { display: flex; flex-direction: column; align-items: center; padding: 12px 16px 28px; text-align: center; }
.avatar { width: 80px; height: 80px; display: grid; place-items: center; flex-shrink: 0; margin-bottom: 13px; border-radius: 50%; background: var(--button); color: var(--button-text); font-size: 30px; font-weight: 500; line-height: 1; user-select: none; }
.profile-title { max-width: 100%; color: var(--ink); font-size: 23px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.profile-subtitle { margin-top: 5px; color: var(--muted); font-size: 15px; }
.menu-group { border-radius: var(--group-radius); background: var(--surface); margin-bottom: 24px; }
.menu-row { position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 16px; color: var(--ink); }
.menu-row:first-child { border-radius: var(--group-radius) var(--group-radius) 0 0; }
.menu-row:last-child { border-radius: 0 0 var(--group-radius) var(--group-radius); }
.menu-row:only-child { border-radius: var(--group-radius); }
.menu-row:not(:last-child)::after { content: ""; position: absolute; height: .5px; background: var(--line); left: 60px; right: 16px; bottom: 0; }
.menu-icon { --icon-top: #36a5ff; --icon-bottom: #007aff; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; color: #ffffff; background: linear-gradient(180deg, var(--icon-top), var(--icon-bottom)); box-shadow: inset 0 .5px 0 rgb(255 255 255 / 18%); }
.menu-icon .icon { width: 20px; height: 20px; }
.menu-icon .icon svg { stroke-width: 1.8; }
.menu-icon .menu-symbol { width: 23px; height: 23px; }
.menu-icon .menu-symbol svg { width: 100%; height: 100%; stroke-width: 2.3; }
.menu-symbol svg[data-filled="true"] { fill: currentColor; stroke: none; }
.menu-icon[data-color="purple"] { --icon-top: #d46bff; --icon-bottom: #aa50e3; }
.menu-icon[data-color="violet"] { --icon-top: #d46bff; --icon-bottom: #aa50e3; }
.menu-icon[data-color="orange"] { --icon-top: #ff6861; --icon-bottom: #ff443e; }
.menu-icon[data-color="green"] { --icon-top: #53dd6c; --icon-bottom: #2acb4b; }
.menu-icon[data-color="gray"] { --icon-top: #b3b3b8; --icon-bottom: #8c8c92; }
.menu-icon[data-color="pink"] { --icon-top: #f779ce; --icon-bottom: #df53b5; }
.menu-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.menu-title { color: var(--ink); font-size: 17px; font-weight: 400; line-height: 1.25; overflow-wrap: anywhere; }
.menu-description { color: var(--muted); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.chevron { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 20px; flex-shrink: 0; color: color-mix(in srgb, var(--soft) 68%, transparent); }
.chevron .icon { width: 18px; height: 18px; }
.chevron .icon svg { stroke-width: 2.8; }
.language-row { width: 100%; cursor: pointer; }
.language-row .menu-title { flex: 1; min-width: 0; }
.menu-value { flex-shrink: 0; color: var(--muted); font-size: 17px; line-height: 1.25; }
.language-row select { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.language-row:has(select:focus-visible) { outline: 2px solid var(--button); outline-offset: 3px; }
.language-row:has(select:disabled) { opacity: .6; cursor: wait; }
.language-row select:disabled { cursor: wait; }
.home-note { padding: 0 16px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.4; }
.home-page .legal-links { gap: 0 16px; margin-top: 0; }
.home-page .legal-links .text-link { min-height: 44px; font-size: 12px; color: var(--muted); }
.home-page .legal-links .icon { width: 13px; height: 13px; }

.section { margin-top: 24px; min-width: 0; }
.section:first-child { margin-top: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 16px 8px; min-width: 0; }
.section-heading > div { min-width: 0; }
.section-heading h2 { color: var(--section-header); font-size: 13px; line-height: 1.35; font-weight: 500; }
.section-description { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.section-heading .button { flex-shrink: 0; margin-right: -9px; padding: 6px 9px; background: transparent; font-size: 14px; }
.row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 14px 16px; background: var(--surface); }
.row:not(:last-child)::after { content: ""; position: absolute; height: .5px; left: 16px; right: 16px; bottom: 0; background: var(--line); }
/* Adjacent rows, empty states and action footers form one card. A heading or
   explanatory note ends the card regardless of its position in the section. */
.section > :is(.row, .empty, .form-section) { border-radius: var(--group-radius); }
.section > :is(.row, .empty, .form-section):has(+ :is(.row, .empty, .form-section)) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.section > :is(.row, .empty, .form-section) + :is(.row, .empty, .form-section) { border-top-left-radius: 0; border-top-right-radius: 0; }
.section > .row:not(:has(+ :is(.row, .empty, .form-section)))::after { display: none; }
.row-copy { flex: 1; min-width: 0; }
.row-copy h3, .row-copy p { overflow-wrap: anywhere; }
.row-copy p { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 1 auto; flex-wrap: wrap; gap: 4px; min-width: 0; max-width: 100%; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.empty { padding: 19px 16px; border-radius: var(--group-radius); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.4; }
.empty p + p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; max-width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 10px; background: var(--accent-bg); color: var(--accent); font-size: 15px; font-weight: 500; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.button.primary { color: var(--button-text); background: var(--button); }
.button.danger { color: var(--danger); background: var(--danger-bg); }
.button.icon-button { width: 44px; min-width: 44px; padding: 10px; background: transparent; color: var(--accent); }
.button.compact { min-height: 44px; padding: 9px 11px; font-size: 14px; }
.button.wide { width: 100%; }
.button.logout { padding-left: 0; padding-right: 0; background: transparent; color: var(--link); font-size: 14px; text-align: left; justify-content: flex-start; }
.text-link { display: inline-flex; align-items: center; justify-content: flex-start; gap: 5px; min-height: 44px; border: 0; padding: 8px 0; color: var(--link); background: transparent; font-size: 15px; line-height: 1.3; }
.text-link .icon { width: 18px; height: 18px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; background: var(--paper); color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.3; overflow-wrap: anywhere; }
.pill.active { color: var(--accent); background: var(--accent-bg); }
.pill.warning { color: var(--ink); background: var(--paper); }
.pill.bad { color: var(--danger); background: var(--danger-bg); }
.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 24px; padding: 16px 0; border-radius: var(--group-radius); background: var(--surface); }
.overview-item { padding: 0 12px; text-align: center; border-inline-end: .5px solid var(--line); min-width: 0; }
.overview-item:last-child { border: 0; }
.overview-number { display: block; color: var(--accent); font-size: 25px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.overview-label { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.task-row { align-items: flex-start; }
.task-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; margin-bottom: 5px; }
.task-meta { color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.task-result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--paper); color: var(--muted); font-size: 14px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.task-result p { margin-top: 0; }
.task-result p + p { margin-top: 5px; }
.task-result .text-link { font-size: 14px; }
.notice { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 0 16px; color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.notice .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--soft); }
.notice.error, .notice.error .icon { color: var(--danger); }
.connector-row { gap: 12px; align-items: flex-start; }
.connector-mark { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 20px; font-weight: 600; }
.connector-row:not(:last-child)::after { left: 64px; }
.connector-status { max-width: 150px; margin-top: 1px; color: var(--muted); font-size: 12px; text-align: right; }
.connector-status small { display: block; margin-top: 5px; font-size: 12px; line-height: 1.35; }
.connector-card, .prepared-action { margin-top: 10px; padding: 16px; border-radius: var(--group-radius); background: var(--surface); min-width: 0; }
.connector-card:first-of-type, .prepared-action:first-of-type { margin-top: 0; }
.connector-summary { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.connector-summary > .pill { flex-shrink: 0; max-width: 135px; }
.connector-account { margin: 12px 0 0; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.connector-note { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.connector-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.connector-actions .button { flex: 1 1 auto; }
.granted-capabilities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.oauth-pending { margin-top: 16px; padding-top: 16px; border-top: .5px solid var(--line); }
.oauth-pending p { margin-bottom: 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.oauth-pending .button + .button { margin-top: 8px; }
.capability-list { min-width: 0; margin: 0; padding: 0; border: 0; }
.capability-list legend { margin-bottom: 8px; color: var(--section-header); font-size: 13px; }
.capability-option { display: flex; align-items: flex-start; gap: 12px; min-height: 56px; padding: 13px 0; border-bottom: .5px solid var(--line); cursor: pointer; }
.capability-option input { width: 22px; height: 22px; flex-shrink: 0; margin: 1px 0 0; accent-color: var(--button); cursor: pointer; }
.capability-option > span { min-width: 0; }
.capability-option strong { display: block; font-size: 16px; font-weight: 500; line-height: 1.3; }
.capability-description { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.permission-details { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }
.permission-details summary { min-height: 44px; padding: 12px 0; color: var(--link); cursor: pointer; }
.permission-details ul { margin: 0; padding-left: 20px; }
.permission-details li { margin-bottom: 10px; }
.permission-details code { display: block; margin-top: 4px; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-preview { margin: 12px 0 0; }
.action-preview > div + div { margin-top: 12px; }
.action-preview dt { margin-bottom: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.action-preview dd { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.action-result { margin-top: 12px; color: var(--ink); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 16px; }
.field label { padding-inline: 2px; color: var(--section-header); font-size: 13px; line-height: 1.3; }
.field input, .field textarea, .field select, .link-field { display: block; width: 100%; min-width: 0; min-height: 48px; padding: 12px; border: 0; border-radius: 10px; background: var(--field); color: var(--ink); font-size: 16px; line-height: 1.4; box-shadow: inset 0 0 0 .5px var(--line); }
.field input::placeholder, .field textarea::placeholder { color: var(--soft); opacity: 1; }
.field textarea { min-height: 112px; resize: vertical; }
.field input[readonly] { color: var(--muted); }
.field small { padding-inline: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
.form-section { padding: 16px; border-radius: var(--group-radius); background: var(--surface); }
.form-section .field input, .form-section .field textarea, .form-section .field select { background: var(--paper); box-shadow: none; }
.form-section > .button { width: 100%; margin-top: 4px; }
.form-error { margin: 4px 0 16px; color: var(--danger); font-size: 14px; line-height: 1.4; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-wrap .icon-button { position: absolute; top: 2px; right: 2px; }
.privacy-row { align-items: flex-start; }
.memory-key { color: var(--muted); font-size: 14px; font-weight: 400; }
.memory-value { margin-top: 4px; color: var(--ink); font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.row:has(> .switch) { align-items: flex-start; flex-wrap: nowrap; }
.switch { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 51px; min-width: 51px; height: 44px; padding: 0; border: 0; border-radius: 22px; background: transparent; }
.switch::before { position: absolute; content: ""; inset: 6px 0; border-radius: 18px; background: color-mix(in srgb, var(--soft) 32%, var(--surface)); transition: background .16s ease; }
.switch-thumb { position: relative; display: block; width: 28px; height: 28px; border-radius: 50%; transform: translateX(-9px); background: var(--button-text); box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 18%, transparent); transition: transform .16s ease; }
.switch[aria-checked="true"]::before { background: var(--button); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(9px); }
.invite-paper { margin-top: 16px; padding: 20px 16px; border-radius: var(--group-radius); background: var(--surface); }
.invite-paper h2 { margin-bottom: 8px; color: var(--ink); font-size: 18px; font-weight: 600; }
.invite-paper > p { margin-bottom: 18px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.invite-paper > .button { width: 100%; }
.invite-result { margin-top: 18px; }
.link-field { margin-bottom: 8px; background: var(--paper); }
.invite-result .button { width: 100%; }
.invite-paper > .invite-note, .invite-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.steps { margin: 18px 0 0; padding-left: 37px; padding-right: 16px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.steps li { margin: 10px 0; padding-left: 2px; }

dialog { position: fixed; inset: calc(var(--safe-top) + var(--content-top)) calc(var(--safe-right) + var(--content-right)) calc(var(--safe-bottom) + var(--content-bottom)) calc(var(--safe-left) + var(--content-left)); width: calc(100% - 48px - var(--safe-left) - var(--content-left) - var(--safe-right) - var(--content-right)); max-width: 480px; max-height: calc(var(--app-viewport-height, 100dvh) - 48px - var(--safe-top) - var(--content-top) - var(--safe-bottom) - var(--content-bottom)); margin: auto; padding: 0; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 60px color-mix(in srgb, var(--ink) 18%, transparent); overflow: auto; overscroll-behavior: contain; scroll-padding-block: 72px; }
/* Keep a usable field area when the keyboard leaves very little room. In that
   case the whole sheet can also scroll, without pinning chrome over its fields. */
dialog[open] { display: grid; grid-template-rows: auto minmax(96px, 1fr) auto; overflow: auto; }
dialog > form { display: contents; }
dialog::backdrop { background: color-mix(in srgb, var(--ink) 32%, transparent); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 64px; padding: 10px 16px; background: var(--paper); }
.dialog-head h2 { color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.dialog-head .icon-button { flex-shrink: 0; color: var(--muted); margin-right: -6px; }
.dialog-body { min-width: 0; min-height: 0; padding: 0 20px 8px; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 16px; }
.dialog-intro { margin-bottom: 20px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.dialog-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; min-width: 0; padding: 12px 20px 16px; border-top: .5px solid var(--line); background: var(--bottom-bar); }
.dialog-footer .button { flex: 1 1 100px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(16px + var(--safe-bottom) + var(--content-bottom)); width: max-content; max-width: min(480px, calc(100% - 32px - var(--safe-left) - var(--safe-right))); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--base); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; transform: translateX(-50%); box-shadow: 0 4px 18px color-mix(in srgb, var(--ink) 14%, transparent); }

.login-page { display: flex; flex-direction: column; width: 100%; max-width: 480px; min-height: 100svh; margin-inline: auto; padding: calc(16px + var(--safe-top) + var(--content-top)) calc(24px + var(--safe-right) + var(--content-right)) calc(20px + var(--safe-bottom) + var(--content-bottom)) calc(24px + var(--safe-left) + var(--content-left)); }
.login-header { display: flex; justify-content: space-between; align-items: center; min-height: 44px; gap: 12px; }
.login-header .edition { display: none; }
.login-body { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 48px 0; text-align: center; }
.login-body > section { width: 100%; }
.login-body h1 { font-size: 25px; font-weight: 600; line-height: 1.2; }
.login-body .page-description { margin: 12px auto 24px; max-width: 340px; font-size: 16px; line-height: 1.45; }
.login-body .button { width: 100%; min-height: 50px; font-size: 17px; font-weight: 600; }
.login-body .avatar { margin: 0 auto 22px; }
.login-note { max-width: 350px; margin: 14px auto 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.login-footer { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.4; }
.login-footer p + p { margin-top: 4px; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin: 4px 0 0; }
.legal-links .text-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }

@media (hover: hover) {
  .nav-link:hover, .menu-row:hover { background: var(--pressed); }
  .nav-link[aria-current="page"]:hover { background: var(--accent-bg); }
  .button:hover:not(:disabled) { filter: brightness(.96); }
  .button.icon-button:hover:not(:disabled) { background: var(--pressed); }
  .text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
.menu-row:active, .nav-link:active { background: var(--pressed); }
.button:active:not(:disabled) { opacity: .8; }

/* App chrome behaves like controls; only actual fields expose text editing. */
:root[data-telegram="true"],
:root[data-telegram="true"] body,
:root[data-telegram="true"] dialog {
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:root[data-telegram="true"] { overflow-x: clip; overscroll-behavior: none; }
:root[data-telegram="true"] body { overflow-x: clip; overscroll-behavior: none; }
:root[data-telegram="true"] :is(a, img, svg) { -webkit-user-drag: none; }
:root[data-telegram="true"] :is(input, textarea, select, [contenteditable]:not([contenteditable="false"])),
:root[data-telegram="true"] [contenteditable]:not([contenteditable="false"]) * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
:root[data-telegram="true"] :is(input, textarea, select) { font-size: max(16px, 1em); }
:root[data-telegram="true"] textarea { resize: none; }
:root[data-telegram="true"] body:has(dialog[open]) { overflow: hidden; }
:root[data-telegram="true"] .shell { display: block; max-width: 744px; }
:root[data-telegram="true"] .sidebar { display: none; }
:root[data-telegram="true"] .main { padding-inline: calc(16px + var(--safe-left) + var(--content-left)) calc(16px + var(--safe-right) + var(--content-right)); }
:root[data-telegram="true"] .native-header { margin-inline: calc(-16px - var(--safe-left) - var(--content-left)) calc(-16px - var(--safe-right) - var(--content-right)); padding-inline: calc(8px + var(--safe-left) + var(--content-left)) calc(8px + var(--safe-right) + var(--content-right)); }
:root[data-telegram="true"][data-route="home"] .native-header { display: none; }
:root[data-telegram="true"][data-route="home"] .home-page { padding-top: calc(16px + var(--safe-top) + var(--content-top)); }

/* Match the current Android client's settings density and switch footprint. */
:root[data-platform="android"] { --group-radius: var(--radius); font-size: 16px; }
:root[data-platform="android"] .menu-row { min-height: 50px; padding: 9px 18px; gap: 18px; }
:root[data-platform="android"] .menu-row:has(.menu-description) { min-height: 60px; }
:root[data-platform="android"] .menu-icon { width: 28px; height: 28px; border-radius: 10px; }
:root[data-platform="android"] .menu-icon .icon { width: 24px; height: 24px; }
:root[data-platform="android"] .menu-copy { gap: 4px; }
:root[data-platform="android"] .menu-title { font-size: 16px; }
:root[data-platform="android"] .menu-description { font-size: 13px; }
:root[data-platform="android"] .menu-row:not(:last-child)::after { left: 64px; }
:root[data-platform="android"] .profile-title { font-size: 22px; }
:root[data-platform="android"] .profile-subtitle { font-size: 13px; }
:root[data-platform="android"] .switch { width: 44px; min-width: 44px; }
:root[data-platform="android"] .switch::before { inset: 12px 3.5px; }
:root[data-platform="android"] .switch-thumb { width: 16px; height: 16px; transform: translateX(-8.5px); }
:root[data-platform="android"] .switch[aria-checked="true"] .switch-thumb { transform: translateX(8.5px); }

@media (max-width: 760px) {
  .shell { display: block; max-width: 712px; }
  .sidebar { display: none; }
  .main { padding: 0 calc(16px + var(--safe-right) + var(--content-right)) calc(28px + var(--safe-bottom) + var(--content-bottom)) calc(16px + var(--safe-left) + var(--content-left)); }
  .native-header { min-height: calc(52px + var(--safe-top) + var(--content-top)); margin: 0 calc(-16px - var(--safe-right) - var(--content-right)) 16px calc(-16px - var(--safe-left) - var(--content-left)); padding-inline: calc(8px + var(--safe-left) + var(--content-left)) calc(8px + var(--safe-right) + var(--content-right)); }
  .home-profile { padding-top: 8px; }
  .page-heading { margin-top: 0; }
  .row { gap: 12px; flex-wrap: wrap; }
  .row > .row-copy { flex-basis: 180px; }
  .row-actions { gap: 8px; }
  .task-row { flex-wrap: wrap; }
  .task-row > .row-copy { flex-basis: calc(100% - 104px); }
  .connector-row { flex-wrap: wrap; gap: 7px 12px; }
  .connector-row > .row-copy { flex-basis: calc(100% - 48px); }
  .connector-status { flex-basis: 100%; max-width: none; margin-left: 48px; text-align: left; }
  .connector-status small { display: inline; margin-left: 7px; }
  .connector-summary { flex-wrap: wrap; }
  .connector-summary > .row-copy { flex-basis: calc(100% - 48px); }
  .connector-summary > .pill { max-width: 100%; margin-left: 48px; }
  .privacy-row { flex-wrap: wrap; }
  .privacy-row > .row-copy { flex-basis: 180px; }
  .privacy-row > .row-actions { justify-content: flex-start; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dialog { position: fixed; inset: auto 0 max(0px, calc(var(--app-layout-height, 100dvh) - var(--app-viewport-height, 100dvh) - var(--app-viewport-top, 0px))); width: 100%; max-width: 600px; max-height: calc(var(--app-viewport-height, 100dvh) - 12px - var(--safe-top) - var(--content-top)); margin: 0 auto; border-radius: 16px 16px 0 0; box-shadow: none; }
  dialog[open] { animation: sheet-in .24s cubic-bezier(.22, 1, .36, 1); }
  .dialog-head { padding: 12px calc(16px + var(--safe-right) + var(--content-right)) 12px calc(16px + var(--safe-left) + var(--content-left)); min-height: 62px; }
  .dialog-body { padding: 0 calc(16px + var(--safe-right) + var(--content-right)) 8px calc(16px + var(--safe-left) + var(--content-left)); }
  .dialog-footer { padding: 12px calc(16px + var(--safe-right) + var(--content-right)) calc(12px + var(--safe-bottom) + var(--content-bottom)) calc(16px + var(--safe-left) + var(--content-left)); }
  .dialog-footer .button { min-height: 48px; font-size: 16px; }
}

@media (max-width: 360px) {
  .main { padding-inline: calc(12px + var(--safe-left) + var(--content-left)) calc(12px + var(--safe-right) + var(--content-right)); }
  .native-header { margin-inline: calc(-12px - var(--safe-left) - var(--content-left)) calc(-12px - var(--safe-right) - var(--content-right)); }
  .menu-row { gap: 10px; padding-inline: 12px; }
  .menu-row:not(:last-child)::after { left: 52px; right: 12px; }
  .row { padding-inline: 12px; gap: 8px; }
  .row > .row-copy { flex-basis: 180px; }
  .row > .row-actions { justify-content: flex-start; }
  .connector-row > .row-copy { flex-basis: calc(100% - 48px); }
  .row:not(:last-child)::after { left: 12px; }
  .connector-row:not(:last-child)::after { left: 60px; }
  .section-heading { padding-inline: 12px; gap: 8px; }
  .connector-card, .prepared-action { padding: 14px 12px; }
  .overview-item { padding-inline: 8px; }
  .header-back { font-size: 15px; }
  .header-title { font-size: 16px; }
  .login-page { padding-inline: 20px; }
}


@keyframes sheet-in { from { transform: translateY(100%); opacity: 1; } to { transform: translateY(0); opacity: 1; } }
@keyframes breathe { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.language-control { display: flex; justify-content: center; margin: 8px 0; }
.language-control select { min-height: 44px; max-width: 160px; padding: 8px 30px 8px 12px; border: 0; border-radius: 10px; background: var(--paper); color: var(--link); font: inherit; font-size: 14px; cursor: pointer; }
.language-control select:disabled { opacity: .6; cursor: wait; }
.login-header .language-control { margin: 0; }
.quality-record { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* The page is scrolled remotely. This shell never becomes another scroll view. */
:root[data-browser-screen="true"], :root[data-browser-screen="true"] body { height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none; }
:root[data-browser-screen="true"] body { position: fixed; inset: 0; width: 100%; }
:root[data-browser-screen="true"] #app { min-height: 0; padding: 0; }
.takeover { position: fixed; top: var(--takeover-top, 0px); left: 0; right: 0; width: 100%; max-width: 760px; height: var(--takeover-height, 100dvh); margin: 0 auto; padding: calc(var(--safe-top) + var(--content-top)) max(var(--safe-right), var(--content-right)) 0 max(var(--safe-left), var(--content-left)); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
.takeover-header { position: relative; z-index: 3; flex: none; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 8px; background: var(--surface); border-bottom: .5px solid var(--line); }
.takeover-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--link); }
.takeover-icon svg { width: 24px; height: 24px; }
.takeover-icon:active, .takeover-done-input:active { background: var(--pressed); }
.takeover-address { flex: 1; min-width: 0; text-align: center; display: grid; gap: 1px; padding: 2px 0; }
.takeover-address strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.takeover-address span { font-size: 11px; color: var(--muted); }
.takeover-done-input { min-width: 52px; height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--link); font-size: 15px; font-weight: 600; }
.takeover-viewport { position: relative; flex: 1; min-height: 0; overflow: clip; overscroll-behavior: none; background: #fff; touch-action: none; }
.takeover-stage { position: relative; width: 100%; overflow: hidden; transform-origin: top left; touch-action: none; }
.takeover-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; margin: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.takeover-fields { position: absolute; inset: 0; pointer-events: none; }
.takeover-input { position: absolute; pointer-events: auto; touch-action: none; margin: 0; padding: 0 12px; min-width: 0; min-height: 0; border: 2px solid transparent; border-radius: 7px; box-shadow: none; background: transparent; color: transparent; font: 16px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; line-height: normal; outline: none; caret-color: #2481cc; resize: none; -webkit-user-select: text; user-select: text; -webkit-appearance: none; appearance: none; }
.takeover-input:focus, .takeover-input.takeover-edited { background: #fff; color: #17191c; }
.takeover-input:focus { border-color: #2481cc; }
.takeover-footer { z-index: 3; flex: none; padding: 12px 16px max(12px, var(--safe-bottom), var(--content-bottom)); background: var(--surface); border-top: .5px solid var(--line); }
.takeover-continue { width: 100%; height: 48px; min-height: 48px; border-radius: 13px; font-size: 16px; font-weight: 600; }
.takeover-status { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.takeover-retry { border: 0; padding: 6px 0; color: var(--link); background: transparent; font-size: inherit; font-weight: 600; }
.takeover[data-keyboard="true"] .takeover-footer { position: absolute; bottom: 0; left: 0; right: 0; visibility: hidden; pointer-events: none; }
.takeover-menu { position: absolute; z-index: 5; top: calc(var(--safe-top) + var(--content-top) + 52px); right: 12px; min-width: 180px; padding: 5px; border: .5px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 28px rgb(0 0 0 / 14%); }
.takeover-menu button { display: block; width: 100%; min-height: 46px; padding: 10px 14px; text-align: left; border: 0; border-radius: 9px; background: transparent; font-size: 15px; }
.takeover-menu button:active { background: var(--pressed); }
.takeover-destructive { color: var(--danger); }
.takeover-loading { height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 14px; color: #707579; }
.takeover-finished { min-height: 100%; padding: 32px 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; text-align: center; color: var(--ink); background: var(--surface); }
.takeover-finished h1 { margin: 0; font-size: 23px; line-height: 1.2; }
.takeover-finished p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; color: var(--muted); max-width: 320px; }
.takeover-result-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-bg); color: var(--link); }
.takeover-result-icon svg { width: 30px; height: 30px; }
.takeover [hidden] { display: none !important; }

/* Freeze the account behind a sheet; only its field area scrolls with the keyboard. */
body.dialog-open { position: fixed; top: var(--dialog-scroll-top, 0px); left: 0; right: 0; width: 100%; overflow: hidden; }
.dialog-head h2:focus { outline: none; }
:root[data-keyboard="true"] .dialog-footer { padding-bottom: 12px; }
